Commit dce25107 authored by maoying's avatar maoying

Merge branch 'dev_upgrade_plan6' into dev_upgrade

parents 54706852 d26a50fe
...@@ -312,7 +312,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -312,7 +312,6 @@ public class ContingencyAction implements CustomerAction {
// 将预案的确认消息发送至中心级 // 将预案的确认消息发送至中心级
if ("CONFIRM".equals(ro.getConfirm())) { if ("CONFIRM".equals(ro.getConfirm())) {
String msg = JSON.toJSONString(event);
log.info("RocketMQ发送的主题是: " + rocketTopic + ", 消息体是: " + toipResponse.toJsonStr() + "!"); log.info("RocketMQ发送的主题是: " + rocketTopic + ", 消息体是: " + toipResponse.toJsonStr() + "!");
try { try {
rocketMQService.sendMsg(rocketTopic, "plan_process", toipResponse); rocketMQService.sendMsg(rocketTopic, "plan_process", toipResponse);
......
...@@ -13,6 +13,11 @@ public class FirePlanAlarmBo { ...@@ -13,6 +13,11 @@ public class FirePlanAlarmBo {
* 报警id * 报警id
*/ */
private String warningId; private String warningId;
/**
* "确警状态"启动告警为1,结束告警为0
*/
private String warningState;
/** /**
* 站编码 * 站编码
*/ */
......
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.ContingencyAction; import com.yeejoin.amos.fas.business.action.ContingencyAction;
...@@ -17,26 +40,11 @@ import com.yeejoin.amos.fas.business.service.intfc.IDataSyncService; ...@@ -17,26 +40,11 @@ import com.yeejoin.amos.fas.business.service.intfc.IDataSyncService;
import com.yeejoin.amos.fas.business.service.intfc.IRocketMQService; import com.yeejoin.amos.fas.business.service.intfc.IRocketMQService;
import com.yeejoin.amos.fas.business.service.model.Operate; import com.yeejoin.amos.fas.business.service.model.Operate;
import com.yeejoin.amos.fas.business.service.model.OperateGroup; import com.yeejoin.amos.fas.business.service.model.OperateGroup;
import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.vo.Toke; import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData; import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.*;
@Service @Service
public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPlanInstance, String>*/ implements IContingencyInstance { public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPlanInstance, String>*/ implements IContingencyInstance {
...@@ -394,12 +402,21 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -394,12 +402,21 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
private void sendPlanAlarm(String batchNo, String buttonCode) { private void sendPlanAlarm(String batchNo, String buttonCode) {
//确警后推送报警数据 //确警后推送报警数据
List<FirePlanAlarmBo> list = new ArrayList<FirePlanAlarmBo>();
if ("FIRE_CONFIRM".equals(buttonCode)) { if ("FIRE_CONFIRM".equals(buttonCode)) {
FirePlanAlarmBo firePlanAlarm = view3dMapper.getPlanAlarmInfo(batchNo); FirePlanAlarmBo firePlanAlarm = view3dMapper.getPlanAlarmInfo(batchNo);
List<FirePlanAlarmBo> list = new ArrayList<FirePlanAlarmBo>(); firePlanAlarm.setWarningState("1");
list.add(firePlanAlarm);
}else if ("END_EMERGENCY".equals(buttonCode)) {
FirePlanAlarmBo firePlanAlarm = view3dMapper.getPlanAlarmInfo(batchNo);
firePlanAlarm.setWarningState("0");
firePlanAlarm.setWarningTime(DateUtils.date2LongStr(new Date()));
list.add(firePlanAlarm); list.add(firePlanAlarm);
rocketMQService.sendMsg(rocketTopicFireEquipAlarm, "plan_alarm", list);
} }
if(!ObjectUtils.isEmpty(list)){
rocketMQService.sendMsg(rocketTopicFireEquipAlarm, "plan_alarm", list);
}
} }
@Scheduled(cron = "*/2 * * * * ?") @Scheduled(cron = "*/2 * * * * ?")
......
...@@ -510,6 +510,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -510,6 +510,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
contingencyRo.setEquipmentName(equipment.getName()); contingencyRo.setEquipmentName(equipment.getName());
contingencyRo.setFireEquipmentId(String.valueOf(equipmentSpecific.getId())); contingencyRo.setFireEquipmentId(String.valueOf(equipmentSpecific.getId()));
contingencyRo.setFireEquipmentName(equipmentSpecific.getName()); contingencyRo.setFireEquipmentName(equipmentSpecific.getName());
contingencyRo.setFireEquipmentCode(equipmentSpecific.getCode());
contingencyRo.setStep("0"); contingencyRo.setStep("0");
contingencyRo.setConfirm("NONE"); contingencyRo.setConfirm("NONE");
contingencyRo.setFireTruckRoute(equipment.getFireTruckRoute()); contingencyRo.setFireTruckRoute(equipment.getFireTruckRoute());
...@@ -527,10 +528,10 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -527,10 +528,10 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
//查询重点设备关联消防炮 //查询重点设备关联消防炮
Map fireMonitorInfo = equipmentSpecificMapper.queryFireMonitor(String.valueOf(equipment.getId()), fireMonitor); Map fireMonitorInfo = equipmentSpecificMapper.queryFireMonitor(String.valueOf(equipment.getId()), fireMonitor);
if (fireMonitorInfo != null && !fireMonitorInfo.isEmpty()) { // if (fireMonitorInfo != null && !fireMonitorInfo.isEmpty()) {
contingencyRo.setFireMonitorCodes(String.valueOf(fireMonitorInfo.get("codes"))); // contingencyRo.setFireMonitorCodes(String.valueOf(fireMonitorInfo.get("codes")));
contingencyRo.setFireMonitorIds(String.valueOf(fireMonitorInfo.get("ids"))); // contingencyRo.setFireMonitorIds(String.valueOf(fireMonitorInfo.get("ids")));
} // }
List<PreplanPicture> pictures = iPreplanPictureDao.findByEquipmentId(Long.valueOf(equipment.getId())); List<PreplanPicture> pictures = iPreplanPictureDao.findByEquipmentId(Long.valueOf(equipment.getId()));
if (!CollectionUtils.isEmpty(pictures)) { if (!CollectionUtils.isEmpty(pictures)) {
...@@ -551,19 +552,19 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -551,19 +552,19 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
} }
// 获取遥信指标,暂不处理 code = 设备编码iot_code-指标项name_key // 获取遥信指标,暂不处理 code = 设备编码iot_code-指标项name_key
List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH");//物联属性指标 and 为true或false // List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH");//物联属性指标 and 为true或false
Map<String, Integer> telesignallingMap = new HashMap<>(); // Map<String, Integer> telesignallingMap = new HashMap<>();
for (Map map : points) { // for (Map map : points) {
telesignallingMap.put(map.get("code") + "", (ObjectUtils.isEmpty(map.get("value")) || "false".equals(map.get("value").toString())) ? 0 : 1); // telesignallingMap.put(map.get("code") + "", (ObjectUtils.isEmpty(map.get("value")) || "false".equals(map.get("value").toString())) ? 0 : 1);
} // }
contingencyRo.setTelesignallingMap(telesignallingMap); // contingencyRo.setTelesignallingMap(telesignallingMap);
// 获取遥测指标 // // 获取遥测指标
points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "ANALOGUE"); //物联指标 非 true false // points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "ANALOGUE"); //物联指标 非 true false
Map<String, Double> telemetryMap = new HashMap<>(); // Map<String, Double> telemetryMap = new HashMap<>();
for (Map map : points) { // for (Map map : points) {
telemetryMap.put(map.get("code") + "", Double.valueOf(ObjectUtils.isEmpty(map.get("value")) ? "0" : map.get("value").toString())); // telemetryMap.put(map.get("code") + "", Double.valueOf(ObjectUtils.isEmpty(map.get("value")) ? "0" : map.get("value").toString()));
} // }
contingencyRo.setTelemetryMap(telemetryMap); // contingencyRo.setTelemetryMap(telemetryMap);
log.info("开始调用规则 参数 contingencyRo{},reservePlan{},equipmentNames" + contingencyRo.toString() + "," + equipment.getReservePlan() + "," + ArrayUtils.toArray(equipment.getName())); log.info("开始调用规则 参数 contingencyRo{},reservePlan{},equipmentNames" + contingencyRo.toString() + "," + equipment.getReservePlan() + "," + ArrayUtils.toArray(equipment.getName()));
Object result = ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName())); Object result = ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName()));
......
...@@ -247,5 +247,10 @@ public class DateUtils { ...@@ -247,5 +247,10 @@ public class DateUtils {
return year + "" + weekOfYear; return year + "" + weekOfYear;
} }
public static String date2LongStr(Date dateDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
} }
...@@ -1476,7 +1476,7 @@ ...@@ -1476,7 +1476,7 @@
</select> </select>
<select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo"> <select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo">
SELECT SELECT
'00602' stationId, '4' stationId,
cod.batch_No, cod.batch_No,
cod.equipment_Name AS deviceName, cod.equipment_Name AS deviceName,
fe.`code` AS deviceId, fe.`code` AS deviceId,
......
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