From 8cb4fb04c4bd4c1ddd28afc68aebba9eaf3e2f86 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 2 Nov 2023 16:42:01 +0800 Subject: [PATCH] =?UTF-8?q?debug=20=E8=BF=90=E7=BB=B4=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/EarlyWarningInstanceNotStartTask.java | 4 ++-- .../com/ningdatech/pmapi/sys/manage/RoleManage.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java index 214084e..b88cffa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -414,11 +414,11 @@ public class EarlyWarningInstanceNotStartTask { for(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){ Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode()); //去预警通知 发给区管 - List users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name()); + List users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name(),needToWaringProject.getRegionCode()); for(UserInfo user : users){ earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,null, needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, - WarningRuleTypeEnum.OPERATION_WARNING.getCode()); + WarningRuleTypeEnum.RENEWAL_FUND.getCode()); } } }); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java index 8e7d9c7..29e765e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java @@ -106,4 +106,23 @@ public class RoleManage { .collect(Collectors.toList()); return userInfoService.listByIds(userIds); } + + public List getUsersByRoleType(String roleType,String regionCode) { + Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) + .eq(Role::getCode, roleType) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(regionRole)){ + return Collections.emptyList(); + } + List userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getRoleId, regionRole.getId())); + if(CollUtil.isEmpty(userRoles)){ + return Collections.emptyList(); + } + List userIds = userRoles.stream().map(UserRole::getUserId) + .collect(Collectors.toList()); + return userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) + .in(UserInfo::getId,userIds) + .eq(UserInfo::getRegionCode,regionCode)); + } }