|
|
@@ -246,4 +246,64 @@ public class FinalAcceptanceManage { |
|
|
|
|
|
|
|
return instanceId; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 重新申报 |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String restartProcess(DefaultDeclaredDTO dto) { |
|
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|
String employeeCode = user.getEmployeeCode(); |
|
|
|
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) |
|
|
|
.throwMessage("获取登录用户失败!"); |
|
|
|
|
|
|
|
ProjectDTO projectDto = dto.getProjectInfo(); |
|
|
|
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("重新提交失败 缺少项目ID!"); |
|
|
|
Project projectInfo = projectService.getNewProject(projectDto.getId()); |
|
|
|
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("重新提交失败 此项目不存在!"); |
|
|
|
VUtils.isTrue(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); |
|
|
|
|
|
|
|
String regionCode = projectInfo.getAreaCode(); |
|
|
|
|
|
|
|
//放入终验材料 |
|
|
|
projectInfo.setFinalAcceptanceMaterials(projectDto.getFinalAcceptanceMaterials()); |
|
|
|
|
|
|
|
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) |
|
|
|
.eq(WflowModels::getRegionCode, regionCode) |
|
|
|
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
|
|
|
|
if (Objects.isNull(model)) { |
|
|
|
log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); |
|
|
|
throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); |
|
|
|
} |
|
|
|
|
|
|
|
//首先要判断 项目当前状态 是不是 方案待申报 |
|
|
|
VUtils.isTrue((!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(projectInfo.getStatus()) && |
|
|
|
!ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode().equals(projectInfo.getStatus())) || |
|
|
|
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) |
|
|
|
.throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); |
|
|
|
|
|
|
|
ProcessStartParamsVo params = new ProcessStartParamsVo(); |
|
|
|
params.setUser(declaredProjectManage.buildUser(employeeCode)); |
|
|
|
params.setProcessUsers(Collections.emptyMap()); |
|
|
|
//放入条件判断的项目字段 |
|
|
|
//把条件值给放入工作流 |
|
|
|
declaredProjectManage.buildCondition(params, dto); |
|
|
|
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 |
|
|
|
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); |
|
|
|
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); |
|
|
|
log.info("终验方案项目重新申报成功 【{}】", instanceId); |
|
|
|
|
|
|
|
//保存终验项目 |
|
|
|
//生成新版本 并且进入下一状态 |
|
|
|
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()); |
|
|
|
|
|
|
|
//发送给第一个审批人消息 |
|
|
|
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, |
|
|
|
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); |
|
|
|
|
|
|
|
return instanceId; |
|
|
|
} |
|
|
|
} |