From ce999c1b60349ab09d9b4481daa1e3f4c81d067d Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 30 Mar 2023 11:30:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=8F=98=20=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/helper/UserInfoHelper.java | 3 ++ .../common/helper/impl/UserInfoHelperImpl.java | 6 ++++ .../manage/ConstructionPlanManage.java | 24 +++++++-------- .../manage/DeclaredProjectManage.java | 32 ++++++++++---------- .../manage/DefaultDeclaredProjectManage.java | 34 ++++++++++++---------- .../PrequalificationDeclaredProjectManage.java | 25 +++++++--------- .../manage/ProjectAdjustmentManage.java | 15 +++++----- .../manage/ReviewByDeptJointManage.java | 4 +-- .../pmapi/projectlib/model/dto/ProjectDTO.java | 4 +-- .../pmapi/projectlib/model/entity/Project.java | 8 ++--- .../pmapi/projectlib/model/vo/ProjectDetailVO.java | 4 +-- .../pmapi/user/manage/UserAuthLoginManage.java | 12 ++++++++ 12 files changed, 94 insertions(+), 77 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java index 5b0f5f1..d115c65 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java @@ -1,6 +1,7 @@ package com.ningdatech.pmapi.common.helper; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import org.springframework.stereotype.Component; /** @@ -29,4 +30,6 @@ public interface UserInfoHelper { * @return */ boolean isSuperOrRegionAdmin(Long userId); + + UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java index 429b486..bd43b50 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java @@ -54,4 +54,10 @@ public class UserInfoHelperImpl implements UserInfoHelper { } return Boolean.FALSE; } + + @Override + public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { + UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfoByEmployeeCode(employeeCode); + return userFullInfo; + } } 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 337d13b..252b698 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 @@ -94,8 +94,8 @@ public class ConstructionPlanManage { @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - Long userId = userInfoDetails.getUserId(); - VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getUserId())) + String employeeCode = userInfoDetails.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(employeeCode)) .throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); @@ -122,7 +122,7 @@ public class ConstructionPlanManage { .throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(userId)); + params.setUser(declaredProjectManage.buildUser(employeeCode)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); @@ -133,7 +133,7 @@ public class ConstructionPlanManage { ); params.setFormData(dto.getFormData()); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,projectInfo); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("建设方案项目申报成功 【{}】", instanceId); @@ -152,7 +152,7 @@ public class ConstructionPlanManage { @Transactional(rollbackFor = Exception.class) public String restartTheProcess(DefaultDeclaredDTO dto) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getUserId())) + VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getEmployeeCode())) .throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); @@ -207,11 +207,10 @@ public class ConstructionPlanManage { //项目阶段 状态 已定 方案待申报 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - Long userId = LoginUserUtil.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(userFullInfo.getOrganizationCode()); + req.setBuildOrgCode(user.getOrganizationCode()); return projectLibManage.projectLibList(req); } @@ -222,11 +221,10 @@ public class ConstructionPlanManage { //项目阶段 状态 已定 方案待申报 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - Long userId = LoginUserUtil.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(userFullInfo.getOrganizationCode()); + req.setBuildOrgCode(user.getOrganizationCode()); req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); req.setPageSize(CommonConst.EXPORT_PAGE_SIZE); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); 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 3b4c238..0f9ba52 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 @@ -109,8 +109,8 @@ public class DeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - Long userId = userInfoDetails.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + String employeeCode = userInfoDetails.getEmployeeCode(); + VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); ProjectDTO projectInfo = dto.getProjectInfo(); @@ -152,7 +152,7 @@ public class DeclaredProjectManage { } ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(userId)); + params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); @@ -166,12 +166,12 @@ public class DeclaredProjectManage { // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Project project = new Project(); BeanUtils.copyProperties(projectInfo,project); - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("申报项目成功 【{}】", instanceId); //如果是重新提交的话 判断下 项目是否存在 - if(saveOrUpdateProject(projectInfo, instanceId,userId) && Objects.nonNull(projectInfo.getDraftId())){ + if(saveOrUpdateProject(projectInfo, instanceId,employeeCode) && Objects.nonNull(projectInfo.getDraftId())){ //如果是草稿箱提交 删除对应的草稿箱 projectDraftService.removeById(projectInfo.getDraftId()); } @@ -189,9 +189,9 @@ public class DeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String reStartTheProcess(DefaultDeclaredDTO dto) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - VUtils.isTrue(Objects.isNull(userInfoDetails) || Objects.isNull(userInfoDetails.getUserId())) + VUtils.isTrue(Objects.isNull(userInfoDetails) || Objects.isNull(userInfoDetails.getEmployeeCode())) .throwMessage("获取登录用户失败!"); - Long userId = userInfoDetails.getUserId(); + String employeeCode = userInfoDetails.getEmployeeCode(); ProjectDTO projectDto = dto.getProjectInfo(); projectDto.setAreaCode(userInfoDetails.getRegionCode()); projectDto.setArea(regionCacheHelper.getRegionName(userInfoDetails.getRegionCode(), RegionConst.RL_COUNTY)); @@ -224,7 +224,7 @@ public class DeclaredProjectManage { .throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(userId)); + params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); @@ -237,12 +237,12 @@ public class DeclaredProjectManage { // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Project project = new Project(); BeanUtils.copyProperties(projectInfo,project); - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("重新申报项目成功 【{}】", instanceId); //保存项目 - saveOrUpdateProject(projectDto,instanceId,userId); + saveOrUpdateProject(projectDto,instanceId,employeeCode); return instanceId; } @@ -254,7 +254,7 @@ public class DeclaredProjectManage { * @param instanceId */ private Boolean saveOrUpdateProject(ProjectDTO projectDto, String instanceId, - Long userId) { + String employeeCode) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { //保存项目表信息 @@ -265,7 +265,7 @@ public class DeclaredProjectManage { project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); project.setInstCode(instanceId); - project.setSponsor(userId); + project.setSponsor(employeeCode); projectService.saveOrUpdate(project); //保存项目应用 if (CollUtil.isNotEmpty(projectDto.getApplicationList())) { @@ -374,9 +374,8 @@ public class DeclaredProjectManage { * @return */ public PageVo projectLibList(ProjectListReq req) { - Long userId = LoginUserUtil.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserInfoDetails userFullInfo = LoginUserUtil.loginUserDetail(); + VUtils.isTrue(Objects.isNull(userFullInfo)).throwMessage("获取登录用户失败!"); //放入用户的单位 req.setBuildOrgCode(userFullInfo.getOrganizationCode()); return projectlibManager.projectLibList(req); @@ -384,8 +383,7 @@ public class DeclaredProjectManage { public void exportList(HttpServletResponse response, ProjectListReq param) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - Long userId = userInfoDetails.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + VUtils.isTrue(Objects.isNull(userInfoDetails)).throwMessage("获取登录用户失败!"); //放入用户的单位 param.setBuildOrgCode(userInfoDetails.getOrganizationCode()); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); 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 824aa77..d54bcd0 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 @@ -108,27 +108,31 @@ public class DefaultDeclaredProjectManage { } } - public ProcessInstanceUserDto buildUser(Long userId){ - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + public ProcessInstanceUserDto buildUser(String employeeCode){ + UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); - VUtils.isTrue(Objects.isNull(userFullInfo)) - .throwMessage("当前登录用户 信息出错!"); + VUtils.isTrue(Objects.isNull(userInfoDetail)) + .throwMessage(String.format("【%s】获取不到用户!",employeeCode)); return ProcessInstanceUserDto.builder() - .userId(String.valueOf(userFullInfo.getUserId())) - .userName(userFullInfo.getRealName()) - .orgCode(userFullInfo.getOrganizationCode()) - .orgName(userFullInfo.getOrganizationName()) + .userId(String.valueOf(userInfoDetail.getEmployeeCode())) + .userName(userInfoDetail.getRealName()) + .orgCode(userInfoDetail.getOrganizationCode()) + .orgName(userInfoDetail.getOrganizationName()) .build(); } - public Map buildOrgModelMap(Long userId,Project project) { + public Map buildOrgModelMap(String employeeCode,Project project) { Map orgMap = new HashMap<>(); // 查出所有的单位流程配置 List orgModelsList = orgProcdefService.list(); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + if(Objects.isNull(userFullInfo)){ + log.warn("取不到员工 返回空map"); + return Collections.emptyMap(); + } DingOrganization startOrg = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) .eq(DingOrganization::getOrganizationCode, userFullInfo.getOrganizationCode())); String startOrgCode = startOrg.getOrganizationCode(); @@ -177,12 +181,12 @@ public class DefaultDeclaredProjectManage { } //直接提交预审方法 提取 在省级联审通过的时候 也可以用 - public String directStartProcess(Project projectInfo,Long userId){ - VUtils.isTrue(Objects.isNull(userId)) - .throwMessage("发起人Id 不能为空!"); + public String directStartProcess(Project projectInfo,String employeeCode){ + VUtils.isTrue(Objects.isNull(employeeCode)) + .throwMessage("发起人 员工code 不能为空!"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(buildUser(userId)); + params.setUser(buildUser(employeeCode)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); @@ -203,7 +207,7 @@ public class DefaultDeclaredProjectManage { } // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = buildOrgModelMap(userId,projectInfo); + Map orgModelMap = buildOrgModelMap(employeeCode,projectInfo); 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/PrequalificationDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index b053ff9..1240c38 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 @@ -90,8 +90,8 @@ public class PrequalificationDeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - Long userId = userInfoDetails.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + String employeeCode = userInfoDetails.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); @@ -117,7 +117,7 @@ public class PrequalificationDeclaredProjectManage { //入库暂存表 后续处理 对接外部接口 projectInfo.setUpdateOn(LocalDateTime.now()); //保存一下 当前的主管单位发起人 - projectInfo.setPreStartUserId(userId); + projectInfo.setPreStartUserId(employeeCode); if(projectStagingService.addByProject(projectInfo,"省级部门联审") && projectService.updateById(projectInfo)){ return "提交省级部门联审成功"; @@ -126,7 +126,7 @@ public class PrequalificationDeclaredProjectManage { }else if(ProjectStatusEnum.PRE_APPLYING .getCode().equals(projectInfo.getStatus())){ //如果是非省级联审的项目 直接提交 预审 - instanceId = defaultDeclaredProjectManage.directStartProcess(projectInfo,userId); + instanceId = defaultDeclaredProjectManage.directStartProcess(projectInfo,employeeCode); }else{ throw new BusinessException("项目状态 错误 project :" + JSON.toJSONString(projectInfo)); } @@ -143,8 +143,8 @@ public class PrequalificationDeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String restartTheProcess(DefaultDeclaredDTO dto) { UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - Long userId = userInfoDetails.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + String employeeCode = userInfoDetails.getEmployeeCode(); + VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); @@ -168,11 +168,10 @@ public class PrequalificationDeclaredProjectManage { //项目阶段 状态 已定 待预审 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - Long userId = LoginUserUtil.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); + VUtils.isTrue(Objects.isNull(userInfoDetail)).throwMessage("获取登录用户失败!"); //放入用户的主管单位 - req.setSuperOrgCode(userFullInfo.getOrganizationCode()); + req.setSuperOrgCode(userInfoDetail.getOrganizationCode()); return projectLibManage.projectLibList(req); } @@ -182,11 +181,9 @@ public class PrequalificationDeclaredProjectManage { //项目阶段 状态 已定 待预审 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - Long userId = LoginUserUtil.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); //放入用户的单位 - req.setSuperOrgCode(userFullInfo.getOrganizationCode()); + req.setSuperOrgCode(userInfoDetail.getOrganizationCode()); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); List records = projectService.list(query); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java index 7cc4018..928873e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java @@ -29,6 +29,7 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; 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.exception.BusinessException; import lombok.RequiredArgsConstructor; @@ -146,11 +147,10 @@ public class ProjectAdjustmentManage { ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); - Long userId = LoginUserUtil.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(userFullInfo.getOrganizationCode()); + req.setBuildOrgCode(user.getOrganizationCode()); return projectLibManage.projectLibList(req); } @@ -165,11 +165,10 @@ public class ProjectAdjustmentManage { ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); - Long userId = LoginUserUtil.getUserId(); - VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(userFullInfo.getOrganizationCode()); + req.setBuildOrgCode(user.getOrganizationCode()); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); List records = projectService.list(query); 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 0f87662..4d6ae72 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 @@ -58,7 +58,7 @@ public class ReviewByDeptJointManage { @Transactional(rollbackFor = Exception.class) public Boolean startTheProcess(Project project) { //这里是任务发起的 所以用项目发起人 - Long userId = project.getSponsor(); + String startUserCode = project.getSponsor(); VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(project.getId()); @@ -99,7 +99,7 @@ public class ReviewByDeptJointManage { params.setFormData(formData); // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId,project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,project); String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); log.info("部门联审申报成功 【{}】", instanceId); 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 28d2c1d..16e0d27 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 @@ -279,8 +279,8 @@ public class ProjectDTO implements Serializable { @ApiModelProperty("流程状态") private Integer processStatus; - @ApiModelProperty("项目发起人") - private Long sponsor; + @ApiModelProperty("项目发起人 员工code") + private String sponsor; @ApiModelProperty("上级条线单位审核意见") private String higherLineSuperOrgReviewComments; 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 3206828..184e3f1 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 @@ -294,11 +294,11 @@ public class Project implements Serializable { @ApiModelProperty("动态表单 json") private String dynamicForm; - @ApiModelProperty("项目发起人 用户id") - private Long sponsor; + @ApiModelProperty("项目发起人 员工code") + private String sponsor; - @ApiModelProperty("预审发起人 用户id") - private Long preStartUserId; + @ApiModelProperty("预审发起人 员工code") + private String preStartUserId; @ApiModelProperty("上级条线单位审核意见") private String higherLineSuperOrgReviewComments; 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 5336103..02238f6 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 @@ -286,8 +286,8 @@ public class ProjectDetailVO { @ApiModelProperty("年度投资金额详情") private List annualAccumulateAmountList; - @ApiModelProperty("项目发起人id") - private Long sponsor; + @ApiModelProperty("项目发起人 员工code") + private String sponsor; @ApiModelProperty("上级条线单位审核意见") private String higherLineSuperOrgReviewComments; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java index b846cb0..ecf658c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java @@ -155,4 +155,16 @@ public class UserAuthLoginManage { userFullInfoDTO.setRealName(userInfo.getRealName()); userFullInfoDTO.setUsername(userInfo.getRealName()); } + + public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode,employeeCode).last("limit 1")); + if (Objects.isNull(userInfo)) { + return null; + } + // 返回用户全量信息 + UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO(); + userFullInfoDTOAssembler(userInfo, userFullInfoDTO); + return userFullInfoDTO; + } }