替换旧代码

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())) {
//过滤短信通知收件人
List<SysUserEntity> sysUserList = sysUserDao.findAll();
boolean normalSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(9L);
boolean vipSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(10L);
List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList, normalSmsEnable, vipSmsEnable);
List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList);
// //推送
// try {
// List<String> userAccountList = pushHelper.obtainUserAccountList(smsReceiverList);

View File

@ -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,6 +286,7 @@ public class SysUserEntity implements Serializable {
", userAgent='" + userAgent + '\'' +
", vipLevel=" + vipLevel +
", receiveSms=" + receiveSms +
", receiveSmsCount=" + receiveSmsCount +
", remark='" + remark + '\'' +
", pushId='" + pushId + '\'' +
", vipTimeRangeJson='" + vipTimeRangeJson + '\'' +

View File

@ -33,11 +33,9 @@ public class FirePointCodeUtils {
*
* @param firePointStreetCode 火点的街道编号
* @param sysUserList 系统用户列表
* @param normalSmsEnable 普通用户能否接收短信通知
* @param vipSmsEnable VIP用户能否接收短信通知
* @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<>();
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;
}
}