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 d66acab..f8cd709 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 @@ -24,6 +24,7 @@ import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; +import com.wflow.workflow.bean.dto.OrgInfoDTO; import com.wflow.workflow.bean.vo.ProcessStartParamsVo; import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessModelService; @@ -65,6 +66,7 @@ public class ConstructionPlanManage { private final UserInfoHelper userInfoHelper; private final DefaultDeclaredProjectManage declaredProjectManage; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; /** * 建设方案 @@ -111,7 +113,9 @@ public class ConstructionPlanManage { }) ); params.setFormData(dto.getFormData()); - String instanceId = processService.startProcess(model.getProcessDefId(), params); + // 获取发起单位、发起单位主管单位信息 + Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId, model); + String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); 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 b3bad8e..89fa802 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 @@ -10,11 +10,10 @@ import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.organization.model.entity.DingOrganization; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; +import com.ningdatech.pmapi.projectdeclared.model.dto.*; import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; -import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectListParamDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO; import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO; import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -31,7 +30,12 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; 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.vo.ProcessStartParamsVo; import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessModelService; @@ -43,10 +47,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -131,7 +132,9 @@ public class DeclaredProjectManage { ); params.setFormData(dto.getFormData()); //开始申报 - String instanceId = processService.startProcess(model.getProcessDefId(), params); + // 获取发起单位、发起单位主管单位信息 + Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId, model); + String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("申报项目成功 【{}】", instanceId); //如果是重新提交的话 判断下 项目是否存在 @@ -140,6 +143,7 @@ public class DeclaredProjectManage { return instanceId; } + /** * 重新提交 启动实例 * 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 4295fc0..db68d3e 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 @@ -3,15 +3,28 @@ package com.ningdatech.pmapi.projectdeclared.manage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.organization.model.entity.DingOrganization; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +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.service.OrgProcdefService; +import com.wflow.workflow.bean.dto.OrgInfoDTO; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; /** * @Classname DefaultDeclaredProjectManage @@ -29,6 +42,9 @@ public class DefaultDeclaredProjectManage { private final UserInfoHelper userInfoHelper; + private final IDingOrganizationService dingOrganizationService; + private final OrgProcdefService orgProcdefService; + //项目名称去重 public void checkDuplication(ProjectDTO project){ VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) @@ -50,4 +66,40 @@ public class DefaultDeclaredProjectManage { .orgName(userFullInfo.getOrganizationName()) .build(); } + + public Map getOrgModelInfo(Long userId, WflowModels model) { + Map orgMap = new HashMap<>(); + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + DingOrganization startOrg = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, userFullInfo.getOrganizationCode())); + String startOrgCode = startOrg.getOrganizationCode(); + String startOrgName = startOrg.getOrganizationName(); + String startOrgParentCode = startOrg.getParentCode(); + String startOrgParentName = startOrg.getParentName(); + //查询 当前发起人所在区域的 单位流程配置 + OrgInfoDTO startOrgInfoDTO = getOrgInfoDTO(model,startOrgCode, startOrgName); + OrgInfoDTO startOrgParentInfoDTO = getOrgInfoDTO(model, startOrgParentCode, startOrgParentName); + orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDTO); + orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),startOrgParentInfoDTO); + return orgMap; + } + + private OrgInfoDTO getOrgInfoDTO(WflowModels model, String startOrgCode, String startOrgName) { + Map startOrgModelsMap = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class) + .eq(WflowOrgModels::getOrgCode, startOrgCode) + .eq(StringUtils.isNotEmpty(model.getProcessDefId()), WflowOrgModels::getProcessDefId, model.getProcessDefId()) + .eq(WflowOrgModels::getIsDelete, Boolean.FALSE)).stream() + .collect(Collectors.toMap(m -> { + if (ProcessDefTypeEnum.SEAL.name().equals(m.getType()) || + ProcessDefTypeEnum.DEFAULT.name().equals(m.getType())) { + return m.getType(); + } + return m.getProcessDefId(); + }, v -> v)); + OrgInfoDTO startOrgInfoDTO = new OrgInfoDTO(); + startOrgInfoDTO.setOrganizationCode(startOrgCode); + startOrgInfoDTO.setOrganizationName(startOrgName); + startOrgInfoDTO.setOrgModelMap(startOrgModelsMap); + return startOrgInfoDTO; + } } 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 b0e17c8..9653119 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 @@ -25,6 +25,7 @@ import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; +import com.wflow.workflow.bean.dto.OrgInfoDTO; import com.wflow.workflow.bean.vo.ProcessStartParamsVo; import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessModelService; @@ -68,6 +69,8 @@ public class PrequalificationDeclaredProjectManage { private final DefaultDeclaredProjectManage declaredProjectManage; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + /** * 提交预审 * @@ -135,7 +138,10 @@ public class PrequalificationDeclaredProjectManage { }) ); params.setFormData(dto.getFormData()); - instanceId = processService.startProcess(model.getProcessDefId(), params); + + // 获取发起单位、发起单位主管单位信息 + Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId, model); + instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("提交预审项目成功 【{}】", instanceId); //保存预审项目 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java index 4500bdb..911c6fe 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java @@ -17,6 +17,7 @@ import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; +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; @@ -52,8 +53,8 @@ public class ReviewByDeptJointManage { private final IProjectInstService projectInstService; private final UserInfoHelper userInfoHelper; - private final DefaultDeclaredProjectManage declaredProjectManage; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; /** * 部门联审 @@ -102,7 +103,10 @@ public class ReviewByDeptJointManage { }) ); params.setFormData(formData); - String instanceId = processService.startProcess(model.getProcessDefId(), params); + + // 获取发起单位、发起单位主管单位信息 + Map orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId, model); + String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("部门联审申报成功 【{}】", instanceId); //保存项目信息 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java index 20e3c0f..53ade38 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java @@ -46,7 +46,7 @@ public class WorkNoticeFlowTask { private final INdWorkNoticeStagingService workNoticeStagingService; private final ZwddClient zwddClient; - @Scheduled(cron = "0 */1 * * * ?") + @Scheduled(cron = "0 */1 * * * ?") public void statusFlow() throws UnknownHostException { //测试暂时用自己电脑HOST if (TaskContant.Host.HOST_CMM.equals(InetAddress.getLocalHost().getHostName())) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java index 859281e..72f43f1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java @@ -60,6 +60,6 @@ public class SysProcDefController { @ApiOperation(value = "系统流程配置发布", notes = "系统流程配置发布") @PostMapping("/deploy/{formId}") public String deploy(@Validated @PathVariable String formId) { - return processModelService.deployProcess(formId); + return processModelService.deployProcess(formId); } }