From 299f4aeb7a06d8334131887abbefa000b7a1fa2a Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 21 Feb 2023 14:19:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=94=B3=E6=8A=A5=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/ConstructionPlanManage.java | 7 +++- .../manage/DeclaredProjectManage.java | 6 +-- .../manage/DefaultDeclaredProjectManage.java | 18 +++++++++ .../PrequalificationDeclaredProjectManage.java | 7 +++- .../manage/ReviewByDeptJointManage.java | 21 ++++------ .../model/dto/DefaultDeclaredDTO.java | 3 -- .../pmapi/todocenter/manage/TodoCenterManage.java | 46 ++++++++++------------ .../todocenter/model/dto/req/ToBeProcessedReq.java | 3 -- 8 files changed, 61 insertions(+), 50 deletions(-) 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 20fb7a3..d66acab 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 @@ -64,6 +64,8 @@ public class ConstructionPlanManage { private final UserInfoHelper userInfoHelper; + private final DefaultDeclaredProjectManage declaredProjectManage; + /** * 建设方案 * @@ -72,6 +74,9 @@ public class ConstructionPlanManage { */ @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { + Long userId = LoginUserUtil.getUserId(); + VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(projectDto.getId()); @@ -96,7 +101,7 @@ public class ConstructionPlanManage { .throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(dto.getUser()); + params.setUser(declaredProjectManage.buildUser(userId)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); 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 c4a6289..02d8802 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 @@ -88,7 +88,6 @@ public class DeclaredProjectManage { public String startTheProcess(DefaultDeclaredDTO dto) { Long userId = LoginUserUtil.getUserId(); VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); ProjectDTO projectInfo = dto.getProjectInfo(); @@ -115,7 +114,7 @@ public class DeclaredProjectManage { defaultDeclaredProjectManage.checkDuplication(projectInfo); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(dto.getUser()); + params.setUser(defaultDeclaredProjectManage.buildUser(userId)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); @@ -144,6 +143,7 @@ public class DeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String reStartTheProcess(DefaultDeclaredDTO dto) { Long userId = LoginUserUtil.getUserId(); + VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); @@ -167,7 +167,7 @@ public class DeclaredProjectManage { .throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(dto.getUser()); + params.setUser(defaultDeclaredProjectManage.buildUser(userId)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); 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 a9e57b0..4295fc0 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 @@ -2,9 +2,12 @@ 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.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.workflow.bean.dto.ProcessInstanceUserDto; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -24,6 +27,7 @@ public class DefaultDeclaredProjectManage { private final IProjectService projectService; + private final UserInfoHelper userInfoHelper; //项目名称去重 public void checkDuplication(ProjectDTO project){ @@ -32,4 +36,18 @@ public class DefaultDeclaredProjectManage { .ne(Objects.nonNull(project.getId()),Project::getId,project.getId())) > 0) .throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); } + + public ProcessInstanceUserDto buildUser(Long userId){ + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + + VUtils.isTrue(Objects.isNull(userFullInfo)) + .throwMessage("当前登录用户 信息出错!"); + + return ProcessInstanceUserDto.builder() + .userId(String.valueOf(userFullInfo.getUserId())) + .userName(userFullInfo.getRealName()) + .orgCode(userFullInfo.getOrganizationCode()) + .orgName(userFullInfo.getOrganizationName()) + .build(); + } } 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 c5f980c..4e1571d 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 @@ -67,6 +67,8 @@ public class PrequalificationDeclaredProjectManage { private final UserInfoHelper userInfoHelper; + private final DefaultDeclaredProjectManage declaredProjectManage; + /** * 提交预审 * @@ -75,6 +77,9 @@ public class PrequalificationDeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { + Long userId = LoginUserUtil.getUserId(); + VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(projectDto.getId()); @@ -121,7 +126,7 @@ public class PrequalificationDeclaredProjectManage { .getCode().equals(projectInfo.getStatus())){ //如果是非省级联审的项目 直接提交 预审 ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(dto.getUser()); + params.setUser(declaredProjectManage.buildUser(userId)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); 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 2245353..4500bdb 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 @@ -14,6 +14,7 @@ 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.util.LoginUserUtil; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; @@ -52,6 +53,8 @@ public class ReviewByDeptJointManage { private final UserInfoHelper userInfoHelper; + private final DefaultDeclaredProjectManage declaredProjectManage; + /** * 部门联审 * @param project @@ -59,6 +62,9 @@ public class ReviewByDeptJointManage { */ @Transactional(rollbackFor = Exception.class) public Boolean startTheProcess(Project project) { + Long userId = LoginUserUtil.getUserId(); + VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(project.getId()); VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); @@ -81,12 +87,10 @@ public class ReviewByDeptJointManage { // 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人 VUtils.isTrue(Objects.isNull(projectInfo.getSponsor())) .throwMessage("提交失败 项目信息 缺少项目发起人!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(projectInfo.getSponsor()); - VUtils.isTrue(Objects.isNull(userFullInfo)) - .throwMessage("提交失败 项目发起人不存在!"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(buildUser(userFullInfo)); + //发起人的信息 + params.setUser(declaredProjectManage.buildUser(projectInfo.getSponsor())); params.setProcessUsers(Collections.emptyMap()); Map formData = Maps.newHashMap(); @@ -109,15 +113,6 @@ public class ReviewByDeptJointManage { return Boolean.TRUE; } - private ProcessInstanceUserDto buildUser(UserFullInfoDTO userFullInfo) { - return ProcessInstanceUserDto.builder() - .userId(String.valueOf(userFullInfo.getUserId())) - .userName(userFullInfo.getRealName()) - .orgCode(userFullInfo.getOrganizationCode()) - .orgName(userFullInfo.getOrganizationName()) - .build(); - } - private Boolean modifyProject(Project project, String instanceId) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java index 55aaa8e..2630d71 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java @@ -31,9 +31,6 @@ public class DefaultDeclaredDTO implements Serializable { @ApiModelProperty("表单信息 保留") private Map formData; - @ApiModelProperty("用户信息 暂时填一下") - private ProcessInstanceUserDto user; - public Map getFormData(){ if(CollUtil.isEmpty(this.formData)){ this.formData = Maps.newHashMap(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 2562784..106915c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -34,6 +34,7 @@ import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.service.IUserInfoService; +import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.ningdatech.zwdd.client.ZwddClient; import com.wflow.bean.entity.WflowModels; import com.wflow.contants.HisProInsEndActId; @@ -114,11 +115,10 @@ public class TodoCenterManage { */ public PageVo todoProjectList(ToBeProcessedReq param) { // 获取登录用户ID - // long userId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); + Long userId = LoginUserUtil.getUserId(); //因为要解耦 不能把项目和工作流一起查 //1.先查出用户工作流 - List userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),userId); + List userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),String.valueOf(userId)); List instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); //2.再分页查询项目信息 @@ -153,14 +153,13 @@ public class TodoCenterManage { */ public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID - // long userId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); + Long userId = LoginUserUtil.getUserId(); param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); //因为要解耦 不能把项目和工作流一起查 //1.先查出用户工作流 - List userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),userId); + List userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),String.valueOf(userId)); List instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); //2.再查询项目信息 @@ -506,9 +505,9 @@ public class TodoCenterManage { */ private void updatePassProjectStatus(Long userId, Project declaredProject) { // 获取当前流程项目状态 - Integer projectStatusSecond = declaredProject.getStatus(); + Integer status = declaredProject.getStatus(); // 根据当前状态获取对应的通过事件 - ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusPassEvent(projectStatusSecond); + ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusPassEvent(status); try { stateMachineUtils.execute(declaredProject, event); declaredProject.setUpdateOn(LocalDateTime.now()); @@ -830,11 +829,10 @@ public class TodoCenterManage { */ public PageVo idoList(ToBeProcessedReq param) { // 获取登录用户ID - // long userId = LoginUserUtil.getUserId(); + long userId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); // 查出用户已处理工作流 - List userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), userId); + List userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(),String.valueOf(userId)); List instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); @@ -870,14 +868,14 @@ public class TodoCenterManage { */ public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID - // long userId = LoginUserUtil.getUserId(); + Long userId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); +// String userId = param.getUserId(); param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); // 查询用户已处理工作流 - List userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), userId); + List userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), String.valueOf(userId)); List instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); // 查询项目信息 @@ -923,10 +921,9 @@ public class TodoCenterManage { public PageVo mySubmittedList(ToBeProcessedReq param) { // 获取登录用户ID - // Long startUserId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); + Long startUserId = LoginUserUtil.getUserId(); // 查出登录用户已提交工作流 - List userSubmittedList = processInstanceService.getUserSubmittedList(userId, param.getProcessDefId(), null); + List userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(startUserId), param.getProcessDefId(), null); List instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); // 分页查询项目信息 @@ -962,13 +959,12 @@ public class TodoCenterManage { public void exportMySubmittedList(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID - // long userId = LoginUserUtil.getUserId(); + long userId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); // 查询用户已处理工作流 - List userSubmittedList = processInstanceService.getUserSubmittedList(userId, param.getProcessDefId(), null); + List userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(userId), param.getProcessDefId(), null); List instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); // 查询项目信息 @@ -1013,11 +1009,10 @@ public class TodoCenterManage { */ public PageVo ccmeList(ToBeProcessedReq param) { // 获取当前登录用户ID - // Long userId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); + Long userId = LoginUserUtil.getUserId(); // 查询抄送登录用户的工作流 - List ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), userId); + List ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); List instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); // 分页查询项目信息 @@ -1053,14 +1048,13 @@ public class TodoCenterManage { public void exportCcMeProjectList(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID - // long userId = LoginUserUtil.getUserId(); + Long userId = LoginUserUtil.getUserId(); - String userId = param.getUserId(); param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); // 查询抄送登录用户的工作流 - List ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), userId); + List ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); List instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); // 查询项目信息 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedReq.java index f3029f1..61d3e18 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedReq.java @@ -45,9 +45,6 @@ public class ToBeProcessedReq extends PagePo implements Serializable { @ApiModelProperty(value = "是否增补项目",allowableValues = "非增补项目 0,增补项目 1") private Integer isTemporaryAugment; - //因为测试 暂时传参 传下userId - private String userId; - @ApiModelProperty("流程配置ID") private String processDefId; }