|
|
@@ -9,6 +9,7 @@ import com.zd.algorithm.api.alarm.entity.AlarmEntrty;
|
|
|
import com.zd.algorithm.api.alarm.entity.Routes;
|
|
|
import com.zd.algorithm.api.alarm.entity.SendTypes;
|
|
|
import com.zd.algorithm.api.alarm.feign.RemoteAlarmService;
|
|
|
+import com.zd.base.api.feign.RemoteMessageService;
|
|
|
import com.zd.chemical.api.fegin.RemoteStockService;
|
|
|
import com.zd.common.core.annotation.DataScope;
|
|
|
import com.zd.common.core.utils.DateUtils;
|
|
|
@@ -30,6 +31,7 @@ import com.zd.laboratory.service.*;
|
|
|
import com.zd.model.constant.HttpStatus;
|
|
|
import com.zd.model.constant.MqttConstants;
|
|
|
import com.zd.model.domain.R;
|
|
|
+import com.zd.model.domain.ResultData;
|
|
|
import com.zd.model.domain.per.PerPrefix;
|
|
|
import com.zd.model.entity.SysUser;
|
|
|
import com.zd.model.enums.WarnUserAttrEnum;
|
|
|
@@ -106,12 +108,16 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
|
|
|
@Autowired
|
|
|
RemoteStockService remoteStockService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RemoteMessageService remoteMessageService;
|
|
|
+
|
|
|
private final String callType = "1";
|
|
|
|
|
|
private final String smsType = "2";
|
|
|
|
|
|
private final String smsFormat = "{}: {},发生风险预案,{}";
|
|
|
private final String smsFormatString = "【实验室安全智能】{}发生{}{}";
|
|
|
+ private final String smsFormatString2 = "【实验室安全系统】{}-{}数值异常,请立即核实处理:{}";
|
|
|
|
|
|
/**
|
|
|
* 查询消息发布
|
|
|
@@ -228,8 +234,54 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
|
|
|
deptName = subAddrrs.get(0).getBuildName();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ WarningNoticeLog warningNoticeLog = new WarningNoticeLog();
|
|
|
+ warningNoticeLog.setKeyId(groupId);
|
|
|
+ warningNoticeLog.setSubId(subject.getId());
|
|
|
+ warningNoticeLog.setSubName(subject.getName());
|
|
|
+ warningNoticeLog.setBuildName(subject.getDeptName());
|
|
|
+ warningNoticeLog.setFloorId(subject.getFloorId());
|
|
|
+ warningNoticeLog.setFloorName(subject.getFloorName());
|
|
|
+ warningNoticeLog.setRoomNum(subject.getRoom());
|
|
|
+ warningNoticeLog.setWarningType(4);
|
|
|
+ //TODO 语音播报通知
|
|
|
+ warningNoticeLog.setVoiceBroadcast(1);
|
|
|
+ String riskPlanName = "";
|
|
|
+ if(labRiskPlanLevel.getRiskPlanLevel() ==1 ){
|
|
|
+ riskPlanName = "低风险";
|
|
|
+ }
|
|
|
+ if(labRiskPlanLevel.getRiskPlanLevel() ==2 ){
|
|
|
+ riskPlanName = "中风险";
|
|
|
+ }
|
|
|
+ if(labRiskPlanLevel.getRiskPlanLevel() ==3 ){
|
|
|
+ riskPlanName = "较高风险";
|
|
|
+ }
|
|
|
+ if(labRiskPlanLevel.getRiskPlanLevel() ==4 ){
|
|
|
+ riskPlanName = "高风险";
|
|
|
+ }
|
|
|
+ warningNoticeLog.setWarningContent(labRiskPlanLevel.getDescribe()+"-"+riskPlanName);
|
|
|
+ LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup = labRiskPlanAbnormalGroupMapper.selectById(groupId);
|
|
|
+ if (labRiskPlanAbnormalGroup != null ) {
|
|
|
+ warningNoticeLog.setStartTime(LocalDateTimeUtil.of(labRiskPlanAbnormalGroup.getCreateTime()));
|
|
|
+ }
|
|
|
+ //获取实验室内人员
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("subId",subject.getId());
|
|
|
+ List<SysUser> users = hardwareStateMapper.querySubOnlineUserByOnepc(params);
|
|
|
+ String internalPerson = "";
|
|
|
+ if (users != null && users.size() > 0) {
|
|
|
+ internalPerson = users.stream().map(SysUser::getUserName).collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
+ warningNoticeLog.setIndoorUser(internalPerson);
|
|
|
+ Long logId = warningNoticeLogService.addWarningNoticeLog(warningNoticeLog);
|
|
|
+ ResultData urlScheme = remoteMessageService.getUrlScheme(logId);
|
|
|
+ if (urlScheme.getCode() != HttpStatus.SUCCESS) {
|
|
|
+ logger.error("获取urlScheme失败!");
|
|
|
+ }
|
|
|
+
|
|
|
// String format = StrUtil.format(smsFormat, deptName, subject.getName(), StrUtil.isBlank(labRiskPlanLevel.getMessage()) ? labRiskPlanLevel.getRiskName() : labRiskPlanLevel.getMessage());
|
|
|
- String format = StrUtil.format(smsFormatString, labRiskPlanLevel.getTopName(), labRiskPlanLevel.getRiskName(), StrUtil.isBlank(labRiskPlanLevel.getMessage()) ? "" : labRiskPlanLevel.getMessage());
|
|
|
+// String format = StrUtil.format(smsFormatString, labRiskPlanLevel.getTopName(), labRiskPlanLevel.getRiskName(), StrUtil.isBlank(labRiskPlanLevel.getMessage()) ? "" : labRiskPlanLevel.getMessage());
|
|
|
+ String format = StrUtil.format(smsFormatString2, labRiskPlanLevel.getTopName(), labRiskPlanLevel.getRiskName(), "https://lab.zjznai.com/labAppTest/earlyWarning/index.html?id=" + logId + "&urlScheme=" + urlScheme.getData());
|
|
|
logger.info("new format = {}",format);
|
|
|
String phone = null;
|
|
|
String userids = null;
|
|
|
@@ -275,45 +327,6 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
|
|
|
messageBody.setMessageId(groupId);
|
|
|
commonSend.send(MqttConstants.TOPIC_ALERT + labRiskPlanLevel.getRiskPlanId() + "/" + subject.getId(), messageBody, SendMode.DISTINCT);
|
|
|
logger.info("发送短信打电话消息推送完成!topic={},msg={}",MqttConstants.TOPIC_ALERT + labRiskPlanLevel.getRiskPlanId() + "/" + subject.getId(),JSON.toJSONString(messageBody));
|
|
|
- WarningNoticeLog warningNoticeLog = new WarningNoticeLog();
|
|
|
- warningNoticeLog.setKeyId(groupId);
|
|
|
- warningNoticeLog.setSubId(subject.getId());
|
|
|
- warningNoticeLog.setSubName(subject.getName());
|
|
|
- warningNoticeLog.setBuildName(subject.getDeptName());
|
|
|
- warningNoticeLog.setFloorId(subject.getFloorId());
|
|
|
- warningNoticeLog.setFloorName(subject.getFloorName());
|
|
|
- warningNoticeLog.setRoomNum(subject.getRoom());
|
|
|
- warningNoticeLog.setWarningType(4);
|
|
|
- //TODO 语音播报通知
|
|
|
- warningNoticeLog.setVoiceBroadcast(1);
|
|
|
- String riskPlanName = "";
|
|
|
- if(labRiskPlanLevel.getRiskPlanLevel() ==1 ){
|
|
|
- riskPlanName = "低风险";
|
|
|
- }
|
|
|
- if(labRiskPlanLevel.getRiskPlanLevel() ==2 ){
|
|
|
- riskPlanName = "中风险";
|
|
|
- }
|
|
|
- if(labRiskPlanLevel.getRiskPlanLevel() ==3 ){
|
|
|
- riskPlanName = "较高风险";
|
|
|
- }
|
|
|
- if(labRiskPlanLevel.getRiskPlanLevel() ==4 ){
|
|
|
- riskPlanName = "高风险";
|
|
|
- }
|
|
|
- warningNoticeLog.setWarningContent(labRiskPlanLevel.getDescribe()+"-"+riskPlanName);
|
|
|
- LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup = labRiskPlanAbnormalGroupMapper.selectById(groupId);
|
|
|
- if (labRiskPlanAbnormalGroup != null ) {
|
|
|
- warningNoticeLog.setStartTime(LocalDateTimeUtil.of(labRiskPlanAbnormalGroup.getCreateTime()));
|
|
|
- }
|
|
|
- //获取实验室内人员
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("subId",subject.getId());
|
|
|
- List<SysUser> users = hardwareStateMapper.querySubOnlineUserByOnepc(params);
|
|
|
- String internalPerson = "";
|
|
|
- if (users != null && users.size() > 0) {
|
|
|
- internalPerson = users.stream().map(SysUser::getUserName).collect(Collectors.joining(","));
|
|
|
- }
|
|
|
- warningNoticeLog.setIndoorUser(internalPerson);
|
|
|
- warningNoticeLogService.addWarningNoticeLog(warningNoticeLog);
|
|
|
try {
|
|
|
if (subject.getAdminId() != null) {
|
|
|
//发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message
|