|
|
@@ -302,7 +302,7 @@ public class ReportController {
|
|
|
Integer departmentId,
|
|
|
@RequestParam(defaultValue = "1") Integer pageIndex,
|
|
|
@RequestParam(defaultValue = "20") Integer pageSize,
|
|
|
- String userId, String orderBy) {
|
|
|
+ String userId, Integer orderByAuditor) {
|
|
|
//startDate和endDate间隔不得超过1年
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate start = LocalDate.parse(startDate, dateTimeFormatter);
|
|
|
@@ -312,7 +312,7 @@ public class ReportController {
|
|
|
httpRespMsg.setError("查询日报时间间隔不得超过1年");
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
- return reportService.getReportListForExport(startDate, endDate, projectId, state, departmentId, pageIndex, pageSize, userId,orderBy, request);
|
|
|
+ return reportService.getReportListForExport(startDate, endDate, projectId, state, departmentId, pageIndex, pageSize, userId,orderByAuditor, request);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -327,7 +327,7 @@ public class ReportController {
|
|
|
public HttpRespMsg exportReportListForExport(String startDate, String endDate,
|
|
|
Integer projectId,
|
|
|
Integer state,
|
|
|
- Integer departmentId, String userId) {
|
|
|
+ Integer departmentId, String userId, Integer orderByAuditor) {
|
|
|
//startDate和endDate间隔不得超过1年
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate start = LocalDate.parse(startDate, dateTimeFormatter);
|
|
|
@@ -337,11 +337,11 @@ public class ReportController {
|
|
|
httpRespMsg.setError("导出日报时间间隔不得超过1年");
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
- return reportService.exportReportListForExport(startDate, endDate, projectId, state, departmentId, userId, request);
|
|
|
+ return reportService.exportReportListForExport(startDate, endDate, projectId, state, departmentId, userId, orderByAuditor, request);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/getReportGroupByDay")
|
|
|
- public HttpRespMsg getReportGroupByDay(String startDate, String endDate,String userId, Integer departmentId, Integer projectId, Integer state, String orderBy) {
|
|
|
+ public HttpRespMsg getReportGroupByDay(String startDate, String endDate,String userId, Integer departmentId, Integer projectId, Integer state, Integer orderByAuditor) {
|
|
|
//startDate和endDate间隔不得超过1年
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate start = LocalDate.parse(startDate, dateTimeFormatter);
|
|
|
@@ -351,7 +351,7 @@ public class ReportController {
|
|
|
httpRespMsg.setError("日报时间间隔不得超过1年");
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
- return reportService.getReportGroupByDay(startDate, endDate,userId, departmentId, projectId, state, orderBy, request);
|
|
|
+ return reportService.getReportGroupByDay(startDate, endDate,userId, departmentId, projectId, state, orderByAuditor, request);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/exportReportGroupByDay")
|
|
|
@@ -674,6 +674,8 @@ public class ReportController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //获取用户分组的数据
|
|
|
+ List<UserGroup> userGroupList = comTimeType.getPayOvertimeMode() == 1? userGroupMapper.selectList(new QueryWrapper<UserGroup>().eq("company_id", company.getId())) : null;
|
|
|
if (company.getPackageProject() == 1) {
|
|
|
//检查是否设置了预算的工时预警
|
|
|
ProjectBasecostSetting alarmSetting = projectBasecostSettingMapper.selectOne(new QueryWrapper<ProjectBasecostSetting>()
|
|
|
@@ -979,6 +981,7 @@ public class ReportController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ List<User> reportUserList = new ArrayList<>();
|
|
|
//代填
|
|
|
if (targetUids != null && targetUids.length > 0) {
|
|
|
String val = targetUids[0];
|
|
|
@@ -988,6 +991,10 @@ public class ReportController {
|
|
|
targetUidList.add(ids[i]);
|
|
|
}
|
|
|
targetUserList = userService.list(new QueryWrapper<User>().in("id", targetUidList));
|
|
|
+ reportUserList.addAll(targetUserList);
|
|
|
+ } else {
|
|
|
+ //自己填自己的
|
|
|
+ reportUserList.add(user);
|
|
|
}
|
|
|
|
|
|
LocalDate now = LocalDate.now();
|
|
|
@@ -1299,9 +1306,9 @@ public class ReportController {
|
|
|
}
|
|
|
//计算工时和成本
|
|
|
if (report.getMultiWorktime() == 0) {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
} else {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
}
|
|
|
|
|
|
//项目专业的进展
|
|
|
@@ -1365,9 +1372,9 @@ public class ReportController {
|
|
|
hourCost = subsUser.getCost();
|
|
|
//计算工时和成本
|
|
|
if (report.getMultiWorktime() == 0) {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
} else {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
}
|
|
|
fillReportProgress(report, professionProgress[i]);
|
|
|
reportList.add(report);
|
|
|
@@ -1429,9 +1436,9 @@ public class ReportController {
|
|
|
}
|
|
|
//计算工时和成本
|
|
|
if (report.getMultiWorktime() == 0) {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
} else {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
}
|
|
|
|
|
|
fillReportProgress(report, professionProgress[i]);
|
|
|
@@ -1507,9 +1514,9 @@ public class ReportController {
|
|
|
hourCost = subsUser.getCost();
|
|
|
//计算工时和成本
|
|
|
if (report.getMultiWorktime() == 0) {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], startTime==null?null:startTime[i], endTime==null?null:endTime[i], sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
} else {
|
|
|
- fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList);
|
|
|
+ fillReportHours(report, hourCost, workingTime==null?null:workingTime[i], timeType==null?null:timeType[i], null, null, sdf, comTimeType, excludeTimeList, reportUserList, userGroupList);
|
|
|
}
|
|
|
|
|
|
fillReportProgress(report, professionProgress[i]);
|
|
|
@@ -2707,7 +2714,7 @@ public class ReportController {
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
- private void fillReportHours(Report report, BigDecimal hourCost, Double workingTime, Integer timeType, String startTime, String endTime, SimpleDateFormat sdf, TimeType comTimeType, List<TimeAutoExclude> excludeTimeList) {
|
|
|
+ private void fillReportHours(Report report, BigDecimal hourCost, Double workingTime, Integer timeType, String startTime, String endTime, SimpleDateFormat sdf, TimeType comTimeType, List<TimeAutoExclude> excludeTimeList, List<User> reportUserList, List<UserGroup> userGroupList) {
|
|
|
if (report.getMultiWorktime() == 0) {
|
|
|
//普通工时成本计算
|
|
|
if (report.getReportTimeType() == 0) {
|
|
|
@@ -2799,7 +2806,22 @@ public class ReportController {
|
|
|
|
|
|
//如果设置了加班有工资并且当前存在加班的勾选,需要计算一下
|
|
|
if (report.getIsOvertime() != null && report.getIsOvertime() == 1 && comTimeType.getPayOvertime()) {
|
|
|
- BigDecimal overtimeCost = hourCost.multiply(new BigDecimal(report.getOvertimeHours())).multiply(new BigDecimal(comTimeType.getOvertimeRatio()));
|
|
|
+ BigDecimal overtimeCost = new BigDecimal(0);
|
|
|
+ if (comTimeType.getPayOvertimeMode() == 0) {
|
|
|
+ overtimeCost = hourCost.multiply(new BigDecimal(report.getOvertimeHours())).multiply(new BigDecimal(comTimeType.getOvertimeRatio()));
|
|
|
+ } else {
|
|
|
+ User targetUser = reportUserList.stream().filter(u->u.getId().equals(report.getCreatorId())).findFirst().orElse(null);
|
|
|
+
|
|
|
+ if (targetUser != null) {
|
|
|
+ if (targetUser.getUserGroupId() != null) {
|
|
|
+ UserGroup userGroup = userGroupList.stream().filter(ug->ug.getId().equals(targetUser.getUserGroupId())).findFirst().orElse(null);
|
|
|
+ if (userGroup != null) {
|
|
|
+ //重新计算加班成本
|
|
|
+ overtimeCost = userGroup.getOvertimeHourCost().multiply(new BigDecimal(report.getOvertimeHours()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
report.setOvertimeCost(overtimeCost);
|
|
|
//重新计算总的cost
|
|
|
BigDecimal nonOvertimeCost = hourCost.multiply(new BigDecimal(report.getWorkingTime() - report.getOvertimeHours()));
|