Explorar el Código

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

tags/Baseline_30082024_BACKEND_UAT
leoho2fi hace 1 año
padre
commit
0b952ffd0a
Se han modificado 3 ficheros con 24 adiciones y 5 borrados
  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 Ver fichero

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

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

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

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

createCell(4).apply {
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 {
@@ -950,6 +952,7 @@ open class ReportService(
}
}

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

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(numberOfDays)
if (ChronoUnit.DAYS.between(LocalDate.now(), milestone.endDate) <= numberOfDays.toLong() && resourceUtilization <= projectCompletion.toDouble() / 100.0) {
milestoneCount++
val tempRow = sheet.getRow(rowIndex) ?: sheet.createRow(rowIndex)
rowIndex++

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

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

return workbook


+ 12
- 3
src/main/java/com/ffii/tsms/modules/report/web/ReportController.kt Ver fichero

@@ -56,7 +56,8 @@ class ReportController(
private val leaveRepository: LeaveRepository,
private val teamService: TeamService,
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")
@@ -94,8 +95,15 @@ class ReportController(

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 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 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 }]
// teamLead = team?.staff
customer = client
customerSubsidiary = subsidiary
status = "On-going"
}, matcher)



+ 1
- 0
src/main/java/com/ffii/tsms/modules/report/web/model/ReportRequest.kt Ver fichero

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

data class StaffMonthlyWorkHourAnalysisReportRequest (


Cargando…
Cancelar
Guardar