From 4357e33424a3bfc5bf38737ae11876cad77d1159 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 10 Mar 2023 15:16:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/enumeration/CommonEnum.java | 22 ++++++ .../manage/DeclaredProjectManage.java | 7 ++ .../PrequalificationDeclaredProjectManage.java | 80 +++++++++++++--------- .../manage/ReviewByProvincialDeptManage.java | 19 ++++- .../pmapi/projectlib/helper/ProjectHelper.java | 1 + .../projectlib/manage/AnnualPlanLibManage.java | 7 +- .../pmapi/projectlib/model/req/ProjectListReq.java | 3 + .../staging/mapper/NdWorkNoticeStagingMapper.xml | 2 +- .../pmapi/staging/mapper/ProjectStagingMapper.xml | 2 +- .../pmapi/user/model/vo/ResUserDetailVO.java | 10 +++ 10 files changed, 110 insertions(+), 43 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java new file mode 100644 index 0000000..0249bae --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author zpf + * @date 2023/3/12 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum CommonEnum { + /** + * 公共的一些枚举 + */ + YES(1,"是"), + NO(0,"否"); + + private Integer code; + private String desc; + +} 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 b62bb63..ed880a5 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 @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.constant.RegionConst; +import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; @@ -103,6 +104,12 @@ public class DeclaredProjectManage { projectInfo.setBuildOrgCode(userInfoDetails.getOrganizationCode()); projectInfo.setBuildOrgName(userInfoDetails.getOrganizationName()); + //如果主管单位没有 那么主管单位就是自己 + if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ + projectInfo.setSuperOrgCode(userInfoDetails.getOrganizationCode()); + projectInfo.setSuperOrg(userInfoDetails.getOrganizationName()); + } + //如果是重新提交的话 判断下 项目是否存在 if(Objects.nonNull(projectInfo.getId())){ Project oldProject = projectService.getById(projectInfo.getId()); 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 6430cd8..18ed068 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 @@ -22,6 +22,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.staging.service.IProjectStagingService; 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.exception.BusinessException; @@ -79,7 +80,8 @@ public class PrequalificationDeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { - Long userId = LoginUserUtil.getUserId(); + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long userId = userInfoDetails.getUserId(); VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); @@ -87,17 +89,9 @@ public class PrequalificationDeclaredProjectManage { Project projectInfo = projectService.getById(projectDto.getId()); VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - 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)); - } + //要判断 当前操作人 是不是项目主管单位的人 + VUtils.isTrue(!userInfoDetails.getOrganizationCode().equals(projectInfo.getSuperOrgCode())) + .throwMessage(String.format("只有主管单位 【%s】的人 才能够提交",projectInfo.getSuperOrg())); //首先要判断 项目当前状态 是不是 待预审 VUtils.isTrue(!ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) || @@ -121,26 +115,7 @@ public class PrequalificationDeclaredProjectManage { }else if(ProjectStatusEnum.PRE_APPLYING .getCode().equals(projectInfo.getStatus())){ //如果是非省级联审的项目 直接提交 预审 - ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(userId)); - params.setProcessUsers(Collections.emptyMap()); - //放入条件判断的项目字段 - ProjectConditionDTO conditionDto = new ProjectConditionDTO(); - BeanUtils.copyProperties(projectInfo, conditionDto); - dto.getFormData().putAll( - JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { - }) - ); - params.setFormData(dto.getFormData()); - - // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo); - instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); - log.info("提交预审项目成功 【{}】", instanceId); - - //保存预审项目 - modifyProject(projectInfo, instanceId); - + instanceId = directStartProcess(projectInfo); }else{ throw new BusinessException("项目状态 错误 project :" + JSON.toJSONString(projectInfo)); } @@ -148,6 +123,43 @@ 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>() { + })); + + 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 orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo); + String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); + log.info("提交预审项目成功 【{}】", instanceId); + + //保存预审项目 + modifyProject(projectInfo, instanceId); + + return instanceId; + } + /** * 提交预审项目 时 更新信息 * @@ -192,8 +204,8 @@ public class PrequalificationDeclaredProjectManage { Long userId = LoginUserUtil.getUserId(); VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //放入用户的单位 - req.setBuildOrgCode(userFullInfo.getOrganizationCode()); + //放入用户的主管单位 + req.setSuperOrgCode(userFullInfo.getOrganizationCode()); return projectLibManage.projectLibList(req); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java index 790165a..e1d2986 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java @@ -1,11 +1,15 @@ package com.ningdatech.pmapi.projectdeclared.manage; import com.ningdatech.basic.function.VUtils; +import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; +import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; 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.service.IProjectService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.Objects; @@ -23,6 +27,10 @@ public class ReviewByProvincialDeptManage { private final IProjectService projectService; + private final StateMachineUtils stateMachineUtils; + + private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; + /** * 省级部门联审 * @param project @@ -40,10 +48,15 @@ public class ReviewByProvincialDeptManage { !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); // TODO 对接省级联审的接口 - Boolean sucessProvince = Boolean.FALSE; + Boolean sucessProvince = Boolean.TRUE; if(sucessProvince){ - //成功了后 - + //测试先成功 + stateMachineUtils.pass(project); + projectService.updateById(project); + //直接去预审 + if(StringUtils.isNotBlank(prequalificationDeclaredProjectManage.directStartProcess(project))){ + return Boolean.TRUE; + } } return Boolean.FALSE; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java index 2f43b1e..b45e178 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java @@ -45,6 +45,7 @@ public class ProjectHelper { .like(req.getBuildOrg() != null, Project::getBuildOrgName, req.getBuildOrg()) .eq(req.getBuildOrgCode() != null, Project::getBuildOrgCode, req.getBuildOrgCode()) + .eq(req.getSuperOrgCode() != null, Project::getSuperOrgCode, req.getSuperOrgCode()) .eq(req.getIsTemporaryAugment() != null, Project::getIsTemporaryAugment, req.getIsTemporaryAugment()) //状态 阶段 list .in(CollUtil.isNotEmpty(req.getStageList()),Project::getStage,req.getStageList()) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java index c3ebe2c..ea75d42 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java @@ -221,15 +221,14 @@ public class AnnualPlanLibManage { public void exportList(ProjectListReq param, HttpServletResponse response) { param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); - LambdaQueryWrapper query = ProjectHelper.projectQuery(param); Integer isTemporaryAugment = param.getIsTemporaryAugment(); if (Objects.isNull(isTemporaryAugment)){ throw new BizException("请传入是否临时增补标志!"); } - query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); - query.eq(Project::getIsTemporaryAugment, 0); + param.setIsTemporaryAugment(isTemporaryAugment); + param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); + LambdaQueryWrapper query = ProjectHelper.projectQuery(param); query.orderByDesc(Project::getAnnualPlanAddTime); - query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); List projects = projectService.list(query); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java index bf25e0f..856f522 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java @@ -39,6 +39,9 @@ public class ProjectListReq extends PagePo { @ApiModelProperty("申报单位code") private String buildOrgCode; + @ApiModelProperty("主管单位code") + private String superOrgCode; + @ApiModelProperty("项目类型") private Integer projectType; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml index cf684ba..759f056 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml @@ -7,6 +7,6 @@ set retry_times = #{retryTimes}, next_time = #{nextRetryTime}, dead = #{dead} - where id = #{id} and retry_times = #{retryTimes - 1} + where id = #{id} and retry_times = #{retryTimes} - 1 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml index 15d0557..929dbc9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml @@ -7,6 +7,6 @@ set retry_times = #{retryTimes}, next_time = #{nextRetryTime}, dead = #{dead} - where id = #{id} and retry_times = #{retryTimes - 1} + where id = #{id} and retry_times = #{retryTimes} - 1 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java index 62a9181..cd4f949 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.user.model.vo; +import com.ningdatech.pmapi.common.constant.RegionConst; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -48,4 +49,13 @@ public class ResUserDetailVO { @ApiModelProperty("更新时间") private LocalDateTime updateTime; + + //是否是市级单位 + public Boolean getIsMunicipalOrg(){ + //如果是丽水市本级的code 就是 + if(RegionConst.RC_LS.equals(this.regionCode)){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } } From 16838fb7973528792fd19b9707e1439db56040d0 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 10 Mar 2023 15:27:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/DefaultDeclaredProjectManage.java | 94 +++++++++++++++++++++- .../PrequalificationDeclaredProjectManage.java | 74 +---------------- .../manage/ReviewByProvincialDeptManage.java | 4 +- 3 files changed, 93 insertions(+), 79 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java index f66435a..2a24456 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -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>() { + })); + + 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 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()); + } + } } 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 7fc025b..0cb4a5c 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 @@ -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>() { - })); - - 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 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 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java index e1d2986..3f39c7a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java @@ -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; } } From 88ee5db4ad4fff4d1362a55ea3dd4ccf099fdcbd Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 10 Mar 2023 17:19:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/DefaultDeclaredProjectManage.java | 12 +++++------- .../manage/PrequalificationDeclaredProjectManage.java | 4 +++- .../projectdeclared/manage/ReviewByProvincialDeptManage.java | 3 ++- .../ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java | 3 +++ .../ningdatech/pmapi/projectlib/model/entity/Project.java | 6 ++++++ .../pmapi/projectlib/model/vo/ProjectDetailVO.java | 3 +++ 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java index 2a24456..0d2f524 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -142,9 +142,9 @@ public class DefaultDeclaredProjectManage { } //直接提交预审方法 提取 在省级联审通过的时候 也可以用 - public String directStartProcess(Project projectInfo){ - UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - Long userId = userInfoDetails.getUserId(); + public String directStartProcess(Project projectInfo,Long userId){ + VUtils.isTrue(Objects.isNull(userId)) + .throwMessage("发起人Id 不能为空!"); ProcessStartParamsVo params = new ProcessStartParamsVo(); params.setUser(buildUser(userId)); @@ -173,7 +173,7 @@ public class DefaultDeclaredProjectManage { log.info("提交预审项目成功 【{}】", instanceId); //保存预审项目 - modifyProject(projectInfo, instanceId); + preModifyProject(projectInfo, instanceId); return instanceId; } @@ -184,13 +184,11 @@ public class DefaultDeclaredProjectManage { * @param project * @param instanceId */ - private void modifyProject(Project project, String instanceId) { + private void preModifyProject(Project project, String instanceId) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { project.setUpdateOn(LocalDateTime.now()); project.setInstCode(instanceId); - //调用状态机 进入下一个通过状态 - stateMachineUtils.pass(project); projectService.updateById(project); //保存项目和实例的关系 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 0cb4a5c..44351fc 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 @@ -116,6 +116,8 @@ public class PrequalificationDeclaredProjectManage { .getCode().equals(projectInfo.getStatus())){ //入库暂存表 后续处理 对接外部接口 projectInfo.setUpdateOn(LocalDateTime.now()); + //保存一下 当前的主管单位发起人 + projectInfo.setPreStartUserId(userId); if(projectStagingService.addByProject(projectInfo,"省级部门联审") && projectService.updateById(projectInfo)){ return "提交省级部门联审成功"; @@ -124,7 +126,7 @@ public class PrequalificationDeclaredProjectManage { }else if(ProjectStatusEnum.PRE_APPLYING .getCode().equals(projectInfo.getStatus())){ //如果是非省级联审的项目 直接提交 预审 - instanceId = defaultDeclaredProjectManage.directStartProcess(projectInfo); + instanceId = defaultDeclaredProjectManage.directStartProcess(projectInfo,userId); }else{ throw new BusinessException("项目状态 错误 project :" + JSON.toJSONString(projectInfo)); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java index 3f39c7a..a612d74 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java @@ -54,7 +54,8 @@ public class ReviewByProvincialDeptManage { stateMachineUtils.pass(project); projectService.updateById(project); //直接去预审 - if(StringUtils.isNotBlank(defaultProjectManage.directStartProcess(project))){ + if(StringUtils.isNotBlank(defaultProjectManage + .directStartProcess(project,project.getPreStartUserId()))){ return Boolean.TRUE; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java index 7286598..291fa67 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java @@ -282,6 +282,9 @@ public class ProjectDTO implements Serializable { @ApiModelProperty("项目发起人") private Long sponsor; + @ApiModelProperty("上级条线单位审核意见") + private String higherLineSuperOrgReviewComments; + private Map dynamicForm; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index 404985a..dc7b710 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -297,6 +297,12 @@ public class Project implements Serializable { @ApiModelProperty("项目发起人 用户id") private Long sponsor; + @ApiModelProperty("预审发起人 用户id") + private Long preStartUserId; + + @ApiModelProperty("上级条线单位审核意见") + private String higherLineSuperOrgReviewComments; + @TableField(fill = FieldFill.INSERT) private Long createBy; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index e468cf1..97b6456 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -289,6 +289,9 @@ public class ProjectDetailVO { @ApiModelProperty("项目发起人id") private Long sponsor; + @ApiModelProperty("上级条线单位审核意见") + private String higherLineSuperOrgReviewComments; + private String projectTypeName; public String getProjectTypeName() {