Bläddra i källkod

优化 processType

tags/24080901
PoffyZhang 1 år sedan
förälder
incheckning
50093d8212
6 ändrade filer med 43 tillägg och 45 borttagningar
  1. +16
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java
  2. +6
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  3. +2
    -28
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  4. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  5. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java
  6. +9
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java

pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProessStageEnum.java → pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java Visa fil

@@ -3,11 +3,14 @@ package com.ningdatech.pmapi.common.enumeration;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ProjectProessStageEnum {
public enum ProjectProcessStageEnum {
/**
* 项目流程配置 阶段枚举
*/
@@ -19,4 +22,16 @@ public enum ProjectProessStageEnum {

private Integer code;
private String desc;

public static String getDesc(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (ProjectProcessStageEnum t : ProjectProcessStageEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}
}

+ 6
- 8
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java Visa fil

@@ -4,7 +4,7 @@ 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.ProjectProessStageEnum;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectdeclared.entity.dto.ConstructionPlanDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectConditionDto;
@@ -59,7 +59,7 @@ public class ConstructionPlanManage {

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

if (Objects.isNull(model)) {
@@ -79,12 +79,10 @@ public class ConstructionPlanManage {
//放入条件判断的项目字段
ProjectConditionDto conditionDto = new ProjectConditionDto();
BeanUtils.copyProperties(projectInfo, conditionDto);
if (Objects.nonNull(conditionDto)) {
dto.getFormData().putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
}
dto.getFormData().putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(dto.getFormData());
String instanceId = processService.startProcess(model.getProcessDefId(), params);
log.info("建设方案项目申报成功 【{}】", instanceId);


+ 2
- 28
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Visa fil

@@ -2,26 +2,23 @@ package com.ningdatech.pmapi.projectdeclared.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.enumeration.ProjectProessStageEnum;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.projectdeclared.entity.ProjectDraft;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectConditionDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectDraftSaveDto;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredDetailVO;
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDraftVo;
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.wflow.bean.entity.WflowModels;
@@ -63,29 +60,6 @@ public class DeclaredProjectManage {

private final ProcessModelService processModelService;

public PageVo<ProjectLibListItemVO> page(DeclaredProjectListParamDto params) {
Page<Project> page = params.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.ge(Objects.nonNull(params.getStartTime()), Project::getCreateOn, params.getStartTime())
.le(Objects.nonNull(params.getEndTime()), Project::getCreateOn, params.getEndTime())
.eq(Objects.nonNull(params.getProjectType()), Project::getProjectType, params.getProjectType())
.eq(Objects.nonNull(params.getProjectYear()), Project::getProjectYear, params.getProjectYear())
.eq(Objects.nonNull(params.getProjectStage()), Project::getStage, params.getProjectStage())
.eq(Objects.nonNull(params.getProjectStatus()), Project::getStatus, params.getProjectStatus())
.like(StringUtils.isNotBlank(params.getProjectName()), Project::getProjectName, params.getProjectName())
.orderByDesc(Project::getUpdateOn);
projectService.page(page, wrapper);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<ProjectLibListItemVO> res = page.getRecords().stream().map(record -> {
ProjectLibListItemVO vo = new ProjectLibListItemVO();
BeanUtils.copyProperties(record, vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}

public PageVo<ProjectDraftVo> pageDraft(DeclaredProjectListParamDto params) {
Page<ProjectDraft> page = params.page();
LambdaQueryWrapper<ProjectDraft> wrapper = Wrappers.lambdaQuery(ProjectDraft.class)
@@ -135,7 +109,7 @@ public class DeclaredProjectManage {

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

if (Objects.isNull(model)) {


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java Visa fil

@@ -4,7 +4,7 @@ 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.ProjectProessStageEnum;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectdeclared.entity.dto.PreDeclaredProjectDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectConditionDto;
@@ -60,7 +60,7 @@ public class PrequalificationDeclaredProjectManage {

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

if (Objects.isNull(model)) {


+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java Visa fil

@@ -1,5 +1,7 @@
package com.ningdatech.pmapi.scheduler.contants;

import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;

/**
* @author PoffyZhang
* @Classname TaskContant
@@ -19,5 +21,11 @@ public interface TaskContant {
public static final String DEFAULT_FORM_NAME = "丽水申报项目表单";

public static final String[] DEFAULT_PROCESS_LIST = {"单位内部审批流程","项目预审审批流程","部门联合审批流程","建设方案审批流程","验收申报审批流程"};

public static final Integer[] DEFAULT_PROCESS_TYPE_LIST = {ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode(),
ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode(),
ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode(),
ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode(),
ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()};
}
}

+ 9
- 6
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java Visa fil

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.scheduler.contants.TaskContant;
import com.ningdatech.pmapi.sys.contant.RegionConst;
import com.ningdatech.pmapi.sys.model.entity.Region;
@@ -96,15 +97,17 @@ public class InitProcessTask {
// continue;
// }

String[] processList = TaskContant.Wflow.DEFAULT_PROCESS_LIST;
for(String processName : processList){
Integer[] processTypeList = TaskContant.Wflow.DEFAULT_PROCESS_TYPE_LIST;
for(Integer processType : processTypeList){
String formName = ProjectProcessStageEnum.getDesc(processType);
WflowModelHistorysDto models = new WflowModelHistorysDto();
models.setCreated(GregorianCalendar.getInstance().getTime());
// models.setFormId("wf" + IdUtil.objectId());
models.setVersion(1);
models.setGroupId(1);
// models.setProcessDefId("pd" + IdUtil.objectId());
models.setFormName(processName);
models.setFormName(formName);
models.setProcessType(processType);
models.setRegionCode(region.getRegionCode());
ProcessNode processNode = new ProcessNode();
models.setProcess(processNode);
@@ -114,12 +117,12 @@ public class InitProcessTask {
if(StringUtils.isNotBlank(processModelService.saveProcess(models))){
//初始的流程在部署表也存一份,用来查询
if(StringUtils.isNotBlank(processModelService.deployProcess(models.getFormId()))){
log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getName(),processName);
log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getName(),formName);
}else{
log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getName(),processName);
log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getName(),formName);
}
}else{
log.info("当前区域 【{}】流程名[{}] 流程数据保存失败",region.getName(),processName);
log.info("当前区域 【{}】流程名[{}] 流程数据保存失败",region.getName(),formName);
}
}
}


Laddar…
Avbryt
Spara