Commit 9926c449 authored by 张森's avatar 张森

31903 站端设备平台v5>消防告警列表>健康诊断告警,稳压泵单小时“启动”次数计算时,次数少1

parent 853b0cd9
......@@ -23,4 +23,6 @@ public class IotDataVO {
private String traceId;
private String createdTime;
private Integer pumNum = 0;
}
......@@ -398,18 +398,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (eqIotCodeList.size() > 1) {
log.info("有重复的{}数据!", iotCode);
}
//给 iot服务 推送消息 插数据到 influxdb
if (isSendIot) {
EquipmentSpecificVo equipmentSpecificVo = eqIotCodeList.get(0);
JSONObject messageObj = JSON.parseObject(message);
if (!messageObj.containsKey("traceId")) {
String traceId = System.currentTimeMillis() + "";
messageObj.put("traceId", traceId);
}
messageObj.put("bizOrgCode", equipmentSpecificVo.getBizOrgCode());
String messageTraceId = JSON.toJSONString(messageObj);
mqttSendGateway.sendToMqtt("influxdb/" + topic.substring(0, endIndex), messageTraceId);
}
EquipmentSpecificVo vo = eqIotCodeList.get(0);
topicEntity.setType(vo.getType());
topicEntity.setCode(vo.getCode());
......@@ -429,6 +418,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
traceId = value.toString();
continue;
}
if (iotDataVO.getKey().equalsIgnoreCase(FHS_PressurePump_Start) && "true".equals(iotDataVO.getValue().toString())) {
Integer pumNumHour = getPumNumHour(topicEntity);
iotDataVO.setPumNum(pumNumHour);
}
iotDatalist.add(iotDataVO);
}
if (ObjectUtils.isEmpty(iotDatalist)) {
......@@ -436,6 +429,19 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
log.info(String.format("收到mqtt消息:%s", message));
//给 iot服务 推送消息 插数据到 influxdb
if (isSendIot) {
EquipmentSpecificVo equipmentSpecificVo = eqIotCodeList.get(0);
JSONObject messageObj = JSON.parseObject(message);
if (!messageObj.containsKey("traceId")) {
String traceIdIot = System.currentTimeMillis() + "";
messageObj.put("traceId", traceIdIot);
}
messageObj.put("bizOrgCode", equipmentSpecificVo.getBizOrgCode());
String messageTraceId = JSON.toJSONString(messageObj);
mqttSendGateway.sendToMqtt("influxdb/" + topic.substring(0, endIndex), messageTraceId);
}
// 发送emq消息转kafka
JSONObject jsonObject = new JSONObject();
jsonObject.put("topic", topic);
......@@ -1168,7 +1174,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
//稳压泵启动次数大于15次触发预警
if (iotDataVO.getKey().equalsIgnoreCase(FHS_PressurePump_Start) && "true".equals(iotDataVO.getValue().toString())) {
doPressurePumInfo(topicEntity, equipmentSpecificIndex);
doPressurePumInfo(iotDataVO.getPumNum(), equipmentSpecificIndex);
}
// 遥测数据生成告警事件、日志处理
if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) ||
......@@ -1550,7 +1556,35 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
}
private void doPressurePumInfo(TopicEntityVo topicEntity, EquipmentSpecificIndex equipmentSpecificIndex) {
private void doPressurePumInfo(Integer totalNum, EquipmentSpecificIndex equipmentSpecificIndex) {
JSONObject config = this.getRiskTriggerConfig("FIRE_EQUIP_PRESSURE");
if (Objects.isNull(config)) {
throw new RuntimeException("获取配置失败!");
}
HashMap<String, String> extra = new HashMap<>();
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", 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");
TableContentVo tableContentVo3 = new TableContentVo("报警对象", "text", equipmentSpecificIndex.getEquipmentSpecificName(), "4");
List<TableContentVo> tableContentVos = Arrays.asList(tableContentVo, tableContentVo1, tableContentVo2, tableContentVo3);
handlePressureWarning(totalNum + 1,
equipmentSpecificIndex,
String.valueOf(equipmentSpecificIndex.getEquipmentSpecificId()),
"fireIot/data/analysis",
"START_NUM",
extra,
"equip",
tableContentVos);
}
private Integer getPumNumHour(TopicEntityVo topicEntity) {
// 查询iot该稳压泵的启停次数 一个小时内
String endDate = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN);
String startDate = DateUtil.format(DateUtil.offsetHour(new Date(), -1), DatePattern.NORM_DATETIME_PATTERN);
......@@ -1560,34 +1594,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
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", 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", 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");
TableContentVo tableContentVo3 = new TableContentVo("报警对象", "text", equipmentSpecificIndex.getEquipmentSpecificName(), "4");
List<TableContentVo> tableContentVos = Arrays.asList(tableContentVo, tableContentVo1, tableContentVo2, tableContentVo3);
handlePressureWarning(totalNum.toString(),
equipmentSpecificIndex,
String.valueOf(equipmentSpecificIndex.getEquipmentSpecificId()),
"fireIot/data/analysis",
"START_NUM",
extra,
"equip",
tableContentVos);
}
}
private void handlePressureWarning(String indexValue,
return totalNum;
}
return 0;
}
private void handlePressureWarning(Integer indexValue,
EquipmentSpecificIndex equipmentSpecificIndex,
String businessId,
String topic,
......@@ -1598,7 +1610,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 触发预警业务
BizMessage bizMessage = new BizMessage();
bizMessage.setIndexKey(indexKey);
bizMessage.setIndexValue(indexValue);
bizMessage.setIndexValue(indexValue.toString());
RiskBizInfoVo riskBizInfoVo = fetchData(equipmentSpecificIndex, extra, source, "稳压泵启停频次过高");
riskBizInfoVo.setWarningObjectCode(businessId);
riskBizInfoVo.getDynamicDetails().get(0).setTabContent(tableContentVos);
......
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