Parcourir la source

update api

tags/Baseline_30082024_BACKEND_UAT
Mac\David il y a 1 an
Parent
révision
b85c8b0bc8
2 fichiers modifiés avec 605 ajouts et 0 suppressions
  1. +460
    -0
      src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt
  2. +145
    -0
      src/main/java/com/ffii/tsms/modules/data/web/DashboardController.kt

+ 460
- 0
src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt Voir le fichier

@@ -1091,6 +1091,466 @@ open class DashboardService(
+ " ORDER BY ds.month"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun monthlyPlannedTeamTotalManhoursSpent(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"SELECT"
+ " p.id as projectId,"
+ " p.name as projectName,"
+ " date_format(p.planStart, '%Y-%m') as planStart,"
+ " date_format(p.planEnd, '%Y-%m') as planEnd,"
+ " PERIOD_DIFF(DATE_FORMAT(:enddate, '%Y%m'),DATE_FORMAT(:startdate, '%Y%m'))+1 as searchDuration,"
+ " CASE"
+ " when p.planStart < :startdate then 0"
+ " when p.planStart >= :startdate then PERIOD_DIFF(DATE_FORMAT(p.planStart, '%Y%m'),DATE_FORMAT(:startdate, '%Y%m'))"
+ " else 0"
+ " END as startCount,"
+ " CASE"
+ " when p.planEnd >= :enddate then PERIOD_DIFF(DATE_FORMAT(:enddate, '%Y%m'),DATE_FORMAT(:startdate, '%Y%m'))"
+ " when p.planEnd < :enddate and p.planEnd > :startdate then PERIOD_DIFF(DATE_FORMAT(p.planEnd, '%Y%m'),DATE_FORMAT(:startdate, '%Y%m'))"
+ " else 0"
+ " END as endCount,"
+ " PERIOD_DIFF(DATE_FORMAT(p.planEnd, '%Y%m'), DATE_FORMAT(p.planStart, '%Y%m'))+1 as projectDuration,"
+ " ROUND(p.totalManhour / (PERIOD_DIFF(DATE_FORMAT(p.planEnd, '%Y%m'), DATE_FORMAT(p.planStart, '%Y%m'))+1), 2) AS 'AverageManhours',"
+ " p.teamLead,"
+ " p.totalManhour"
+ " FROM project p"
+ " left join team t on p.teamLead = t.teamLead"
+ " WHERE p.status = 'On-going'"
+ " and t.id = :teamId"
+ " and p.planEnd > :startdate"
+ " and p.planStart < :enddate"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun weeklyActualTeamTotalManhoursSpent(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"WITH RECURSIVE date_series AS ("
+ " SELECT DATE_FORMAT(:startdate, '%Y-%m-%d') AS day"
+ " UNION ALL"
+ " SELECT DATE_FORMAT(DATE_ADD(day, INTERVAL 1 DAY), '%Y-%m-%d')"
+ " FROM date_series"
+ " WHERE day < DATE_FORMAT(DATE_ADD(:startdate, INTERVAL 6 DAY), '%Y-%m-%d')"
+ " )"
+ " SELECT"
+ " ds.day AS yearMonth,"
+ " IFNULL(SUM(IFNULL(ts.normalConsumed, 0) + IFNULL(ts.otConsumed, 0)), 0) AS 'TotalManhourConsumed',"
+ " :teamId AS teamId"
+ " FROM date_series ds"
+ " LEFT JOIN staff st"
+ " on st.teamId = :teamId"
+ " LEFT JOIN timesheet ts"
+ " ON DATE_FORMAT(ts.recordDate, '%m-%d') = DATE_FORMAT(ds.day, '%m-%d') and ts.staffID = st.id"
+ " WHERE ds.day BETWEEN DATE_FORMAT(:startdate, '%Y-%m-%d') AND DATE_FORMAT(DATE_ADD(:startdate, INTERVAL 6 DAY), '%Y-%m-%d')"
+ " GROUP BY ds.day, st.teamId"
+ " ORDER BY ds.day"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun weeklyPlannedTeamTotalManhoursSpent(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"SELECT"
+ " p.id as projectId,"
+ " p.name as projectName,"
+ " date_format(p.planStart, '%Y-%m-%d') as planStart,"
+ " date_format(p.planEnd, '%Y-%m-%d') as planEnd,"
+ " DATEDIFF(DATE_FORMAT(DATE_ADD(:startdate, INTERVAL 6 DAY), '%Y%m%d'),DATE_FORMAT(:startdate, '%Y%m%d'))+1 as searchDuration,"
+ " CASE"
+ " when p.planStart < :startdate then 0"
+ " when p.planStart >= :startdate then DATEDIFF(DATE_FORMAT(p.planStart, '%Y%m%d'),DATE_FORMAT(:startdate, '%Y%m%d'))"
+ " else 0"
+ " END as startCount,"
+ " CASE"
+ " when p.planEnd >= DATE_ADD(:startdate, INTERVAL 6 DAY) then DATEDIFF(DATE_FORMAT(DATE_ADD(:startdate, INTERVAL 6 DAY), '%Y%m%d'),DATE_FORMAT(:startdate, '%Y%m%d'))"
+ " when p.planEnd < DATE_ADD(:startdate, INTERVAL 6 DAY) and p.planEnd > :startdate then DATEDIFF(DATE_FORMAT(p.planEnd, '%Y%m%d'),DATE_FORMAT(:startdate, '%Y%m%d'))"
+ " else 0"
+ " END as endCount,"
+ " DATEDIFF(DATE_FORMAT(p.planEnd, '%Y%m%d'), DATE_FORMAT(p.planStart, '%Y%m%d'))+1 as projectDuration,"
+ " ROUND(p.totalManhour / (DATEDIFF(DATE_FORMAT(p.planEnd, '%Y%m%d'), DATE_FORMAT(p.planStart, '%Y%m%d'))+1), 2) AS 'AverageManhours',"
+ " p.teamLead,"
+ " p.totalManhour"
+ " FROM project p"
+ " left join team t on p.teamLead = t.teamLead"
+ " WHERE p.status = 'On-going'"
+ " and t.id = :teamId"
+ " and p.planEnd > :startdate"
+ " and p.planStart < DATE_ADD(:startdate, INTERVAL 6 DAY)"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun weeklyUnsubmittedTimeSheet(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"SELECT"
+ " st.id, st.name, st.teamId, count(dates.missing_date) as 'UnsubmittedCount'"
+ " FROM"
+ " tsmsdb.staff st"
+ " CROSS JOIN"
+ " ("
+ " SELECT"
+ " DATE(:startdate + INTERVAL numbers.num DAY) AS missing_date"
+ " FROM"
+ " ("
+ " SELECT 0 AS num UNION ALL"
+ " SELECT 1 AS num UNION ALL"
+ " SELECT 2 AS num UNION ALL"
+ " SELECT 3 AS num UNION ALL"
+ " SELECT 4 AS num UNION ALL"
+ " SELECT 5 as num"
+ " ) numbers"
+ " WHERE"
+ " DATE(:startdate + INTERVAL numbers.num DAY) BETWEEN :startdate AND DATE_ADD(:startdate, INTERVAL 6 DAY)"
+ " AND DAYOFWEEK(DATE(:startdate + INTERVAL numbers.num DAY)) BETWEEN 2 AND 6"
+ " AND DATE(:startdate + INTERVAL numbers.num DAY) not in (select ch.date from company_holiday ch where ch.deleted = 0)"
+ " AND DATE(:startdate + INTERVAL numbers.num DAY) not in (:publicHolidayList)"
+ " ) dates"
+ " LEFT JOIN"
+ " ("
+ " SELECT"
+ " staffId, recordDate"
+ " FROM"
+ " tsmsdb.timesheet"
+ " WHERE"
+ " recordDate BETWEEN :startdate AND DATE_ADD(:startdate, INTERVAL 6 DAY)"
+ " ) ts"
+ " ON st.id = ts.staffId"
+ " AND dates.missing_date = ts.recordDate"
+ " WHERE"
+ " st.teamId = :teamId"
+ " AND ts.recordDate IS NULL"
+ " GROUP BY st.id, st.name"
+ " ORDER BY"
+ " st.id"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun monthlyUnsubmittedTimeSheet(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"SELECT"
+ " st.id,"
+ " st.name,"
+ " st.teamId,"
+ " :startdate AS 'month',"
+ " COUNT(dates.missing_date) AS 'UnsubmittedCount'"
+ " FROM"
+ " tsmsdb.staff st"
+ " CROSS JOIN"
+ " ("
+ " SELECT"
+ " DATE(:startdate + INTERVAL numbers.num DAY) AS missing_date"
+ " FROM"
+ " ("
+ " SELECT 0 AS num UNION ALL"
+ " SELECT 1 AS num UNION ALL"
+ " SELECT 2 AS num UNION ALL"
+ " SELECT 3 AS num UNION ALL"
+ " SELECT 4 AS num UNION ALL"
+ " SELECT 5 as num UNION ALL"
+ " SELECT 6 as num UNION ALL"
+ " SELECT 7 as num UNION ALL"
+ " SELECT 8 as num UNION ALL"
+ " SELECT 9 as num UNION ALL"
+ " SELECT 10 as num UNION ALL"
+ " SELECT 11 as num UNION ALL"
+ " SELECT 12 as num UNION ALL"
+ " SELECT 13 as num UNION ALL"
+ " SELECT 14 as num UNION ALL"
+ " SELECT 15 as num UNION ALL"
+ " SELECT 16 as num UNION ALL"
+ " SELECT 17 as num UNION ALL"
+ " SELECT 18 as num UNION ALL"
+ " SELECT 19 as num UNION ALL"
+ " SELECT 20 as num UNION ALL"
+ " SELECT 21 as num UNION ALL"
+ " SELECT 22 as num UNION ALL"
+ " SELECT 23 as num UNION ALL"
+ " SELECT 24 as num UNION ALL"
+ " SELECT 25 as num UNION ALL"
+ " SELECT 26 as num UNION ALL"
+ " SELECT 27 as num UNION ALL"
+ " SELECT 28 as num UNION ALL"
+ " SELECT 29 as num UNION ALL"
+ " SELECT 30 as num UNION ALL"
+ " SELECT 31 as num"
+ " ) numbers"
+ " WHERE"
+ " DATE(:startdate + INTERVAL numbers.num DAY) BETWEEN"
+ " :startdate AND"
+ " LAST_DAY(:startdate)"
+ " AND DAYOFWEEK(DATE(:startdate + INTERVAL numbers.num DAY)) BETWEEN 2 AND 6"
+ " AND DATE(:startdate + INTERVAL numbers.num DAY) not in (select ch.date from company_holiday ch where ch.deleted = 0)"
+ " AND DATE(:startdate + INTERVAL numbers.num DAY) not in (:publicHolidayList)"
+ " ) dates"
+ " LEFT JOIN"
+ " ("
+ " SELECT"
+ " staffId,"
+ " recordDate"
+ " FROM"
+ " tsmsdb.timesheet"
+ " WHERE"
+ " recordDate BETWEEN"
+ " :startdate AND"
+ " LAST_DAY(:startdate)"
+ " ) ts"
+ " ON st.id = ts.staffId"
+ " AND dates.missing_date = ts.recordDate"
+ " WHERE"
+ " st.teamId = :teamId"
+ " AND ts.recordDate IS NULL"
+ " GROUP BY"
+ " st.id,"
+ " st.name"
+ " ORDER BY"
+ " st.id"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun newMonthlyUnsubmittedTimeSheet(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"WITH RECURSIVE numbers AS ("
+ " SELECT 0 AS num"
+ " UNION ALL"
+ " SELECT num + 1"
+ " FROM numbers"
+ " WHERE num < DATEDIFF(:enddate, :startdate)"
+ " )"
+ " SELECT"
+ " st.id,"
+ " st.name,"
+ " st.teamId,"
+ " :startdate AS 'month',"
+ " COUNT(dates.missing_date) AS 'UnsubmittedCount'"
+ " FROM"
+ " tsmsdb.staff st"
+ " CROSS JOIN"
+ " ("
+ " SELECT"
+ " DATE(:startdate + INTERVAL numbers.num DAY) AS missing_date"
+ " FROM"
+ " numbers"
+ " WHERE"
+ " DATE(:startdate + INTERVAL numbers.num DAY) BETWEEN :startdate AND :enddate"
+ " AND DAYOFWEEK(DATE(:startdate + INTERVAL numbers.num DAY)) BETWEEN 2 AND 6"
+ " AND DATE(:startdate + INTERVAL numbers.num DAY) NOT IN ("
+ " SELECT ch.date FROM company_holiday ch WHERE ch.deleted = 0"
+ " )"
+ " AND DATE(:startdate + INTERVAL numbers.num DAY) NOT IN (:publicHolidayList)"
+ " ) dates"
+ " LEFT JOIN"
+ " ("
+ " SELECT"
+ " staffId,"
+ " recordDate"
+ " FROM"
+ " tsmsdb.timesheet"
+ " WHERE"
+ " recordDate BETWEEN :startdate AND :enddate"
+ " ) ts"
+ " ON st.id = ts.staffId AND dates.missing_date = ts.recordDate"
+ " WHERE"
+ " st.teamId = :teamId"
+ " AND ts.recordDate IS NULL"
+ " GROUP BY"
+ " st.id,"
+ " st.name"
+ " ORDER BY"
+ " st.id"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun staffGradeTotalManhours(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " g.id as id,"
+ " g.name as gradeName,"
+ " coalesce(records.manhours,0) as manhours"
+ " from grade g"
+ " left join ("
+ " select"
+ " g.id as gid,"
+ " coalesce (sum(t.normalConsumed)+sum(t.otConsumed),0) as manhours"
+ " from grade g"
+ " left join staff s on g.id = s.gradeId"
+ " left join timesheet t on s.id = t.staffId"
+ " where g.deleted = 0"
+ " and t.recordDate >= :startdate"
+ " and t.recordDate < DATE_FORMAT(:enddate, '%Y-%m-%d 23:59:59')"
+ " group by g.id"
+ " ) as records on records.gid = g.id"
+ " group by g.id, g.name,records.manhours"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun staffGradeTotalPlannedManhours(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " g.id,"
+ " g.name,"
+ " p.name as projectName,"
+ " p.planStart as planStart,"
+ " p.planEnd as planEnd,"
+ " DATEDIFF(DATE_FORMAT(:enddate, '%Y%m%d'),DATE_FORMAT(:startdate, '%Y%m%d'))+1 as searchDuration,"
+ " case"
+ " when DATEDIFF(DATE_FORMAT(p.planStart, '%Y%m%d'),DATE_FORMAT(:startdate, '%Y%m%d'))+1 < 0 then 0"
+ " else DATEDIFF(DATE_FORMAT(p.planStart, '%Y%m%d'),DATE_FORMAT(:startdate, '%Y%m%d'))+1"
+ " end as startDiff,"
+ " case"
+ " when DATEDIFF(DATE_FORMAT(:enddate, '%Y%m%d'),DATE_FORMAT(p.planEnd, '%Y%m%d'))+1 < 0 then 0"
+ " else DATEDIFF(DATE_FORMAT(:enddate, '%Y%m%d'),DATE_FORMAT(p.planEnd, '%Y%m%d'))+1"
+ " end as endDiff,"
+ " DATEDIFF(DATE_FORMAT(p.planEnd, '%Y%m%d'), DATE_FORMAT(p.planStart, '%Y%m%d'))+1 as projectDuration,"
+ " ga.manhour as gradeManhour,"
+ " (ga.manhour/DATEDIFF(DATE_FORMAT(p.planEnd, '%Y%m%d'), DATE_FORMAT(p.planStart, '%Y%m%d'))+1) as avgGradeManhour"
+ " from grade g"
+ " left join grade_allocation ga on g.id = ga.gradeId"
+ " left join project p on ga.projectId = p.id"
+ " where p.status = 'On-going'"
+ " and p.planEnd > :startdate"
+ " and p.planStart < :enddate"
+ " order by g.id"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun IndividualStaffManhoursSpentByMonth(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " p2.id as id,"
+ " p2.name as projectName,"
+ " coalesce (result.manhours,0) as manhours,"
+ " coalesce (round((result.manhours/ sum(result.manhours))*100,2),0) as percentage"
+ " from staff s2"
+ " left join staff_allocation sa2 on sa2.staff_id = s2.id"
+ " left join project p2 on sa2.project_id = p2.id"
+ " left join ("
+ " select"
+ " p.id as pid,"
+ " p.name as projectName,"
+ " coalesce (sum(t.normalConsumed)+sum(t.otConsumed),0) as manhours"
+ " from staff s"
+ " left join staff_allocation sa on sa.staff_id = s.id"
+ " left join project p on sa.project_id = p.id"
+ " left join timesheet t on p.id = t.projectId"
+ " where s.id = :staffId"
+ " and t.recordDate >= :startdate"
+ " and t.recordDate <= last_day(:startdate)"
+ " group by p.id, p.name"
+ " ) as result on result.pid = p2.id"
+ " where s2.id = :staffId"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun IndividualStaffManhoursSpentWeekly(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " p2.id as id,"
+ " p2.name as projectName,"
+ " coalesce (result.manhours,0) as manhours,"
+ " coalesce (round((result.manhours/ sum(result.manhours))*100,2),0) as percentage"
+ " from staff s2"
+ " left join staff_allocation sa2 on sa2.staff_id = s2.id"
+ " left join project p2 on sa2.project_id = p2.id"
+ " left join ("
+ " select"
+ " p.id as pid,"
+ " p.name as projectName,"
+ " coalesce (sum(t.normalConsumed)+sum(t.otConsumed),0) as manhours"
+ " from staff s"
+ " left join staff_allocation sa on sa.staff_id = s.id"
+ " left join project p on sa.project_id = p.id"
+ " left join timesheet t on p.id = t.projectId"
+ " where s.id = :staffId"
+ " and t.recordDate >= :startdate"
+ " and t.recordDate <= :enddate"
+ " group by p.id, p.name"
+ " ) as result on result.pid = p2.id"
+ " where s2.id = :staffId"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun IndividualStaffManhoursSpentByDay(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " p2.id as id,"
+ " p2.name as projectName,"
+ " coalesce (result.manhours,0) as manhours,"
+ " coalesce (round((result.manhours/ sum(result.manhours))*100,2),0) as percentage"
+ " from staff s2"
+ " left join staff_allocation sa2 on sa2.staff_id = s2.id"
+ " left join project p2 on sa2.project_id = p2.id"
+ " left join ("
+ " select"
+ " p.id as pid,"
+ " p.name as projectName,"
+ " coalesce (sum(t.normalConsumed)+sum(t.otConsumed),0) as manhours"
+ " from staff s"
+ " left join staff_allocation sa on sa.staff_id = s.id"
+ " left join project p on sa.project_id = p.id"
+ " left join timesheet t on p.id = t.projectId"
+ " where s.id = :staffId"
+ " and t.recordDate >= :startdate"
+ " group by p.id, p.name"
+ " ) as result on result.pid = p2.id"
+ " where s2.id = :staffId"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun IndividualStaffTotalManhoursSpentByDay(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " coalesce (sum(t.normalConsumed),0) as normalManhours,"
+ " coalesce (sum(t.otConsumed),0) as otManhours"
+ " from staff s"
+ " left join staff_allocation sa on sa.staff_id = s.id"
+ " left join project p on sa.project_id = p.id"
+ " left join timesheet t on p.id = t.projectId"
+ " where s.id = :staffId"
+ " and t.recordDate = :startdate"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun IndividualStaffTotalManhoursSpentWeekly(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " coalesce (sum(t.normalConsumed),0) as normalManhours,"
+ " coalesce (sum(t.otConsumed),0) as otManhours"
+ " from staff s"
+ " left join staff_allocation sa on sa.staff_id = s.id"
+ " left join project p on sa.project_id = p.id"
+ " left join timesheet t on p.id = t.projectId"
+ " where s.id = :staffId"
+ " and t.recordDate >= :startdate"
+ " and t.recordDate <= :enddate"
)

return jdbcDao.queryForList(sql.toString(), args)
}
fun IndividualStaffTotalManhoursSpentByMonthly(args: Map<String, Any>): List<Map<String, Any>> {
val sql = StringBuilder(
"select"
+ " coalesce (sum(t.normalConsumed),0) as normalManhours,"
+ " coalesce (sum(t.otConsumed),0) as otManhours"
+ " from staff s"
+ " left join staff_allocation sa on sa.staff_id = s.id"
+ " left join project p on sa.project_id = p.id"
+ " left join timesheet t on p.id = t.projectId"
+ " where s.id = :staffId"
+ " and t.recordDate >= :startdate"
+ " and t.recordDate <= last_day(:startdate)"
)

return jdbcDao.queryForList(sql.toString(), args)
}
}


+ 145
- 0
src/main/java/com/ffii/tsms/modules/data/web/DashboardController.kt Voir le fichier

@@ -249,7 +249,152 @@ class DashboardController(
}
val result = mutableMapOf<String, Any>()
val monthlyActualTeamTotalManhoursSpent = dashboardService.monthlyActualTeamTotalManhoursSpent(args)
val monthlyPlannedTeamTotalManhoursSpent = dashboardService.monthlyPlannedTeamTotalManhoursSpent(args)
result["monthlyActualTeamTotalManhoursSpent"] = monthlyActualTeamTotalManhoursSpent
result["monthlyPlannedTeamTotalManhoursSpent"] = monthlyPlannedTeamTotalManhoursSpent
return listOf(result)
}
@GetMapping("/searchWeeklyActualTeamTotalManhoursSpent")
fun searchWeeklyActualTeamTotalManhoursSpent(request: HttpServletRequest?): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
val teamId = request?.getParameter("teamId")
val startdate = request?.getParameter("startdate")
val enddate = request?.getParameter("enddate")
if (teamId != null) {
args["teamId"] = teamId
}
if (startdate != null) {
args["startdate"] = startdate
}
if (enddate != null) {
args["enddate"] = enddate
}
val result = mutableMapOf<String, Any>()
val weeklyActualTeamTotalManhoursSpent = dashboardService.weeklyActualTeamTotalManhoursSpent(args)
val weeklyPlannedTeamTotalManhoursSpent = dashboardService.weeklyPlannedTeamTotalManhoursSpent(args)
result["weeklyActualTeamTotalManhoursSpent"] = weeklyActualTeamTotalManhoursSpent
result["weeklyPlannedTeamTotalManhoursSpent"] = weeklyPlannedTeamTotalManhoursSpent
return listOf(result)
}
@GetMapping("/searchWeeklyUnsubmittedTimeSheet")
fun searchWeeklyUnsubmittedTimeSheet(request: HttpServletRequest?): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
val teamId = request?.getParameter("teamId")
val startdate = request?.getParameter("startdate")
val enddate = request?.getParameter("enddate")
val publicHolidayListParam = request?.getParameter("publicHolidayList")
if (teamId != null) {
args["teamId"] = teamId
}
if (startdate != null) {
args["startdate"] = startdate
}
if (enddate != null) {
args["enddate"] = enddate
}
if (publicHolidayListParam != null) {
val publicHolidayList = publicHolidayListParam.split(",").map { it.trim() }
args["publicHolidayList"] = publicHolidayList
}
return dashboardService.weeklyUnsubmittedTimeSheet(args)
}
@GetMapping("/searchMonthlyUnsubmittedTimeSheet")
fun searchMonthlyUnsubmittedTimeSheet(request: HttpServletRequest?): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
val teamId = request?.getParameter("teamId")
val startdate = request?.getParameter("startdate")
val enddate = request?.getParameter("enddate")
val publicHolidayListParam = request?.getParameter("publicHolidayList")
if (teamId != null) {
args["teamId"] = teamId
}
if (startdate != null) {
args["startdate"] = startdate
}
if (enddate != null) {
args["enddate"] = enddate
}
if (publicHolidayListParam != null) {
val publicHolidayList = publicHolidayListParam.split(",").map { it.trim() }
args["publicHolidayList"] = publicHolidayList
}
return dashboardService.newMonthlyUnsubmittedTimeSheet(args)
}
@GetMapping("/searchTotalManhoursSpentByStaffGrade")
fun searchTotalManhoursSpentByStaffGrade(request: HttpServletRequest?): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
val startdate = request?.getParameter("startdate")
val enddate = request?.getParameter("enddate")
if (startdate != null) {
args["startdate"] = startdate
}
if (enddate != null) {
args["enddate"] = enddate
}
val result = mutableMapOf<String, Any>()
val staffGradeTotalManhours = dashboardService.staffGradeTotalManhours(args)
val staffGradeTotalPlannedManhours = dashboardService.staffGradeTotalPlannedManhours(args)
result["staffGradeTotalManhours"] = staffGradeTotalManhours
result["staffGradeTotalPlannedManhours"] = staffGradeTotalPlannedManhours
return listOf(result)
}
@GetMapping("/searchTotalManhoursSpentByStaffDaily")
fun searchTotalManhoursSpentByStaffDaily(request: HttpServletRequest?): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
val staffId = request?.getParameter("staffId")
val startdate = request?.getParameter("startdate")

if (startdate != null) {
args["startdate"] = startdate
}
if (staffId != null) {
args["staff"] = staffId
}
val result = mutableMapOf<String, Any>()
val individualStaffManhoursSpentByDay = dashboardService.IndividualStaffManhoursSpentByDay(args)
val individualStaffTotalManhoursSpentByDay = dashboardService.IndividualStaffTotalManhoursSpentByDay(args)
result["individualStaffManhoursSpentByDay"] = individualStaffManhoursSpentByDay
result["individualStaffTotalManhoursSpentByDay"] = individualStaffTotalManhoursSpentByDay
return listOf(result)
}
@GetMapping("/searchTotalManhoursSpentByStaffWeekly")
fun searchTotalManhoursSpentByStaffWeekly(request: HttpServletRequest?): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
val staffId = request?.getParameter("staffId")
val startdate = request?.getParameter("startdate")
val enddate = request?.getParameter("enddate")
if (startdate != null) {
args["startdate"] = startdate
}
if (enddate != null) {
args["enddate"] = enddate
}
if (staffId != null) {
args["staff"] = staffId
}
val result = mutableMapOf<String, Any>()
val individualStaffManhoursSpentWeekly = dashboardService.IndividualStaffManhoursSpentWeekly(args)
val individualStaffTotalManhoursSpentWeekly = dashboardService.IndividualStaffTotalManhoursSpentWeekly(args)
result["individualStaffManhoursSpentWeekly"] = individualStaffManhoursSpentWeekly
result["individualStaffTotalManhoursSpentWeekly"] = individualStaffTotalManhoursSpentWeekly
return listOf(result)
}
@GetMapping("/searchTotalManhoursSpentByStaffByMonth")
fun searchTotalManhoursSpentByStaffByMonth(request: HttpServletRequest?): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
val staffId = request?.getParameter("staffId")
val startdate = request?.getParameter("startdate")
if (startdate != null) {
args["startdate"] = startdate
}
if (staffId != null) {
args["staff"] = staffId
}
val result = mutableMapOf<String, Any>()
val individualStaffManhoursSpentByMonth = dashboardService.IndividualStaffManhoursSpentByMonth(args)
val individualStaffTotalManhoursSpentByMonth = dashboardService.IndividualStaffTotalManhoursSpentByMonthly(args)
result["individualStaffManhoursSpentByMonth"] = individualStaffManhoursSpentByMonth
result["individualStaffTotalManhoursSpentByMonth"] = individualStaffTotalManhoursSpentByMonth
return listOf(result)
}
}

Chargement…
Annuler
Enregistrer