From c9c7c6ccdf5f8a61d38774d772b383beeef84283 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 30 Jan 2023 14:07:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=87=E6=BB=A4=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1=E6=8E=A5=E6=94=B6=E8=80=85=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FirePointServiceImpl.java | 6 +--- .../com/xkrs/utils/FirePointCodeUtils.java | 28 +++++-------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 566123b..387af11 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -65,9 +65,6 @@ public class FirePointServiceImpl implements FirePointService { @Resource private CountyCodeWeiXinDao countyCodeWeiXinDao; - @Resource - private RelRoleAuthorityDao relRoleAuthorityDao; - @Resource private FirePointQueryHelper firePointQueryHelper; @@ -279,10 +276,9 @@ public class FirePointServiceImpl implements FirePointService { if ("耕地".equals(firePointEntity.getLandType())) { //过滤短信通知收件人 List sysUserList = sysUserDao.findAll(); - List adminList = relRoleAuthorityDao.selectByAuthorityId(1); boolean normalSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(9L); boolean vipSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(10L); - List smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList, adminList, normalSmsEnable, vipSmsEnable); + List smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList, normalSmsEnable, vipSmsEnable); // //推送 // try { // List userAccountList = pushHelper.obtainUserAccountList(smsReceiverList); diff --git a/src/main/java/com/xkrs/utils/FirePointCodeUtils.java b/src/main/java/com/xkrs/utils/FirePointCodeUtils.java index 32d67ff..3e0c291 100644 --- a/src/main/java/com/xkrs/utils/FirePointCodeUtils.java +++ b/src/main/java/com/xkrs/utils/FirePointCodeUtils.java @@ -1,7 +1,6 @@ package com.xkrs.utils; import com.xkrs.model.entity.AgentOrgEntity; -import com.xkrs.model.entity.RelRoleAuthorityEntity; import com.xkrs.model.entity.SysUserEntity; import org.apache.hc.core5.util.TextUtils; @@ -36,12 +35,11 @@ public class FirePointCodeUtils { * * @param firePointStreetCode 火点的街道编号 * @param sysUserList 系统用户列表 - * @param adminList 管理员列表 * @param normalSmsEnable 普通用户能否接收短信通知 * @param vipSmsEnable VIP用户能否接收短信通知 * @return 短信通知收信人列表 */ - public static List filterSmsReceiver(String firePointStreetCode, List sysUserList, List adminList, boolean normalSmsEnable, boolean vipSmsEnable) { + public static List filterSmsReceiver(String firePointStreetCode, List sysUserList, boolean normalSmsEnable, boolean vipSmsEnable) { List smsReceiverList = new ArrayList<>(); if (sysUserList == null || sysUserList.isEmpty()) { return smsReceiverList; @@ -59,6 +57,12 @@ public class FirePointCodeUtils { if (sysUser.getReceiveSms() != 1) {//关掉开关的用户不发短信 continue; } + if (sysUser.getStatusCode() != 0) {//状态不正常的用户不发短信 + continue; + } + if ("管理员".equals(sysUser.getAccountType())) {//管理员用户不发短信 + continue; + } LocalDateTime sysUserOverDateTime = DateTimeUtil.stringToDateTimeFormatter(sysUser.getOverTime(), DateTimeUtil.COMMON_FORMATTER_DATETIME); if (sysUserOverDateTime.isBefore(DateTimeUtil.getNowTime())) { if (!normalSmsEnable) {//根据配置信息决定普通用户是否发送短信 @@ -69,9 +73,6 @@ public class FirePointCodeUtils { continue; } } - if (isAdmin(adminList, sysUser)) {//管理员用户不发短信 - continue; - } smsReceiverList.add(sysUser); } } catch (Exception e) { @@ -81,21 +82,6 @@ public class FirePointCodeUtils { return smsReceiverList; } - /** - * 判断是否是管理员 - */ - private static boolean isAdmin(List administratorList, SysUserEntity sysUser) { - if (administratorList == null || administratorList.size() == 0) { - return false; - } - for (RelRoleAuthorityEntity administrator : administratorList) { - if (administrator.getUserId().intValue() == sysUser.getId().intValue()) { - return true; - } - } - return false; - } - /** * 对短信通知收信人进行分组 */