Browse Source

获取用户所在任职单位信息

tags/24080901
niohe·erbao 1 year ago
parent
commit
92ebdfe204
10 changed files with 78 additions and 19 deletions
  1. +11
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  2. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  3. +10
    -15
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  4. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java
  5. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java
  6. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java
  7. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java
  8. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java
  9. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java
  10. +12
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java

+ 11
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java View File

@@ -1,7 +1,6 @@
package com.ningdatech.pmapi.common.helper; package com.ningdatech.pmapi.common.helper;


import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;


/** /**
@@ -14,7 +13,7 @@ import org.springframework.stereotype.Component;
public interface UserInfoHelper { public interface UserInfoHelper {


/** /**
* 根据用户id 获取 用户所属公司 organizationCode
* 根据用户id 获取 用户所属组织code organizationCode
* *
* @param userId * @param userId
* @return * @return
@@ -27,9 +26,19 @@ public interface UserInfoHelper {


/** /**
* 判断该用户是否是区管或者超管 * 判断该用户是否是区管或者超管
*
* @return * @return
*/ */
boolean isSuperOrRegionAdmin(Long userId); boolean isSuperOrRegionAdmin(Long userId);


UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode);

/**
* 获取用户任职所在单位code
*
* @return
*/
String getUserEmpPosUnitCode(Long userId);


} }

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java View File

@@ -60,4 +60,10 @@ public class UserInfoHelperImpl implements UserInfoHelper {
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfoByEmployeeCode(employeeCode); UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfoByEmployeeCode(employeeCode);
return userFullInfo; return userFullInfo;
} }

@Override
public String getUserEmpPosUnitCode(Long userId) {
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
return userFullInfo.getEmpPosUnitCode();
}
} }

+ 10
- 15
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -1,8 +1,6 @@
package com.ningdatech.pmapi.projectdeclared.manage; package com.ningdatech.pmapi.projectdeclared.manage;


import com.alibaba.excel.EasyExcel; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst; 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.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; 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.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.projectdeclared.model.dto.ConstructionPlanExportDTO; import com.ningdatech.pmapi.projectdeclared.model.dto.ConstructionPlanExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; 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.projectdeclared.model.req.ConstrctionPlanListReq;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; 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.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; 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.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels; import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException; import com.wflow.exception.BusinessException;
@@ -67,7 +61,7 @@ import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
public class ConstructionPlanManage {
public class ConstructionPlanManage {


private final IProjectService projectService; private final IProjectService projectService;


@@ -96,7 +90,7 @@ public class ConstructionPlanManage {
public String startTheProcess(DefaultDeclaredDTO dto) { public String startTheProcess(DefaultDeclaredDTO dto) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String employeeCode = user.getEmployeeCode(); String employeeCode = user.getEmployeeCode();
VUtils.isTrue(Objects.isNull(user) ||Objects.isNull(employeeCode))
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode))
.throwMessage("获取登录用户失败!"); .throwMessage("获取登录用户失败!");


ProjectDTO projectDto = dto.getProjectInfo(); ProjectDTO projectDto = dto.getProjectInfo();
@@ -130,10 +124,10 @@ public class ConstructionPlanManage {
params.setProcessUsers(Collections.emptyMap()); params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段 //放入条件判断的项目字段
//把条件值给放入工作流 //把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params,dto);
defaultDeclaredProjectManage.buildCondition(params, dto);
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, projectInfo);
String instanceId = processService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap);
log.info("建设方案项目申报成功 【{}】", instanceId); log.info("建设方案项目申报成功 【{}】", instanceId);


//保存建设项目 //保存建设项目
@@ -151,7 +145,7 @@ public class ConstructionPlanManage {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String restartTheProcess(DefaultDeclaredDTO dto) { public String restartTheProcess(DefaultDeclaredDTO dto) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); 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("获取登录用户失败!"); .throwMessage("获取登录用户失败!");


ProjectDTO projectDto = dto.getProjectInfo(); ProjectDTO projectDto = dto.getProjectInfo();
@@ -197,13 +191,14 @@ public class ConstructionPlanManage {


/** /**
* 查项目 * 查项目
*
* @param planReq * @param planReq
* @return * @return
*/ */
public PageVo<ProjectLibListItemVO> projectLibList(ConstrctionPlanListReq planReq) { public PageVo<ProjectLibListItemVO> projectLibList(ConstrctionPlanListReq planReq) {
//限定参数 复制bean //限定参数 复制bean
ProjectListReq req = new ProjectListReq(); ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(planReq,req);
BeanUtils.copyProperties(planReq, req);
//项目阶段 状态 已定 方案待申报 //项目阶段 状态 已定 方案待申报
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
@@ -217,7 +212,7 @@ public class ConstructionPlanManage {
public void exportList(HttpServletResponse response, ConstrctionPlanListReq planReq) { public void exportList(HttpServletResponse response, ConstrctionPlanListReq planReq) {
//限定参数 复制bean //限定参数 复制bean
ProjectListReq req = new ProjectListReq(); ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(planReq,req);
BeanUtils.copyProperties(planReq, req);
//项目阶段 状态 已定 方案待申报 //项目阶段 状态 已定 方案待申报
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
@@ -244,7 +239,7 @@ public class ConstructionPlanManage {
collect.get(i).setSerialNumber(i + 1); collect.get(i).setSerialNumber(i + 1);
} }
String fileName = "建设方案申报项目列表"; String fileName = "建设方案申报项目列表";
ExcelDownUtil.setFileName(fileName,response);
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数 //数据导出处理函数
try { try {
EasyExcel.write(response.getOutputStream(), ConstructionPlanExportDTO.class) EasyExcel.write(response.getOutputStream(), ConstructionPlanExportDTO.class)


+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java View File

@@ -124,6 +124,20 @@ public class UserAuthLoginManage {
.eq(DingEmployeeInfo::getMainJob, "true")); .eq(DingEmployeeInfo::getMainJob, "true"));
DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); 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(); String organizationCode = dingEmployeeInfo.getOrganizationCode();
List<DingOrganization> dingOrganizationList = iDingOrganizationService List<DingOrganization> dingOrganizationList = iDingOrganizationService
.list(Wrappers.lambdaQuery(DingOrganization.class) .list(Wrappers.lambdaQuery(DingOrganization.class)
@@ -151,12 +165,15 @@ public class UserAuthLoginManage {
} }
userFullInfoDTO.setUserRoleList(roleList); userFullInfoDTO.setUserRoleList(roleList);


// 装配用户任职所在单位

// 装配返回 // 装配返回
userFullInfoDTO.setUserId(userInfo.getId()); userFullInfoDTO.setUserId(userInfo.getId());
userFullInfoDTO.setIdentifier(userInfo.getRealName()); userFullInfoDTO.setIdentifier(userInfo.getRealName());
userFullInfoDTO.setRealName(userInfo.getRealName()); userFullInfoDTO.setRealName(userInfo.getRealName());
userFullInfoDTO.setEmployeeCode(employeeCode); userFullInfoDTO.setEmployeeCode(employeeCode);
userFullInfoDTO.setUsername(userInfo.getRealName()); userFullInfoDTO.setUsername(userInfo.getRealName());

} }


public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) {


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java View File

@@ -422,6 +422,8 @@ public class UserInfoManage {
resUserDetailVO.setOrgCode(userFullInfo.getOrganizationCode()); resUserDetailVO.setOrgCode(userFullInfo.getOrganizationCode());
resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); resUserDetailVO.setOrgName(userFullInfo.getOrganizationName());
resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); resUserDetailVO.setRegionCode(userFullInfo.getRegionCode());
resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode());
resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName());
} }
return resUserDetailVO; return resUserDetailVO;
} }


+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java View File

@@ -41,6 +41,12 @@ public class ResUserDetailVO {
private Long regionId; private Long regionId;
private String regionCode; private String regionCode;


@ApiModelProperty("用户任职所在单位code")
private String empPosUnitCode;

@ApiModelProperty("用户任职所在单位")
private String empPosUnitName;

@ApiModelProperty("用户角色") @ApiModelProperty("用户角色")
private List<UserRoleVO> userRoleList; private List<UserRoleVO> userRoleList;




+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java View File

@@ -44,6 +44,8 @@ public class AgentLoginUserDetailService implements UserDetailsService {
userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode());
userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode());
userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName());
userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode());
userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getOrganizationName());
return userInfoDetails; return userInfoDetails;
} }
} }

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java View File

@@ -72,6 +72,8 @@ public class CredentialLoginUserDetailService implements UserDetailsService {
userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode()); userInfoDetails.setEmployeeCode(userFullInfoDTO.getEmployeeCode());
userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode()); userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode());
userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName()); userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName());
userInfoDetails.setEmpPosUnitCode(userFullInfoDTO.getEmpPosUnitCode());
userInfoDetails.setEmpPosUnitName(userFullInfoDTO.getEmpPosUnitName());
return userInfoDetails; return userInfoDetails;
} }
} }

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java View File

@@ -52,6 +52,16 @@ public class UserFullInfoDTO {
private String organizationName; private String organizationName;


/** /**
* 任职所在单位code
*/
private String empPosUnitCode;

/**
* 任职所在单位
*/
private String empPosUnitName;

/**
* 用户角色 * 用户角色
*/ */
private List<Role> userRoleList; private List<Role> userRoleList;


+ 12
- 2
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java View File

@@ -62,6 +62,16 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
*/ */
private List<Role> userRoleList; private List<Role> userRoleList;


/**
* 任职所在单位code
*/
private String empPosUnitCode;

/**
* 任职所在单位
*/
private String empPosUnitName;



/** /**
* 获取用户权限 * 获取用户权限
@@ -135,9 +145,9 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
return Boolean.FALSE; return Boolean.FALSE;
} }


public Boolean getIsMunicipalOrg(){
public Boolean getIsMunicipalOrg() {
//如果是丽水市本级的code 就是 //如果是丽水市本级的code 就是
if(RegionConst.RC_LS.equals(this.regionCode)){
if (RegionConst.RC_LS.equals(this.regionCode)) {
return Boolean.TRUE; return Boolean.TRUE;
} }
return Boolean.FALSE; return Boolean.FALSE;


Loading…
Cancel
Save