瀏覽代碼

Export Staff Info

Las modify report
master
MSI\2Fi 3 月之前
父節點
當前提交
3bffd4ff82
共有 3 個文件被更改,包括 55 次插入3 次删除
  1. +5
    -1
      src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt
  2. +50
    -2
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt
  3. 二進制
      src/main/resources/templates/report/Staff Information.xlsx

+ 5
- 1
src/main/java/com/ffii/tsms/modules/data/service/StaffsService.kt 查看文件

@@ -410,12 +410,16 @@ open class StaffsService(
+ " coalesce (s.joinDate, '') as employmentDate,"
+ " g.code as grade,"
+ " p.description ,"
+ " s.salaryId,"
+ " s.salaryId, "
+ " s2.lowerLimit, "
+ " s2.upperLimit, "
+ " s2.hourlyRate, "
+ " coalesce (s.email , '') as email,"
+ " s.departDate"
+ " from staff s"
+ " left join team on team.id = s.teamId"
+ " left join grade g on g.id = s.gradeId"
+ " left join salary s2 on s2.salaryPoint = s.salaryId"
+ " left join `position` p on p.id = s.currentPosition"
+ " where s.deleted = false "
)


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

@@ -5741,6 +5741,7 @@ open class ReportService(
"select " +
"s.staffId, " +
"s.name, " +
"s.departDate, " +
"COALESCE(s.email, '') as email, " +
"t.code as team, " +
"lmd.lastRecordDate " +
@@ -5752,7 +5753,17 @@ open class ReportService(
"order by lmd.lastrecorddate "
)

val results = jdbcDao.queryForList(sql.toString(), mapOf("searchDate" to date.format(formatter))).map {
val results = jdbcDao.queryForList(sql.toString(), mapOf("searchDate" to date.format(formatter)))
.filter{
val departDate = it["departDate"] as? java.sql.Date
if (departDate != null) {
val currentDate = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant())
departDate.after(currentDate)
} else {
false // Exclude entries with null departDate
}
}
.map {
result ->
StaffLastRecordData(
result["staffId"] as String,
@@ -5907,7 +5918,11 @@ open class ReportService(
val gradeCell = row.createCell(4)
val positionCell = row.createCell(5)
val salaryPointCell = row.createCell(6)
val emailCell = row.createCell(7)
val lowerLimitCell = row.createCell(7)
val upperLimitCell = row.createCell(8)
val hourlyRateCell = row.createCell(9)
val emailCell = row.createCell(10)
val activeCell = row.createCell(11)

staffIdCell.apply {
setCellValue(it.getValue("staffId") as String)
@@ -5946,11 +5961,44 @@ open class ReportService(
cellStyle = blackFontStyle
}

lowerLimitCell.apply{
setCellValue((it.getValue("lowerLimit") as Int).toString())
cellStyle = blackFontStyle
}

upperLimitCell.apply{
setCellValue((it.getValue("upperLimit") as Int).toString())
cellStyle = blackFontStyle
}

hourlyRateCell.apply{
setCellValue((it.getValue("hourlyRate") as BigDecimal).toString())
cellStyle = blackFontStyle
}

emailCell.apply {
setCellValue(it.getValue("email") as String)
cellStyle = blackFontStyle
}

activeCell.apply {
var active: Boolean
var uniCode: String
val departDate = it["departDate"] as? java.sql.Date

if (departDate != null) {
val currentDate = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant())
active = departDate.after(currentDate)
} else {
active = true // Exclude entries with null departDate
}

uniCode = if (active) "\u2713" else "\u2717"

setCellValue(uniCode)
cellStyle = blackFontStyle
}

startRowIndex++
}



二進制
src/main/resources/templates/report/Staff Information.xlsx 查看文件


Loading…
取消
儲存