Browse Source

project plan start plan end

add_swagger
MSI\derek 10 months ago
parent
commit
ca0d7e905e
3 changed files with 42 additions and 14 deletions
  1. +2
    -1
      src/main/java/com/ffii/tsms/modules/project/service/ProjectsService.kt
  2. +1
    -0
      src/main/java/com/ffii/tsms/modules/project/web/models/NewProjectRequest.kt
  3. +39
    -13
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 2
- 1
src/main/java/com/ffii/tsms/modules/project/service/ProjectsService.kt View File

@@ -329,7 +329,7 @@ open class ProjectsService(


if (milestones.isNotEmpty()) { if (milestones.isNotEmpty()) {
project.apply { project.apply {
planStart = milestones.mapNotNull { it.startDate }.minOrNull()
planStart = request.projectPlanStart ?:milestones.mapNotNull { it.startDate }.minOrNull()
planEnd = request.projectPlanEnd ?: milestones.mapNotNull { it.endDate }.maxOrNull() planEnd = request.projectPlanEnd ?: milestones.mapNotNull { it.endDate }.maxOrNull()
} }
} }
@@ -724,6 +724,7 @@ open class ProjectsService(
row.getCell(2), row.getCell(2),
DateTimeFormatter.ofPattern("MM/dd/yyyy") DateTimeFormatter.ofPattern("MM/dd/yyyy")
), ),
projectPlanStart = null,
projectPlanEnd = ExcelUtils.getDateValue( projectPlanEnd = ExcelUtils.getDateValue(
row.getCell(3), row.getCell(3),
DateTimeFormatter.ofPattern("MM/dd/yyyy") DateTimeFormatter.ofPattern("MM/dd/yyyy")


+ 1
- 0
src/main/java/com/ffii/tsms/modules/project/web/models/NewProjectRequest.kt View File

@@ -16,6 +16,7 @@ data class NewProjectRequest(
val projectId: Long?, val projectId: Long?,
val projectActualStart: LocalDate?, val projectActualStart: LocalDate?,
val projectActualEnd: LocalDate?, val projectActualEnd: LocalDate?,
val projectPlanStart: LocalDate?,
val projectPlanEnd: LocalDate?, val projectPlanEnd: LocalDate?,
val isClpProject: Boolean?, val isClpProject: Boolean?,
val mainProjectId: Long?, val mainProjectId: Long?,


+ 39
- 13
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt View File

@@ -3619,7 +3619,9 @@ open class ReportService(
) )
return jdbcDao.queryForList(sql.toString(), args) return jdbcDao.queryForList(sql.toString(), args)
} }
// private fun binarySearch(Any[], ) {


// }
private fun generateTeamsInOutMap( private fun generateTeamsInOutMap(
teams: List<Team>, teams: List<Team>,
desiredTeam: MutableList<Team>, desiredTeam: MutableList<Team>,
@@ -3628,7 +3630,7 @@ open class ReportService(
gradeLog: List<GradeLog>, gradeLog: List<GradeLog>,
salaryEffective: List<SalaryEffective>, salaryEffective: List<SalaryEffective>,
): MutableMap<String, MutableMap<String, InOut>> { ): MutableMap<String, MutableMap<String, InOut>> {
// val teamlog = teamLogRepository.findAll().filter { it.deleted == false }
val teamlog = teamLogRepository.findAll().filter { it.deleted == false }
val gradeMap: MutableMap<String, InOut> = mutableMapOf() val gradeMap: MutableMap<String, InOut> = mutableMapOf()
var teamsMap: MutableMap<String, MutableMap<String, InOut>> = mutableMapOf() var teamsMap: MutableMap<String, MutableMap<String, InOut>> = mutableMapOf()
grades.forEach { grades.forEach {
@@ -3658,14 +3660,24 @@ open class ReportService(
val team = desiredTeam[0] val team = desiredTeam[0]
val targetTeam = team.code val targetTeam = team.code
_timesheets = timesheets.filter { ts -> _timesheets = timesheets.filter { ts ->
val staffTeam = ts.staff!!.team.code
// val staffTeam = ts.staff!!.team.code
val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&& it.deleted == false
}!!.team.code
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
projectTeam != staffTeam && projectTeam != staffTeam &&
(staffTeam == targetTeam || projectTeam == targetTeam ) (staffTeam == targetTeam || projectTeam == targetTeam )
} }
} else { } else {
_timesheets = timesheets.filter { ts -> _timesheets = timesheets.filter { ts ->
val staffTeam = ts.staff!!.team.code
// val staffTeam = ts.staff!!.team.code
val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&& it.deleted == false
}!!.team.code
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
projectTeam != staffTeam projectTeam != staffTeam
} }
@@ -3673,19 +3685,17 @@ open class ReportService(
_timesheets.forEach {ts -> _timesheets.forEach {ts ->
// this team charging others // this team charging others
// get the grade and salary data of the record // get the grade and salary data of the record

val _grade = gradeLog.find { val _grade = gradeLog.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&&
it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&&
it.deleted == false
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&& it.deleted == false
} }
val gradeCode = _grade!!.grade.code val gradeCode = _grade!!.grade.code
val otMultiplier = 1.15 val otMultiplier = 1.15
val thisSE = salaryEffective.find { val thisSE = salaryEffective.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&&
it.startDate.isBefore(ts.recordDate) && (it.endDate.isAfter(ts.recordDate) || it.endDate == null)
&& it.startDate.isBefore(ts.recordDate) && (it.endDate.isAfter(ts.recordDate) || it.endDate == null)
} }
val normalHour = ts.normalConsumed ?: 0.0 val normalHour = ts.normalConsumed ?: 0.0
val otHour = ts.otConsumed ?: 0.0 val otHour = ts.otConsumed ?: 0.0
@@ -4118,7 +4128,7 @@ open class ReportService(
columnIndex++ columnIndex++
tempCell = getOrCreateCell(tempRow, columnIndex) tempCell = getOrCreateCell(tempRow, columnIndex)
CellUtil.setCellStyleProperties(tempCell, CellUtil.setCellStyleProperties(tempCell,
cellBorderArgs(1,1,1,1)
cellBorderArgs(1,1,1,2)
+ fontArgs("Times New Roman", false, false) + fontArgs("Times New Roman", false, false)
+ dataFormatArgs(accountingStyle) + dataFormatArgs(accountingStyle)
) )
@@ -4145,14 +4155,17 @@ open class ReportService(
var i = 0 var i = 0
while (i < numberOfColumns) { while (i < numberOfColumns) {
var leftBorder = 1 var leftBorder = 1
var rightBorder = 1
if (i == numberOfColumns - 2) { if (i == numberOfColumns - 2) {
leftBorder = 2 leftBorder = 2
} else if (i == numberOfColumns - 1) {
rightBorder = 2
} }
tempCell = getOrCreateCell(tempRow, columnIndex) tempCell = getOrCreateCell(tempRow, columnIndex)
val columnLetter = CellReference.convertNumToColString(columnIndex) val columnLetter = CellReference.convertNumToColString(columnIndex)
tempCell.cellFormula = "SUM(${columnLetter}${startingRow+1}:${columnLetter}${rowIndex})" tempCell.cellFormula = "SUM(${columnLetter}${startingRow+1}:${columnLetter}${rowIndex})"
CellUtil.setCellStyleProperties(tempCell, CellUtil.setCellStyleProperties(tempCell,
cellBorderArgs(1,2,leftBorder,1)
cellBorderArgs(2,2,leftBorder,rightBorder)
+ fontArgs("Times New Roman", false, false) + fontArgs("Times New Roman", false, false)
+ dataFormatArgs(accountingStyle) + dataFormatArgs(accountingStyle)
) )
@@ -4172,6 +4185,7 @@ open class ReportService(
gradeLog: List<GradeLog>, gradeLog: List<GradeLog>,
salaryEffective: List<SalaryEffective>, salaryEffective: List<SalaryEffective>,
): MutableMap<String, CrossTeamP4InOut> { ): MutableMap<String, CrossTeamP4InOut> {
val teamlog = teamLogRepository.findAll().filter { it.deleted == false }
var teamsMap: MutableMap<String, CrossTeamP4InOut> = mutableMapOf() var teamsMap: MutableMap<String, CrossTeamP4InOut> = mutableMapOf()
// teams.forEach { team -> // teams.forEach { team ->
// val key = team.code // val key = team.code
@@ -4187,14 +4201,26 @@ open class ReportService(
val team = desiredTeams[0] val team = desiredTeams[0]
val targetTeam = team.code val targetTeam = team.code
_timesheets = timesheets.filter { ts -> _timesheets = timesheets.filter { ts ->
val staffTeam = ts.staff!!.team.code
// val staffTeam = ts.staff!!.team.code
val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&& it.deleted == false
}!!.team.code
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
projectTeam != staffTeam && projectTeam != staffTeam &&
(staffTeam == targetTeam || projectTeam == targetTeam ) (staffTeam == targetTeam || projectTeam == targetTeam )
} }
} else { } else {
_timesheets = timesheets.filter { ts -> _timesheets = timesheets.filter { ts ->
val staffTeam = ts.staff!!.team.code
// val staffTeam = ts.staff!!.team.code
val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id
&&
it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&&
it.deleted == false
}!!.team.code
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
projectTeam != staffTeam projectTeam != staffTeam
} }


Loading…
Cancel
Save