代码优化
This commit is contained in:
@@ -56,6 +56,7 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -357,6 +358,7 @@ public class MqttMessageHandler {
|
||||
RspDataDto rspDataDto = JSON.parseObject(JSON.toJSONString(res.getMsg()), RspDataDto.class);
|
||||
switch (rspDataDto.getDataType()){
|
||||
case 1:
|
||||
log.info("{} 更新设备软件信息",nDid);
|
||||
logDto.setOperate(nDid + "更新设备软件信息");
|
||||
RspDataDto.SoftInfo softInfo = JSON.parseObject(JSON.toJSONString(rspDataDto.getDataArray()), RspDataDto.SoftInfo.class);
|
||||
//记录设备软件信息
|
||||
@@ -384,6 +386,7 @@ public class MqttMessageHandler {
|
||||
List<RspDataDto.LdevInfo> devInfo = JSON.parseArray(JSON.toJSONString(rspDataDto.getDataArray()), RspDataDto.LdevInfo.class);
|
||||
if (CollectionUtil.isNotEmpty(devInfo)){
|
||||
if (Objects.equals(res.getDid(),1)){
|
||||
log.info("{} 更新治理监测点信息和设备容量",nDid);
|
||||
logDto.setOperate(nDid + "更新治理监测点信息和设备容量");
|
||||
List<CsDevCapacityPO> list = new ArrayList<>();
|
||||
devInfo.forEach(item->{
|
||||
@@ -401,7 +404,7 @@ public class MqttMessageHandler {
|
||||
CsDevCapacityPO csDevCapacity = new CsDevCapacityPO();
|
||||
csDevCapacity.setLineId(nDid.concat("0"));
|
||||
csDevCapacity.setCldid(item.getClDid());
|
||||
csDevCapacity.setCapacity(item.getCapacity());
|
||||
csDevCapacity.setCapacity(item.getCapacityA());
|
||||
list.add(csDevCapacity);
|
||||
});
|
||||
devCapacityFeignClient.addList(list);
|
||||
@@ -410,6 +413,7 @@ public class MqttMessageHandler {
|
||||
//4.询问监测点pt/ct信息
|
||||
askDevData(nDid,version,3,(res.getMid()+1));
|
||||
} else if (Objects.equals(res.getDid(),2)) {
|
||||
log.info("{} 更新电网侧、负载侧监测点信息",nDid);
|
||||
logDto.setOperate(nDid + "更新电网侧、负载侧监测点信息");
|
||||
//1.更新电网侧、负载侧监测点相关信息
|
||||
devInfo.forEach(item->{
|
||||
@@ -606,6 +610,7 @@ public class MqttMessageHandler {
|
||||
break;
|
||||
}
|
||||
reqAndResParam.setMsg(askDataDto);
|
||||
log.info("askDevData的请求报文:" + new Gson().toJson(reqAndResParam));
|
||||
publisher.send("/Pfm/DevCmd/"+version+"/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user