Selaa lähdekoodia

update

add_swagger
MSI\derek 11 kuukautta sitten
vanhempi
commit
190112091a
1 muutettua tiedostoa jossa 26 lisäystä ja 3 poistoa
  1. +26
    -3
      src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt

+ 26
- 3
src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt Näytä tiedosto

@@ -193,6 +193,29 @@ open class StaffsService(
}
}
salaryEffectiveService.saveSalaryEffective(staff.id!!, salary.salaryPoint.toLong())
if (team != null) {
val teamLog = TeamLog().apply {
this.staff = staff
this.team = team
from = LocalDate.now()
}
teamLogRepository.save(teamLog)
}

val gradeLog = GradeLog().apply {
this.staff = staff
this.grade = grade
from = LocalDate.now()
}
gradeLogRepository.save(gradeLog)

val positionLog = PositionLog().apply {
this.staff = staff
this.position = currentPosition
from = LocalDate.now()
}
positionLogRepository.save(positionLog)

return staff
}
@Transactional(rollbackFor = [Exception::class])
@@ -223,7 +246,7 @@ open class StaffsService(
val latestTeam = teamLogRepository.findFirstByStaffIdAndDeletedFalseOrderByCreatedDesc(staff.id)
val latestGrade = gradeLogRepository.findFirstByStaffIdAndDeletedFalseOrderByCreatedDesc(staff.id)
val latestPosition = positionLogRepository.findFirstByStaffIdAndDeletedFalseOrderByCreatedDesc(staff.id)
if (latestTeam.team.id != req.teamId) {
if (latestTeam != null && latestTeam.team.id != req.teamId) {
val teamLog = TeamLog().apply {
this.staff = staff
this.team = team
@@ -235,7 +258,7 @@ open class StaffsService(
teamLogRepository.save(teamLog)
teamLogRepository.save(lastRecordTeam)
}
if (latestGrade.grade.id != req.gradeId) {
if (latestGrade != null && latestGrade.grade.id != req.gradeId) {
val gradeLog = GradeLog().apply {
this.staff = staff
this.grade = grade
@@ -247,7 +270,7 @@ open class StaffsService(
gradeLogRepository.save(gradeLog)
gradeLogRepository.save(lastRecordGrade)
}
if (latestPosition.position.id != req.currentPositionId) {
if (latestPosition != null && latestPosition.position.id != req.currentPositionId) {
val positionLog = PositionLog().apply {
this.staff = staff
this.position = currentPosition


Ladataan…
Peruuta
Tallenna