From 3c4abdc34adc17300e8877030397f16bca3b8d05 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 30 Aug 2024 15:10:56 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E5=A2=9E=E5=8A=A0=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=8C=BA=E5=8E=BF=E7=94=A8=E6=88=B7=E3=80=81=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=9B=BD=E6=9C=89=E4=BC=81=E4=B8=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E3=80=81=E6=98=AF=E5=90=A6=E9=87=8D=E7=82=B9=E8=A1=8C=E4=B8=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E3=80=81=E6=98=AF=E5=90=A6=E5=B8=82=E6=9C=AC?= =?UTF-8?q?=E7=BA=A7=E7=94=A8=E6=88=B7=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/common/helper/impl/UserInfoHelperImpl.java | 30 +++++++++++++++++++--- .../pm/api/common/model/constant/MhUnitConst.java | 16 ++++++++++++ .../com/hz/pm/api/common/util/ThreadPoolUtil.java | 1 - .../com/hz/pm/api/user/manage/UserInfoManage.java | 8 +++--- .../hz/pm/api/user/model/vo/ResUserDetailVO.java | 15 +++++++++++ .../api/user/security/model/UserFullInfoDTO.java | 17 ++++++++++++ .../api/user/security/model/UserInfoDetails.java | 17 ++++++++++++ 7 files changed, 95 insertions(+), 9 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java index 26eb4a7..38a3716 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java @@ -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.service.IUserRoleService; 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.enumeration.RoleEnum; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; @@ -76,8 +77,29 @@ public class UserInfoHelperImpl implements UserInfoHelper { .collect(Collectors.toList()); userFullInfo.setUserRoleList(roleMapper.selectBatchIds(roleIdList)); } - List 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 citySoeUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.CITY_SOE_UNIT_ID); + userFullInfo.setIsCitySoeUser(citySoeUnitIds.contains(userInfo.getMhUnitId())); + if (!userFullInfo.getIsCitySoeUser()) { + // 是否关键行业部门下用户 + List keyIndustryUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.KEY_INDUSTRY_UNIT_ID); + userFullInfo.setIsKeyIndustryUser(keyIndustryUnitIds.contains(userInfo.getMhUnitId())); + if (!userFullInfo.getIsKeyIndustryUser()) { + // 是否区县部门下用户 + List countyUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.COUNTY_PARENT_UNIT_ID); + userFullInfo.setIsCountyUser(countyUnitIds.contains(userInfo.getMhUnitId())); + if (!userFullInfo.getIsCountyUser()) { + // 是否市本级用户 + List cityDistrictUnitIds = mhUnitCache.getViewChildIdsRecursion(MhUnitConst.CITY_DISTRICT_UNIT_ID); + userFullInfo.setIsCityDistrictUser(cityDistrictUnitIds.contains(userInfo.getMhUnitId())); + } + } + } + } + // 装配返回 userFullInfo.setUserId(userInfo.getId()); userFullInfo.setMhUserId(userInfo.getMhUserId()); @@ -109,7 +131,7 @@ public class UserInfoHelperImpl implements UserInfoHelper { return userInfos.stream().map(this::convert).collect(Collectors.toList()); } - private UserFullInfoDTO convert(UserInfo userInfo){ + private UserFullInfoDTO convert(UserInfo userInfo) { UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); // 装配返回 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" + " and nur.role_id = {0}", role.getId()); List userInfos = userInfoService.list(query); - return CollUtils.convert(userInfos,this::convert); + return CollUtils.convert(userInfos, this::convert); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/MhUnitConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/MhUnitConst.java index 7222c3b..006b741 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/MhUnitConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/MhUnitConst.java @@ -16,6 +16,22 @@ public class 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 ROOT_UNIT_ID = 1; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ThreadPoolUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ThreadPoolUtil.java index a09fb84..a883990 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ThreadPoolUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ThreadPoolUtil.java @@ -46,7 +46,6 @@ public class ThreadPoolUtil { SCHEDULER.setPoolSize(schedulerProps.getCorePoolSize()); SCHEDULER.setThreadPriority(Thread.NORM_PRIORITY - 1); SCHEDULER.setWaitForTasksToCompleteOnShutdown(schedulerProps.getWaitForTasksToCompleteOnShutdown()); - SCHEDULER.setThreadNamePrefix("scheduler-"); SCHEDULER.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); SCHEDULER.initialize(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index a747909..979d7d7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -280,10 +280,7 @@ public class UserInfoManage { resUserDetail.setStatus(userInfo.getAvailable()); resUserDetail.setEmployeeCode(userInfo.getEmployeeCode()); 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()); // 装配用户角色信息列表 @@ -301,6 +298,9 @@ public class UserInfoManage { resUserDetail.setUserRoleInfoList(userRoles); } resUserDetail.setIsCountyUser(userDetail.getIsCountyUser()); + resUserDetail.setIsCityDistrictUser(userDetail.getIsCityDistrictUser()); + resUserDetail.setIsCityDistrictUser(userDetail.getIsCitySoeUser()); + resUserDetail.setIsKeyIndustryUser(userDetail.getIsKeyIndustryUser()); return resUserDetail; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java index 4f80066..f95c6fe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java @@ -54,4 +54,19 @@ public class ResUserDetailVO { @ApiModelProperty("是否是区县用户") private Boolean isCountyUser; + /** + * 是否是市属国有企业用户 + */ + private Boolean isCitySoeUser; + + /** + * 是否是市级单位用户 + */ + private Boolean isCityDistrictUser; + + /** + * 是否是重点行业用户 + */ + private Boolean isKeyIndustryUser; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java index d76d3f7..0d617b7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java @@ -57,6 +57,23 @@ public class UserFullInfoDTO { private Boolean isCountyUser; /** + * 是否是市属国有企业 + */ + private Boolean isCitySoeUser; + + /** + * 是否是市级单位 + */ + private Boolean isCityDistrictUser; + + /** + * 是否是重点行业 + */ + private Boolean isKeyIndustryUser; + + private Integer unitStrip; + + /** * 取最高的权限 * * @return \ diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java index ed9b669..ad4e611 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java @@ -62,6 +62,23 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { */ private Boolean isCountyUser; + /** + * 是否是市属国有企业 + */ + private Boolean isCitySoeUser; + + /** + * 是否是市级单位 + */ + private Boolean isCityDistrictUser; + + /** + * 是否是重点行业 + */ + private Boolean isKeyIndustryUser; + + private Integer unitStrip; + public String getUserIdStr() { return String.valueOf(getUserId()); }