ソースを参照

update for cross team report

add_swagger
MSI\derek 9ヶ月前
コミット
aa544fd3dc
3個のファイルの変更14行の追加12行の削除
  1. +3
    -3
      src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt
  2. +10
    -7
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt
  3. +1
    -2
      src/main/java/com/ffii/tsms/modules/report/web/ReportController.kt

+ 3
- 3
src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt ファイルの表示

@@ -198,7 +198,7 @@ open class StaffsService(
val teamLog = TeamLog().apply {
this.staff = staff
this.team = team
from = LocalDate.now()
from = req.joinDate ?: LocalDate.now()
}
teamLogRepository.save(teamLog)
}
@@ -206,14 +206,14 @@ open class StaffsService(
val gradeLog = GradeLog().apply {
this.staff = staff
this.grade = grade
from = LocalDate.now()
from = req.joinDate ?: LocalDate.now()
}
gradeLogRepository.save(gradeLog)

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



+ 10
- 7
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt ファイルの表示

@@ -3672,9 +3672,12 @@ open class ReportService(
val targetTeam = team.code
_timesheets = timesheets.filter { ts ->
// val staffTeam = ts.staff!!.team.code
println(ts.staff!!.id!!)
println(ts.id)
println(ts.recordDate)
val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&& it.from <= ts.recordDate && (it.to == null || it.to >= ts.recordDate)
&& it.deleted == false
}!!.team.code
val projectTeam = ts.project!!.teamLead!!.team.code
@@ -3696,17 +3699,19 @@ open class ReportService(
_timesheets.forEach {ts ->
// this team charging others
// get the grade and salary data of the record

val _grade = gradeLog.find {
it.staff.id == ts.staff!!.id
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
println("it staff: ${it.staff.id} ; ts staff: ${ts.staff!!.id}")
println(it.staff.id == ts.staff!!.id)
it.staff != null && it.staff.id == ts.staff!!.id
&& it.from <= ts.recordDate && (it.to == null || it.to >=ts.recordDate)
&& it.deleted == false
}
println(_grade)
val gradeCode = _grade!!.grade.code
val otMultiplier = 1.15
val thisSE = salaryEffective.find {
it.staff.id == ts.staff!!.id
&& it.startDate.isBefore(ts.recordDate) && (it.endDate.isAfter(ts.recordDate) || it.endDate == null)
&& it.startDate <= ts.recordDate && (it.endDate >= ts.recordDate || it.endDate == null)
}
val normalHour = ts.normalConsumed ?: 0.0
val otHour = ts.otConsumed ?: 0.0
@@ -3716,12 +3721,10 @@ open class ReportService(
val projectTeam = ts.project!!.teamLead!!.team.code
val staffTeam = ts.staff!!.team.code
// write in
//println("putting in")
var tsInData = teamsMap[projectTeam]!![gradeCode]!!.In
tsInData.manhour += normalHour + otHour
tsInData.cost += normalCost + otCost
// write out
//println("putting out")
val tsOutData = teamsMap[staffTeam]!!.get(gradeCode)!!.Out
tsOutData.manhour += normalHour + otHour
tsOutData.cost += normalCost + otCost


+ 1
- 2
src/main/java/com/ffii/tsms/modules/report/web/ReportController.kt ファイルの表示

@@ -343,8 +343,7 @@ class ReportController(
val teams = teamRepository.findAll().filter { it.deleted == false }
val grades = gradeRepository.findAll().filter { it.deleted == false }
val monthlyStaffSalaryEffective = salaryEffectiveService.getMonthlyStaffSalaryData(startDate, endDate)
val gradeLog = gradeLogRepository.findByDeletedFalseAndFromBeforeAndToIsNullOrToAfter(startDate, endDate)
print(gradeLog)
val gradeLog = gradeLogRepository.findAll()
val reportResult: ByteArray = excelReportService.generateCrossTeamChargeReport(request.month, timesheets, teams, grades, monthlyStaffSalaryEffective, request.teamId, gradeLog)
return ResponseEntity.ok()
.header("filename", "Cross Team Charge Report - " + LocalDate.now() + ".xlsx")


読み込み中…
キャンセル
保存