瀏覽代碼

Merge branch 'master' of https://git.2fi-solutions.com/davidhui/TSMS-backend

tags/Baseline_30082024_BACKEND_UAT
leoho2fi 1 年之前
父節點
當前提交
0b952ffd0a
共有 3 個檔案被更改,包括 24 行新增5 行删除
  1. +11
    -2
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt
  2. +12
    -3
      src/main/java/com/ffii/tsms/modules/report/web/ReportController.kt
  3. +1
    -0
      src/main/java/com/ffii/tsms/modules/report/web/model/ReportRequest.kt

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

@@ -916,11 +916,12 @@ open class ReportService(
// } // }


rowIndex = 6 rowIndex = 6
var projectCount = 0
projects.forEach { project: Project -> projects.forEach { project: Project ->


sheet.createRow(rowIndex).apply { sheet.createRow(rowIndex).apply {
createCell(0).apply { createCell(0).apply {
setCellValue((rowIndex - 5).toString())
setCellValue((++projectCount).toString())
} }


createCell(1).apply { createCell(1).apply {
@@ -938,7 +939,8 @@ open class ReportService(


createCell(4).apply { createCell(4).apply {
val currentClient = project.customer val currentClient = project.customer
setCellValue(currentClient?.code + " - " + currentClient?.name)
val currentSubsidiary = project.customerSubsidiary
setCellValue(if (currentSubsidiary != null) currentSubsidiary.code + " - " + currentSubsidiary.name else currentClient?.code + " - " + currentClient?.name)
} }


createCell(5).apply { createCell(5).apply {
@@ -950,6 +952,7 @@ open class ReportService(
} }
} }


var milestoneCount = 0
project.milestones.forEach { milestone: Milestone -> project.milestones.forEach { milestone: Milestone ->


val manHoursSpent = groupedTimesheets[Pair(project.id, milestone.id)]?.sum() ?: 0.0 val manHoursSpent = groupedTimesheets[Pair(project.id, milestone.id)]?.sum() ?: 0.0
@@ -957,6 +960,7 @@ open class ReportService(
// logger.info(project.name + " : " + milestone.taskGroup?.name + " : " + ChronoUnit.DAYS.between(LocalDate.now(), milestone.endDate)) // logger.info(project.name + " : " + milestone.taskGroup?.name + " : " + ChronoUnit.DAYS.between(LocalDate.now(), milestone.endDate))
// logger.info(numberOfDays) // logger.info(numberOfDays)
if (ChronoUnit.DAYS.between(LocalDate.now(), milestone.endDate) <= numberOfDays.toLong() && resourceUtilization <= projectCompletion.toDouble() / 100.0) { if (ChronoUnit.DAYS.between(LocalDate.now(), milestone.endDate) <= numberOfDays.toLong() && resourceUtilization <= projectCompletion.toDouble() / 100.0) {
milestoneCount++
val tempRow = sheet.getRow(rowIndex) ?: sheet.createRow(rowIndex) val tempRow = sheet.getRow(rowIndex) ?: sheet.createRow(rowIndex)
rowIndex++ rowIndex++


@@ -985,6 +989,11 @@ open class ReportService(
} }
} }
} }

if (milestoneCount == 0) {
sheet.createRow(rowIndex)
projectCount--
}
} }


return workbook return workbook


+ 12
- 3
src/main/java/com/ffii/tsms/modules/report/web/ReportController.kt 查看文件

@@ -56,7 +56,8 @@ class ReportController(
private val leaveRepository: LeaveRepository, private val leaveRepository: LeaveRepository,
private val teamService: TeamService, private val teamService: TeamService,
private val customerService: CustomerService, private val customerService: CustomerService,
private val invoiceService: InvoiceService, private val gradeAllocationRepository: GradeAllocationRepository
private val invoiceService: InvoiceService, private val gradeAllocationRepository: GradeAllocationRepository,
private val subsidiaryRepository: SubsidiaryRepository
) { ) {


@PostMapping("/fetchProjectsFinancialStatusReport") @PostMapping("/fetchProjectsFinancialStatusReport")
@@ -94,8 +95,15 @@ class ReportController(


val team = if (request.teamId.lowercase() == "all") null else teamRepository.findById(request.teamId.toLong()).orElse(null) val team = if (request.teamId.lowercase() == "all") null else teamRepository.findById(request.teamId.toLong()).orElse(null)
val searchedTeam = if (team == null) "All" else team.code + " - " +team.name val searchedTeam = if (team == null) "All" else team.code + " - " +team.name
val client = if (request.clientId.lowercase() == "all") null else customerRepository.findById(request.clientId.toLong()).orElse(null)
val searchedClient = if (client == null) "All" else client.code + " - " +client.name
val client = if (request.clientId.lowercase() == "all" || request.type != "client") null else customerRepository.findById(request.clientId.toLong()).orElse(null)
val subsidiary = if (request.clientId.lowercase() == "all" || request.type != "subsidiary") null else subsidiaryRepository.findById(request.clientId.toLong()).orElse(null)
val searchedClient = if (client != null) {
client.code + " - " + client.name
} else if (subsidiary != null) {
subsidiary.code + " - " + subsidiary.name
} else {
"All"
}


val matcher = ExampleMatcher.matching().withIgnoreNullValues() val matcher = ExampleMatcher.matching().withIgnoreNullValues()
val exampleQuery = Example.of(Project().apply { val exampleQuery = Example.of(Project().apply {
@@ -103,6 +111,7 @@ class ReportController(
// [{ com.ffii.tsms.modules.project.entity.Project@6847e037 }] -teamLead-> [{ com.ffii.tsms.modules.data.entity.Staff@2a4c488b }] -team-> [{ com.ffii.tsms.modules.data.entity.Team@a09acb5 }] -staff-> [{ com.ffii.tsms.modules.data.entity.Staff@2a4c488b }] // [{ com.ffii.tsms.modules.project.entity.Project@6847e037 }] -teamLead-> [{ com.ffii.tsms.modules.data.entity.Staff@2a4c488b }] -team-> [{ com.ffii.tsms.modules.data.entity.Team@a09acb5 }] -staff-> [{ com.ffii.tsms.modules.data.entity.Staff@2a4c488b }]
// teamLead = team?.staff // teamLead = team?.staff
customer = client customer = client
customerSubsidiary = subsidiary
status = "On-going" status = "On-going"
}, matcher) }, matcher)




+ 1
- 0
src/main/java/com/ffii/tsms/modules/report/web/model/ReportRequest.kt 查看文件

@@ -29,6 +29,7 @@ data class ProjectPotentialDelayReportRequest (
val clientId: String, val clientId: String,
val numberOfDays: Int, val numberOfDays: Int,
val projectCompletion: Int, val projectCompletion: Int,
val type: String,
) )


data class StaffMonthlyWorkHourAnalysisReportRequest ( data class StaffMonthlyWorkHourAnalysisReportRequest (


Loading…
取消
儲存