diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfoServiceImpl.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfoServiceImpl.java index 88c34fa..67cf9e2 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfoServiceImpl.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfoServiceImpl.java @@ -1772,15 +1772,17 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl getPlanNames(String projectid) { - List updatePlanList = Arrays.asList("初验阶段", "试运行阶段","终验阶段"); + List updatePlanList = Arrays.asList("提交终验申请", "联合验收审批 ", "提交核验申请", "部门集中核验", "上传核验报告"); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(HuzhouPlaninfo::getProjectId,projectid); - queryWrapper.in(HuzhouPlaninfo::getTaskName,updatePlanList); + queryWrapper.eq(HuzhouPlaninfo::getProjectId, projectid); + queryWrapper.in(HuzhouPlaninfo::getTaskName, updatePlanList); List planInfoList = planInfoMapper.selectList(queryWrapper); List rs = new ArrayList<>(); - for (HuzhouPlaninfo planInfo : planInfoList) { - rs.add(new PlanSelectVo(planInfo.getTaskName(),planInfo.getId())); + if (CollectionUtil.isNotEmpty(planInfoList)) { + for (HuzhouPlaninfo planInfo : planInfoList) { + rs.add(new PlanSelectVo(planInfo.getTaskName(), planInfo.getId())); + } } return rs; } diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfofileServiceImpl.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfofileServiceImpl.java index b465174..12994b8 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfofileServiceImpl.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfofileServiceImpl.java @@ -6,14 +6,11 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.util.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.easy.admin.auth.model.SysUser; import com.easy.admin.auth.service.SysUserService; -import com.easy.admin.common.api.vo.Result; import com.easy.admin.common.core.exception.EasyException; import com.easy.admin.modules.huzhou.dao.HuzhouContractinfoMapper; import com.easy.admin.modules.huzhou.dao.HuzhouPlaninfoMapper; @@ -40,14 +37,12 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.time.LocalDate; import java.time.ZoneId; import java.util.*; -import java.util.function.Function; import java.util.stream.Collectors; @Service @@ -190,6 +185,9 @@ public class HuzhouPlaninfofileServiceImpl extends ServiceImpl variables = new HashMap<>(); - variables.put("taskLeadingDepartment",strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId,"approvalStatue","1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId,processInstanceId,comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - - planinfoService.updateById(huzhouPlaninfo); + basicFlowUpdate(planinfoid, strings, workFlow); } else if("集中核验".equals(taskName)){ WorkFlow workFlow = workflowService.createFlow("centralizedCheck",planinfoid); - Task task = workFlow.getTask(); - String taskId = task.getId(); - String processInstanceId = workFlow.getProcessInstanceId(); - Map variables = new HashMap<>(); - variables.put("taskLeadingDepartment",strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId,"approvalStatue","1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId,processInstanceId,comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - - planinfoService.updateById(huzhouPlaninfo); + basicFlowUpdate(planinfoid, strings, workFlow); }else if("招标文件编制".equals(taskName)){ WorkFlow workFlow = workflowService.createFlow("bidDocumentsPreparation",planinfoid); - Task task = workFlow.getTask(); - String taskId = task.getId(); - String processInstanceId = workFlow.getProcessInstanceId(); - Map variables = new HashMap<>(); - variables.put("taskLeadingDepartment",strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId,"approvalStatue","1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId,processInstanceId,comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - planinfoService.updateById(huzhouPlaninfo); + basicFlowUpdate(planinfoid, strings, workFlow); } else if ("可研报告初稿编制".equals(taskName)) { //审批通过但是要开始下一阶段流程 HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); @@ -346,77 +297,23 @@ public class HuzhouPlaninfofileServiceImpl extends ServiceImpl variables = new HashMap<>(); - variables.put("taskLeadingDepartment",strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId,"approvalStatue","1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId,processInstanceId,comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - planinfoService.updateById(huzhouPlaninfo); - } else if("立项审批".equals(taskName)){ + basicFlowUpdate(planinfoid, strings, workFlow); + } else if("立项审批".equals(taskName)){ WorkFlow workFlow = workflowService.createFlow("projectApprovalStage",planinfoid); - Task task = workFlow.getTask(); - String taskId = task.getId(); - String processInstanceId = workFlow.getProcessInstanceId(); - Map variables = new HashMap<>(); - variables.put("taskLeadingDepartment",strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId,"approvalStatue","1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId,processInstanceId,comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - planinfoService.updateById(huzhouPlaninfo); - }else if("提交终验申请".equals(taskName)){ + basicFlowUpdate(planinfoid, strings, workFlow); + }else if("提交终验申请".equals(taskName)){ WorkFlow workFlow = workflowService.createFlow("submitFinalApplication",planinfoid); - Task task = workFlow.getTask(); - String taskId = task.getId(); - String processInstanceId = workFlow.getProcessInstanceId(); - Map variables = new HashMap<>(); - variables.put("taskLeadingDepartment",strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId,"approvalStatue","1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId,processInstanceId,comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - planinfoService.updateById(huzhouPlaninfo); + basicFlowUpdate(planinfoid, strings, workFlow); } else if ("联合验收审批".equals(taskName)) { WorkFlow workFlow = workflowService.createFlow("JAA", planinfoid); - Task task = workFlow.getTask(); - String taskId = task.getId(); - String processInstanceId = workFlow.getProcessInstanceId(); - Map variables = new HashMap<>(); - variables.put("taskLeadingDepartment", strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId, "approvalStatue", "1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId, processInstanceId, comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - planinfoService.updateById(huzhouPlaninfo); - } else { + basicFlowUpdate(planinfoid, strings, workFlow); + } else if ("提交核验申请".equals(taskName)) { + WorkFlow workFlow = workflowService.createFlow("DCV", planinfoid); + basicFlowUpdate(planinfoid, strings, workFlow); + } else if ("上传核验报告".equals(taskName)) { + WorkFlow workFlow = workflowService.createFlow("UAR", planinfoid); + basicFlowUpdate(planinfoid, strings, workFlow); + }else { HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); huzhouPlaninfo.setId(planinfoid); huzhouPlaninfo.setIsfinish("2"); @@ -454,6 +351,67 @@ public class HuzhouPlaninfofileServiceImpl extends ServiceImpl strings, WorkFlow workFlow) { + Task task = workFlow.getTask(); + String taskId = task.getId(); + String processInstanceId = workFlow.getProcessInstanceId(); + Map variables = new HashMap<>(); + variables.put("taskLeadingDepartment", strings); + runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 + //发起人节点处理 + taskService.setVariableLocal(taskId, "approvalStatue", "1");//添加审批状态 通过 + String comment = "同意"; + taskService.addComment(taskId, processInstanceId, comment);//添加审批意见 + taskService.complete(taskId, variables); + HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); + huzhouPlaninfo.setId(planinfoid); + huzhouPlaninfo.setIsfinish("1"); + huzhouPlaninfo.setActualStartTime(new Date()); + planinfoService.updateById(huzhouPlaninfo); + } + + private void autoCreatPlanAfterFinal(HuzhouPlaninfo planinfo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(HuzhouPlaninfo::getProjectId, planinfo.getProjectId()); + queryWrapper.eq(HuzhouPlaninfo::getTaskName,"终验阶段"); + HuzhouPlaninfo source = planinfoMapper.selectOne(queryWrapper); + + if (source != null) { + HuzhouPlaninfo target = new HuzhouPlaninfo(); + BeanUtils.copyProperties(source, target, "id", "actualStartTime", "actualEndTime"); + target.setTaskName("提交核验申请"); + target.setTaskFile("《验收文件》"); + target.setIsfinish("0"); + // 设置日期为 2025-12-31 + LocalDate targetLocalDate = LocalDate.of(2025, 12, 31); + ZoneId zone = ZoneId.of("GMT+8"); + Date setDate = Date.from(targetLocalDate.atStartOfDay(zone).toInstant()); + target.setScheduledStartTime(setDate); + target.setScheduledEndTime(setDate); + planinfoMapper.insert(target); + + // 添加计划 + HuzhouPlaninfo target2 = new HuzhouPlaninfo(); + BeanUtils.copyProperties(source, target2, "id", "actualStartTime", "actualEndTime"); + target2.setTaskName("部门集中核验"); + target2.setTaskFile("《验收文件》"); + target2.setIsfinish("0"); + target2.setScheduledStartTime(setDate); + target2.setScheduledEndTime(setDate); + planinfoMapper.insert(target2); + + // 添加计划 + HuzhouPlaninfo target3 = new HuzhouPlaninfo(); + BeanUtils.copyProperties(source, target3, "id", "actualStartTime", "actualEndTime"); + target3.setTaskName("上传核验报告"); + target3.setTaskFile("《验收文件》"); + target3.setIsfinish("0"); + target3.setScheduledStartTime(setDate); + target3.setScheduledEndTime(setDate); + planinfoMapper.insert(target3); + } + } + private void checkVariable(String contractMoneyFieldsValue, List contractList, HuzhouPlaninfo planinfo, String taskName) throws JsonProcessingException { // 增加终验申请校验 HuzhouProjectinfo huzhouProjectinfo = projectinfoService.getById(planinfo.getProjectId()); @@ -818,22 +776,7 @@ public class HuzhouPlaninfofileServiceImpl extends ServiceImpl variables = new HashMap<>(); - variables.put("taskLeadingDepartment",strings); - runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 - //发起人节点处理 - taskService.setVariableLocal(taskId,"approvalStatue","1");//添加审批状态 通过 - String comment = "同意"; - taskService.addComment(taskId,processInstanceId,comment);//添加审批意见 - taskService.complete(taskId, variables); - HuzhouPlaninfo huzhouPlaninfo = new HuzhouPlaninfo(); - huzhouPlaninfo.setId(planinfoid); - huzhouPlaninfo.setIsfinish("1"); - huzhouPlaninfo.setActualStartTime(new Date()); - planinfoService.updateById(huzhouPlaninfo); + basicFlowUpdate(planinfoid, strings, workFlow); } } @Override diff --git a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouUploadfileinfoServiceImpl.java b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouUploadfileinfoServiceImpl.java index 391fcbf..4b0a815 100644 --- a/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouUploadfileinfoServiceImpl.java +++ b/huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouUploadfileinfoServiceImpl.java @@ -203,9 +203,11 @@ public class HuzhouUploadfileinfoServiceImpl extends ServiceImpl map:userDictByRoles - ) { + for (HashMap map : userDictByRoles) { String userid = map.get("value"); strings.add(userid); } + variables.put("taskLeadingDepartment",strings); runtimeService.setVariable(processInstanceId, "taskLeadingDepartment", strings);//设置第四个人变量信息 //发起人节点处理