Explorar o código

报警逻辑调整

hanzhiwei %!s(int64=2) %!d(string=hai) anos
pai
achega
3eb75ea7d2

+ 9 - 5
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/event/RedisExpiredPhotographListener.java

@@ -211,8 +211,6 @@ public class RedisExpiredPhotographListener extends KeyExpirationEventMessageLis
                     }
 
                     //是否通知
-                    long count1 = warningNoticeLogService.count(new LambdaQueryWrapper<WarningNoticeLog>().eq(WarningNoticeLog::getSubId, warningNoticeLog.getSubId())
-                                                                .eq(WarningNoticeLog::getWarningType,1).eq(WarningNoticeLog::getIsDeleted,Boolean.FALSE));
                     ResultData urlScheme = remoteMessageService.getUrlScheme(warningNoticeLog.getId());
                     if(urlScheme.getCode() != HttpStatus.SUCCESS){
                         log.error("获取urlScheme失败!");
@@ -220,7 +218,9 @@ public class RedisExpiredPhotographListener extends KeyExpirationEventMessageLis
                     String systemText = "【实验室安全系统】"+warningNoticeLog.getSubName()+"-监测到实验人员违规未穿戴实验服,请尽快确认。";
                     String text = "【实验室安全系统】"+warningNoticeLog.getSubName()+"-监测到实验人员违规未穿戴实验服,请尽快确认。点击查看:https://lab.zjznai.com/labAppTest/earlyWarning/index.html?id="+warningNoticeLog.getId()+"&urlScheme="+urlScheme.getData();
                     //系统 短信 语音通知
-                    if (warningConfig.getSystemNotice() != null && count1 > warningConfig.getSystemNotice()) {
+                    long systemNoticeCount = warningNoticeLogService.count(new LambdaQueryWrapper<WarningNoticeLog>().eq(WarningNoticeLog::getSubId, warningNoticeLog.getSubId())
+                            .eq(WarningNoticeLog::getWarningType,1).like(WarningNoticeLog::getWarningWay,"1").eq(WarningNoticeLog::getIsDeleted,Boolean.FALSE));
+                    if (warningConfig.getSystemNotice() != null && systemNoticeCount == warningConfig.getSystemNotice()) {
                         //系统通知
                         LabMessageContent labMessageContent = new LabMessageContent();
                         labMessageContent.setSendMode(2);
@@ -232,7 +232,9 @@ public class RedisExpiredPhotographListener extends KeyExpirationEventMessageLis
                         labMessageContent.setContent(systemText);
                         labMessageContentService.sendMessage(labMessageContent);
                     }
-                    if (warningConfig.getMessageNotice() != null && count1 > warningConfig.getMessageNotice()) {
+                    long messageNoticeCount = warningNoticeLogService.count(new LambdaQueryWrapper<WarningNoticeLog>().eq(WarningNoticeLog::getSubId, warningNoticeLog.getSubId())
+                            .eq(WarningNoticeLog::getWarningType,1).like(WarningNoticeLog::getWarningWay,"2").eq(WarningNoticeLog::getIsDeleted,Boolean.FALSE));
+                    if (warningConfig.getMessageNotice() != null && messageNoticeCount == warningConfig.getMessageNotice()) {
                         //短信通知
                         String[] strings = Stream.of(phones.toString().split(",")).filter(a -> StrUtil.isNotBlank(a)).collect(Collectors.joining(",")).split(",");
                         if (strings != null) {
@@ -242,7 +244,9 @@ public class RedisExpiredPhotographListener extends KeyExpirationEventMessageLis
                             log.info("未穿戴实验服发送短信内容:{}",text);
                         }
                     }
-                    if (warningConfig.getVoiceNotcie() != null && count1 > warningConfig.getVoiceNotcie()) {
+                    long voiceNoticeCount = warningNoticeLogService.count(new LambdaQueryWrapper<WarningNoticeLog>().eq(WarningNoticeLog::getSubId, warningNoticeLog.getSubId())
+                            .eq(WarningNoticeLog::getWarningType,1).like(WarningNoticeLog::getWarningWay,"3").eq(WarningNoticeLog::getIsDeleted,Boolean.FALSE));
+                    if (warningConfig.getVoiceNotcie() != null && voiceNoticeCount == warningConfig.getVoiceNotcie()) {
                         //语音播报
                         log.info("打开喇叭-远程调用查询喇叭列表,实验室id={}", warningNoticeLog.getSubId());
                         Integer count = labSparseHardwareService.selectSpeakerCount();