From 48a28c79c0dc1203cb71147dcff0b4d4bf7bc8d0 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Tue, 04 Nov 2025 13:18:27 +0800
Subject: [PATCH] 修改
---
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/DataReceiveServiceImpl.java | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/DataReceiveServiceImpl.java b/src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/DataReceiveServiceImpl.java
index b0ce10c..598a24f 100644
--- a/src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/DataReceiveServiceImpl.java
+++ b/src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/DataReceiveServiceImpl.java
@@ -5,6 +5,7 @@
import com.gkhy.fourierSpecialGasMonitor.commons.domain.Result;
import com.gkhy.fourierSpecialGasMonitor.commons.enums.ForeignResultCode;
import com.gkhy.fourierSpecialGasMonitor.commons.enums.ResultCode;
+import com.gkhy.fourierSpecialGasMonitor.commons.enums.SystemCacheKeyEnum;
import com.gkhy.fourierSpecialGasMonitor.commons.exception.DataReceiveException;
import com.gkhy.fourierSpecialGasMonitor.decorator.WarningThresholdUpdateEvent;
import com.gkhy.fourierSpecialGasMonitor.entity.*;
@@ -118,7 +119,7 @@
private static final DateTimeFormatter warnLogFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
- private static final String[] DEVICE_EXC_RECEIVER = {"17625323889","18019908965"};
+ private static final String[] DEVICE_EXC_RECEIVER = {"17625323889","18019908965","18899396560"};
@PostConstruct
public void init() {
@@ -170,6 +171,9 @@
return ForeignResult.success();
}
+ /**
+ * 设备预警
+ * */
@Override
public ForeignResult deviceMonitor(DeviceMonitorReqDTO reqDTO) {
if (reqDTO == null)
@@ -197,7 +201,7 @@
descs.add(GasFluxStateEnum.INVERSION_FAILED_10_MINUTES_NO_DATA.getDesc());
}
String message = JSON.toJSONString(reqDTO);
- //todo 暂时改为实时推送给前端
+ //暂时改为实时推送给前端
try {
GasDeviceExcWebsocketServer.sendInfo(message,null);
} catch (IOException e) {
@@ -209,12 +213,11 @@
if (lastLog == null || now.compareTo(lastLog.getTime().plusHours(1)) >= 0) {
Map<String, String> mesMap = new HashMap<>();
mesMap.put("message","数据异常,无法进行监测");
- mesMap.put(" level","设备离线");
- //// TODO: 2024/2/22
+ mesMap.put(" level","设备离线"); // todo
List<String> deviceExcReceiver = Arrays.asList(DEVICE_EXC_RECEIVER);
if (!CollectionUtils.isEmpty(deviceExcReceiver)) {
List<String> distinctPhone = deviceExcReceiver.stream().distinct().collect(Collectors.toList());
- logger.info("【气体浓度异常短信发送】-----发送内容:" + "数据异常,无法进行监测 气体浓度连续超标,系统判断为设备离线,请相关负责人及时检查处置。"
+ logger.info("【气体浓度异常短信发送】-----发送内容:" + "克拉玛依富城数据异常,无法进行监测 气体浓度连续超标,系统判断为设备离线,请相关负责人及时检查处置。"
+ " 发送时间: " + LocalDateTime.now()+ " 接收人手机号:" + distinctPhone);
if (!org.springframework.util.StringUtils.isEmpty(smsSendEnabledStatus) && "true".equals(smsSendEnabledStatus)) {
sendMessageUtil.sendMessageCheck(deviceExcReceiver.toArray(new String[deviceExcReceiver.size()]), mesMap);
@@ -228,6 +231,7 @@
log.setContent(content);
log.setTime(now);
log.setExecDesc(execInfo);
+ log.setDelFlag(0);
DeviceExceptionLog save = deviceExceptionLogService.save(log);
if (save == null) {
logger.info("【警告】设备异常日志保存>>>>>>>>>>>>>>>>>>失败");
@@ -236,6 +240,7 @@
}
return ForeignResult.success();
}
+
private void gasFluxDataCacheAndPush(){
LocalDateTime time = LocalDateTime.now();
@@ -270,7 +275,7 @@
private void execDataCountAndPush(UploadGasConcentrationReqDTO reqDto){
- RBucket<List<GasCategory>> bucket = redissonClient.getBucket("gas_category_cache_info");
+ RBucket<List<GasCategory>> bucket = redissonClient.getBucket(SystemCacheKeyEnum.KEY_GAS_CATEGORY.getKey());
List<GasCategory> gasCategoryCache = bucket.get();
if (CollectionUtils.isEmpty(gasCategoryCache)){
gasCategoryCache = gasCategoryService.list();
@@ -325,6 +330,9 @@
}
}
+ /**
+ * 气体数据--预警信息推送
+ * */
private void warnLogGenerateAndExecPush(Integer warnThresholdEnumCode,GasCategory gasCategory,Double value){
if (gasCategory == null)
throw new DataReceiveException(this.getClass(), ForeignResultCode.SYSTEM_ERROR_DATABASE_FAIL.getCode(),"该气体不存在于对照表");
@@ -370,7 +378,6 @@
Map<String, String> mesMap = new HashMap<>();
mesMap.put("message",warnTime+" "+gasCategory.getName());
mesMap.put(" level",warnThresholdName);
- //todo
if (!CollectionUtils.isEmpty(phone)) {
List<String> distinctPhone = phone.stream().distinct().collect(Collectors.toList());
logger.info("【气体浓度异常短信发送】-----发送内容:" + content + " 发送时间: " + now + " 接收人手机号:" + distinctPhone);
--
Gitblit v1.9.2