Преглед на файлове

update report

pull/3/head
MSI\derek преди 7 месеца
родител
ревизия
ce81196829
променени са 2 файла, в които са добавени 9 реда и са изтрити 8 реда
  1. +7
    -7
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt
  2. +2
    -1
      src/main/java/com/ffii/tsms/modules/report/web/ReportController.kt

+ 7
- 7
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt Целия файл

@@ -2250,12 +2250,12 @@ open class ReportService(
+ " c.name as client, "
+ " sum(coalesce(t.normalConsumed, 0) + coalesce(t.otConsumed,0)) as consumed "
+ " from timesheet t "
+ " left join team_log tl on tl.staffId = t.staffId and t.recordDate >= tl.`from` and (t.recordDate <= tl.`to` or tl.`to` is null) "
// + " left join team_log tl on tl.staffId = t.staffId and t.recordDate >= tl.`from` and (t.recordDate <= tl.`to` or tl.`to` is null) "
+ " left join staff s on s.id = t.staffId "
+ " left join project p on p.id = t.projectId "
+ " left join customer c on c.id = p.customerId "
+ " where t.deleted = false "
+ " and (tl.teamId is not null and s.teamId is not null) "
// + " and (tl.teamId is not null and s.teamId is not null) "
+ " and t.projectId is not null "
)
if (args.containsKey(("startDate"))) {
@@ -2265,12 +2265,12 @@ open class ReportService(
sql.append(" and t.recordDate < :endDate ")
}
if (args.containsKey(("teamId"))) {
sql.append(" and coalesce(tl.teamId, s.teamId) = :teamId ")
sql.append(" and p.teamlead = :teamId ")
}
if (args["groupBy"] == "staff") {
sql.append(" group by recordMonth, t.staffId, t.projectId, tl.teamId ")
sql.append(" group by recordMonth, t.staffId, t.projectId ")
} else {
sql.append(" group by recordMonth, t.projectId, tl.teamId ")
sql.append(" group by recordMonth, t.projectId ")
}
return jdbcDao.queryForList(sql.toString(), args)
}
@@ -3785,8 +3785,8 @@ open class ReportService(
tempRow2 = getOrCreateRow(sheet2, rowIndex)
tempCell = getOrCreateCell(tempRow, columnIndex)
tempCell2 = getOrCreateCell(tempRow2, columnIndex)
tempCell.setCellValue("${args["startDate"].toString()} - ${args["endDate"].toString()}")
tempCell2.setCellValue("${args["startDate"].toString()} - ${args["endDate"].toString()}")
tempCell.setCellValue("${args["startDate"].toString()} - ${(args["endDate"] as LocalDate).minusDays(1.toLong()).toString()}")
tempCell2.setCellValue("${args["startDate"].toString()} - ${(args["endDate"] as LocalDate).minusDays(1.toLong()).toString()}")
// write months header
rowIndex = 5
columnIndex = 3


+ 2
- 1
src/main/java/com/ffii/tsms/modules/report/web/ReportController.kt Целия файл

@@ -311,10 +311,11 @@ class ReportController(
@Throws(ServletRequestBindingException::class, IOException::class)
fun getProjectManhourSummary(@RequestBody @Valid request: ProjectManhourSummaryRequest): ResponseEntity<Resource> {
println("starting")
val teamlead = teamRepository.findById(request.teamId.toString().toLong()).orElseThrow().staff.id
val args = mapOf(
"startDate" to request.startDate,
"endDate" to request.endDate,
"teamId" to request.teamId,
"teamId" to teamlead,
)
val reportResult: ByteArray = excelReportService.generateProjectManhourSummaryReport(args)
println("ending")


Зареждане…
Отказ
Запис