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 d115c65..b9fc833 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,7 +1,6 @@ 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; /** @@ -14,7 +13,7 @@ import org.springframework.stereotype.Component; public interface UserInfoHelper { /** - * 根据用户id 获取 用户所属公司 organizationCode + * 根据用户id 获取 用户所属组织code organizationCode * * @param userId * @return @@ -27,9 +26,19 @@ public interface UserInfoHelper { /** * 判断该用户是否是区管或者超管 + * * @return */ boolean isSuperOrRegionAdmin(Long userId); UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); + + /** + * 获取用户任职所在单位code + * + * @return + */ + String getUserEmpPosUnitCode(Long userId); + + } 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 bd43b50..21487ba 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 @@ -60,4 +60,10 @@ public class UserInfoHelperImpl implements UserInfoHelper { UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfoByEmployeeCode(employeeCode); return userFullInfo; } + + @Override + public String getUserEmpPosUnitCode(Long userId) { + UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId); + return userFullInfo.getEmpPosUnitCode(); + } } 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 814468b..d252054 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 @@ -1,8 +1,6 @@ package com.ningdatech.pmapi.projectdeclared.manage; import com.alibaba.excel.EasyExcel; -import com.alibaba.fastjson.JSON; -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; @@ -10,7 +8,6 @@ import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.common.constant.CommonConst; -import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; @@ -18,8 +15,6 @@ import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; import com.ningdatech.pmapi.projectdeclared.model.dto.ConstructionPlanExportDTO; import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.PretrialDeclaredExportDTO; -import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -34,7 +29,6 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; 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.exception.BusinessException; @@ -67,7 +61,7 @@ import java.util.stream.Collectors; @Component @Slf4j @RequiredArgsConstructor -public class ConstructionPlanManage { +public class ConstructionPlanManage { private final IProjectService projectService; @@ -96,7 +90,7 @@ public class ConstructionPlanManage { public String startTheProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(user) ||Objects.isNull(employeeCode)) + VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) .throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); @@ -130,10 +124,10 @@ public class ConstructionPlanManage { params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params,dto); + defaultDeclaredProjectManage.buildCondition(params, dto); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); - String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); + String instanceId = processService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); log.info("建设方案项目申报成功 【{}】", instanceId); //保存建设项目 @@ -151,7 +145,7 @@ public class ConstructionPlanManage { @Transactional(rollbackFor = Exception.class) public String restartTheProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user) ||Objects.isNull(user.getEmployeeCode())) + VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) .throwMessage("获取登录用户失败!"); ProjectDTO projectDto = dto.getProjectInfo(); @@ -197,13 +191,14 @@ public class ConstructionPlanManage { /** * 查项目 + * * @param planReq * @return */ public PageVo projectLibList(ConstrctionPlanListReq planReq) { //限定参数 复制bean ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(planReq,req); + BeanUtils.copyProperties(planReq, req); //项目阶段 状态 已定 方案待申报 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); @@ -217,7 +212,7 @@ public class ConstructionPlanManage { public void exportList(HttpServletResponse response, ConstrctionPlanListReq planReq) { //限定参数 复制bean ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(planReq,req); + BeanUtils.copyProperties(planReq, req); //项目阶段 状态 已定 方案待申报 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); @@ -244,7 +239,7 @@ public class ConstructionPlanManage { collect.get(i).setSerialNumber(i + 1); } String fileName = "建设方案申报项目列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), ConstructionPlanExportDTO.class) 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 86ebfde..1dd3e35 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 @@ -124,6 +124,20 @@ public class UserAuthLoginManage { .eq(DingEmployeeInfo::getMainJob, "true")); DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); + + // 装配用户任职所在单位 + String empPosUnitCode = dingEmployeeInfo.getEmpPosUnitCode(); + if (StringUtils.isNotBlank(empPosUnitCode)) { + DingOrganization dingOrganization = iDingOrganizationService + .getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, empPosUnitCode)); + if (Objects.nonNull(dingOrganization)) { + userFullInfoDTO.setEmpPosUnitCode(empPosUnitCode); + userFullInfoDTO.setEmpPosUnitName(dingOrganization.getOrganizationName()); + } + } + + // 装配用户所在orgCode String organizationCode = dingEmployeeInfo.getOrganizationCode(); List dingOrganizationList = iDingOrganizationService .list(Wrappers.lambdaQuery(DingOrganization.class) @@ -151,12 +165,15 @@ public class UserAuthLoginManage { } userFullInfoDTO.setUserRoleList(roleList); + // 装配用户任职所在单位 + // 装配返回 userFullInfoDTO.setUserId(userInfo.getId()); userFullInfoDTO.setIdentifier(userInfo.getRealName()); userFullInfoDTO.setRealName(userInfo.getRealName()); userFullInfoDTO.setEmployeeCode(employeeCode); userFullInfoDTO.setUsername(userInfo.getRealName()); + } public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index bb7b4e0..5a7ac45 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -422,6 +422,8 @@ public class UserInfoManage { resUserDetailVO.setOrgCode(userFullInfo.getOrganizationCode()); resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); + resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); + resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); } return resUserDetailVO; } 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 cd4f949..ba3766a 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 @@ -41,6 +41,12 @@ public class ResUserDetailVO { private Long regionId; private String regionCode; + @ApiModelProperty("用户任职所在单位code") + private String empPosUnitCode; + + @ApiModelProperty("用户任职所在单位") + private String empPosUnitName; + @ApiModelProperty("用户角色") private List userRoleList; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java index 3121098..b4134ef 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java @@ -44,6 +44,8 @@ public class AgentLoginUserDetailService implements UserDetailsService { userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); + userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode()); + userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getOrganizationName()); return userInfoDetails; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java index 1d4ca2a..854db99 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java @@ -72,6 +72,8 @@ public class CredentialLoginUserDetailService implements UserDetailsService { userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); + userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode()); + userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getEmpPosUnitName()); return userInfoDetails; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java index b0ed9a0..d26d63e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java @@ -52,6 +52,16 @@ public class UserFullInfoDTO { private String organizationName; /** + * 任职所在单位code + */ + private String empPosUnitCode; + + /** + * 任职所在单位 + */ + private String empPosUnitName; + + /** * 用户角色 */ private List userRoleList; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java index e21d3d0..831ee2b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java @@ -62,6 +62,16 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { */ private List userRoleList; + /** + * 任职所在单位code + */ + private String empPosUnitCode; + + /** + * 任职所在单位 + */ + private String empPosUnitName; + /** * 获取用户权限 @@ -135,9 +145,9 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { return Boolean.FALSE; } - public Boolean getIsMunicipalOrg(){ + public Boolean getIsMunicipalOrg() { //如果是丽水市本级的code 就是 - if(RegionConst.RC_LS.equals(this.regionCode)){ + if (RegionConst.RC_LS.equals(this.regionCode)) { return Boolean.TRUE; } return Boolean.FALSE;