将火点消息通知用户

This commit is contained in:
liuchengqian 2023-04-26 09:18:54 +08:00
parent 37607bcbc1
commit c74f9ee503
2 changed files with 80 additions and 67 deletions

View File

@ -35,9 +35,11 @@ public class FirePointPushManager {
private PushHelper pushHelper; private PushHelper pushHelper;
public void pushNotification(FirePointOrdinaryEntity firePoint) { public void pushNotification(FirePointOrdinaryEntity firePoint) {
//发送微信群聊消息 //发送微信群聊消息
sendWeChatGroupMessage(firePoint); sendWeChatGroupMessage(firePoint);
try {
//过滤短信通知收件人 //过滤短信通知收件人
List<SysUserEntity> sysUserList = sysUserDao.findAll(); List<SysUserEntity> sysUserList = sysUserDao.findAll();
List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePoint.getTownCode(), sysUserList); List<SysUserEntity> smsReceiverList = FirePointCodeUtils.filterSmsReceiver(firePoint.getTownCode(), sysUserList);
@ -83,12 +85,18 @@ public class FirePointPushManager {
builder.append("结束统计发送短信").append(nowTime).append("\n"); builder.append("结束统计发送短信").append(nowTime).append("\n");
log.info(builder.toString()); log.info(builder.toString());
} }
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage());
}
} }
/** /**
* 发送微信消息 * 发送微信消息
*/ */
private void sendWeChatGroupMessage(FirePointOrdinaryEntity firePoint) { private void sendWeChatGroupMessage(FirePointOrdinaryEntity firePoint) {
try {
List<CountyCodeWeiXinEntity> countyCodeWeiXinList = countyCodeWeiXinDao.findAll(); List<CountyCodeWeiXinEntity> countyCodeWeiXinList = countyCodeWeiXinDao.findAll();
if (countyCodeWeiXinList.isEmpty()) { if (countyCodeWeiXinList.isEmpty()) {
return; return;
@ -127,6 +135,10 @@ public class FirePointPushManager {
stringBuilder.append("火情信息:").append(messageContent); stringBuilder.append("火情信息:").append(messageContent);
log.info(stringBuilder.toString()); log.info(stringBuilder.toString());
} }
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage());
}
} }
} }

View File

@ -119,6 +119,7 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
firePointOrdinaryEntity.setTownName(addressBean.getTownName()); firePointOrdinaryEntity.setTownName(addressBean.getTownName());
firePointOrdinaryEntity.setFirePointAddress(addressBean.getFirePointAddress()); firePointOrdinaryEntity.setFirePointAddress(addressBean.getFirePointAddress());
firePointOrdinaryDao.save(firePointOrdinaryEntity); firePointOrdinaryDao.save(firePointOrdinaryEntity);
firePointPushManager.pushNotification(firePointOrdinaryEntity);//将火点消息通知用户
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale);
} }
ErrorInfoLogUtils.log("高德逆地理编码异常,出现问题的火点详情:" + firePointOrdinaryEntity.toString()); ErrorInfoLogUtils.log("高德逆地理编码异常,出现问题的火点详情:" + firePointOrdinaryEntity.toString());
@ -134,6 +135,7 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
firePointOrdinaryEntity.setCountyName(countyName); firePointOrdinaryEntity.setCountyName(countyName);
firePointOrdinaryEntity.setTownCode(townCode); firePointOrdinaryEntity.setTownCode(townCode);
firePointOrdinaryDao.save(firePointOrdinaryEntity); firePointOrdinaryDao.save(firePointOrdinaryEntity);
firePointPushManager.pushNotification(firePointOrdinaryEntity);//将火点消息通知用户
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale);
} }
@ -181,7 +183,6 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
FirePointOrdinaryEntity firePoint = firePointList.get(0); FirePointOrdinaryEntity firePoint = firePointList.get(0);
firePoint.setFireStatus(status);//设置火点的研判标志属性 firePoint.setFireStatus(status);//设置火点的研判标志属性
firePointOrdinaryDao.save(firePoint);//数据库保存 firePointOrdinaryDao.save(firePoint);//数据库保存
firePointPushManager.pushNotification(firePoint);//将火点消息通知用户
} else { } else {
ErrorInfoLogUtils.log("操作异常审核系统发送的fireCode在秸秆系统中size() != 1fireCode = " + fireCode + "status = " + fireCode); ErrorInfoLogUtils.log("操作异常审核系统发送的fireCode在秸秆系统中size() != 1fireCode = " + fireCode + "status = " + fireCode);
} }