From e7af80b564b264d9eae2ee11f42d30ef8f2676ae Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 14 Feb 2023 17:23:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E6=97=A7=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/service/impl/FirePointServiceImpl.java | 4 +--- .../xkrs/straw/model/entity/SysUserEntity.java | 16 +++++++++++++++- .../java/com/xkrs/utils/FirePointCodeUtils.java | 16 ++++++---------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index e541c45..9b324e8 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -180,9 +180,7 @@ public class FirePointServiceImpl implements FirePointService { if ("耕地".equals(firePointEntity.getLandType())) { //过滤短信通知收件人 List sysUserList = sysUserDao.findAll(); - boolean normalSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(9L); - boolean vipSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(10L); - List smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList, normalSmsEnable, vipSmsEnable); + List smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList); // //推送 // try { // List userAccountList = pushHelper.obtainUserAccountList(smsReceiverList); diff --git a/src/main/java/com/xkrs/straw/model/entity/SysUserEntity.java b/src/main/java/com/xkrs/straw/model/entity/SysUserEntity.java index 2ad7516..ba775f3 100644 --- a/src/main/java/com/xkrs/straw/model/entity/SysUserEntity.java +++ b/src/main/java/com/xkrs/straw/model/entity/SysUserEntity.java @@ -83,6 +83,11 @@ public class SysUserEntity implements Serializable { */ private Integer receiveSms; + /** + * 一共接收了多少条短信 + */ + private Long receiveSmsCount; + /** * 备注 */ @@ -230,6 +235,14 @@ public class SysUserEntity implements Serializable { this.receiveSms = receiveSms; } + public Long getReceiveSmsCount() { + return receiveSmsCount; + } + + public void setReceiveSmsCount(Long receiveSmsCount) { + this.receiveSmsCount = receiveSmsCount; + } + public String getRemark() { return remark; } @@ -273,9 +286,10 @@ public class SysUserEntity implements Serializable { ", userAgent='" + userAgent + '\'' + ", vipLevel=" + vipLevel + ", receiveSms=" + receiveSms + + ", receiveSmsCount=" + receiveSmsCount + ", remark='" + remark + '\'' + ", pushId='" + pushId + '\'' + ", vipTimeRangeJson='" + vipTimeRangeJson + '\'' + '}'; } -} +} \ No newline at end of file diff --git a/src/main/java/com/xkrs/utils/FirePointCodeUtils.java b/src/main/java/com/xkrs/utils/FirePointCodeUtils.java index 69352dd..9c7e85c 100644 --- a/src/main/java/com/xkrs/utils/FirePointCodeUtils.java +++ b/src/main/java/com/xkrs/utils/FirePointCodeUtils.java @@ -33,11 +33,9 @@ public class FirePointCodeUtils { * * @param firePointStreetCode 火点的街道编号 * @param sysUserList 系统用户列表 - * @param normalSmsEnable 普通用户能否接收短信通知 - * @param vipSmsEnable VIP用户能否接收短信通知 * @return 短信通知收信人列表 */ - public static List filterSmsReceiver(String firePointStreetCode, List sysUserList, boolean normalSmsEnable, boolean vipSmsEnable) { + public static List filterSmsReceiver(String firePointStreetCode, List sysUserList) { List smsReceiverList = new ArrayList<>(); if (sysUserList == null || sysUserList.isEmpty()) { return smsReceiverList; @@ -56,14 +54,12 @@ public class FirePointCodeUtils { continue; } boolean inVipTimeRange = VipTimeRangeUtils.checkIfInVipTimeRange(sysUser.getVipTimeRangeJson()); - - LocalDateTime sysUserOverDateTime = DateTimeUtil.stringToDateTimeFormatter(sysUser.getOverTime(), DateTimeUtil.COMMON_FORMATTER_DATETIME); - if (sysUserOverDateTime.isBefore(LocalDateTime.now())) { - if (!normalSmsEnable) {//根据配置信息决定普通用户是否发送短信 - continue; - } + if (inVipTimeRange) { + //VIP用户可以接收短信 } else { - if (!vipSmsEnable) {//根据配置信息决定VIP用户是否发送短信 + //普通用户可以接收3条短信 + Long receiveSmsCount = sysUser.getReceiveSmsCount(); + if (receiveSmsCount != null && receiveSmsCount>=3) { continue; } }