|
|
@@ -16,6 +16,7 @@ import com.management.platform.entity.vo.SysRichFunction;
|
|
|
import com.management.platform.entity.vo.WorktimeItem;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
|
+import com.management.platform.service.impl.ProjectConstructionStageServiceImpl;
|
|
|
import com.management.platform.service.impl.WxCorpInfoServiceImpl;
|
|
|
import com.management.platform.util.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -51,8 +52,15 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
@RequestMapping("/report")
|
|
|
public class ReportController {
|
|
|
+ @Resource
|
|
|
+ private ReportProjectConstructionService reportProjectConstructionService;
|
|
|
+
|
|
|
@Resource
|
|
|
private UserRecentReportService userRecentReportService;
|
|
|
+ @Resource
|
|
|
+ private ConstructionStageService constructionStageService;
|
|
|
+ @Resource
|
|
|
+ private ProjectConstructionStageService projectConstructionStageService;
|
|
|
@Autowired
|
|
|
private ReportService reportService;
|
|
|
@Resource
|
|
|
@@ -131,6 +139,8 @@ public class ReportController {
|
|
|
private UserDingdingTimeMapper userDingdingTimeMapper;
|
|
|
@Resource
|
|
|
private MaskWordService maskWordService;
|
|
|
+ @Autowired
|
|
|
+ private ReportProjectConstructionMapper reportProjectConstructionMapper;
|
|
|
|
|
|
//获取任务相关的日报列表
|
|
|
@RequestMapping("/getTaskReportList")
|
|
|
@@ -494,7 +504,8 @@ public class ReportController {
|
|
|
String weeklyAttachment,
|
|
|
String[] extraField4,
|
|
|
String[] extraField5,
|
|
|
- Boolean abnormalTime
|
|
|
+ Boolean abnormalTime,
|
|
|
+ String[] constructionStagesStr //柘中定制的施工进度
|
|
|
) {
|
|
|
List<Report> reportList = new ArrayList<>();
|
|
|
String token = request.getHeader("Token");
|
|
|
@@ -522,28 +533,20 @@ public class ReportController {
|
|
|
}
|
|
|
if (subProjectId == null) {
|
|
|
subProjectId = new Integer[projectId.length];
|
|
|
- for(int i=0;i<subProjectId.length; i++) {
|
|
|
- subProjectId[i] = 0;
|
|
|
- }
|
|
|
+ Arrays.fill(subProjectId, 0);
|
|
|
}
|
|
|
//初始化,防止老版本无此字段奔溃报错
|
|
|
if (multiWorktime == null) {
|
|
|
multiWorktime = new Integer[projectId.length];
|
|
|
- for(int i=0;i<multiWorktime.length; i++) {
|
|
|
- multiWorktime[i] = 0;
|
|
|
- }
|
|
|
+ Arrays.fill(multiWorktime, 0);
|
|
|
}
|
|
|
if (degreeId == null) {
|
|
|
degreeId = new Integer[projectId.length];
|
|
|
- for(int i=0;i<degreeId.length; i++) {
|
|
|
- degreeId[i] = -1;
|
|
|
- }
|
|
|
+ Arrays.fill(degreeId, -1);
|
|
|
}
|
|
|
if (groupId == null) {
|
|
|
groupId = new Integer[projectId.length];
|
|
|
- for(int i=0;i<groupId.length; i++) {
|
|
|
- groupId[i] = 0;
|
|
|
- }
|
|
|
+ Arrays.fill(groupId, 0);
|
|
|
}
|
|
|
if (groupId.length != id.length) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
@@ -581,15 +584,10 @@ public class ReportController {
|
|
|
|
|
|
if (customData == null) {
|
|
|
customData = new Double[projectId.length];
|
|
|
- for(int i=0;i<customData.length; i++) {
|
|
|
- customData[i] = 0.0;
|
|
|
- }
|
|
|
+ Arrays.fill(customData, 0.0);
|
|
|
}
|
|
|
if (projectAuditorId == null || projectAuditorId.length == 0) {
|
|
|
projectAuditorId = new String[projectId.length];
|
|
|
- for(int i=0;i<projectAuditorId.length; i++) {
|
|
|
- projectAuditorId[i] = null;
|
|
|
- }
|
|
|
}
|
|
|
else if (projectAuditorId.length < projectId.length) {
|
|
|
if (comTimeType.getReportAuditType() <= 1) {
|
|
|
@@ -612,27 +610,18 @@ public class ReportController {
|
|
|
|
|
|
if (overtimeHours == null) {
|
|
|
overtimeHours = new Double[projectAuditorId.length];
|
|
|
- for(int i=0;i<projectAuditorId.length; i++) {
|
|
|
- overtimeHours[i] = null;
|
|
|
- }
|
|
|
}
|
|
|
if (taskFinish == null) {
|
|
|
taskFinish = new Integer[projectId.length];
|
|
|
- for(int i=0;i<taskFinish.length; i++) {
|
|
|
- taskFinish[i] = 0;
|
|
|
- }
|
|
|
+ Arrays.fill(taskFinish, 0);
|
|
|
}
|
|
|
if (customText == null) {
|
|
|
customText = new String[projectId.length];
|
|
|
- for(int i=0;i<customText.length; i++) {
|
|
|
- customText[i] = "-";
|
|
|
- }
|
|
|
+ Arrays.fill(customText, "-");
|
|
|
}
|
|
|
if (basecostId == null) {
|
|
|
basecostId = new Integer[projectId.length];
|
|
|
- for(int i=0;i<basecostId.length; i++) {
|
|
|
- basecostId[i] = 0;
|
|
|
- }
|
|
|
+ Arrays.fill(basecostId, 0);
|
|
|
}
|
|
|
if (extraField1 == null) {
|
|
|
extraField1 = new Integer[projectId.length];
|
|
|
@@ -644,53 +633,46 @@ public class ReportController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ for (int i=0;i<extraField1.length; i++) {
|
|
|
+ if (extraField1[i] != null && extraField1[i] == -1) {
|
|
|
+ extraField1[i] = null;//针对前端传的占位值,进行转化
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (extraField2 == null) {
|
|
|
extraField2 = new Integer[projectId.length];
|
|
|
- for(int i=0;i<extraField2.length; i++) {
|
|
|
- extraField2[i] = null;
|
|
|
- }
|
|
|
}
|
|
|
if (extraField3 == null) {
|
|
|
extraField3 = new Integer[projectId.length];
|
|
|
- for(int i=0;i<extraField3.length; i++) {
|
|
|
- extraField3[i] = null;
|
|
|
- }
|
|
|
}
|
|
|
if (extraField4 == null || extraField4.length == 0) {
|
|
|
extraField4 = new String[projectId.length];
|
|
|
- for(int i=0;i<extraField4.length; i++) {
|
|
|
- extraField4[i] = "";
|
|
|
- }
|
|
|
+ Arrays.fill(extraField4, "");
|
|
|
}
|
|
|
if (extraField5 == null || extraField5.length == 0) {
|
|
|
extraField5 = new String[projectId.length];
|
|
|
- for(int i=0;i<extraField5.length; i++) {
|
|
|
- extraField5[i] = "";
|
|
|
- }
|
|
|
+ Arrays.fill(extraField5, "");
|
|
|
}
|
|
|
if (professionProgress == null) {
|
|
|
professionProgress = new String[projectId.length];
|
|
|
- for(int i=0;i<professionProgress.length; i++) {
|
|
|
- professionProgress[i] = null;
|
|
|
- }
|
|
|
}
|
|
|
if (sapServiceId == null) {
|
|
|
sapServiceId = new Integer[projectId.length];
|
|
|
- for (int i=0;i<sapServiceId.length; i++) {
|
|
|
- sapServiceId[i] = null;
|
|
|
- }
|
|
|
}
|
|
|
if (multiDegrId == null) {
|
|
|
multiDegrId = new String[projectId.length];
|
|
|
- for (int i=0;i<multiDegrId.length; i++) {
|
|
|
- multiDegrId[i] = null;
|
|
|
- }
|
|
|
}
|
|
|
if (reportTargetDeptId == null) {
|
|
|
reportTargetDeptId = new Integer[projectId.length];
|
|
|
- for (int i=0;i<reportTargetDeptId.length; i++) {
|
|
|
- reportTargetDeptId[i] = -1;
|
|
|
+ }
|
|
|
+ if (constructionStagesStr == null) {
|
|
|
+ constructionStagesStr = new String[projectId.length];
|
|
|
+ } else {
|
|
|
+ //替换符号
|
|
|
+ for (int i=0; i < constructionStagesStr.length; i++) {
|
|
|
+ if (!StringUtils.isEmpty(constructionStagesStr[i])) {
|
|
|
+ constructionStagesStr[i] = constructionStagesStr[i].replaceAll("@", ",");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (company.getPackageProject() == 1) {
|
|
|
@@ -843,12 +825,57 @@ public class ReportController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//检查项目是否可填报; 修改为不校验项目,前端加载的项目已经过滤掉了完成和撤销的
|
|
|
List<Integer> integers = Arrays.asList(projectId);
|
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", integers));
|
|
|
|
|
|
+ //柘中,校验完成数量累计不可超过项目中每个施工节点的设计量
|
|
|
+ if (company.getId() == 10 || company.getId() == 4811) {
|
|
|
+ for (int i=0;i<integers.size(); i++) {
|
|
|
+ if (!StringUtils.isEmpty(constructionStagesStr[i])) {
|
|
|
+ final int i1 = i;
|
|
|
+ Project project = projectList.stream().filter(p -> p.getId().equals(integers.get(i1))).findFirst().orElse(null);
|
|
|
+ List<ConstructionStage> stageList = JSONArray.parseArray(constructionStagesStr[i], ConstructionStage.class);
|
|
|
+ for (ConstructionStage currentStage : stageList) {
|
|
|
+ if (currentStage == null) continue;
|
|
|
+ //获取到施工分项的id
|
|
|
+ ProjectConstructionStage projectConstructionStage = projectConstructionStageService.getOne(new QueryWrapper<ProjectConstructionStage>().eq("project_id", project.getId()).eq("stage_id", currentStage.getId()));
|
|
|
+ if (projectConstructionStage != null && projectConstructionStage.getDesignNumber() != null && projectConstructionStage.getDesignNumber() > 0) {
|
|
|
+ Double currentMax = projectConstructionStage.getDesignNumber();
|
|
|
+ System.out.println("currentStage.getId(), "+currentStage.getId());
|
|
|
+ ReportProjectConstruction rpc = reportProjectConstructionMapper.selectOne(new QueryWrapper<ReportProjectConstruction>().select("sum(finish_number) as finish_number").eq("project_id", project.getId())
|
|
|
+ .eq("construction_stage_id", currentStage.getId()));
|
|
|
+ System.out.println("rpc==="+(rpc == null) + ", "+(rpc != null ? rpc.getFinishNumber()+"哥":"0"));
|
|
|
+ Double finishNum = (rpc == null || rpc.getFinishNumber() == null) ? 0: rpc.getFinishNumber();
|
|
|
+ double left = currentMax - finishNum;
|
|
|
+ if (left < 0) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError("项目"+project.getProjectName()+"当前施工分项完成数量为"+finishNum+", 施工节点设计量不足,请联系管理员修改。");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ //叠加上当前日报上合计填报的完成数量
|
|
|
+ int currentNum = 0;
|
|
|
+ for (int j=0;j<projectId.length; j++) {
|
|
|
+ if (projectId[j].equals(project.getId())) {
|
|
|
+ //取该项目上填报的该施工节点的数量
|
|
|
+ List<ConstructionStage> nextStageList = JSONArray.parseArray(constructionStagesStr[j], ConstructionStage.class);
|
|
|
+ ConstructionStage nextStage = nextStageList.stream().filter(next->next.getId().equals(currentStage.getId())).findFirst().orElse(null);
|
|
|
+ if (nextStage != null && nextStage.getFinishNumber() != null ) {
|
|
|
+ currentNum += nextStage.getFinishNumber();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (currentNum > 0 && currentNum > left) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError("项目"+project.getProjectName()+"中的【"+currentStage.getName()+"】最大为"+currentMax+",仅剩余:"+left+", 当前填报:"+currentNum);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
List<ReportAuditorSetting> auditorSettingList = null;
|
|
|
if (comTimeType.getReportAuditType() == 3) {
|
|
|
@@ -1239,6 +1266,7 @@ public class ReportController {
|
|
|
report.setMultiDegrId(multiDegrId[i]);
|
|
|
report.setExtraField4(extraField4[i]);
|
|
|
report.setExtraField5(extraField5[i]);
|
|
|
+ report.setConstructionStagesStr(constructionStagesStr[i]);
|
|
|
//如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
if (comTimeType.getReportAuditType() == 3) {
|
|
|
report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
@@ -1298,6 +1326,7 @@ public class ReportController {
|
|
|
report.setMultiDegrId(multiDegrId[i]);
|
|
|
report.setExtraField4(extraField4[i]);
|
|
|
report.setExtraField5(extraField5[i]);
|
|
|
+ report.setConstructionStagesStr(constructionStagesStr[i]);
|
|
|
//如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
if (comTimeType.getReportAuditType() == 3) {
|
|
|
report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
@@ -1357,6 +1386,7 @@ public class ReportController {
|
|
|
report.setMultiDegrId(multiDegrId[i]);
|
|
|
report.setExtraField4(extraField4[i]);
|
|
|
report.setExtraField5(extraField5[i]);
|
|
|
+ report.setConstructionStagesStr(constructionStagesStr[i]);
|
|
|
//如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
if (comTimeType.getReportAuditType() == 3) {
|
|
|
report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
@@ -1422,6 +1452,7 @@ public class ReportController {
|
|
|
report.setMultiDegrId(multiDegrId[i]);
|
|
|
report.setExtraField4(extraField4[i]);
|
|
|
report.setExtraField5(extraField5[i]);
|
|
|
+ report.setConstructionStagesStr(constructionStagesStr[i]);
|
|
|
//如果是员工自由选择审批流程的方式,需要处理一下
|
|
|
if (comTimeType.getReportAuditType() == 3) {
|
|
|
report.setAuditorSetting(auditorSettingList.get(i));
|
|
|
@@ -2364,9 +2395,9 @@ public class ReportController {
|
|
|
Integer oneId = id[i];
|
|
|
if (oneId == -1) {
|
|
|
Report report = reportList.get(i);
|
|
|
- if (report.getCreatorId().equals(report.getProjectAuditorId())) {
|
|
|
- //直接审核
|
|
|
- if (report.getState() == 0) {
|
|
|
+ if (report.getState() == 0) {//部门也直接审核通过
|
|
|
+ if (report.getCreatorId().equals(report.getProjectAuditorId()) || (comTimeType.getAutoProjectApprove() && report.getIsDeptAudit() == 1 && report.getAuditDeptManagerid().equals(report.getCreatorId()))) {
|
|
|
+ //直接审核
|
|
|
reportIds.add(report.getId().toString());
|
|
|
}
|
|
|
}
|
|
|
@@ -2646,6 +2677,7 @@ public class ReportController {
|
|
|
Department curDept = allDeptList.stream()
|
|
|
.filter(ad->ad.getDepartmentId().equals(firstNode.getAuditDeptId())).findFirst().get();
|
|
|
String curDeptManagerId = curDept.getManagerId();
|
|
|
+
|
|
|
//启用了本部门负责人的日报由上级部门主要负责人审核
|
|
|
if (comTimeType.getReportAuditFlowEnableSuperDeptAduit() == 1 && curDeptManagerId.equals(report.getCreatorId())) {
|
|
|
//当前提交的人是这个部门的主要负责人,那么要取该部门的上一级部门的主要负责人来审核
|