Commit a128e36c authored by 刘林's avatar 刘林

fix(equip):对接韶山换流站kafka数据

parent 5560474f
...@@ -52,7 +52,11 @@ public class RedisKey { ...@@ -52,7 +52,11 @@ public class RedisKey {
* 装备指标Key值 * 装备指标Key值
*/ */
public static final String EQUIP_INDEX_ADDRESS_KEY = "equip_index_address_key"; public static final String EQUIP_INDEX_ADDRESS_KEY = "equip_index_address_key";
/**
* 韶山换流站指标Key
*/
public static final String EQUIP_INDEX_ADDRESS_KEY_STATION = "equip_index_address_key_station";
/** 驼峰转下划线(简单写法,效率低于 ) */ /** 驼峰转下划线(简单写法,效率低于 ) */
public static String humpToLine(String str) { public static String humpToLine(String str) {
return str.replaceAll("[A-Z]", "_$0").toLowerCase(); return str.replaceAll("[A-Z]", "_$0").toLowerCase();
......
...@@ -72,6 +72,9 @@ public class EquipmentIndexVO { ...@@ -72,6 +72,9 @@ public class EquipmentIndexVO {
@ApiModelProperty(value = "信号的索引键key,用于唯一索引信号") @ApiModelProperty(value = "信号的索引键key,用于唯一索引信号")
private String indexAddress; private String indexAddress;
@ApiModelProperty(value = "信号的索引键pointId,用于唯一索引信号")
private String eventAddress;
@ApiModelProperty(value = "测点类型,analog/state") @ApiModelProperty(value = "测点类型,analog/state")
private String dataType; private String dataType;
......
package com.yeejoin.equipmanage.common.enums;
/**
* @author LiuLin
* @date 2023年08月02日 11:02
*/
public interface MqttConstant {
String TRUE = "true";
String FALSE = "false";
String STATE = "state";
String DIS_CREATE = "discreate";
String ONE_1 = "1";
String ONE_1_0 = "1.0";
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author LiuLin
* @date 2023年08月02日 11:02
*/
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class SShanMessage {
private String eventTextL1;
private String pointId;
private String time;
private String deviceId;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.util.List;
/**
* @author LiuLin
* @date 2023年08月02日 11:02
*/
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class SShanStationMessage {
private String timestamp;
private List<SShanMessage> warns;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* 对接苏州,绍兴换流站Kafka数据
* @author LiuLin
* @date 2023年08月02日 11:02
*/
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class StationMessage {
private String dataType;
private String value;
private String timeStamp;
private String quality;
private String scadaId;
private String key;
private String disCreate;
private String name;
}
...@@ -33,6 +33,7 @@ public class EquipmentIndexCacheRunner implements CommandLineRunner { ...@@ -33,6 +33,7 @@ public class EquipmentIndexCacheRunner implements CommandLineRunner {
log.info(">>服务启动执行,执行预加载数据等操作"); log.info(">>服务启动执行,执行预加载数据等操作");
redisUtils.del(RedisKey.EQUIP_INDEX_ADDRESS); redisUtils.del(RedisKey.EQUIP_INDEX_ADDRESS);
redisUtils.del(RedisKey.EQUIP_INDEX_ADDRESS_KEY); redisUtils.del(RedisKey.EQUIP_INDEX_ADDRESS_KEY);
redisUtils.del(RedisKey.EQUIP_INDEX_ADDRESS_KEY_STATION);
List<EquipmentIndexVO> equipSpecificIndexList = equipmentSpecificIndexMapper.getEquipSpecificIndexList(null); List<EquipmentIndexVO> equipSpecificIndexList = equipmentSpecificIndexMapper.getEquipSpecificIndexList(null);
Map<String, Object> equipmentIndexVOMap = equipSpecificIndexList.stream() Map<String, Object> equipmentIndexVOMap = equipSpecificIndexList.stream()
.filter(v -> v.getGatewayId() != null) .filter(v -> v.getGatewayId() != null)
...@@ -40,8 +41,12 @@ public class EquipmentIndexCacheRunner implements CommandLineRunner { ...@@ -40,8 +41,12 @@ public class EquipmentIndexCacheRunner implements CommandLineRunner {
Map<String, Object> equipmentIndexKeyMap = equipSpecificIndexList.stream() Map<String, Object> equipmentIndexKeyMap = equipSpecificIndexList.stream()
.filter(v -> v.getIndexAddress() != null && v.getGatewayId() == null) .filter(v -> v.getIndexAddress() != null && v.getGatewayId() == null)
.collect(Collectors.toMap(EquipmentIndexVO::getIndexAddress, Function.identity(),(v1, v2) -> v1)); .collect(Collectors.toMap(EquipmentIndexVO::getIndexAddress, Function.identity(),(v1, v2) -> v1));
Map<String, Object> equipmentIndexEventMap = equipSpecificIndexList.stream()
.filter(v -> v.getEventAddress() != null)
.collect(Collectors.toMap(EquipmentIndexVO::getEventAddress, Function.identity(),(v1, v2) -> v1));
redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS, equipmentIndexVOMap); redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS, equipmentIndexVOMap);
redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS_KEY, equipmentIndexKeyMap); redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS_KEY, equipmentIndexKeyMap);
redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS_KEY_STATION, equipmentIndexEventMap);
} }
} }
\ No newline at end of file
...@@ -126,6 +126,7 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -126,6 +126,7 @@ public class EquipmentIotMqttReceiveConfig {
list.add("+/+/event"); // 添加iot事件监听 list.add("+/+/event"); // 添加iot事件监听
list.add("+/+/transmit"); // 添加交换站事件监听 list.add("+/+/transmit"); // 添加交换站事件监听
list.add("+/+/perspective"); // 添加交换站事件监听 list.add("+/+/perspective"); // 添加交换站事件监听
list.add("+/+/shaoshan"); // 添加换流站韶山监听事件
String[] arr = list.toArray(new String[list.size()]); String[] arr = list.toArray(new String[list.size()]);
adapter = new MqttPahoMessageDrivenChannelAdapter(clientId + "_inbound", mqttPahoClientFactory(), arr); adapter = new MqttPahoMessageDrivenChannelAdapter(clientId + "_inbound", mqttPahoClientFactory(), arr);
adapter.setCompletionTimeout(completionTimeout); adapter.setCompletionTimeout(completionTimeout);
...@@ -151,8 +152,8 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -151,8 +152,8 @@ public class EquipmentIotMqttReceiveConfig {
mqttEventReceiveService.handlerMqttIncrementMessage(topic, msg); mqttEventReceiveService.handlerMqttIncrementMessage(topic, msg);
}else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){ }else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){
mqttReceiveService.handlerMqttRomaMessage(topic,msg); mqttReceiveService.handlerMqttRomaMessage(topic,msg);
}else if (dataType.equals("perspective") && StringUtil.isNotEmpty(msg)){ }else if (dataType.equals("shaoshan") && StringUtil.isNotEmpty(msg)){
mqttReceiveService.handlerMqttIotMessage(topic,msg); mqttReceiveService.handlerMqttStationMessage(topic,msg);
} }
} }
}; };
......
...@@ -114,5 +114,5 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif ...@@ -114,5 +114,5 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<EquipmentSpecificIndex> getEquipIndexInIndex(@Param("list") List<String> listIndex); List<EquipmentSpecificIndex> getEquipIndexInIndex(@Param("list") List<String> listIndex);
EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress,String gatewayId); EquipmentSpecificIndex getEquipmentSpeIndexByAddress(String indexAddress, String eventAddress, String gatewayId);
} }
...@@ -40,5 +40,5 @@ public interface IEquipmentSpecificIndexService extends IService<EquipmentSpecif ...@@ -40,5 +40,5 @@ public interface IEquipmentSpecificIndexService extends IService<EquipmentSpecif
* @param indexAddress indexAddress * @param indexAddress indexAddress
* @return EquipmentSpecificIndex * @return EquipmentSpecificIndex
*/ */
EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress,String gatewayId); EquipmentSpecificIndex getEquipmentSpeIndexByAddress(String indexAddress, String eventAddress, String gatewayId);
} }
...@@ -30,5 +30,5 @@ public interface MqttReceiveService { ...@@ -30,5 +30,5 @@ public interface MqttReceiveService {
* @param topic 主题 * @param topic 主题
* @param message 消息内容 * @param message 消息内容
*/ */
void handlerMqttIotMessage(String topic, String message); void handlerMqttStationMessage(String topic, String message);
} }
...@@ -30,7 +30,7 @@ public class EquipmentSpecificIndexServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -30,7 +30,7 @@ public class EquipmentSpecificIndexServiceImpl extends ServiceImpl<EquipmentSpec
} }
@Override @Override
public EquipmentSpecificIndex getEquipmentSpeIndexByIndexAddress(String indexAddress,String gatewayId) { public EquipmentSpecificIndex getEquipmentSpeIndexByAddress(String indexAddress,String eventAddress, String gatewayId) {
return this.baseMapper.getEquipmentSpeIndexByIndexAddress(indexAddress,gatewayId); return this.baseMapper.getEquipmentSpeIndexByAddress(indexAddress, eventAddress, gatewayId);
} }
} }
...@@ -54,6 +54,8 @@ import java.text.SimpleDateFormat; ...@@ -54,6 +54,8 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.equipmanage.common.enums.MqttConstant.*;
/** /**
* @author keyong * @author keyong
...@@ -67,44 +69,55 @@ import java.util.stream.Collectors; ...@@ -67,44 +69,55 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
public class MqttReceiveServiceImpl implements MqttReceiveService { public class MqttReceiveServiceImpl implements MqttReceiveService {
private static String PUMP_JOB_GROUP_NAME = "EQUIP_PUMP_JOB_GROUP_NAME"; /**
private static String PUMP_TRIGGER_NAME = "EQUIP_PUMP_TRIGGER_NAME"; * 泡沫罐KEY
private static String PUMP_TRIGGER_GROUP_NAME = "EQUIP_PUMP_TRIGGER_GROUP_NAME"; */
private final static String CAFS_FoamTank_FoamTankLevel = "CAFS_FoamTank_FoamTankLevel";
private static Map<String, TemperatureAlarmDto> temperatureMap = new HashMap<>(); /**
* 泡沫罐KEY
*/
private final static String FHS_PipePressureDetector_PipePressure = "FHS_PipePressureDetector_PipePressure";
/**
* 水池信息
*/
private final static String FHS_FirePoolDevice_WaterLevel = "FHS_FirePoolDevice_WaterLevel";
/**
* 水池信息
*/
private final static String FHS_WirelessliquidDetector_WaterLevel = "FHS_WirelessliquidDetector_WaterLevel";
/**
* 水箱液位
*/
private final static String CAFS_WaterTank_WaterTankLevel = "CAFS_WaterTank_WaterTankLevel";
private static final String PUMP_JOB_GROUP_NAME = "EQUIP_PUMP_JOB_GROUP_NAME";
private static final String PUMP_TRIGGER_NAME = "EQUIP_PUMP_TRIGGER_NAME";
private static final String PUMP_TRIGGER_GROUP_NAME = "EQUIP_PUMP_TRIGGER_GROUP_NAME";
private static final Map<String, TemperatureAlarmDto> temperatureMap = new HashMap<>();
static IEquipmentSpecificIndexService equipmentSpecificIndexService; static IEquipmentSpecificIndexService equipmentSpecificIndexService;
static EquipmentSpecificMapper equipmentSpecificMapper;
static IFireFightingSystemService fireFightingSystemService;
static MqttSendGateway mqttSendGateway;
private static RemoteSecurityService remoteSecurityService;
private static String canvasTopic;
private static Boolean jcsSwitch;
private static Boolean bool = Boolean.FALSE;
@Autowired @Autowired
public void setEquipmentSpecificIndexService(IEquipmentSpecificIndexService equipmentSpecificIndexService) { protected EmqKeeper emqKeeper;
MqttReceiveServiceImpl.equipmentSpecificIndexService = equipmentSpecificIndexService;
}
@Autowired @Autowired
ICarPropertyService carPropertyService; ICarPropertyService carPropertyService;
@Autowired @Autowired
IEquipmentSpecificAlarmService equipmentSpecificAlarmService; IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired @Autowired
IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService; IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService;
@Autowired @Autowired
EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper; EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired @Autowired
EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper; EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired @Autowired
@Lazy @Lazy
IEquipmentIndexService equipmentIndexService; IEquipmentIndexService equipmentIndexService;
@Autowired @Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private IotFeign iotFeign;
@Autowired @Autowired
MarqueeDataMapper marqueeDataMapper; MarqueeDataMapper marqueeDataMapper;
//消防泵 //消防泵
...@@ -113,161 +126,183 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -113,161 +126,183 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
//消防炮 //消防炮
@Value("${equipment.plan.monitor}") @Value("${equipment.plan.monitor}")
String monitorCodes; String monitorCodes;
@Autowired @Autowired
private InfluxDbConnection influxDbConnection; FireFightingSystemMapper FireFightingSystemMapper;
/**
* 泡沫罐KEY
*/
private final static String CAFS_FoamTank_FoamTankLevel = "CAFS_FoamTank_FoamTankLevel";
/**
* 泡沫罐KEY
*/
private final static String FHS_PipePressureDetector_PipePressure = "FHS_PipePressureDetector_PipePressure";
/**
* 水池信息
*/
private final static String FHS_FirePoolDevice_WaterLevel = "FHS_FirePoolDevice_WaterLevel";
/**
* 水池信息
*/
private final static String FHS_WirelessliquidDetector_WaterLevel = "FHS_WirelessliquidDetector_WaterLevel";
/**
* 水箱液位
*/
private final static String CAFS_WaterTank_WaterTankLevel = "CAFS_WaterTank_WaterTankLevel";
static EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired @Autowired
public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper) { CarMapper carMapper;
MqttReceiveServiceImpl.equipmentSpecificMapper = equipmentSpecificMapper;
}
@Autowired @Autowired
FireFightingSystemMapper FireFightingSystemMapper; FireFightingSystemMapper fireFightingSystemMapper;
static IFireFightingSystemService fireFightingSystemService;
@Autowired @Autowired
public void setFireFightingSystemService(IFireFightingSystemService fireFightingSystemService) { IESeqService eSeqService;
MqttReceiveServiceImpl.fireFightingSystemService = fireFightingSystemService;
}
static MqttSendGateway mqttSendGateway;
@Autowired @Autowired
public void setMqttSendGateway(MqttSendGateway mqttSendGateway) { private IotFeign iotFeign;
MqttReceiveServiceImpl.mqttSendGateway = mqttSendGateway;
}
@Autowired @Autowired
private RedisUtils redisUtils; private InfluxDbConnection influxDbConnection;
@Autowired @Autowired
CarMapper carMapper; private RedisUtils redisUtils;
@Autowired @Autowired
private ISyncDataService syncDataService; private ISyncDataService syncDataService;
@Autowired @Autowired
private IEquipmentAlarmReportDayService iEquipmentAlarmReportDayService; private IEquipmentAlarmReportDayService iEquipmentAlarmReportDayService;
@Autowired @Autowired
private IEquipmentSpecificSerivce iEquipmentSpecificSerivce; private IEquipmentSpecificSerivce iEquipmentSpecificSerivce;
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired @Autowired
private SystemctlFeign systemctlFeign; private SystemctlFeign systemctlFeign;
private static RemoteSecurityService remoteSecurityService;
@Autowired
public void setRemoteSecurityService(RemoteSecurityService remoteSecurityService) {
MqttReceiveServiceImpl.remoteSecurityService = remoteSecurityService;
}
@Autowired @Autowired
private TopographyService topographyService; private TopographyService topographyService;
@Autowired @Autowired
IESeqService eSeqService;
@Autowired
private IEquipmentService equipmentService; private IEquipmentService equipmentService;
@Autowired @Autowired
private IPressurePumpService pressurePumpService; private IPressurePumpService pressurePumpService;
@Value("${equipManage.name}") @Value("${equipManage.name}")
private String serverName; private String serverName;
@Value("${state.code:code}") @Value("${state.code:code}")
private String stationCode; private String stationCode;
@Value("${system.type}") @Value("${system.type}")
private String system; private String system;
@Value("${state.name:name}") @Value("${state.name:name}")
private String stationName; private String stationName;
@Value("${mqtt.vehicle.topic}") @Value("${mqtt.vehicle.topic}")
private String carTopic; private String carTopic;
private static String canvasTopic;
@Value("${equip.point.equipmentdata.topic}")
public void setCanvasTopic(String canvasTopic) {
MqttReceiveServiceImpl.canvasTopic = canvasTopic;
}
@Value("${equip.index.topic}") @Value("${equip.index.topic}")
private String indexTopic; private String indexTopic;
@Value("${spring.redis.expire.time}") @Value("${spring.redis.expire.time}")
private long redisExpireTime; private long redisExpireTime;
@Value("${systemctl.sync.switch}") @Value("${systemctl.sync.switch}")
private Boolean syncSwitch; private Boolean syncSwitch;
@Value("${systemctl.amos.switch}") @Value("${systemctl.amos.switch}")
private Boolean amosSwitch; private Boolean amosSwitch;
@Value("${isSendApp}") @Value("${isSendApp}")
private Boolean isSendApp; private Boolean isSendApp;
@Value("${isSendIot:false}") @Value("${isSendIot:false}")
private Boolean isSendIot; private Boolean isSendIot;
@Value("${is.open.telemetering:false}") @Value("${is.open.telemetering:false}")
private Boolean isOpenTelemetering; private Boolean isOpenTelemetering;
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Value("${emergency.disposal.indicators}")
private String emergencyDisposalIndicators;
private static Boolean jcsSwitch; public static List<EquipmentSpecificAlarmLog> upAlarmLogStatus(String iotCode, String equipmentSpecificIndexKey,
String traceId, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService,
@Value("${systemctl.jcs.switch}") boolean flag) {
public void setJcsSwitch(Boolean jcsSwitch) { LambdaQueryWrapper<EquipmentSpecificAlarmLog> queryWrapper = new LambdaQueryWrapper<>();
MqttReceiveServiceImpl.jcsSwitch = jcsSwitch; queryWrapper.eq(EquipmentSpecificAlarmLog::getIotCode, iotCode);
queryWrapper.eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey, equipmentSpecificIndexKey);
queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode());
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper().selectList(queryWrapper);
if (!logs.isEmpty()) {
EquipmentSpecificAlarmLog log = logs.get(0);
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
if (!flag) {
// 若已经被确警处理过,此处不再做处理
if (StringUtils.isEmpty(x.getConfirmType())) {
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
}
x.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
}
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
}
});
equipmentSpecificAlarmLogService.updateBatchById(logs);
}
if (flag) {
List<EquipmentSpecificIndex> indexList = equipmentSpecificIndexService.getEquipmentSpeIndexBySpeIotCode(iotCode);
publishDataToCanvas(indexList);
}
return logs;
} }
/**
* 画布数据消息推送
*
* @param indexList
*/
public static void publishDataToCanvas(List<EquipmentSpecificIndex> indexList) {
if (!ObjectUtils.isEmpty(indexList)) {
EquipmentSpecificIndex index = indexList.stream().filter(x -> x.getUpdateDate() != null)
.sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList()).get(0);
EquipmentStateVo equipmentStateVo = new EquipmentStateVo();
equipmentStateVo.setEquipName(index.getEquipmentSpecificName());
equipmentStateVo.setOrgCode(index.getOrgCode());
equipmentStateVo.setSpecificId(index.getEquipmentSpecificId());
equipmentStateVo.setEquipCode(index.getQrCode());
equipmentStateVo.setEquipIotCode(index.getIotCode());
equipmentStateVo.setStatus("");
equipmentStateVo.setColor(index.getEmergencyLevelColor());
// 添加性能指标项
//flag 无意义 getSpeIndex 方法其他地方共用 做了额外封装 为0时走原逻辑
int flag = 0;
equipmentStateVo.setSpeindexList(fireFightingSystemService.getSpeIndex(index.getEquipmentSpecificId(), flag));
Map<String, Object> topicObject = new HashMap<>();
topicObject.put("equipCode", equipmentStateVo.getEquipCode());
if (TrueOrFalseEnum.real.value.equalsIgnoreCase(index.getValue())) {
topicObject.put("color", equipmentStateVo.getColor());
} else {
topicObject.put("color", "");
}
Map<String, Object> map = JSON.parseObject(JSON.toJSONString(equipmentStateVo));
topicObject.put("uuid", UUID.randomUUID().toString());
map.put(canvasTopic, topicObject);
// 发送数据至画布
mqttSendGateway.sendToMqtt(canvasTopic, JSON.toJSONString(map));
}
}
@Value("${equipment.pressurepump.start}") @Autowired
private String pressurePumpStart; public void setEquipmentSpecificIndexService(IEquipmentSpecificIndexService equipmentSpecificIndexService) {
MqttReceiveServiceImpl.equipmentSpecificIndexService = equipmentSpecificIndexService;
}
@Autowired
public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper) {
MqttReceiveServiceImpl.equipmentSpecificMapper = equipmentSpecificMapper;
}
@Value("${emergency.disposal.indicators}") @Autowired
private String emergencyDisposalIndicators; public void setFireFightingSystemService(IFireFightingSystemService fireFightingSystemService) {
MqttReceiveServiceImpl.fireFightingSystemService = fireFightingSystemService;
}
private static Boolean bool = Boolean.FALSE; @Autowired
public void setMqttSendGateway(MqttSendGateway mqttSendGateway) {
MqttReceiveServiceImpl.mqttSendGateway = mqttSendGateway;
}
@Autowired @Autowired
protected EmqKeeper emqKeeper; public void setRemoteSecurityService(RemoteSecurityService remoteSecurityService) {
MqttReceiveServiceImpl.remoteSecurityService = remoteSecurityService;
}
@Value("${equip.point.equipmentdata.topic}")
public void setCanvasTopic(String canvasTopic) {
MqttReceiveServiceImpl.canvasTopic = canvasTopic;
}
@Value("${systemctl.jcs.switch}")
public void setJcsSwitch(Boolean jcsSwitch) {
MqttReceiveServiceImpl.jcsSwitch = jcsSwitch;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -343,7 +378,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -343,7 +378,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handlerMqttRomaMessage(String topic, String message) { public void handlerMqttRomaMessage(String topic, String message) {
log.info("接收到Mqtt消息: {}", message); log.info("接收到换流站Kafka消息: {}", message);
TopicEntityVo topicEntity = new TopicEntityVo(); TopicEntityVo topicEntity = new TopicEntityVo();
topicEntity.setTopic(topic); topicEntity.setTopic(topic);
topicEntity.setMessage(message); topicEntity.setMessage(message);
...@@ -353,30 +388,28 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -353,30 +388,28 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
List<EquipmentSpecificAlarm> equipmentSpecificAlarms = new ArrayList<>(); List<EquipmentSpecificAlarm> equipmentSpecificAlarms = new ArrayList<>();
List<IndexStateVo> indexStateList = new ArrayList<>(); List<IndexStateVo> indexStateList = new ArrayList<>();
JSONObject jsonObject = JSONObject.parseObject(message); StationMessage stationMessage = JSON.parseObject(String.valueOf(message), StationMessage.class);
String dataType = jsonObject.getString("datatype"); String indexAddress = null, value = null, timeStamp = null, quality = null, dataType = null;
String indexAddress = null, value, timeStamp, quality = null; if (stationMessage != null) {
dataType = stationMessage.getDataType();
//如果消息是遥信类型,进行指标转换 timeStamp = stationMessage.getTimeStamp();
assert dataType != null; quality = stationMessage.getQuality();
if (dataType.equals("state")) {
indexAddress = jsonObject.getString("scadaid"); if (dataType.equals(STATE)) {
value = jsonObject.getInteger("value") == 1 ? "true" : "false"; indexAddress = stationMessage.getScadaId();
timeStamp = jsonObject.getString("timestamp"); value = ONE_1.equalsIgnoreCase(stationMessage.getValue()) ? TRUE : FALSE;
}else if (dataType.equals("discreate")){ } else if (dataType.equals(DIS_CREATE)) {
indexAddress = jsonObject.getString("key"); indexAddress = stationMessage.getKey();
value = jsonObject.getFloat("value") == 0.0 ? "false" : "true"; value = ONE_1_0.equalsIgnoreCase(stationMessage.getValue()) ? TRUE : FALSE;
timeStamp = jsonObject.getString("time_stamp"); } else {
quality = jsonObject.getString("quality"); indexAddress = stationMessage.getKey();
}else { value = stationMessage.getValue();
indexAddress = jsonObject.getString("key"); }
value = jsonObject.getFloat("value")+"";
timeStamp = jsonObject.getString("time_stamp");
quality = jsonObject.getString("quality");
} }
Map<Object, Object> equipmentIndexKeyMap = redisUtils.hmget(RedisKey.EQUIP_INDEX_ADDRESS_KEY); Map<Object, Object> equipmentIndexKeyMap = redisUtils.hmget(RedisKey.EQUIP_INDEX_ADDRESS_KEY);
if (equipmentIndexKeyMap.get(indexAddress) != null) { if (equipmentIndexKeyMap.get(indexAddress) != null) {
EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress, null); EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByAddress(indexAddress, null, null);
equipmentSpeIndex.setValue(value); equipmentSpeIndex.setValue(value);
equipmentSpeIndex.setValueLabel(valueTranslate(value, equipmentSpeIndex.getValueEnum())); equipmentSpeIndex.setValueLabel(valueTranslate(value, equipmentSpeIndex.getValueEnum()));
...@@ -439,22 +472,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -439,22 +472,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
boolean alarmFlag = false; boolean alarmFlag = false;
Map<String, String> messageBodyMap = new HashMap<>(); Map<String, String> messageBodyMap = new HashMap<>();
//管网压力、泡沫罐信息、水箱液位告警处理 //管网压力、泡沫罐信息、水箱液位告警处理
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase()) || if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) ||
FHS_PipePressureDetector_PipePressure.toLowerCase().equals(iotDataVO.getKey().toLowerCase()) || FHS_PipePressureDetector_PipePressure.equalsIgnoreCase(iotDataVO.getKey()) ||
iotDataVO.getKey().toLowerCase().equals(CAFS_WaterTank_WaterTankLevel.toLowerCase())) { iotDataVO.getKey().equalsIgnoreCase(CAFS_WaterTank_WaterTankLevel)) {
alarmFlag = doFoamTankLevel(iotDataVO, equipmentSpeIndex, messageBodyMap); alarmFlag = doFoamTankLevel(iotDataVO, equipmentSpeIndex, messageBodyMap);
} }
//消防水池液位处理 //消防水池液位处理
if (iotDataVO.getKey().toLowerCase().equals(FHS_FirePoolDevice_WaterLevel.toLowerCase()) || if (iotDataVO.getKey().equalsIgnoreCase(FHS_FirePoolDevice_WaterLevel) ||
iotDataVO.getKey().toLowerCase().equals(FHS_WirelessliquidDetector_WaterLevel.toLowerCase())) { iotDataVO.getKey().equalsIgnoreCase(FHS_WirelessliquidDetector_WaterLevel)) {
alarmFlag = doWaterPoolLevel(iotDataVO, equipmentSpeIndex, messageBodyMap); alarmFlag = doWaterPoolLevel(iotDataVO, equipmentSpeIndex, messageBodyMap);
} }
// 遥测数据生成告警事件、日志处理 // 遥测数据生成告警事件、日志处理
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase()) || if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) ||
FHS_PipePressureDetector_PipePressure.toLowerCase().equals(iotDataVO.getKey().toLowerCase()) || FHS_PipePressureDetector_PipePressure.equalsIgnoreCase(iotDataVO.getKey()) ||
iotDataVO.getKey().toLowerCase().equals(CAFS_WaterTank_WaterTankLevel.toLowerCase()) || iotDataVO.getKey().equalsIgnoreCase(CAFS_WaterTank_WaterTankLevel) ||
iotDataVO.getKey().toLowerCase().equals(FHS_FirePoolDevice_WaterLevel.toLowerCase()) || iotDataVO.getKey().equalsIgnoreCase(FHS_FirePoolDevice_WaterLevel) ||
iotDataVO.getKey().toLowerCase().equals(FHS_WirelessliquidDetector_WaterLevel.toLowerCase())) { iotDataVO.getKey().equalsIgnoreCase(FHS_WirelessliquidDetector_WaterLevel)) {
handlingAlarms(equipmentSpeIndex, alarmFlag); handlingAlarms(equipmentSpeIndex, alarmFlag);
} }
...@@ -495,7 +528,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -495,7 +528,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
jsonObjectData.put("measurementType", null == equipmentSpeIndex.getEquipmentIndexKey() ? "" : equipmentSpeIndex.getEquipmentIndexKey()); jsonObjectData.put("measurementType", null == equipmentSpeIndex.getEquipmentIndexKey() ? "" : equipmentSpeIndex.getEquipmentIndexKey());
jsonObjectData.put("dateTime", date); jsonObjectData.put("dateTime", date);
jsonObjectData.put("quality", "0"); // 量测质量码:0 有效,1 无效 jsonObjectData.put("quality", "0"); // 量测质量码:0 有效,1 无效
List<JSONObject> jsonObjects = Arrays.asList(jsonObjectData); List<JSONObject> jsonObjects = Collections.singletonList(jsonObjectData);
jsonObjectXf.put("data", jsonObjects); jsonObjectXf.put("data", jsonObjects);
...@@ -508,7 +541,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -508,7 +541,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
log.info("遥测遥信数据推送云端kafka成功"); log.info("遥测遥信数据推送云端kafka成功");
} catch (MqttException e) { } catch (MqttException e) {
log.error("遥测遥信数据推送云端kafka失败=====>" + e.getMessage()); log.error("遥测遥信数据推送云端kafka失败=====>" + e.getMessage());
e.printStackTrace();
} }
} }
...@@ -598,7 +630,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -598,7 +630,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
//消防水源 //消防水源
if (!flag) { if (!flag) {
List<Map> lit = iEquipmentSpecificSerivce.getWater(equipmentSpecificVo.getId()); List<Map> lit = iEquipmentSpecificSerivce.getWater(equipmentSpecificVo.getId());
if (lit != null && lit.size() > 0) { if (lit != null && !lit.isEmpty()) {
topicEntity.setType("xfsy"); topicEntity.setType("xfsy");
mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity)); mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity));
} }
...@@ -612,128 +644,251 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -612,128 +644,251 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handlerMqttIotMessage(String topic, String message) { public void handlerMqttStationMessage(String topic, String message) {
//influxdb log.info("接收到韶山Kafka消息: {}", message);
Map<String, String> tagsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
Map<String, Object> fieldsStrMap = new HashMap<>();
log.info("接收到iot消息: {}", message);
TopicEntityVo topicEntity = new TopicEntityVo(); TopicEntityVo topicEntity = new TopicEntityVo();
topicEntity.setTopic(topic); topicEntity.setTopic(topic);
topicEntity.setMessage(message); topicEntity.setMessage(message);
List<IotDataVO> iotDatalist = new ArrayList<>();
List<EquipmentSpecificIndex> equipmentSpecificIndexList = new ArrayList<>(); List<EquipmentSpecificIndex> equipmentSpecificIndexList = new ArrayList<>();
List<EquipmentSpecificAlarm> equipmentSpecificAlarms = new ArrayList<>();
List<IndexStateVo> indexStateList = new ArrayList<>(); List<IndexStateVo> indexStateList = new ArrayList<>();
JSONObject jsonObject = JSONObject.parseObject(message); SShanStationMessage sShanStationMessage = JSON.parseObject(String.valueOf(message), SShanStationMessage.class);
String dataType = jsonObject.getString("dataType"); Map<Object, Object> equipmentIndexKeyMap = redisUtils.hmget(RedisKey.EQUIP_INDEX_ADDRESS_KEY_STATION);
String indexAddress = jsonObject.getString("address"); sShanStationMessage.getWarns().forEach(m -> {
String traceId = jsonObject.getString("traceId"); String value = m.getEventTextL1().contains("出现") ? TRUE : FALSE;
String deviceCode = jsonObject.getString("deviceCode"); if (equipmentIndexKeyMap.get(m.getPointId()) != null) {
String gatewayId = jsonObject.getString("gatewayId"); EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByAddress(null, m.getPointId(), null);
String value = jsonObject.getString("value"); if (equipmentSpeIndex == null) {
return;
}
equipmentSpeIndex.setValue(value);
equipmentSpeIndex.setValueLabel(valueTranslate(value, equipmentSpeIndex.getValueEnum()));
equipmentSpeIndex.setEquipmentType(topicEntity.getType());
equipmentSpeIndex.setUpdateDate(new Date());
equipmentSpeIndex.setTimeStamp(sShanStationMessage.getTimestamp());
equipmentSpeIndex.setUUID(UUIDUtils.getUUID());
IotDataVO iotDataVO = new IotDataVO();
iotDataVO.setKey(equipmentSpeIndex.getNameKey());
iotDataVO.setValue(value);
iotDatalist.add(iotDataVO);
QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", equipmentSpeIndex.getEquipmentSpecificId());
EquipmentSpecific equipmentSpecific = iEquipmentSpecificSerivce.getOne(queryWrapper);
if (equipmentSpecific == null) {
return;
}
String iotCode = equipmentSpecific.getIotCode();
StringBuilder endIndex = new StringBuilder(iotCode).insert(8, '/');
String iotTopic = "influxdb/" + endIndex;
JSONObject msg = new JSONObject();
msg.put(equipmentSpeIndex.getEquipmentIndexKey(), value);
mqttSendGateway.sendToMqtt(iotTopic, JSON.toJSONString(msg));
List<EquipmentSpecificVo> eqIotCodeList = iEquipmentSpecificSerivce.getEquipAndCarIotcodeByIotcode(iotCode);
EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress, gatewayId); if (eqIotCodeList.isEmpty()) {
if (equipmentSpeIndex == null) { log.info("该数据{}不存在!", iotCode);
return; return;
} }
if (eqIotCodeList.size() > 1) {
log.info("有重复的{}数据!", iotCode);
}
EquipmentSpecificVo equipmentSpecificVo = eqIotCodeList.get(0);
topicEntity.setType(equipmentSpecificVo.getType());
topicEntity.setCode(equipmentSpecificVo.getCode());
equipmentSpeIndex.setValue(value); //es存储数据
equipmentSpeIndex.setValueLabel(valueTranslate(value, equipmentSpeIndex.getValueEnum())); eSeqService.saveESEquiplistSpecificBySystemESVO(equipmentSpeIndex, String.valueOf(equipmentSpecificVo.getSystemId()), equipmentSpecificVo.getSystemName());
equipmentSpeIndex.setEquipmentType(topicEntity.getType()); //更新装备性能指标
equipmentSpeIndex.setUpdateDate(new Date()); equipmentSpecificIndexService.updateById(equipmentSpeIndex);
equipmentSpeIndex.setGatewayId(gatewayId);
equipmentSpeIndex.setDataType(dataType);
equipmentSpeIndex.setTraceId(traceId);
equipmentSpeIndex.setUUID(UUIDUtils.getUUID());
//更新装备性能指标
//equipmentSpecificIndexService.updateById(equipmentSpeIndex);
tagsMap.put("key", indexAddress + "_" + gatewayId);
fieldsMap.put("traceId", traceId);
fieldsMap.put("address", indexAddress);
fieldsMap.put("value", value);
fieldsMap.put("gatewayId", gatewayId);
fieldsMap.put("dataType", dataType);
fieldsMap.put("equipmentId", equipmentSpeIndex.getEquipmentId());
fieldsMap.put("equipmentIndexName", equipmentSpeIndex.getEquipmentIndexName());
fieldsMap.put("equipmentIndexKey", equipmentSpeIndex.getEquipmentIndexKey());
fieldsMap.put("isAlarm", equipmentSpeIndex.getIsAlarm().toString());
fieldsMap.put("unit", equipmentSpeIndex.getUnit());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fieldsMap.put("createdTime", simpleDateFormat.format(new Date()));
fieldsMap.put("equipmentIndex", JSON.toJSONString(equipmentSpeIndex));
//保存influxDB库
influxDbConnection.insert("iot_data", tagsMap, fieldsMap);
QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", equipmentSpeIndex.getEquipmentSpecificId());
EquipmentSpecific equipmentSpecific = iEquipmentSpecificSerivce.getOne(queryWrapper);
if (equipmentSpecific == null) {
return;
}
String iotCode = equipmentSpecific.getIotCode();
List<EquipmentSpecificVo> eqIotCodeList = iEquipmentSpecificSerivce.getEquipAndCarIotcodeByIotcode(iotCode); // 更新设备表指标状态
iEquipmentSpecificSerivce.updateEquipmentSpecIndexRealtimeData(equipmentSpeIndex);
if (eqIotCodeList.isEmpty()) { equipmentSpecificIndexList.add(equipmentSpeIndex);
log.info("该数据{}不存在!", iotCode);
return;
}
if (eqIotCodeList.size() > 1) {
log.info("有重复的{}数据!", iotCode);
}
EquipmentSpecificVo equipmentSpecificVo = eqIotCodeList.get(0);
topicEntity.setType(equipmentSpecificVo.getType());
topicEntity.setCode(equipmentSpecificVo.getCode());
// 更新设备表指标状态 indexStateList.add(createIndexStateVo(equipmentSpeIndex));
iEquipmentSpecificSerivce.updateEquipmentSpecIndexRealtimeData(equipmentSpeIndex);
equipmentSpecificIndexList.add(equipmentSpeIndex); // 添加指标报告
saveEquipmentAlarmReportDay(equipmentSpeIndex);
indexStateList.add(createIndexStateVo(equipmentSpeIndex)); // 火眼数据构造告警指标逻辑
equipmentSpeIndex = handleTemperatureAlarm(equipmentSpeIndex, iotDatalist);
// 添加指标报告 boolean alarmFlag = false;
saveEquipmentAlarmReportDay(equipmentSpeIndex); Map<String, String> messageBodyMap = new HashMap<>();
//管网压力、泡沫罐信息、水箱液位告警处理
if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) ||
FHS_PipePressureDetector_PipePressure.equalsIgnoreCase(iotDataVO.getKey()) ||
iotDataVO.getKey().equalsIgnoreCase(CAFS_WaterTank_WaterTankLevel)) {
alarmFlag = doFoamTankLevel(iotDataVO, equipmentSpeIndex, messageBodyMap);
}
//消防水池液位处理
if (iotDataVO.getKey().equalsIgnoreCase(FHS_FirePoolDevice_WaterLevel) ||
iotDataVO.getKey().equalsIgnoreCase(FHS_WirelessliquidDetector_WaterLevel)) {
alarmFlag = doWaterPoolLevel(iotDataVO, equipmentSpeIndex, messageBodyMap);
}
// 遥测数据生成告警事件、日志处理
if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) ||
FHS_PipePressureDetector_PipePressure.equalsIgnoreCase(iotDataVO.getKey()) ||
iotDataVO.getKey().equalsIgnoreCase(CAFS_WaterTank_WaterTankLevel) ||
iotDataVO.getKey().equalsIgnoreCase(FHS_FirePoolDevice_WaterLevel) ||
iotDataVO.getKey().equalsIgnoreCase(FHS_WirelessliquidDetector_WaterLevel)) {
handlingAlarms(equipmentSpeIndex, alarmFlag);
}
// 指标告警处理
if (equipmentSpeIndex.getIsAlarm() != null && 1 == equipmentSpeIndex.getIsAlarm()) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpeIndex, messageBodyMap));
}
// 遥测遥信数据推送云端kafka
JSONObject jsonObjectXf = new JSONObject();
jsonObjectXf.put("data_class", "realdata");
// 需要在事务提交之后,否则事务隔离查询不出数据 if (equipmentSpeIndex.getIsTrend() == 1) {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { jsonObjectXf.put("data_type", "analog");
@Override } else {
public void afterCommit() { jsonObjectXf.put("data_type", "state");
}
// 直流中心消息推送刷新 String date = DateUtils.date2LongStr(new Date());
publishDataToDCCenterPage(equipmentSpecificIndexList); jsonObjectXf.put("op_type", "subscribe_emergency");
JSONObject jsonObjectCondition = new JSONObject();
jsonObjectCondition.put("station_psr_id", stationCode);
jsonObjectCondition.put("station_name", stationName);
jsonObjectCondition.put("data_upload_time", date);
jsonObjectXf.put("condition", jsonObjectCondition);
JSONObject jsonObjectData = new JSONObject();
jsonObjectData.put("psrId", stationCode);
jsonObjectData.put("astId", equipmentSpeIndex.getSpecificCode());
jsonObjectData.put("equipType", equipmentSpeIndex.getEquipmentCode());
jsonObjectData.put("name", equipmentSpeIndex.getEquipmentSpecificName() + "-" + equipmentSpeIndex.getEquipmentSpecificIndexName());
if (value.equals("true")) {
jsonObjectData.put("value", "1");
} else {
jsonObjectData.put("value", "0");
}
jsonObjectData.put("measurementType", null == equipmentSpeIndex.getEquipmentIndexKey() ? "" : equipmentSpeIndex.getEquipmentIndexKey());
jsonObjectData.put("dateTime", date);
jsonObjectData.put("quality", "0"); // 量测质量码:0 有效,1 无效
List<JSONObject> jsonObjects = Collections.singletonList(jsonObjectData);
// 四横八纵遥测信号信息列表刷新 jsonObjectXf.put("data", jsonObjects);
publishNormalIndexValueToPage(equipmentSpecificIndexList);
if ("zd".equals(system)) {
System.out.println("站端系统----------------");
// 向预控系统发送消息 // 遥测
sendEquipSpecIndexToAutosysTopic(equipmentSpecificIndexList); if (!isOpenTelemetering && equipmentSpeIndex.getIsTrend() == 1) {
// 首页性能指标数据订阅 } else {
mqttSendGateway.sendToMqtt(indexTopic, JSON.toJSONString(indexStateList)); try {
emqKeeper.getMqttClient().publish("emq.xf.created", jsonObjectXf.toString().getBytes(), 1, false);
log.info("遥测遥信数据推送云端kafka成功");
} catch (MqttException e) {
log.error("遥测遥信数据推送云端kafka失败=====>" + e.getMessage());
e.printStackTrace();
}
}
// 组态大屏消息推送,设备表实时指标修改 // 报警数据保存
intePageSysDataRefresh(equipmentSpecificIndexList, topicEntity); List<EquipmentSpecificAlarmLog> alarmLogs = new ArrayList<>();
if (!ObjectUtils.isEmpty(equipmentSpecificAlarms)) {
equipmentSpecificAlarmService.saveOrUpdateBatch(equipmentSpecificAlarms);
}
// 数字换流站同步指标修改 // 需要在事务提交之后,否则事务隔离查询不出数据
syncSpecificIndexsToGS(equipmentSpecificIndexList); TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
equipmentSpecificAlarms.forEach(action -> {
if (AlarmStatusEnum.BJ.getCode() == action.getStatus()) {
alarmLogs.add(addEquipAlarmLogRecord(action));
if (ValidationUtil.isEmpty(action.getAlamContent())) {
action.setAlamContent(action.getEquipmentSpecificName() + action.getEquipmentSpecificIndexName());
}
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
} else {
alarmLogs.addAll(upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), action.getTraceId(),
equipmentSpecificAlarmLogService, false));
mqttSendGateway.sendToMqtt(TopicEnum.EQYQR.getTopic(), JSONArray.toJSON(action).toString());
bool = Boolean.TRUE;
}
});
// 则更新拓扑节点数据及告警状态 // 直流中心消息推送刷新
updateNodeDateByEquipId(equipmentSpecificIndexList); publishDataToDCCenterPage(equipmentSpecificIndexList);
// 向画布推送 // 四横八纵遥测信号信息列表刷新
publishDataToCanvas(equipmentSpecificIndexList); publishNormalIndexValueToPage(equipmentSpecificIndexList);
if ("zd".equals(system)) {
System.out.println("站端系统----------------");
} // 向预控系统发送消息
sendEquipSpecIndexToAutosysTopic(equipmentSpecificIndexList);
// 首页性能指标数据订阅
mqttSendGateway.sendToMqtt(indexTopic, JSON.toJSONString(indexStateList));
// 组态大屏消息推送,设备表实时指标修改
intePageSysDataRefresh(equipmentSpecificIndexList, topicEntity);
// 数字换流站同步指标修改
syncSpecificIndexsToGS(equipmentSpecificIndexList);
// 则更新拓扑节点数据及告警状态
updateNodeDateByEquipId(equipmentSpecificIndexList);
// 向画布推送
publishDataToCanvas(equipmentSpecificIndexList);
// 向其他系统推送报警
equipmentAlarmLogsToOtherSystems(alarmLogs);
if (equipmentSpecificVo.getEcode() != null) {
String ecode = equipmentSpecificVo.getEcode();
boolean flag = false;
//消防泵
String[] strings = pumpCodes.split(",");
for (String string : strings) {
if (ecode.startsWith(string)) {
//通知>消防应急预案
topicEntity.setType("xfb");
mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity));
flag = true;
break;
}
}
// 消防炮
String[] stringxfp = monitorCodes.split(",");
if (!flag) {
for (String string1 : stringxfp) {
if (ecode.startsWith(string1)) {
//通知>消防应急预案
topicEntity.setType("xfp");
mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity));
flag = true;
break;
}
}
}
//消防水源
if (!flag) {
List<Map> lit = iEquipmentSpecificSerivce.getWater(equipmentSpecificVo.getId());
if (lit != null && !lit.isEmpty()) {
topicEntity.setType("xfsy");
mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity));
}
}
}
}
}
});
} }
}); });
} }
...@@ -784,7 +939,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -784,7 +939,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
for (EquipmentSpecificIndex equipmentSpecificIndex : indexList) { for (EquipmentSpecificIndex equipmentSpecificIndex : indexList) {
if (!ObjectUtils.isEmpty(equipmentSpecificIndex.getNameKey()) if (!ObjectUtils.isEmpty(equipmentSpecificIndex.getNameKey())
&& equipmentSpecificIndex.getNameKey().toLowerCase().equals(iotDataVO.getKey().toLowerCase())) { && equipmentSpecificIndex.getNameKey().equalsIgnoreCase(iotDataVO.getKey())) {
EquipmentSpecificIndex equipmentSpeIndex = new EquipmentSpecificIndex(); EquipmentSpecificIndex equipmentSpeIndex = new EquipmentSpecificIndex();
BeanUtils.copyProperties(equipmentSpecificIndex, equipmentSpeIndex); BeanUtils.copyProperties(equipmentSpecificIndex, equipmentSpeIndex);
String value = iotDataVO.getValue().toString(); String value = iotDataVO.getValue().toString();
...@@ -816,22 +971,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -816,22 +971,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 告警日志表消息内容 // 告警日志表消息内容
Map<String, String> messageBodyMap = new HashMap<>(); Map<String, String> messageBodyMap = new HashMap<>();
//管网压力、泡沫罐信息、水箱液位告警处理 //管网压力、泡沫罐信息、水箱液位告警处理
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase()) || if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) ||
FHS_PipePressureDetector_PipePressure.toLowerCase().equals(iotDataVO.getKey().toLowerCase()) || FHS_PipePressureDetector_PipePressure.equalsIgnoreCase(iotDataVO.getKey()) ||
iotDataVO.getKey().toLowerCase().equals(CAFS_WaterTank_WaterTankLevel.toLowerCase())) { iotDataVO.getKey().equalsIgnoreCase(CAFS_WaterTank_WaterTankLevel)) {
alarmFlag = doFoamTankLevel(iotDataVO, equipmentSpecificIndex, messageBodyMap); alarmFlag = doFoamTankLevel(iotDataVO, equipmentSpecificIndex, messageBodyMap);
} }
//消防水池液位处理 //消防水池液位处理
if (iotDataVO.getKey().toLowerCase().equals(FHS_FirePoolDevice_WaterLevel.toLowerCase()) || if (iotDataVO.getKey().equalsIgnoreCase(FHS_FirePoolDevice_WaterLevel) ||
iotDataVO.getKey().toLowerCase().equals(FHS_WirelessliquidDetector_WaterLevel.toLowerCase())) { iotDataVO.getKey().equalsIgnoreCase(FHS_WirelessliquidDetector_WaterLevel)) {
alarmFlag = doWaterPoolLevel(iotDataVO, equipmentSpecificIndex, messageBodyMap); alarmFlag = doWaterPoolLevel(iotDataVO, equipmentSpecificIndex, messageBodyMap);
} }
// 遥测数据生成告警事件、日志处理 // 遥测数据生成告警事件、日志处理
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase()) || if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) ||
FHS_PipePressureDetector_PipePressure.toLowerCase().equals(iotDataVO.getKey().toLowerCase()) || FHS_PipePressureDetector_PipePressure.equalsIgnoreCase(iotDataVO.getKey()) ||
iotDataVO.getKey().toLowerCase().equals(CAFS_WaterTank_WaterTankLevel.toLowerCase()) || iotDataVO.getKey().equalsIgnoreCase(CAFS_WaterTank_WaterTankLevel) ||
iotDataVO.getKey().toLowerCase().equals(FHS_FirePoolDevice_WaterLevel.toLowerCase()) || iotDataVO.getKey().equalsIgnoreCase(FHS_FirePoolDevice_WaterLevel) ||
iotDataVO.getKey().toLowerCase().equals(FHS_WirelessliquidDetector_WaterLevel.toLowerCase())) { iotDataVO.getKey().equalsIgnoreCase(FHS_WirelessliquidDetector_WaterLevel)) {
handlingAlarms(equipmentSpecificIndex, alarmFlag); handlingAlarms(equipmentSpecificIndex, alarmFlag);
} }
...@@ -872,7 +1027,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -872,7 +1027,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
jsonObjectData.put("measurementType", null == equipmentSpecificIndex.getEquipmentIndexKey() ? "" : equipmentSpecificIndex.getEquipmentIndexKey()); jsonObjectData.put("measurementType", null == equipmentSpecificIndex.getEquipmentIndexKey() ? "" : equipmentSpecificIndex.getEquipmentIndexKey());
jsonObjectData.put("dateTime", date); jsonObjectData.put("dateTime", date);
jsonObjectData.put("quality", "0"); // 量测质量码:0 有效,1 无效 jsonObjectData.put("quality", "0"); // 量测质量码:0 有效,1 无效
List<JSONObject> jsonObjects = Arrays.asList(jsonObjectData); List<JSONObject> jsonObjects = Collections.singletonList(jsonObjectData);
jsonObjectXf.put("data", jsonObjects); jsonObjectXf.put("data", jsonObjects);
...@@ -1003,7 +1158,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1003,7 +1158,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificIndex.setValue(String.valueOf(alarmFlag)); equipmentSpecificIndex.setValue(String.valueOf(alarmFlag));
} }
/** /**
* 泡沫罐 或 者管网压力 消息发送 * 泡沫罐 或 者管网压力 消息发送
* *
...@@ -1014,7 +1168,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1014,7 +1168,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
boolean alarmFlag = false; boolean alarmFlag = false;
MessageModel model = new MessageModel(); MessageModel model = new MessageModel();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase()) || iotDataVO.getKey().toLowerCase().equals(CAFS_WaterTank_WaterTankLevel.toLowerCase())) { if (iotDataVO.getKey().equalsIgnoreCase(CAFS_FoamTank_FoamTankLevel) || iotDataVO.getKey().equalsIgnoreCase(CAFS_WaterTank_WaterTankLevel)) {
map = fireFightingSystemMapper.getFoamTankLevel(equipmentSpecificIndex.getEquipmentSpecificId()); map = fireFightingSystemMapper.getFoamTankLevel(equipmentSpecificIndex.getEquipmentSpecificId());
} else { } else {
map = fireFightingSystemMapper.getPipeNetwork(equipmentSpecificIndex.getEquipmentSpecificId()); map = fireFightingSystemMapper.getPipeNetwork(equipmentSpecificIndex.getEquipmentSpecificId());
...@@ -1048,7 +1202,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1048,7 +1202,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
model.setRelationId(equipmentSpecificIndex.getEquipmentSpecificId().toString()); model.setRelationId(equipmentSpecificIndex.getEquipmentSpecificId().toString());
model.setIsSendApp(false); model.setIsSendApp(false);
model.setTerminal("WEB"); model.setTerminal("WEB");
model.setRecivers(Arrays.asList("system")); model.setRecivers(Collections.singletonList("system"));
Map<String, String> ext = new HashMap<>(); Map<String, String> ext = new HashMap<>();
ext.put("content", body); ext.put("content", body);
ext.put("type", "模拟量超阈值提醒"); ext.put("type", "模拟量超阈值提醒");
...@@ -1084,7 +1238,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1084,7 +1238,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
String levelDeviceId = (String) map.get("levelDeviceId"); String levelDeviceId = (String) map.get("levelDeviceId");
BigDecimal add = nowValue; BigDecimal add = nowValue;
if (levelDeviceId.contains(",")) { if (levelDeviceId.contains(",")) {
List<String> split = Arrays.asList(levelDeviceId.split(",")); String[] split = levelDeviceId.split(",");
int i = 1; int i = 1;
for (String s : split) { for (String s : split) {
if (!s.trim().equals(Long.toString(equipmentSpecificIndex.getEquipmentSpecificId()))) { if (!s.trim().equals(Long.toString(equipmentSpecificIndex.getEquipmentSpecificId()))) {
...@@ -1120,7 +1274,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1120,7 +1274,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
model.setRelationId(map.get("id").toString()); model.setRelationId(map.get("id").toString());
model.setIsSendApp(false); model.setIsSendApp(false);
model.setTerminal("WEB"); model.setTerminal("WEB");
model.setRecivers(Arrays.asList("system")); model.setRecivers(Collections.singletonList("system"));
Map<String, String> ext = new HashMap<>(); Map<String, String> ext = new HashMap<>();
ext.put("content", body); ext.put("content", body);
ext.put("type", "模拟量超阈值提醒"); ext.put("type", "模拟量超阈值提醒");
...@@ -1145,10 +1299,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1145,10 +1299,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (!ObjectUtils.isEmpty(equipmentSpecificIndex) || !ObjectUtils.isEmpty(equipmentSpecificIndex.getUnit())) { if (!ObjectUtils.isEmpty(equipmentSpecificIndex) || !ObjectUtils.isEmpty(equipmentSpecificIndex.getUnit())) {
if (UnitEnum.MM.getKey().equalsIgnoreCase(equipmentSpecificIndex.getUnit()) || UnitEnum.MM.getName().equals(equipmentSpecificIndex.getUnit())) { if (UnitEnum.MM.getKey().equalsIgnoreCase(equipmentSpecificIndex.getUnit()) || UnitEnum.MM.getName().equals(equipmentSpecificIndex.getUnit())) {
BigDecimal divide = new BigDecimal(1000); BigDecimal divide = new BigDecimal(1000);
nowValue = nowValue.divide(divide, 2, BigDecimal.ROUND_HALF_UP); nowValue = nowValue.divide(divide, 2, RoundingMode.HALF_UP);
} else if (UnitEnum.CM.getKey().equalsIgnoreCase(equipmentSpecificIndex.getUnit()) || UnitEnum.CM.getName().equals(equipmentSpecificIndex.getUnit())) { } else if (UnitEnum.CM.getKey().equalsIgnoreCase(equipmentSpecificIndex.getUnit()) || UnitEnum.CM.getName().equals(equipmentSpecificIndex.getUnit())) {
BigDecimal divide = new BigDecimal(100); BigDecimal divide = new BigDecimal(100);
nowValue = nowValue.divide(divide, 2, BigDecimal.ROUND_HALF_UP); nowValue = nowValue.divide(divide, 2, RoundingMode.HALF_UP);
} }
} }
return nowValue; return nowValue;
...@@ -1172,7 +1326,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1172,7 +1326,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return val; return val;
} }
public void carRealTimeDate(List<IotDataVO> iotDatalist, List<CarProperty> carProperties, TopicEntityVo topicEntity) { public void carRealTimeDate(List<IotDataVO> iotDatalist, List<CarProperty> carProperties, TopicEntityVo topicEntity) {
List<CarProperty> carIndexsList = new ArrayList<>(); List<CarProperty> carIndexsList = new ArrayList<>();
iotDatalist.forEach(iotDataVO -> { iotDatalist.forEach(iotDataVO -> {
...@@ -1225,92 +1378,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1225,92 +1378,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}); });
} }
public static List<EquipmentSpecificAlarmLog> upAlarmLogStatus(String iotCode, String equipmentSpecificIndexKey,
String traceId, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService,
boolean flag) {
LambdaQueryWrapper<EquipmentSpecificAlarmLog> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EquipmentSpecificAlarmLog::getIotCode, iotCode);
queryWrapper.eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey, equipmentSpecificIndexKey);
queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode());
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper().selectList(queryWrapper);
if (!logs.isEmpty()) {
EquipmentSpecificAlarmLog log = logs.get(0);
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
if (!flag) {
// 若已经被确警处理过,此处不再做处理
if (StringUtils.isEmpty(x.getConfirmType())) {
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
}
x.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
}
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
}
});
equipmentSpecificAlarmLogService.updateBatchById(logs);
}
if (flag) {
List<EquipmentSpecificIndex> indexList = equipmentSpecificIndexService.getEquipmentSpeIndexBySpeIotCode(iotCode);
publishDataToCanvas(indexList);
}
return logs;
}
/**
* 画布数据消息推送
*
* @param indexList
*/
public static void publishDataToCanvas(List<EquipmentSpecificIndex> indexList) {
if (!ObjectUtils.isEmpty(indexList)) {
EquipmentSpecificIndex index = indexList.stream().filter(x -> x.getUpdateDate() != null)
.sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList()).get(0);
EquipmentStateVo equipmentStateVo = new EquipmentStateVo();
equipmentStateVo.setEquipName(index.getEquipmentSpecificName());
equipmentStateVo.setOrgCode(index.getOrgCode());
equipmentStateVo.setSpecificId(index.getEquipmentSpecificId());
equipmentStateVo.setEquipCode(index.getQrCode());
equipmentStateVo.setEquipIotCode(index.getIotCode());
equipmentStateVo.setStatus("");
equipmentStateVo.setColor(index.getEmergencyLevelColor());
// 添加性能指标项
//flag 无意义 getSpeIndex 方法其他地方共用 做了额外封装 为0时走原逻辑
int flag = 0;
equipmentStateVo.setSpeindexList(fireFightingSystemService.getSpeIndex(index.getEquipmentSpecificId(), flag));
Map<String, Object> topicObject = new HashMap<>();
topicObject.put("equipCode", equipmentStateVo.getEquipCode());
if (TrueOrFalseEnum.real.value.toUpperCase().equals(index.getValue().toUpperCase())) {
topicObject.put("color", equipmentStateVo.getColor());
} else {
topicObject.put("color", "");
}
Map<String, Object> map = JSON.parseObject(JSON.toJSONString(equipmentStateVo));
topicObject.put("uuid", UUID.randomUUID().toString());
map.put(canvasTopic, topicObject);
// 发送数据至画布
mqttSendGateway.sendToMqtt(canvasTopic, JSON.toJSONString(map));
}
}
/** /**
* 报警消息推送amos平台 * 报警消息推送amos平台
* *
...@@ -1594,13 +1661,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1594,13 +1661,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private boolean temperatureMapIsEmpty(String traceId) { private boolean temperatureMapIsEmpty(String traceId) {
TemperatureAlarmDto dto = temperatureMap.get(traceId); TemperatureAlarmDto dto = temperatureMap.get(traceId);
if (!ValidationUtil.isEmpty(dto) && !ValidationUtil.isEmpty(dto.getAlarmLevel()) return !ValidationUtil.isEmpty(dto) && !ValidationUtil.isEmpty(dto.getAlarmLevel())
&& !ValidationUtil.isEmpty(dto.getAlarmType()) && !ValidationUtil.isEmpty(dto.getAlarmRule()) && !ValidationUtil.isEmpty(dto.getAlarmType()) && !ValidationUtil.isEmpty(dto.getAlarmRule())
&& !ValidationUtil.isEmpty(dto.getRuleTemperature()) && !ValidationUtil.isEmpty(dto.getTemperature()) && !ValidationUtil.isEmpty(dto.getRuleTemperature()) && !ValidationUtil.isEmpty(dto.getTemperature())
&& !ValidationUtil.isEmpty(dto.getThermometryUnit())) { && !ValidationUtil.isEmpty(dto.getThermometryUnit());
return true;
}
return false;
} }
/** /**
...@@ -1622,8 +1686,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1622,8 +1686,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificIndex.getValue()); equipmentSpecificIndex.getValue());
equipmentSpecificAlarm.setAlamReason(equipmentSpecificAlarm.getEquipmentSpecificIndexName().replace("NB_", "") equipmentSpecificAlarm.setAlamReason(equipmentSpecificAlarm.getEquipmentSpecificIndexName().replace("NB_", "")
+ ":" + NBalarmEnum.getDescByKey(enumKey)); + ":" + NBalarmEnum.getDescByKey(enumKey));
boolean flag = false; boolean flag = !ValidationUtil.isEmpty(equipmentSpecificAlarm.getType())
if (!ValidationUtil.isEmpty(equipmentSpecificAlarm.getType())
&& !ValidationUtil.isEmpty(equipmentSpecificAlarm.getIotCode()) && !ValidationUtil.isEmpty(equipmentSpecificAlarm.getIotCode())
&& !ValidationUtil.isEmpty(equipmentSpecificAlarm.getEquipmentSpecificIndexKey()) && !ValidationUtil.isEmpty(equipmentSpecificAlarm.getEquipmentSpecificIndexKey())
&& (NBalarmEnum.NB_liquid_level_state_0.getKey().equals(enumKey) && (NBalarmEnum.NB_liquid_level_state_0.getKey().equals(enumKey)
...@@ -1632,9 +1695,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1632,9 +1695,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
|| NBalarmEnum.NB_hydraulic_state_0.getKey().equals(enumKey) || NBalarmEnum.NB_hydraulic_state_0.getKey().equals(enumKey)
|| NBalarmEnum.NB_hydraulic_state_2.getKey().equals(enumKey) || NBalarmEnum.NB_hydraulic_state_2.getKey().equals(enumKey)
|| NBalarmEnum.NB_hydraulic_state_4.getKey().equals(enumKey) || NBalarmEnum.NB_hydraulic_state_4.getKey().equals(enumKey)
|| NBalarmEnum.NB_alarm_status_4.getKey().equals(enumKey))) { || NBalarmEnum.NB_alarm_status_4.getKey().equals(enumKey));
flag = true;
}
return flag; return flag;
} }
...@@ -1941,7 +2002,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1941,7 +2002,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private List<CarIndexGisVo> createCarIndexGisVo(List<CarProperty> carProperties) { private List<CarIndexGisVo> createCarIndexGisVo(List<CarProperty> carProperties) {
List<CarIndexGisVo> list = new ArrayList<>(); List<CarIndexGisVo> list = new ArrayList<>();
long id = 0l; long id = 0L;
String iotCode = ""; String iotCode = "";
for (CarProperty action : carProperties) { for (CarProperty action : carProperties) {
CarIndexGisVo v = new CarIndexGisVo(); CarIndexGisVo v = new CarIndexGisVo();
......
...@@ -522,7 +522,7 @@ ...@@ -522,7 +522,7 @@
</select> </select>
<!-- 根据信号索引查询装备性能指标 --> <!-- 根据信号索引查询装备性能指标 -->
<select id="getEquipmentSpeIndexByIndexAddress" <select id="getEquipmentSpeIndexByAddress"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"> resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT wesi.id AS id, SELECT wesi.id AS id,
wei.name_key AS nameKey, wei.name_key AS nameKey,
...@@ -561,10 +561,16 @@ ...@@ -561,10 +561,16 @@
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE <where>
wesi.index_address = #{indexAddress} <if test="indexAddress != null">
<if test="gatewayId != null"> AND wesi.index_address = #{indexAddress}
AND wesi.gateway_id = #{gatewayId} </if>
</if> <if test="eventAddress != null">
AND wesi.event_address = #{eventAddress}
</if>
<if test="gatewayId != null">
AND wesi.gateway_id = #{gatewayId}
</if>
</where>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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