暂时关闭消息推送功能

This commit is contained in:
liuchengqian 2023-03-10 17:42:13 +08:00
parent b6bf402c2c
commit 0d55683533

View File

@ -1,15 +1,15 @@
package com.xkrs.helper;
import com.xkrs.dao.CountyCodeWeiXinDao;
import com.xkrs.model.entity.CountyCodeWeiXinEntity;
import com.xkrs.dao.SysUserDao;
import com.xkrs.model.entity.CountyCodeWeiXinEntity;
import com.xkrs.model.entity.FirePointOrdinaryEntity;
import com.xkrs.model.entity.FirePointPreciseEntity;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.helper.PushHelper;
import com.xkrs.model.vo.AllFirePointVo;
import com.xkrs.utilsnew.FirePointConvertUtils;
import com.xkrs.utilsnew.FirePointCodeUtils;
import com.xkrs.utilsnew.FirePointConvertUtils;
import com.xkrs.utilsnew.SMSUtils;
import com.xkrs.utilsnew.WeiXinMessageUtils;
import org.slf4j.Logger;
@ -44,48 +44,48 @@ public class FirePointPushManager {
}
private void pushNotification(AllFirePointVo firePoint, boolean precise) {
//发送微信群聊消息
sendWeChatGroupMessage(firePoint);
if (precise && firePoint.getLandType().contains("耕地")) {
//过滤短信通知收件人
List<SysUserEntity> sysUserList = sysUserDao.findAll();
List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePoint.getTownCode(), sysUserList);
// //推送
// try {
// List<String> userAccountList = pushHelper.obtainUserAccountList(smsReceiverList);
// pushHelper.dispatchPushMessage(userAccountList, firePointEntity);
// } catch (Exception e) {
// e.printStackTrace();
// //发送微信群聊消息
// sendWeChatGroupMessage(firePoint);
//
// if (precise) {
// //过滤短信通知收件人
// List<SysUserEntity> sysUserList = sysUserDao.findAll();
// List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePoint.getTownCode(), sysUserList);
//// //推送
//// try {
//// List<String> userAccountList = pushHelper.obtainUserAccountList(smsReceiverList);
//// pushHelper.dispatchPushMessage(userAccountList, firePointEntity);
//// } catch (Exception e) {
//// e.printStackTrace();
//// }
// if (smsReceiverList.size() > 0) {
// String[] telephoneArray = new String[smsReceiverList.size()];
// for (int i = 0; i < smsReceiverList.size(); i++) {
// telephoneArray[i] = "86" + smsReceiverList.get(i).getUserName();
// }
// int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", new String[]{firePoint.getFirePointAddress()});
// String sendResult;
// if (resValue == 0) {
// //联系人列表发送短信成功在数据库中的已发短信数量字段加一
// for (SysUserEntity smsReceiver : smsReceiverList) {
// smsReceiver.setReceiveSmsCount(smsReceiver.getReceiveSmsCount() + 1);
// }
// sysUserDao.saveAll(smsReceiverList);
// sendResult = "短信通知发送成功!";
// } else {
// sendResult = "短信通知发送失败!";
// }
// //记录短信通知日志
// StringBuilder stringBuilder = new StringBuilder("发送人:青岛星科瑞升信息科技有限公司\n");
// for (String telephone : telephoneArray) {
// stringBuilder.append("接收人:").append(telephone).append("\n");
// }
// stringBuilder.append("模板参数:").append(firePoint.getFirePointAddress()).append("\n");
// stringBuilder.append("超级详细的参数:").append(firePoint.toString()).append("\n");
// stringBuilder.append(sendResult);
// log.info(stringBuilder.toString());
// }
// }
if (smsReceiverList.size() > 0) {
String[] telephoneArray = new String[smsReceiverList.size()];
for (int i = 0; i < smsReceiverList.size(); i++) {
telephoneArray[i] = "86" + smsReceiverList.get(i).getUserName();
}
int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", new String[]{firePoint.getFirePointAddress()});
String sendResult;
if (resValue == 0) {
//联系人列表发送短信成功在数据库中的已发短信数量字段加一
for (SysUserEntity smsReceiver : smsReceiverList) {
smsReceiver.setReceiveSmsCount(smsReceiver.getReceiveSmsCount() + 1);
}
sysUserDao.saveAll(smsReceiverList);
sendResult = "短信通知发送成功!";
} else {
sendResult = "短信通知发送失败!";
}
//记录短信通知日志
StringBuilder stringBuilder = new StringBuilder("发送人:青岛星科瑞升信息科技有限公司\n");
for (String telephone : telephoneArray) {
stringBuilder.append("接收人:").append(telephone).append("\n");
}
stringBuilder.append("模板参数:").append(firePoint.getFirePointAddress()).append("\n");
stringBuilder.append("超级详细的参数:").append(firePoint.toString()).append("\n");
stringBuilder.append(sendResult);
log.info(stringBuilder.toString());
}
}
}
/**
@ -118,7 +118,7 @@ public class FirePointPushManager {
String countyName = firePoint.getCountyName();
String streetName = firePoint.getTownName();
String landType = firePoint.getLandType();
String messageContent = firePoint.getSatelliteType() + "发现1个火点。\n卫星时间" + satelliteTime + "\nlongitude" + formatLongitude + "\nlatitude" + formatLatitude + "\ncountyName" + countyName + "\nstreetName" + streetName + "\nlandType" + landType;
String messageContent = "星巡-秸秆焚烧卫星监测系统\n" + firePoint.getSatelliteType() + "发现1个火点。\n卫星时间" + satelliteTime + "\nlongitude" + formatLongitude + "\nlatitude" + formatLatitude + "\ncountyName" + countyName + "\nstreetName" + streetName + "\nlandType" + landType;
for (String weixinId : weixinIdList) {
stringBuilder.append(weixinId).append("\n");
try {