云前置改造

This commit is contained in:
xy
2025-11-14 10:02:52 +08:00
parent 528f376f6d
commit cd8cf60683
2 changed files with 42 additions and 29 deletions

View File

@@ -380,32 +380,27 @@ public class MqttMessageHandler {
if (Objects.equals(res.getDid(),1)){ if (Objects.equals(res.getDid(),1)){
log.info("{},设备数据应答--->更新治理监测点信息和设备容量", nDid); log.info("{},设备数据应答--->更新治理监测点信息和设备容量", nDid);
List<CsDevCapacityPO> list3 = new ArrayList<>(); List<CsDevCapacityPO> list3 = new ArrayList<>();
devInfo.forEach(item->{ boolean hasZeroClDid = devInfo.stream().anyMatch(item -> item.getClDid() == 0);
//1.更新治理监测点信息 //治理设备
CsLineParam csLineParam = new CsLineParam(); if (hasZeroClDid) {
if (Objects.equals(item.getClDid(),0)){ devInfo.forEach(item->{
csLineParam.setLineId(nDid.concat("0")); if (Objects.equals(item.getClDid(),0)){
updateLineInfo(nDid,item);
}
//2.录入各个模块设备容量 //2.录入各个模块设备容量
CsDevCapacityPO csDevCapacity = new CsDevCapacityPO(); CsDevCapacityPO csDevCapacity = new CsDevCapacityPO();
csDevCapacity.setLineId(nDid.concat("0")); csDevCapacity.setLineId(nDid.concat("0"));
csDevCapacity.setCldid(item.getClDid()); csDevCapacity.setCldid(item.getClDid());
csDevCapacity.setCapacity(Objects.isNull(item.getCapacityA())?0.0:item.getCapacityA()); csDevCapacity.setCapacity(Objects.isNull(item.getCapacityA())?0.0:item.getCapacityA());
list3.add(csDevCapacity); list3.add(csDevCapacity);
} else { });
csLineParam.setLineId(nDid.concat(item.getClDid().toString())); }
} //其余设备
csLineParam.setVolGrade(item.getVolGrade()); else {
csLineParam.setPtRatio(item.getPtRatio()); devInfo.forEach(item->{
csLineParam.setCtRatio(item.getCtRatio()); updateLineInfo(nDid,item);
csLineParam.setConType(item.getConType()); });
csLineParam.setLineInterval(item.getStatCycle()); }
csLineFeignClient.updateLine(csLineParam);
//生成监测点限值
Overlimit overlimit = COverlimitUtil.globalAssemble(item.getVolGrade().floatValue(),10f,10f,10f,0,0);
overlimit.setId(nDid.concat(item.getClDid().toString()));
overlimitMapper.deleteById(nDid.concat(item.getClDid().toString()));
overlimitMapper.insert(overlimit);
});
if (CollectionUtil.isNotEmpty(list3)) { if (CollectionUtil.isNotEmpty(list3)) {
devCapacityFeignClient.addList(list3); devCapacityFeignClient.addList(list3);
//3.更新设备模块个数 //3.更新设备模块个数
@@ -416,14 +411,7 @@ public class MqttMessageHandler {
logDto.setOperate(nDid + "更新电网侧、负载侧监测点信息"); logDto.setOperate(nDid + "更新电网侧、负载侧监测点信息");
//1.更新电网侧、负载侧监测点相关信息 //1.更新电网侧、负载侧监测点相关信息
devInfo.forEach(item->{ devInfo.forEach(item->{
CsLineParam csLineParam = new CsLineParam(); updateLineInfo(nDid,item);
csLineParam.setLineId(nDid.concat(item.getClDid().toString()));
csLineParam.setVolGrade(item.getVolGrade());
csLineParam.setPtRatio(item.getPtRatio());
csLineParam.setCtRatio(item.getCtRatio());
csLineParam.setConType(item.getConType());
csLineParam.setLineInterval(item.getStatCycle());
csLineFeignClient.updateLine(csLineParam);
}); });
} }
} }
@@ -468,6 +456,22 @@ public class MqttMessageHandler {
} }
} }
public void updateLineInfo(String nDid,RspDataDto.LdevInfo item) {
CsLineParam csLineParam = new CsLineParam();
csLineParam.setLineId(nDid.concat(item.getClDid().toString()));
csLineParam.setVolGrade(item.getVolGrade());
csLineParam.setPtRatio(item.getPtRatio());
csLineParam.setCtRatio(item.getCtRatio());
csLineParam.setConType(item.getConType());
csLineParam.setLineInterval(item.getStatCycle());
csLineFeignClient.updateLine(csLineParam);
//生成监测点限值
Overlimit overlimit = COverlimitUtil.globalAssemble(item.getVolGrade().floatValue(),10f,10f,10f,0,0);
overlimit.setId(nDid.concat(item.getClDid().toString()));
overlimitMapper.deleteById(nDid.concat(item.getClDid().toString()));
overlimitMapper.insert(overlimit);
}
/** /**
* 装置心跳 && 主动数据上送 * 装置心跳 && 主动数据上送
* fixme 这边由于接收文件数据时间跨度会很长,途中有其他请求进来会中断之前的程序,目前是记录中断的位置,等处理完成再继续请求接收文件 * fixme 这边由于接收文件数据时间跨度会很长,途中有其他请求进来会中断之前的程序,目前是记录中断的位置,等处理完成再继续请求接收文件

View File

@@ -57,6 +57,11 @@ public class StatServiceImpl implements IStatService {
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final ChannelObjectUtil channelObjectUtil; private final ChannelObjectUtil channelObjectUtil;
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient; private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A");
put("BC", "B");
put("CA", "C");
}};
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@@ -215,10 +220,11 @@ public class StatServiceImpl implements IStatService {
String tableName = map.get(dataArrayList.get(i).getName()); String tableName = map.get(dataArrayList.get(i).getName());
Map<String, String> tags = new HashMap<>(); Map<String, String> tags = new HashMap<>();
tags.put(InfluxDBTableConstant.LINE_ID,lineId); tags.put(InfluxDBTableConstant.LINE_ID,lineId);
tags.put(InfluxDBTableConstant.PHASIC_TYPE,dataArrayList.get(i).getPhase()); tags.put(InfluxDBTableConstant.PHASIC_TYPE,Objects.isNull(PHASE_MAPPING.get(dataArrayList.get(i).getPhase()))?dataArrayList.get(i).getPhase():PHASE_MAPPING.get(dataArrayList.get(i).getPhase()));
tags.put(InfluxDBTableConstant.VALUE_TYPE,statMethod); tags.put(InfluxDBTableConstant.VALUE_TYPE,statMethod);
tags.put(InfluxDBTableConstant.CL_DID,clDid.toString()); tags.put(InfluxDBTableConstant.CL_DID,clDid.toString());
tags.put(InfluxDBTableConstant.PROCESS,process.toString()); tags.put(InfluxDBTableConstant.PROCESS,process.toString());
tags.put(InfluxDBTableConstant.QUALITY_FLAG,"0");
Map<String,Object> fields = new HashMap<>(); Map<String,Object> fields = new HashMap<>();
//这边特殊处理如果数据为3.14159则将数据置为null //这边特殊处理如果数据为3.14159则将数据置为null
fields.put(dataArrayList.get(i).getName(),Objects.equals(floats.get(i),3.14159f) ? null:floats.get(i)); fields.put(dataArrayList.get(i).getName(),Objects.equals(floats.get(i),3.14159f) ? null:floats.get(i));
@@ -244,4 +250,7 @@ public class StatServiceImpl implements IStatService {
return urlList; return urlList;
} }
//相别处理
} }