Commit 2c3bf1ac authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/develop_bugfix@dl' into develop_bugfix@dl

parents f671bdec cfce2561
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.biz.common.utils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.cache.enumeration.CacheType;
......@@ -24,6 +25,10 @@ public class RedisUtils {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private StringRedisTemplate stringRedisTemplate;
/**
* 指定缓存失效时间
*
......@@ -41,6 +46,17 @@ public class RedisUtils {
}
/**
* 普通缓存获取
*
* @param key 键
* @return 值
*/
public String getString(String key) {
String object = stringRedisTemplate.opsForValue().get(key);
return object;
}
/**
* 根据key 获取过期时间
*
* @param key 键 不能为null
......
......@@ -238,6 +238,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private String specialChars;
@Value("${auth-key-auth-enabled:}")
private String authKeyEnable;
private static final String QRCODE_REDIS_KEY = "qrCodeRedisKey";
public static List<EquipmentSpecificAlarmLog> upAlarmLogStatus(String iotCode, String equipmentSpecificIndexKey,
String traceId, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService,
......@@ -1165,9 +1166,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 处理每站消防储水量不少于4000m³ 预警问题
doWaterStationWarning(equipmentSpecificIndex.getBizOrgCode(), equipmentSpecificIndex.getBizOrgName());
}
//稳压泵启停次数大于15次触发预警
if (iotDataVO.getKey().equalsIgnoreCase(FHS_PressurePump_Start) ||
iotDataVO.getKey().equalsIgnoreCase(FHS_PressurePump_Stop)) {
//稳压泵启动次数大于15次触发预警
if (iotDataVO.getKey().equalsIgnoreCase(FHS_PressurePump_Start)) {
doPressurePumInfo(topicEntity, equipmentSpecificIndex);
}
// 遥测数据生成告警事件、日志处理
......@@ -1425,14 +1425,17 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
//预警业务 泡沫罐 或 者管网压力
JSONObject config = this.getRiskTriggerConfig("FIRE_EQUIP_LEVEL");
if (Objects.isNull(config)) {
throw new RuntimeException("获取配置失败!");
}
HashMap<String, String> extra = new HashMap<>();
extra.put("useSource", "center");
extra.put("codingSystem", "center");
extra.put("codingType", "equipment");
extra.put("problemReception", "station");
extra.put("useSource", config.getString("useSource"));
extra.put("codingSystem", config.getString("useSource"));
extra.put("codingType", config.getString("codingType"));
extra.put("problemReception", config.getString("problemReception"));
extra.put("bussId", String.valueOf(equipmentSpecificIndex.getEquipmentSpecificId()));
extra.put("clearUniqueCode", "equip-level");
extra.put("clearUniqueCode", config.getString("clearUniqueCode"));
TableContentVo tableContentVo = new TableContentVo("报警类型", "text", "液位超出阈值", "1");
TableContentVo tableContentVo1 = new TableContentVo("报警部位", "text", equipmentSpecificIndex.getLocation(), "2");
......@@ -1502,13 +1505,17 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private void doWaterStationInfo(String bizOrgCode, String bizOrgName, String indexValue) {
String indexKey = "WATER_CAPACITY";
String warningObjectCode = bizOrgCode + "@" + indexKey;
JSONObject config = this.getRiskTriggerConfig("FIRE_WATER_CAPACITY");
if (Objects.isNull(config)) {
throw new RuntimeException("获取配置失败!");
}
HashMap<String, String> extra = new HashMap<>();
extra.put("useSource", "center");
extra.put("codingSystem", "center");
extra.put("codingType", "station");
extra.put("problemReception", "station");
extra.put("useSource", config.getString("useSource"));
extra.put("codingSystem", config.getString("useSource"));
extra.put("codingType", config.getString("codingType"));
extra.put("problemReception", config.getString("problemReception"));
extra.put("bussId", warningObjectCode);
extra.put("clearUniqueCode", "station-WATER_CAPACITY");
extra.put("clearUniqueCode", config.getString("clearUniqueCode"));
TableContentVo tableContentVo = new TableContentVo("分析结果", "text", "消防水池+工业水池储水量<4000m³", "1");
TableContentVo tableContentVo1 = new TableContentVo("管理要求", "text", "每站消防储水量不少于4000m³", "2");
TableContentVo tableContentVo2 = new TableContentVo("管理依据", "text", "换流站消防系统运行规程", "3");
......@@ -1549,17 +1556,21 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
String startDate = DateUtil.format(DateUtil.offsetHour(new Date(), -1), DatePattern.NORM_DATETIME_PATTERN);
String prefix = topicEntity.getIotCode().substring(0, 8);
String suffix = topicEntity.getIotCode().substring(8);
ResponseModel<Map<String, Integer>> mapResponseModel = iotFeign.queryIotDataNumByIndex(startDate, endDate, prefix, suffix, FHS_PressurePump_Start + "," + FHS_PressurePump_Stop, "true");
ResponseModel<Map<String, Integer>> mapResponseModel = iotFeign.queryIotDataNumByIndex(startDate, endDate, prefix, suffix, FHS_PressurePump_Start, "true");
if (200 == mapResponseModel.getStatus()) {
Map<String, Integer> result = mapResponseModel.getResult();
Integer totalNum = result.get("num");
JSONObject config = this.getRiskTriggerConfig("FIRE_EQUIP_PRESSURE");
if (Objects.isNull(config)) {
throw new RuntimeException("获取配置失败!");
}
HashMap<String, String> extra = new HashMap<>();
extra.put("useSource", "center");
extra.put("codingSystem", "center");
extra.put("codingType", "equipment");
extra.put("problemReception", "station");
extra.put("useSource", config.getString("useSource"));
extra.put("codingSystem", config.getString("useSource"));
extra.put("codingType", config.getString("codingType"));
extra.put("problemReception", config.getString("problemReception"));
extra.put("bussId", String.valueOf(equipmentSpecificIndex.getEquipmentSpecificId()));
extra.put("clearUniqueCode", "equip-pressure");
extra.put("clearUniqueCode", config.getString("clearUniqueCode"));
TableContentVo tableContentVo = new TableContentVo("报警类型", "text", "稳压泵启停频次过高", "1");
TableContentVo tableContentVo1 = new TableContentVo("报警部位", "text", equipmentSpecificIndex.getLocation(), "2");
TableContentVo tableContentVo2 = new TableContentVo("报警时间", "text", DateUtil.now(), "3");
......@@ -1637,13 +1648,17 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
nowValue = checkValue;
}
if ("pool".equals(map.get("resourceType").toString()) || "waterTank".equals(map.get("resourceType").toString())) {
JSONObject config = this.getRiskTriggerConfig("FIRE_WATER_LEVEL");
if (Objects.isNull(config)) {
throw new RuntimeException("获取配置失败!");
}
HashMap<String, String> extra = new HashMap<>();
extra.put("useSource", "center");
extra.put("codingSystem", "center");
extra.put("codingType", "water");
extra.put("problemReception", "station");
extra.put("useSource", config.getString("useSource"));
extra.put("codingSystem", config.getString("useSource"));
extra.put("codingType", config.getString("codingType"));
extra.put("problemReception", config.getString("problemReception"));
extra.put("bussId", map.get("id").toString());
extra.put("clearUniqueCode", "water-resource");
extra.put("clearUniqueCode", config.getString("clearUniqueCode"));
TableContentVo tableContentVo = new TableContentVo("报警类型", "text", "液位超出阈值", "1");
TableContentVo tableContentVo1 = new TableContentVo("报警部位", "text", equipmentSpecificIndex.getLocation(), "2");
TableContentVo tableContentVo2 = new TableContentVo("报警时间", "text", DateUtil.now(), "3");
......@@ -3093,4 +3108,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
mqttSendGateway.sendToMqtt(ConfigPageTopicEnum.EQUIP_MULTI_INDICATOR.getTopic(), message2.toJSONString());
}
}
private JSONObject getRiskTriggerConfig(String tableName) {
Map<String, Object> configMap = JSON.parseObject(redisUtils.getString(QRCODE_REDIS_KEY), Map.class);
if (!ObjectUtils.isEmpty(configMap)) {
String config = configMap.get(tableName + "0").toString();
return JSONObject.parseObject(config).getJSONObject("content").getJSONObject("extra");
}
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment