fix(device): 修复设备服务中的循环次数和排序设置问题

- 将等待设备上线的循环次数从3次增加到10次
- 为负载侧和电源侧拓扑图参数添加正确的排序值设置
- 移除重复的排序设置逻辑,避免数据冲突
- 确保设备数据集按正确顺序进行初始化配置
This commit is contained in:
xy
2026-06-26 15:22:20 +08:00
parent 14a8a4344a
commit f439a4f2c8

View File

@@ -191,7 +191,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
Object model = null;
try {
String key = AppRedisKey.LINE + nDid;
for (int i = 0; i < 3 ; i++) {
for (int i = 0; i < 10 ; i++) {
Thread.sleep(1000);
model = redisUtil.getObjectByKey(key);
if (!Objects.isNull(model)){
@@ -277,6 +277,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
param.setId(uuid);
appLineTopologyDiagramPo.setLineId(uuid);
po.setClDid(1);
param.setSort(1);
} else if (Objects.equals(DicDataEnum.LOAD_SIDE.getCode(),location)){
if (!Objects.isNull(clDidToIdMap.get(2))) {
uuid = clDidToIdMap.get(2);
@@ -291,6 +292,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
param.setId(uuid);
appLineTopologyDiagramPo.setLineId(uuid);
po.setClDid(2);
param.setSort(2);
} else {
if (!Objects.isNull(clDidToIdMap.get(0))) {
uuid = clDidToIdMap.get(0);
@@ -303,6 +305,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
String dataSetId = Objects.requireNonNull(dataSets.stream().filter(it -> Objects.equals(it.getClDev(), 0)&&Objects.equals(it.getType(), 0)).findFirst().orElse(null)).getId();
po.setDataSetId(dataSetId);
param.setId(uuid);
param.setSort(0);
appLineTopologyDiagramPo.setLineId(uuid);
}
po.setStatus(1);
@@ -310,7 +313,6 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
param.setPid(vo.getId());
param.setName(item.getName());
param.setLevel(3);
param.setSort(po.getClDid());
csLedgerService.addLedgerTree(param);
appLineTopologyDiagramPo.setId(devAccessParam.getTopologyDiagram());
appLineTopologyDiagramPo.setLat(item.getLat());