|
@@ -175,7 +175,8 @@ public class ReportController {
|
|
|
String[] projectAuditorId,
|
|
|
Double[] overtimeHours, //加班时长
|
|
|
String[] customText,
|
|
|
- Integer[] basecostId //成本基线项的id
|
|
|
+ Integer[] basecostId, //成本基线项的id
|
|
|
+ String[] auditorSettingArray
|
|
|
) {
|
|
|
List<Report> reportList = new ArrayList<>();
|
|
|
String token = request.getHeader("Token");
|
|
@@ -269,7 +270,6 @@ public class ReportController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -314,12 +314,46 @@ public class ReportController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //自动填充项目审核人
|
|
|
- for (int i=0;i<projectAuditorId.length; i++) {
|
|
|
- if (projectAuditorId[i] == null) {
|
|
|
- final int index = i;
|
|
|
- projectAuditorId[i] = projectList.stream().filter(p->p.getId().equals(projectId[index])).findFirst().get().getInchargerId();
|
|
|
+ TimeType comTimeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
+ List<ReportAuditorSetting> auditorSettingList = null;
|
|
|
+ if (comTimeType.getReportAuditType() == 3) {
|
|
|
+ //员工自由选择审批人
|
|
|
+ if (auditorSettingArray == null) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError("请设置审批人");
|
|
|
+ return msg;
|
|
|
+ } else {
|
|
|
+ for (int i=0;i<auditorSettingArray.length; i++) {
|
|
|
+ String str = auditorSettingArray[i];
|
|
|
+ ReportAuditorSetting reportAuditorSetting = JSONObject.parseObject(str, ReportAuditorSetting.class);
|
|
|
+ auditorSettingList.add(reportAuditorSetting);
|
|
|
+ //检查审核人层级是否设置满
|
|
|
+ if (comTimeType.getAuditLevel() == 1 && reportAuditorSetting.getAuditorFirst() == null) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError("请设置审核人");
|
|
|
+ return msg;
|
|
|
+ } else if (comTimeType.getAuditLevel() == 2 && (reportAuditorSetting.getAuditorFirst() == null || reportAuditorSetting.getAuditorSec() == null)) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError("请设置审核人");
|
|
|
+ return msg;
|
|
|
+ }else if (comTimeType.getAuditLevel() == 3 && (reportAuditorSetting.getAuditorFirst() == null || reportAuditorSetting.getAuditorSec() == null
|
|
|
+ || reportAuditorSetting.getAuditorThird() == null)) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError("请设置审核人");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ //设置审核人为第一审核人
|
|
|
+ projectAuditorId = new String[auditorSettingArray.length];
|
|
|
+ projectAuditorId[i] = reportAuditorSetting.getAuditorFirst();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //自动填充项目审核人
|
|
|
+ for (int i=0;i<projectAuditorId.length; i++) {
|
|
|
+ if (projectAuditorId[i] == null) {
|
|
|
+ final int index = i;
|
|
|
+ projectAuditorId[i] = projectList.stream().filter(p->p.getId().equals(projectId[index])).findFirst().get().getInchargerId();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -337,7 +371,7 @@ public class ReportController {
|
|
|
LocalDate now = LocalDate.now();
|
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
BigDecimal hourCost = null;
|
|
|
- TimeType comTimeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
+
|
|
|
//自己填写的情况,计算个人自己的时薪
|
|
|
if (targetUidList == null) {
|
|
|
if (user.getCostApplyDate() != null) {
|
|
@@ -519,7 +553,10 @@ public class ReportController {
|
|
|
report.setTaskFinish(taskFinish[i]);
|
|
|
report.setCustomText(customText[i]);
|
|
|
report.setBasecostId(basecostId[i]);
|
|
|
-
|
|
|
+ //如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
+ if (comTimeType.getReportAuditType() == 3) {
|
|
|
+ report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
+ }
|
|
|
if (auditWorkflowList.size() == 0) {
|
|
|
//没有自定义审核流,默认的直接是项目负责人审核
|
|
|
report.setIsDeptAudit(0);
|
|
@@ -577,6 +614,10 @@ public class ReportController {
|
|
|
report.setTaskFinish(taskFinish[i]);
|
|
|
report.setCustomText(customText[i]);
|
|
|
report.setBasecostId(basecostId[i]);
|
|
|
+ //如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
+ if (comTimeType.getReportAuditType() == 3) {
|
|
|
+ report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
+ }
|
|
|
if (auditWorkflowList.size() == 0) {
|
|
|
//没有自定义审核流,默认的直接是项目负责人审核
|
|
|
report.setIsDeptAudit(0);
|
|
@@ -636,6 +677,10 @@ public class ReportController {
|
|
|
report.setTaskFinish(taskFinish[i]);
|
|
|
report.setCustomText(customText[i]);
|
|
|
report.setBasecostId(basecostId[i]);
|
|
|
+ //如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
+ if (comTimeType.getReportAuditType() == 3) {
|
|
|
+ report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
+ }
|
|
|
if (auditWorkflowList.size() == 0) {
|
|
|
//没有自定义审核流,默认的直接是项目负责人审核
|
|
|
report.setIsDeptAudit(0);
|
|
@@ -700,6 +745,10 @@ public class ReportController {
|
|
|
report.setTaskFinish(taskFinish[i]);
|
|
|
report.setCustomText(customText[i]);
|
|
|
report.setBasecostId(basecostId[i]);
|
|
|
+ //如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
+ if (comTimeType.getReportAuditType() == 3) {
|
|
|
+ report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
+ }
|
|
|
if (auditWorkflowList.size() == 0) {
|
|
|
//没有自定义审核流,直接代填的,就算审核通过
|
|
|
report.setIsDeptAudit(0);
|