Przeglądaj źródła

需求变更

tags/24080901
PoffyZhang 1 rok temu
rodzic
commit
16838fb797
3 zmienionych plików z 93 dodań i 79 usunięć
  1. +90
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java
  2. +1
    -73
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  3. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java

+ 90
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java Wyświetl plik

@@ -1,29 +1,41 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.bean.entity.WflowOrgModels;
import com.wflow.enums.OrgTypeEnum;
import com.wflow.enums.ProcessDefTypeEnum;
import com.wflow.exception.BusinessException;
import com.wflow.service.OrgProcdefService;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

/**
@@ -45,6 +57,14 @@ public class DefaultDeclaredProjectManage {
private final IDingOrganizationService dingOrganizationService;
private final OrgProcdefService orgProcdefService;

private final ProcessModelService processModelService;

private final ProcessInstanceService processService;

private final IProjectInstService projectInstService;

private final StateMachineUtils stateMachineUtils;

//项目名称去重
public void checkDuplication(ProjectDTO project){
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class)
@@ -120,4 +140,70 @@ public class DefaultDeclaredProjectManage {
orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO);
return orgMap;
}

//直接提交预审方法 提取 在省级联审通过的时候 也可以用
public String directStartProcess(Project projectInfo){
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail();
Long userId = userInfoDetails.getUserId();

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(buildUser(userId));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
}));

String regionCode = projectInfo.getAreaCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode())
.last("limit 1"));

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到 预审流程配置", regionCode);
throw new BusinessException(String.format("此 【%s】区域找不到 预审流程配置", regionCode));
}

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = getOrgModelInfo(userId,projectInfo);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("提交预审项目成功 【{}】", instanceId);

//保存预审项目
modifyProject(projectInfo, instanceId);

return instanceId;
}

/**
* 提交预审项目 时 更新信息
*
* @param project
* @param instanceId
*/
private void modifyProject(Project project, String instanceId) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
//调用状态机 进入下一个通过状态
stateMachineUtils.pass(project);
projectService.updateById(project);

//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
projectInst.setInstType(ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("提交预审 项目信息修改 错误 ", e);
throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage());
}
}
}

+ 1
- 73
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java Wyświetl plik

@@ -71,12 +71,6 @@ public class PrequalificationDeclaredProjectManage {

private final StateMachineUtils stateMachineUtils;

private final ProcessInstanceService processService;

private final ProcessModelService processModelService;

private final IProjectInstService projectInstService;

private final IProjectStagingService projectStagingService;

private final ProjectLibManage projectLibManage;
@@ -130,7 +124,7 @@ public class PrequalificationDeclaredProjectManage {
}else if(ProjectStatusEnum.PRE_APPLYING
.getCode().equals(projectInfo.getStatus())){
//如果是非省级联审的项目 直接提交 预审
instanceId = directStartProcess(projectInfo);
instanceId = defaultDeclaredProjectManage.directStartProcess(projectInfo);
}else{
throw new BusinessException("项目状态 错误 project :" + JSON.toJSONString(projectInfo));
}
@@ -138,72 +132,6 @@ public class PrequalificationDeclaredProjectManage {
return "提交预审成功【" + instanceId + "】";
}

//直接提交方法 提取 在省级联审通过的时候 也可以用
public String directStartProcess(Project projectInfo){
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail();
Long userId = userInfoDetails.getUserId();

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(declaredProjectManage.buildUser(userId));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
}));

String regionCode = projectInfo.getAreaCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode())
.last("limit 1"));

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到 预审流程配置", regionCode);
throw new BusinessException(String.format("此 【%s】区域找不到 预审流程配置", regionCode));
}

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("提交预审项目成功 【{}】", instanceId);

//保存预审项目
modifyProject(projectInfo, instanceId);

return instanceId;
}

/**
* 提交预审项目 时 更新信息
*
* @param project
* @param instanceId
*/
private void modifyProject(Project project, String instanceId) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
//调用状态机 进入下一个通过状态
stateMachineUtils.pass(project);
projectService.updateById(project);

//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
projectInst.setInstType(ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("提交预审 项目信息修改 错误 ", e);
throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage());
}
}

/**
* 查询项目库
* @param preReq


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java Wyświetl plik

@@ -29,7 +29,7 @@ public class ReviewByProvincialDeptManage {

private final StateMachineUtils stateMachineUtils;

private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage;
private final DefaultDeclaredProjectManage defaultProjectManage;

/**
* 省级部门联审
@@ -54,7 +54,7 @@ public class ReviewByProvincialDeptManage {
stateMachineUtils.pass(project);
projectService.updateById(project);
//直接去预审
if(StringUtils.isNotBlank(prequalificationDeclaredProjectManage.directStartProcess(project))){
if(StringUtils.isNotBlank(defaultProjectManage.directStartProcess(project))){
return Boolean.TRUE;
}
}


Ładowanie…
Anuluj
Zapisz