优化过滤短信接收者的逻辑
This commit is contained in:
parent
431d8aac0d
commit
c9c7c6ccdf
@ -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<SysUserEntity> sysUserList = sysUserDao.findAll();
|
||||
List<RelRoleAuthorityEntity> adminList = relRoleAuthorityDao.selectByAuthorityId(1);
|
||||
boolean normalSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(9L);
|
||||
boolean vipSmsEnable = 1L == globalConfigService.selectGlobalConfigValue(10L);
|
||||
List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList, adminList, normalSmsEnable, vipSmsEnable);
|
||||
List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePointEntity.getStreetCode(), sysUserList, normalSmsEnable, vipSmsEnable);
|
||||
// //推送
|
||||
// try {
|
||||
// List<String> userAccountList = pushHelper.obtainUserAccountList(smsReceiverList);
|
||||
|
@ -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<SysUserEntity> filterSmsReceiver(String firePointStreetCode, List<SysUserEntity> sysUserList, List<RelRoleAuthorityEntity> adminList, boolean normalSmsEnable, boolean vipSmsEnable) {
|
||||
public static List<SysUserEntity> filterSmsReceiver(String firePointStreetCode, List<SysUserEntity> sysUserList, boolean normalSmsEnable, boolean vipSmsEnable) {
|
||||
List<SysUserEntity> 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<RelRoleAuthorityEntity> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对短信通知收信人进行分组
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user