|
|
@@ -1,5 +1,6 @@
|
|
|
package com.zd.chemical.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
@@ -441,7 +442,14 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
}
|
|
|
//按照配置预警
|
|
|
if (illegalRemoval != null) {
|
|
|
- String text = "【实验室安全系统】" + warningNoticeLogDto.getSubName() + "-实验人员违规携带" + warningNoticeLogDto.getName() + "离开房间,发生时间:" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss") + ",请尽快确认。";
|
|
|
+ String date_s = LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss");
|
|
|
+ String templateContent = "【忠江科技】{lab_name}- -实验人员违规携带 {name} 离开房间,发生时间:{date},请尽快确认。";
|
|
|
+ String text = "【忠江科技】" + warningNoticeLogDto.getSubName() + "-实验人员违规携带" + warningNoticeLogDto.getName() + "离开房间,发生时间:" + date_s + ",请尽快确认。";
|
|
|
+
|
|
|
+ List<String> paramList=new ArrayList<>();
|
|
|
+ paramList.add(warningNoticeLogDto.getSubName());
|
|
|
+ paramList.add(warningNoticeLogDto.getName());
|
|
|
+ paramList.add(date_s);
|
|
|
//系统通知
|
|
|
if (illegalRemoval.contains("1")) {
|
|
|
LabMessageContent labMessageContent = new LabMessageContent();
|
|
|
@@ -464,11 +472,23 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
logger.info("获取实验室管理员和安全员信息失败!{}",JSON.toJSONString(listResultData));
|
|
|
}
|
|
|
List<UserPhoneInfo> userPhoneInfoList = listResultData.getData();
|
|
|
- AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.name(), text);
|
|
|
- alarmEntrty.setLogId(logId);
|
|
|
- alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
|
|
|
- remoteAlarmService.send(alarmEntrty);
|
|
|
- logger.info("化学品违规带离发送短信打电话消息推送完成!");
|
|
|
+
|
|
|
+ if(!CollectionUtil.isEmpty(userPhoneInfoList)){
|
|
|
+ TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
+ textMessageVo.setPhoneList(userPhoneInfoList.stream().map(UserPhoneInfo::getPhone).collect(Collectors.toList()));
|
|
|
+ textMessageVo.setTempContent(templateContent);
|
|
|
+ textMessageVo.setVariableList(paramList);
|
|
|
+ textMessageVo.setTempId("142047");
|
|
|
+ remoteSmsService.sendTemplateMessage(textMessageVo);
|
|
|
+ logger.info("化学品违规带离发送短信打电话消息推送完成!");
|
|
|
+ }else{
|
|
|
+ logger.info("短信接收人员为空,请仔细检查");
|
|
|
+ }
|
|
|
+// AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.SMS.name(), text);
|
|
|
+// alarmEntrty.setLogId(logId);
|
|
|
+// alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
|
|
|
+// remoteAlarmService.send(alarmEntrty);
|
|
|
+// logger.info("化学品违规带离发送短信打电话消息推送完成!");
|
|
|
}
|
|
|
}
|
|
|
//电话通知
|
|
|
@@ -481,11 +501,21 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
logger.info("获取实验室管理员和安全员信息失败!{}",JSON.toJSONString(listResultData));
|
|
|
}
|
|
|
List<UserPhoneInfo> userPhoneInfoList = listResultData.getData();
|
|
|
- AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.Call.name(), text);
|
|
|
- alarmEntrty.setLogId(logId);
|
|
|
- alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
|
|
|
- remoteAlarmService.send(alarmEntrty);
|
|
|
- logger.info("化学品违规带离打电话消息推送完成!");
|
|
|
+// AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, SendTypes.Call.name(), text);
|
|
|
+// alarmEntrty.setLogId(logId);
|
|
|
+// alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
|
|
|
+// remoteAlarmService.send(alarmEntrty);
|
|
|
+// logger.info("化学品违规带离打电话消息推送完成!");
|
|
|
+ if(!CollectionUtil.isEmpty(userPhoneInfoList)){
|
|
|
+ TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
+ textMessageVo.setPhoneList(userPhoneInfoList.stream().map(UserPhoneInfo::getPhone).collect(Collectors.toList()));
|
|
|
+ textMessageVo.setTempContent(templateContent);
|
|
|
+ textMessageVo.setVariableList(paramList);
|
|
|
+ remoteSmsService.sendVoiceMessage(textMessageVo);
|
|
|
+ logger.info("化学品违规带离打电话消息推送完成!");
|
|
|
+ }else{
|
|
|
+ logger.info("语音接收人员为空,请仔细检查");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//声光报警
|
|
|
@@ -612,14 +642,24 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
|
|
|
// 判断四医大还是其他学校短信方案
|
|
|
String content;
|
|
|
+ String templateContent = "【忠江科技】 {lab_name} 的化学品:{name}违规带离实验室,请尽快确认!";
|
|
|
if(phoneMode == 0){
|
|
|
- content = "电话报警:" + subName + "的化学品" + chemicalName + "违规带离实验室,请尽快确认!";
|
|
|
- AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, to, content);
|
|
|
- AjaxResult result = remoteAlarmService.send(alarmEntrty);
|
|
|
+// content = "电话报警:" + subName + "的化学品" + chemicalName + "违规带离实验室,请尽快确认!";
|
|
|
+// AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, to, content);
|
|
|
+// AjaxResult result = remoteAlarmService.send(alarmEntrty);
|
|
|
+ List<String> paramList=new ArrayList<>();
|
|
|
+ TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
+ textMessageVo.setPhoneList(Arrays.asList(to));
|
|
|
+ paramList.add(subName);
|
|
|
+ paramList.add(chemicalName);
|
|
|
+ textMessageVo.setVariableList(paramList);
|
|
|
+ textMessageVo.setTempId("142046");
|
|
|
+ textMessageVo.setTempContent(templateContent);
|
|
|
+ remoteSmsService.sendVoiceMessage(textMessageVo);//发送语音
|
|
|
+ remoteSmsService.sendTemplateMessage(textMessageVo);//发送短信
|
|
|
|
|
|
- logger.error(JSONUtil.toJsonStr(result));
|
|
|
}else if(phoneMode == 1){
|
|
|
- content = "【实验室安全系统】" + subName + "-实验人员未领用即携带化学品离开房间,发生时间:"
|
|
|
+ content = "【忠江科技】" + subName + "-实验人员未领用即携带化学品离开房间,发生时间:"
|
|
|
+ DateUtil.format(DateUtil.date(), DateUtils.YYYY_MM_DD_HH_MM_SS)
|
|
|
+ ",请尽快确认。";//短信回复“CL”确认已处理。
|
|
|
try {
|
|
|
@@ -891,13 +931,13 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
logger.info("即将过期保存日志成功!");
|
|
|
}
|
|
|
Long logId = (Long) result.getData();
|
|
|
- String text = "【实验室安全系统】" + warningNoticeLogDto.getSubName() + "-" + warningNoticeLogDto.getName() + "即将过期,发生时间:" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss") + ",请尽快确认。";
|
|
|
+ String text = "【忠江科技】" + warningNoticeLogDto.getSubName() + "-" + warningNoticeLogDto.getName() + "即将过期,发生时间:" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss") + ",请尽快确认。";
|
|
|
List<String> paramList=new ArrayList<>();
|
|
|
paramList.add(warningNoticeLogDto.getSubName());
|
|
|
paramList.add(warningNoticeLogDto.getName());
|
|
|
paramList.add(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
//发送通知
|
|
|
- sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getUnexpired(),text,logId,paramList);
|
|
|
+ sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getUnexpired(),text,logId,paramList,"142030","【忠江科技】{lab_name}-{name} 即将过期,发生时间:{date} ,请尽快确认。");
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -951,12 +991,12 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
logger.info("已过期保存日志成功!");
|
|
|
}
|
|
|
Long logId = (Long)result.getData();
|
|
|
- String text = "【实验室安全系统】"+warningNoticeLogDto.getSubName()+"-"+warningNoticeLogDto.getName()+"已过期,请尽快确认。";
|
|
|
+ String text = "【忠江科技】"+warningNoticeLogDto.getSubName()+"-"+warningNoticeLogDto.getName()+"已过期,请尽快确认。";
|
|
|
List<String> parmList=new ArrayList<>();
|
|
|
parmList.add(warningNoticeLogDto.getSubName());
|
|
|
parmList.add(warningNoticeLogDto.getName());
|
|
|
//发送通知
|
|
|
- sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getExpired(), text, logId,parmList);
|
|
|
+ sendNotice(hxpStock, userIdStr, phones, warningConfigDto.getExpired(), text, logId,parmList,"142031","【忠江科技】{lab_name}-{name}已过期,请尽快确认。");
|
|
|
});
|
|
|
|
|
|
List<Long> stockIds = expiredStock.stream().filter(i -> 1 == i.getStatus()).map(HxpStockVO::getId).collect(Collectors.toList());
|
|
|
@@ -969,7 +1009,19 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void sendNotice(HxpStockVO hxpStock, StringBuffer userIdStr, StringBuffer phones, String expired,String text,Long logId,List<String> paramList) {
|
|
|
+ /**
|
|
|
+ * 2024/4/16 修改 添加模板id和模板内容字段,替换短信平台
|
|
|
+ * @param hxpStock
|
|
|
+ * @param userIdStr
|
|
|
+ * @param phones
|
|
|
+ * @param expired
|
|
|
+ * @param text
|
|
|
+ * @param logId
|
|
|
+ * @param paramList
|
|
|
+ * @param tempId 模板id
|
|
|
+ * @param tempContent 模板内容
|
|
|
+ */
|
|
|
+ private void sendNotice(HxpStockVO hxpStock, StringBuffer userIdStr, StringBuffer phones, String expired,String text,Long logId,List<String> paramList,String tempId,String tempContent) {
|
|
|
if (expired.contains("1")) {
|
|
|
//系统通知
|
|
|
LabMessageContent labMessageContent = new LabMessageContent();
|
|
|
@@ -996,16 +1048,17 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
// alarmEntrty.setLogId(logId);
|
|
|
// alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
|
|
|
// remoteAlarmService.send(alarmEntrty);
|
|
|
- List<String> phoneList=new ArrayList<>();
|
|
|
- userPhoneInfoList.forEach(a->{
|
|
|
- phoneList.add(a.getPhone());
|
|
|
- });
|
|
|
- TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
- textMessageVo.setPhoneList(phoneList);
|
|
|
- textMessageVo.setTempContent(text);
|
|
|
- textMessageVo.setVariableList(paramList);
|
|
|
- remoteSmsService.sendTemplateMessage(textMessageVo);
|
|
|
- logger.info("化学品已过期发送短信打电话消息推送完成!");
|
|
|
+ if(!CollectionUtil.isEmpty(userPhoneInfoList)){
|
|
|
+ TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
+ textMessageVo.setPhoneList(userPhoneInfoList.stream().map(UserPhoneInfo::getPhone).collect(Collectors.toList()));
|
|
|
+ textMessageVo.setTempContent(tempContent);
|
|
|
+ textMessageVo.setVariableList(paramList);
|
|
|
+ textMessageVo.setTempId(tempId);
|
|
|
+ remoteSmsService.sendTemplateMessage(textMessageVo);
|
|
|
+ logger.info("发送短信打电话消息推送完成!");
|
|
|
+ }else{
|
|
|
+ logger.info("短信接收人员为空,请仔细检查");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1084,7 +1137,8 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
logger.info("化学品超时未归还保存日志成功!");
|
|
|
}
|
|
|
Long logId = (Long) result.getData();
|
|
|
- String text ="【实验室安全系统】"+warningNoticeLogDto.getSubName()+"-"+warningNoticeLogDto.getApplyUser()+"领用"+warningNoticeLogDto.getName()+"超时未归还,领用时间:"+LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss") +",请尽快确认。";
|
|
|
+ String text ="【忠江科技】"+warningNoticeLogDto.getSubName()+"-"+warningNoticeLogDto.getApplyUser()+"领用"+warningNoticeLogDto.getName()+"超时未归还,领用时间:"+LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss") +",请尽快确认。";
|
|
|
+ String templateContent = "【忠江科技】{lab_name} - {apply_user} 领用{name}超时未归还,领用时间:{date},请尽快确认。";
|
|
|
if (timeout.contains("1")) {
|
|
|
//系统通知
|
|
|
LabMessageContent labMessageContent = new LabMessageContent();
|
|
|
@@ -1097,12 +1151,14 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
labMessageContent.setContent(text);
|
|
|
remoteMessageContentService.sendMessage(labMessageContent);
|
|
|
}
|
|
|
+
|
|
|
+ List<String> paramList=new ArrayList<>();
|
|
|
+ paramList.add(warningNoticeLogDto.getSubName());
|
|
|
+ paramList.add(warningNoticeLogDto.getApplyUser());
|
|
|
+ paramList.add(warningNoticeLogDto.getName());
|
|
|
+ paramList.add(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+
|
|
|
if (timeout.contains("2")) {
|
|
|
- List<String> paramList=new ArrayList<>();
|
|
|
- paramList.add(warningNoticeLogDto.getSubName());
|
|
|
- paramList.add(warningNoticeLogDto.getApplyUser());
|
|
|
- paramList.add(warningNoticeLogDto.getName());
|
|
|
- paramList.add(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
//短信通知
|
|
|
String[] strings = Stream.of(phones.toString().split(",")).filter(a -> StrUtil.isNotBlank(a)).collect(Collectors.joining(",")).split(",");
|
|
|
if (strings != null) {
|
|
|
@@ -1117,16 +1173,17 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
// alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
|
|
|
// remoteAlarmService.send(alarmEntrty);
|
|
|
//此处改成发短信模式
|
|
|
- List<String> phoneList=new ArrayList<>();
|
|
|
- userPhoneInfoList.forEach(a->{
|
|
|
- phoneList.add(a.getPhone());
|
|
|
- });
|
|
|
- TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
- textMessageVo.setPhoneList(phoneList);
|
|
|
- textMessageVo.setTempContent(text);
|
|
|
- textMessageVo.setVariableList(paramList);
|
|
|
- remoteSmsService.sendTemplateMessage(textMessageVo);
|
|
|
- logger.info("化学品超时未归还发送短信打电话消息推送完成!");
|
|
|
+ if(!CollectionUtil.isEmpty(userPhoneInfoList)){
|
|
|
+ TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
+ textMessageVo.setPhoneList(userPhoneInfoList.stream().map(UserPhoneInfo::getPhone).collect(Collectors.toList()));
|
|
|
+ textMessageVo.setTempContent(templateContent);
|
|
|
+ textMessageVo.setTempId("142034");
|
|
|
+ textMessageVo.setVariableList(paramList);
|
|
|
+ remoteSmsService.sendTemplateMessage(textMessageVo);
|
|
|
+ logger.info("化学品超时未归还发送短信打电话消息推送完成!");
|
|
|
+ }else{
|
|
|
+ logger.info("短信接收人员未空,请仔细检查");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (timeout.contains("5")) {
|
|
|
@@ -1143,15 +1200,16 @@ public class HxpStockServiceImpl implements IHxpStockService {
|
|
|
// alarmEntrty.setLogId(logId);
|
|
|
// alarmEntrty.setUserPhoneInfo(userPhoneInfoList);
|
|
|
// remoteAlarmService.send(alarmEntrty);
|
|
|
- List<String> phoneList=new ArrayList<>();
|
|
|
- userPhoneInfoList.forEach(a->{
|
|
|
- phoneList.add(a.getPhone());
|
|
|
- });
|
|
|
- TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
- textMessageVo.setPhoneList(phoneList);
|
|
|
- textMessageVo.setTempContent(text);
|
|
|
- remoteSmsService.sendVoiceMessage(textMessageVo);
|
|
|
- logger.info("化学品超时未归还打电话消息推送完成!");
|
|
|
+ if(!CollectionUtil.isEmpty(userPhoneInfoList)){
|
|
|
+ TextMessageVo textMessageVo=new TextMessageVo();
|
|
|
+ textMessageVo.setPhoneList(userPhoneInfoList.stream().map(UserPhoneInfo::getPhone).collect(Collectors.toList()));
|
|
|
+ textMessageVo.setTempContent(templateContent);
|
|
|
+ textMessageVo.setVariableList(paramList);
|
|
|
+ remoteSmsService.sendVoiceMessage(textMessageVo);
|
|
|
+ logger.info("化学品超时未归还打电话消息推送完成!");
|
|
|
+ }else{
|
|
|
+ logger.info("电信接收人员未空,请仔细检查");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|