Browse Source

modify:

1. 增加是否区县用户、是否国有企业用户、是否重点行业用户、是否市本级用户;
tags/24083002
WendyYang 2 months ago
parent
commit
3c4abdc34a
7 changed files with 95 additions and 9 deletions
  1. +26
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java
  2. +16
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/MhUnitConst.java
  3. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/ThreadPoolUtil.java
  4. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java
  5. +15
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java
  6. +17
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java
  7. +17
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java

+ 26
- 4
hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java View File

@@ -13,6 +13,7 @@ import com.hz.pm.api.sys.model.entity.Role;
import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.model.entity.UserRole;
import com.hz.pm.api.sys.service.IUserRoleService; import com.hz.pm.api.sys.service.IUserRoleService;
import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.UnitDTO;
import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.model.enumeration.RoleEnum;
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum;
@@ -76,8 +77,29 @@ public class UserInfoHelperImpl implements UserInfoHelper {
.collect(Collectors.toList()); .collect(Collectors.toList());
userFullInfo.setUserRoleList(roleMapper.selectBatchIds(roleIdList)); userFullInfo.setUserRoleList(roleMapper.selectBatchIds(roleIdList));
} }
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.COUNTY_PARENT_UNIT_ID);
userFullInfo.setIsCountyUser(viewUnitIds.contains(userInfo.getMhUnitId()));
UnitDTO unit = mhUnitCache.getById(userInfo.getMhUnitId());
if (unit != null && unit.getType() != null) {
userFullInfo.setUnitStrip(unit.getType().getStrip().getCode());
// 是否市属国有企业下用户
List<Long> citySoeUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.CITY_SOE_UNIT_ID);
userFullInfo.setIsCitySoeUser(citySoeUnitIds.contains(userInfo.getMhUnitId()));
if (!userFullInfo.getIsCitySoeUser()) {
// 是否关键行业部门下用户
List<Long> keyIndustryUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.KEY_INDUSTRY_UNIT_ID);
userFullInfo.setIsKeyIndustryUser(keyIndustryUnitIds.contains(userInfo.getMhUnitId()));
if (!userFullInfo.getIsKeyIndustryUser()) {
// 是否区县部门下用户
List<Long> countyUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.COUNTY_PARENT_UNIT_ID);
userFullInfo.setIsCountyUser(countyUnitIds.contains(userInfo.getMhUnitId()));
if (!userFullInfo.getIsCountyUser()) {
// 是否市本级用户
List<Long> cityDistrictUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.CITY_DISTRICT_UNIT_ID);
userFullInfo.setIsCityDistrictUser(cityDistrictUnitIds.contains(userInfo.getMhUnitId()));
}
}
}
}

// 装配返回 // 装配返回
userFullInfo.setUserId(userInfo.getId()); userFullInfo.setUserId(userInfo.getId());
userFullInfo.setMhUserId(userInfo.getMhUserId()); userFullInfo.setMhUserId(userInfo.getMhUserId());
@@ -109,7 +131,7 @@ public class UserInfoHelperImpl implements UserInfoHelper {
return userInfos.stream().map(this::convert).collect(Collectors.toList()); return userInfos.stream().map(this::convert).collect(Collectors.toList());
} }


private UserFullInfoDTO convert(UserInfo userInfo){
private UserFullInfoDTO convert(UserInfo userInfo) {
UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); UserFullInfoDTO userFullInfo = new UserFullInfoDTO();
// 装配返回 // 装配返回
userFullInfo.setMhUnitName(userInfo.getMhUnitName()); userFullInfo.setMhUnitName(userInfo.getMhUnitName());
@@ -168,7 +190,7 @@ public class UserInfoHelperImpl implements UserInfoHelper {
.exists("select 1 from nd_user_role nur where nur.user_id = nd_user_info.id" + .exists("select 1 from nd_user_role nur where nur.user_id = nd_user_info.id" +
" and nur.role_id = {0}", role.getId()); " and nur.role_id = {0}", role.getId());
List<UserInfo> userInfos = userInfoService.list(query); List<UserInfo> userInfos = userInfoService.list(query);
return CollUtils.convert(userInfos,this::convert);
return CollUtils.convert(userInfos, this::convert);
} }


} }

+ 16
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/MhUnitConst.java View File

@@ -16,6 +16,22 @@ public class MhUnitConst {
private MhUnitConst() { private MhUnitConst() {
} }


/**
* 重点行业
*/
public static final long KEY_INDUSTRY_UNIT_ID = 6788;

/**
* 市级部门
*/
public static final long CITY_DISTRICT_UNIT_ID = 970;
/**
* 市属国有企业
*/
public static final long CITY_SOE_UNIT_ID = 3269;
/**
* 区县部门
*/
public static final long COUNTY_PARENT_UNIT_ID = 1084; public static final long COUNTY_PARENT_UNIT_ID = 1084;


public static final long ROOT_UNIT_ID = 1; public static final long ROOT_UNIT_ID = 1;


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/util/ThreadPoolUtil.java View File

@@ -46,7 +46,6 @@ public class ThreadPoolUtil {
SCHEDULER.setPoolSize(schedulerProps.getCorePoolSize()); SCHEDULER.setPoolSize(schedulerProps.getCorePoolSize());
SCHEDULER.setThreadPriority(Thread.NORM_PRIORITY - 1); SCHEDULER.setThreadPriority(Thread.NORM_PRIORITY - 1);
SCHEDULER.setWaitForTasksToCompleteOnShutdown(schedulerProps.getWaitForTasksToCompleteOnShutdown()); SCHEDULER.setWaitForTasksToCompleteOnShutdown(schedulerProps.getWaitForTasksToCompleteOnShutdown());
SCHEDULER.setThreadNamePrefix("scheduler-");
SCHEDULER.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); SCHEDULER.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
SCHEDULER.initialize(); SCHEDULER.initialize();
} }


+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java View File

@@ -280,10 +280,7 @@ public class UserInfoManage {
resUserDetail.setStatus(userInfo.getAvailable()); resUserDetail.setStatus(userInfo.getAvailable());
resUserDetail.setEmployeeCode(userInfo.getEmployeeCode()); resUserDetail.setEmployeeCode(userInfo.getEmployeeCode());
resUserDetail.setMhUnitId(userInfo.getMhUnitId()); resUserDetail.setMhUnitId(userInfo.getMhUnitId());
UnitDTO unit = mhUnitCache.getById(userInfo.getMhUnitId());
if (unit != null && unit.getType() != null) {
resUserDetail.setUnitStrip(unit.getType().getStrip().getCode());
}
resUserDetail.setUnitStrip(userDetail.getUnitStrip());
resUserDetail.setMhUnitName(userInfo.getMhUnitName()); resUserDetail.setMhUnitName(userInfo.getMhUnitName());


// 装配用户角色信息列表 // 装配用户角色信息列表
@@ -301,6 +298,9 @@ public class UserInfoManage {
resUserDetail.setUserRoleInfoList(userRoles); resUserDetail.setUserRoleInfoList(userRoles);
} }
resUserDetail.setIsCountyUser(userDetail.getIsCountyUser()); resUserDetail.setIsCountyUser(userDetail.getIsCountyUser());
resUserDetail.setIsCityDistrictUser(userDetail.getIsCityDistrictUser());
resUserDetail.setIsCityDistrictUser(userDetail.getIsCitySoeUser());
resUserDetail.setIsKeyIndustryUser(userDetail.getIsKeyIndustryUser());
return resUserDetail; return resUserDetail;
} }




+ 15
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java View File

@@ -54,4 +54,19 @@ public class ResUserDetailVO {
@ApiModelProperty("是否是区县用户") @ApiModelProperty("是否是区县用户")
private Boolean isCountyUser; private Boolean isCountyUser;


/**
* 是否是市属国有企业用户
*/
private Boolean isCitySoeUser;

/**
* 是否是市级单位用户
*/
private Boolean isCityDistrictUser;

/**
* 是否是重点行业用户
*/
private Boolean isKeyIndustryUser;

} }

+ 17
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java View File

@@ -57,6 +57,23 @@ public class UserFullInfoDTO {
private Boolean isCountyUser; private Boolean isCountyUser;


/** /**
* 是否是市属国有企业
*/
private Boolean isCitySoeUser;

/**
* 是否是市级单位
*/
private Boolean isCityDistrictUser;

/**
* 是否是重点行业
*/
private Boolean isKeyIndustryUser;

private Integer unitStrip;

/**
* 取最高的权限 * 取最高的权限
* *
* @return \ * @return \


+ 17
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java View File

@@ -62,6 +62,23 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
*/ */
private Boolean isCountyUser; private Boolean isCountyUser;


/**
* 是否是市属国有企业
*/
private Boolean isCitySoeUser;

/**
* 是否是市级单位
*/
private Boolean isCityDistrictUser;

/**
* 是否是重点行业
*/
private Boolean isKeyIndustryUser;

private Integer unitStrip;

public String getUserIdStr() { public String getUserIdStr() {
return String.valueOf(getUserId()); return String.valueOf(getUserId());
} }


Loading…
Cancel
Save