Browse Source

终验 重新提交

tags/24080901
PoffyZhang 1 year ago
parent
commit
bfba2485fb
3 changed files with 68 additions and 6 deletions
  1. +0
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java
  2. +60
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java
  3. +8
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java

+ 0
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java View File

@@ -83,8 +83,6 @@ public class DelayedApplyManage {

private final IProjectService projectService;
private final UserInfoHelper userInfoHelper;

private final StateMachineUtils stateMachineUtils;
private final ProcessModelService processModelService;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
private final ProcessInstanceService processInstanceService;


+ 60
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java View File

@@ -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;
}
}

+ 8
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java View File

@@ -1,10 +1,7 @@
package com.ningdatech.pmapi.projectdeclared.utils;

import com.google.common.collect.Maps;
import com.ningdatech.pmapi.projectdeclared.manage.ConstructionPlanManage;
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage;
import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage;
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage;
import com.ningdatech.pmapi.projectdeclared.manage.*;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +28,10 @@ public class ReStartProcessMapUtil {

@Autowired
private ReviewByProvincialDeptManage provincialDeptManage;

@Autowired
private FinalAcceptanceManage finalAcceptanceManage;

public Map<Integer, Function<DefaultDeclaredDTO,String>> reStartProcessMap = Maps.newHashMap();
/**
* 初始化业务分派逻辑,代替了if-else部分
@@ -50,5 +51,8 @@ public class ReStartProcessMapUtil {
//省级联审
reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(),
dto->provincialDeptManage.restartTheProcess(dto));
//终审
reStartProcessMap.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(),
dto->finalAcceptanceManage.restartProcess(dto));
}
}

Loading…
Cancel
Save