Browse Source

Update username when editing the staff

add_swagger
MSI\2Fi 8 months ago
parent
commit
ef080fcc58
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt

+ 10
- 6
src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt View File

@@ -305,14 +305,18 @@ open class StaffsService(
this.department = department this.department = department
} }


if (req.departDate != null) {
val user = userRepository.findByUsernameAndDeletedFalse(req.staffId).orElseThrow()
user.apply {
locked = LocalDate.now().isAfter(req.departDate)
val user = userRepository.findByUsernameAndDeletedFalse(req.staffId).orElseThrow()
user.apply {
username = req.staffId
locked = if (req.departDate != null) {
LocalDate.now().isAfter(req.departDate)
} else {
false
} }

userRepository.save(user)
} }

userRepository.save(user)

// salaryEffectiveService.saveSalaryEffective(staff.id!!, salary.salaryPoint.toLong()) // salaryEffectiveService.saveSalaryEffective(staff.id!!, salary.salaryPoint.toLong())
if (req.salaryEffectiveInfo != null && req.delSalaryEffectiveInfo != null) { if (req.salaryEffectiveInfo != null && req.delSalaryEffectiveInfo != null) {
salaryEffectiveService.updateSalaryEffective(staff.id!!, req.salaryEffectiveInfo.sortedBy { it.date }, req.delSalaryEffectiveInfo) salaryEffectiveService.updateSalaryEffective(staff.id!!, req.salaryEffectiveInfo.sortedBy { it.date }, req.delSalaryEffectiveInfo)


Loading…
Cancel
Save