3 Commits

Author SHA1 Message Date
xy
6714a6f582 微调 2026-01-13 14:42:10 +08:00
xy
2910770be1 基于云前置系统-新增监测设备的告警等级 2026-01-08 18:39:17 +08:00
xy
cd8cf60683 云前置改造 2025-11-14 10:02:52 +08:00
5 changed files with 76 additions and 31 deletions

View File

@@ -380,32 +380,27 @@ public class MqttMessageHandler {
if (Objects.equals(res.getDid(),1)){
log.info("{},设备数据应答--->更新治理监测点信息和设备容量", nDid);
List<CsDevCapacityPO> list3 = new ArrayList<>();
devInfo.forEach(item->{
//1.更新治理监测点信息
CsLineParam csLineParam = new CsLineParam();
if (Objects.equals(item.getClDid(),0)){
csLineParam.setLineId(nDid.concat("0"));
boolean hasZeroClDid = devInfo.stream().anyMatch(item -> item.getClDid() == 0);
//治理设备
if (hasZeroClDid) {
devInfo.forEach(item->{
if (Objects.equals(item.getClDid(),0)){
updateLineInfo(nDid,item);
}
//2.录入各个模块设备容量
CsDevCapacityPO csDevCapacity = new CsDevCapacityPO();
csDevCapacity.setLineId(nDid.concat("0"));
csDevCapacity.setCldid(item.getClDid());
csDevCapacity.setCapacity(Objects.isNull(item.getCapacityA())?0.0:item.getCapacityA());
list3.add(csDevCapacity);
} else {
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);
});
});
}
//其余设备
else {
devInfo.forEach(item->{
updateLineInfo(nDid,item);
});
}
if (CollectionUtil.isNotEmpty(list3)) {
devCapacityFeignClient.addList(list3);
//3.更新设备模块个数
@@ -416,14 +411,7 @@ public class MqttMessageHandler {
logDto.setOperate(nDid + "更新电网侧、负载侧监测点信息");
//1.更新电网侧、负载侧监测点相关信息
devInfo.forEach(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);
updateLineInfo(nDid,item);
});
}
}
@@ -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 这边由于接收文件数据时间跨度会很长,途中有其他请求进来会中断之前的程序,目前是记录中断的位置,等处理完成再继续请求接收文件

View File

@@ -133,6 +133,8 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
if (ObjectUtil.isNotNull(object)) {
csLineFeignClient.updateDataByList(devList,csDevModelPo.getId(),object.toString());
}
//清空监测点缓存的模板信息
}
}
csLogsFeignClient.addUserLog(logDto);
@@ -1275,6 +1277,8 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
showName = "电网侧数据模板";
} else if (Objects.equals(code, DicDataEnum.PORTABLE.getCode())){
showName = "监测1#数据模板";
} else {
showName = "统计数据";
}
break;
case "Ds$Pqd$Stat$02":
@@ -1282,8 +1286,13 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
showName = "负载侧数据模板";
} else if (Objects.equals(code, DicDataEnum.PORTABLE.getCode())){
showName = "监测2#数据模板";
} else {
showName = "统计数据";
}
break;
case "Ds$Pqd$Rt$01":
showName = "实时数据";
break;
//波形参数名称
case "Wave_Param_Position":
showName = "录波记录位置";

View File

@@ -88,7 +88,7 @@ public class RtServiceImpl implements IRtService {
long timestamp = item.getDataTimeSec() - 8*3600;
baseRealDataSet.setDataTime(getTime(timestamp));
publisher.send("/Web/RealData/" + lineId, new Gson().toJson(baseRealDataSet), 1, false);
} else if (dataSet.getName().contains("实时数据")) {
} else if (dataSet.getName().contains("实时数据") || dataSet.getName().contains("Ds$Pqd$Rt$01")) {
//用户Id
Object redisObject = redisUtil.getObjectByKey("rtDataUserId:"+lineId);
if (ObjectUtil.isNotNull(redisObject)) {

View File

@@ -57,6 +57,11 @@ public class StatServiceImpl implements IStatService {
private final RedisUtil redisUtil;
private final ChannelObjectUtil channelObjectUtil;
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
@Transactional(rollbackFor = Exception.class)
@@ -215,10 +220,11 @@ public class StatServiceImpl implements IStatService {
String tableName = map.get(dataArrayList.get(i).getName());
Map<String, String> tags = new HashMap<>();
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.CL_DID,clDid.toString());
tags.put(InfluxDBTableConstant.PROCESS,process.toString());
tags.put(InfluxDBTableConstant.QUALITY_FLAG,"0");
Map<String,Object> fields = new HashMap<>();
//这边特殊处理如果数据为3.14159则将数据置为null
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;
}
//相别处理
}

View File

@@ -265,7 +265,7 @@ public class EventServiceImpl implements IEventService {
po.setStartTime(LocalDateTime.parse(cldLogMessage.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
po.setTag(cldLogMessage.getLog());
po.setClDid(1);
po.setLevel(3);
po.setLevel(channelLevel(cldLogMessage.getGrade()));
po.setProcess(4);
po.setCode(cldLogMessage.getCode());
//前置告警
@@ -289,6 +289,29 @@ public class EventServiceImpl implements IEventService {
csEventService.save(po);
}
/**
* 处理告警等级
*/
public int channelLevel(String grade) {
int result;
switch (grade) {
case "DEBUG":
result = 4;
break;
case "WARN":
result = 6;
break;
case "ERROR":
result = 7;
break;
default:
result = 5;
break;
}
return result;
}
/**
* 处理电压
* @param vol