@@ -94,8 +94,14 @@ open class SalaryEffectiveService( | |||||
open fun updateSalaryEffective(staffId: Long, salaryEffectiveInfo: List<SalaryEffectiveInfo>?){ | |||||
open fun updateSalaryEffective(staffId: Long, salaryEffectiveInfo: List<SalaryEffectiveInfo>?, delSalaryEffectiveInfo: List<Long>?){ | |||||
delSalaryEffectiveInfo?.forEach { item -> | |||||
salaryEffectiveRepository.deleteById(item) | |||||
} | |||||
salaryEffectiveInfo?.forEachIndexed { index, item -> | salaryEffectiveInfo?.forEachIndexed { index, item -> | ||||
// println("================ $staffId ===========================") | |||||
// println("salaryPoint: $item.salaryPoint") | |||||
val staff = staffRepository.findById(staffId).orElseThrow() | val staff = staffRepository.findById(staffId).orElseThrow() | ||||
val salary = salaryRepository.findBySalaryPoint(item.salaryPoint).orElseThrow() | val salary = salaryRepository.findBySalaryPoint(item.salaryPoint).orElseThrow() | ||||
val salaryEffective: SalaryEffective | val salaryEffective: SalaryEffective | ||||
@@ -227,7 +227,7 @@ open class StaffsService( | |||||
} | } | ||||
// salaryEffectiveService.saveSalaryEffective(staff.id!!, salary.salaryPoint.toLong()) | // salaryEffectiveService.saveSalaryEffective(staff.id!!, salary.salaryPoint.toLong()) | ||||
// salaryEffectiveService.updateSalaryEffective(staff.id!!, req.salaryEffectiveInfo?.sortedBy { it.date }) | |||||
salaryEffectiveService.updateSalaryEffective(staff.id!!, req.salaryEffectiveInfo?.sortedBy { it.date }, req.delSalaryEffectiveInfo) | |||||
return staffRepository.save(staff) | return staffRepository.save(staff) | ||||
} | } | ||||
@@ -37,7 +37,8 @@ data class NewStaffRequest( | |||||
val departDate: LocalDate?, | val departDate: LocalDate?, | ||||
val departReason: String?, | val departReason: String?, | ||||
val remark: String?, | val remark: String?, | ||||
val salaryEffectiveInfo: List<SalaryEffectiveInfo>? | |||||
val salaryEffectiveInfo: List<SalaryEffectiveInfo>?, | |||||
val delSalaryEffectiveInfo: List<Long>? | |||||
) | ) | ||||
data class SalaryEffectiveInfo( | data class SalaryEffectiveInfo( | ||||