浏览代码

update report

tags/Baseline_30082024_BACKEND_UAT
cyril.tsui 1年前
父节点
当前提交
6250a2c6ff
共有 2 个文件被更改,包括 15 次插入5 次删除
  1. +13
    -3
      src/main/java/com/ffii/tsms/modules/data/service/SalaryEffectiveService.kt
  2. +2
    -2
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 13
- 3
src/main/java/com/ffii/tsms/modules/data/service/SalaryEffectiveService.kt 查看文件

@@ -159,8 +159,10 @@ open class SalaryEffectiveService(


open fun getMonthlyStaffSalaryData(startDate: LocalDate, endDate: LocalDate): List<MonthlyStaffSalaryData> { open fun getMonthlyStaffSalaryData(startDate: LocalDate, endDate: LocalDate): List<MonthlyStaffSalaryData> {
val salaryEffective = salaryEffectiveRepository.findAll() val salaryEffective = salaryEffectiveRepository.findAll()
.groupBy { Pair(it.date.year, it.date.month) }
.map { (_, se) -> se.maxByOrNull { it.date }!!}
.groupBy { Triple(it.staff.id, it.date.year, it.date.month) }
.map { (_, se) ->
se.maxByOrNull { it.date }!!
}
salaryEffective.sortedWith(compareBy({it.staff.staffId}, {it.date})) salaryEffective.sortedWith(compareBy({it.staff.staffId}, {it.date}))


val staffs = staffRepository.findAll().sortedBy { it.staffId }.filter { it.deleted == false } val staffs = staffRepository.findAll().sortedBy { it.staffId }.filter { it.deleted == false }
@@ -168,15 +170,23 @@ open class SalaryEffectiveService(
val result = mutableListOf<MonthlyStaffSalaryData>() val result = mutableListOf<MonthlyStaffSalaryData>()
val dateList = (0..ChronoUnit.MONTHS.between(startDate, endDate)).map { startDate.withDayOfMonth(1).plusMonths(it) } val dateList = (0..ChronoUnit.MONTHS.between(startDate, endDate)).map { startDate.withDayOfMonth(1).plusMonths(it) }


// logger.info(dateList)
staffs.forEach { staff -> staffs.forEach { staff ->
dateList.forEach{ date -> dateList.forEach{ date ->
val staffSalaryEffective = salaryEffective.filter { it.staff.staffId.equals(staff.staffId) } val staffSalaryEffective = salaryEffective.filter { it.staff.staffId.equals(staff.staffId) }
var currentHourlyRate = staffSalaryEffective.filter { date.isEqual(it.date.withDayOfMonth(1)) || date.isAfter(it.date.withDayOfMonth(1)) }.minByOrNull { it.date }

var currentHourlyRate = staffSalaryEffective.filter {
date.isEqual(it.date.withDayOfMonth(1)) || date.isAfter(it.date.withDayOfMonth(1))
}.maxByOrNull { it.date }


if (currentHourlyRate == null) { if (currentHourlyRate == null) {
currentHourlyRate = staffSalaryEffective.minByOrNull { it.date } currentHourlyRate = staffSalaryEffective.minByOrNull { it.date }
} }


// if (staff.staffId == "B374") {
// logger.info("date:${date} | hourlyRate:${currentHourlyRate?.salary?.hourlyRate}")
// }

result += MonthlyStaffSalaryData( result += MonthlyStaffSalaryData(
staff = staff, staff = staff,
date = date, date = date,


+ 2
- 2
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt 查看文件

@@ -769,12 +769,12 @@ open class ReportService(
rowIndex = 10 rowIndex = 10
sheet.getRow(rowIndex).apply { sheet.getRow(rowIndex).apply {
createCell(1).apply { createCell(1).apply {
setCellValue(if (project.expectedTotalFee != null) project.expectedTotalFee!! * 0.8 else 0.0)
setCellValue(if (project.expectedTotalFee != null) (project.expectedTotalFee!! - (project.subContractFee ?: 0.0)) * 0.8 else 0.0)
cellStyle.dataFormat = accountingStyle cellStyle.dataFormat = accountingStyle
} }


createCell(2).apply { createCell(2).apply {
setCellValue(project.expectedTotalFee ?: 0.0)
setCellValue((project.expectedTotalFee ?: 0.0) - (project.subContractFee ?: 0.0))
cellStyle.dataFormat = accountingStyle cellStyle.dataFormat = accountingStyle
} }
} }


正在加载...
取消
保存