代码优化

This commit is contained in:
xy
2024-11-07 12:58:18 +08:00
parent fc73879c95
commit c40cd44402

View File

@@ -88,6 +88,8 @@ public class EventServiceImpl implements IEventService {
}
//获取装置id
CsEquipmentDeliveryPO po = equipmentFeignClient.findDevByNDid(appEventMessage.getId()).getData();
//获取设备类型 true:治理设备 false:其他类型的设备
boolean devModel = equipmentFeignClient.judgeDevModel(appEventMessage.getId()).getData();
try {
//处理事件数据
List<AppEventMessage.DataArray> dataArray = appEventMessage.getMsg().getDataArray();
@@ -124,17 +126,18 @@ public class EventServiceImpl implements IEventService {
tags.put(InfluxDBTableConstant.UUID,id);
Map<String,Object> fields = new HashMap<>();
//只有治理型号的设备有监测位置
if (Objects.equals(ZlConstant.EVENT_POSITION,param.getName())){
if (Objects.equals(param.getData(),ZlConstant.GRID)){
if (devModel) {
if (appEventMessage.getMsg().getClDid() == 1) {
fields.put(param.getName(),"电网侧");
lineId = new Gson().fromJson(String.valueOf(redisUtil.getObjectByKey(AppRedisKey.LINE_POSITION+appEventMessage.getId())), Map.class).get("1").toString();
csEvent.setClDid(1);
} else if (Objects.equals(param.getData(),ZlConstant.LOAD)){
csEvent.setLocation("grid");
} else if (appEventMessage.getMsg().getClDid() == 2) {
fields.put(param.getName(),"负载侧");
lineId = new Gson().fromJson(String.valueOf(redisUtil.getObjectByKey(AppRedisKey.LINE_POSITION+appEventMessage.getId())), Map.class).get("2").toString();
csEvent.setClDid(2);
csEvent.setLocation("load");
}
csEvent.setLocation(param.getData().toString());
} else {
if (Objects.equals(param.getName(),ZlConstant.EVT_PARAM_TM)){
csEvent.setPersistTime(Double.parseDouble(param.getData().toString()));