替换旧代码

This commit is contained in:
liuchengqian 2023-02-14 17:23:45 +08:00
parent 51edb2e4e8
commit e7af80b564
3 changed files with 22 additions and 14 deletions

View File

@ -180,9 +180,7 @@ public class FirePointServiceImpl implements FirePointService {
if ("耕地".equals(firePointEntity.getLandType())) { if ("耕地".equals(firePointEntity.getLandType())) {
//过滤短信通知收件人 //过滤短信通知收件人
List<SysUserEntity> sysUserList = sysUserDao.findAll(); List<SysUserEntity> sysUserList = sysUserDao.findAll();
boolean normalSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(9L); List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList);
boolean vipSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(10L);
List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList, normalSmsEnable, vipSmsEnable);
// //推送 // //推送
// try { // try {
// List<String> userAccountList = pushHelper.obtainUserAccountList(smsReceiverList); // List<String> userAccountList = pushHelper.obtainUserAccountList(smsReceiverList);

View File

@ -83,6 +83,11 @@ public class SysUserEntity implements Serializable {
*/ */
private Integer receiveSms; private Integer receiveSms;
/**
* 一共接收了多少条短信
*/
private Long receiveSmsCount;
/** /**
* 备注 * 备注
*/ */
@ -230,6 +235,14 @@ public class SysUserEntity implements Serializable {
this.receiveSms = receiveSms; this.receiveSms = receiveSms;
} }
public Long getReceiveSmsCount() {
return receiveSmsCount;
}
public void setReceiveSmsCount(Long receiveSmsCount) {
this.receiveSmsCount = receiveSmsCount;
}
public String getRemark() { public String getRemark() {
return remark; return remark;
} }
@ -273,6 +286,7 @@ public class SysUserEntity implements Serializable {
", userAgent='" + userAgent + '\'' + ", userAgent='" + userAgent + '\'' +
", vipLevel=" + vipLevel + ", vipLevel=" + vipLevel +
", receiveSms=" + receiveSms + ", receiveSms=" + receiveSms +
", receiveSmsCount=" + receiveSmsCount +
", remark='" + remark + '\'' + ", remark='" + remark + '\'' +
", pushId='" + pushId + '\'' + ", pushId='" + pushId + '\'' +
", vipTimeRangeJson='" + vipTimeRangeJson + '\'' + ", vipTimeRangeJson='" + vipTimeRangeJson + '\'' +

View File

@ -33,11 +33,9 @@ public class FirePointCodeUtils {
* *
* @param firePointStreetCode 火点的街道编号 * @param firePointStreetCode 火点的街道编号
* @param sysUserList 系统用户列表 * @param sysUserList 系统用户列表
* @param normalSmsEnable 普通用户能否接收短信通知
* @param vipSmsEnable VIP用户能否接收短信通知
* @return 短信通知收信人列表 * @return 短信通知收信人列表
*/ */
public static List<SysUserEntity> filterSmsReceiver(String firePointStreetCode, List<SysUserEntity> sysUserList, boolean normalSmsEnable, boolean vipSmsEnable) { public static List<SysUserEntity> filterSmsReceiver(String firePointStreetCode, List<SysUserEntity> sysUserList) {
List<SysUserEntity> smsReceiverList = new ArrayList<>(); List<SysUserEntity> smsReceiverList = new ArrayList<>();
if (sysUserList == null || sysUserList.isEmpty()) { if (sysUserList == null || sysUserList.isEmpty()) {
return smsReceiverList; return smsReceiverList;
@ -56,14 +54,12 @@ public class FirePointCodeUtils {
continue; continue;
} }
boolean inVipTimeRange = VipTimeRangeUtils.checkIfInVipTimeRange(sysUser.getVipTimeRangeJson()); boolean inVipTimeRange = VipTimeRangeUtils.checkIfInVipTimeRange(sysUser.getVipTimeRangeJson());
if (inVipTimeRange) {
LocalDateTime sysUserOverDateTime = DateTimeUtil.stringToDateTimeFormatter(sysUser.getOverTime(), DateTimeUtil.COMMON_FORMATTER_DATETIME); //VIP用户可以接收短信
if (sysUserOverDateTime.isBefore(LocalDateTime.now())) {
if (!normalSmsEnable) {//根据配置信息决定普通用户是否发送短信
continue;
}
} else { } else {
if (!vipSmsEnable) {//根据配置信息决定VIP用户是否发送短信 //普通用户可以接收3条短信
Long receiveSmsCount = sysUser.getReceiveSmsCount();
if (receiveSmsCount != null && receiveSmsCount>=3) {
continue; continue;
} }
} }