diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProessStageEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java similarity index 58% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProessStageEnum.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java index 99cc654..bcc0cce 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProessStageEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ProjectProcessStageEnum.java @@ -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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java index ae1c659..ad5fd2f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -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>() { - }) - ); - } + dto.getFormData().putAll( + JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + }) + ); params.setFormData(dto.getFormData()); String instanceId = processService.startProcess(model.getProcessDefId(), params); log.info("建设方案项目申报成功 【{}】", instanceId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index b594e00..b0ffbe4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -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 page(DeclaredProjectListParamDto params) { - Page page = params.page(); - LambdaQueryWrapper 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 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 pageDraft(DeclaredProjectListParamDto params) { Page page = params.page(); LambdaQueryWrapper 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)) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index e19f880..a0804f7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -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)) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java index 7f689f9..e303c10 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java @@ -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()}; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java index 08b54d3..9279584 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java @@ -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); } } }