From 0d556835335ed6fa104b50488f4149283b9c0d19 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Fri, 10 Mar 2023 17:42:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=85=B3=E9=97=AD=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=8E=A8=E9=80=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/helper/FirePointPushManager.java | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/xkrs/helper/FirePointPushManager.java b/src/main/java/com/xkrs/helper/FirePointPushManager.java index c10d690..12f74c4 100644 --- a/src/main/java/com/xkrs/helper/FirePointPushManager.java +++ b/src/main/java/com/xkrs/helper/FirePointPushManager.java @@ -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 sysUserList = sysUserDao.findAll(); - List smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePoint.getTownCode(), sysUserList); -// //推送 -// try { -// List userAccountList = pushHelper.obtainUserAccountList(smsReceiverList); -// pushHelper.dispatchPushMessage(userAccountList, firePointEntity); -// } catch (Exception e) { -// e.printStackTrace(); +// //发送微信群聊消息 +// sendWeChatGroupMessage(firePoint); +// +// if (precise) { +// //过滤短信通知收件人 +// List sysUserList = sysUserDao.findAll(); +// List smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePoint.getTownCode(), sysUserList); +//// //推送 +//// try { +//// List 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 {