feat(device): 更新设备台账和事件查询功能

- 添加AppProjectService依赖以获取项目信息
- 修改项目数量获取逻辑,直接从接口获取项目信息而非设备关联数
- 在事件查询接口中添加线路ID参数支持
- 更新XML映射文件,添加线路ID过滤条件
- 修复便携式设备树结构中的固定ID分配
- 更新便携式工程和项目的固定ID为"1"和"2"
- 优化事件查询服务中的设备和线路ID处理逻辑
This commit is contained in:
xy
2026-07-13 16:35:48 +08:00
parent b265e95bdf
commit 4e7a10f46e
5 changed files with 40 additions and 19 deletions

View File

@@ -60,6 +60,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
private final UserFeignClient userFeignClient;
private final IMqttUserService mqttUserService;
private final CsCommTerminalFeignClient commTerminalService;
private final AppProjectService appProjectService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -272,9 +273,15 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
break;
}
}
//获取项目数量
if (CollectionUtil.isNotEmpty(currentProjectIds)) {
vo.setCurrentProjectCount(currentProjectIds.size());
//获取项目数量 这边可能项目下没有挂载设备,这边项目数量直接从接口获取
// if (CollectionUtil.isNotEmpty(currentProjectIds)) {
// vo.setCurrentProjectCount(currentProjectIds.size());
// }
List<AppProjectPO> projectInfoList = appProjectService.getProjectByEngineering(Collections.singletonList(id));
if (CollectionUtil.isNotEmpty(projectInfoList)) {
vo.setCurrentProjectCount(projectInfoList.size());
} else {
vo.setCurrentProjectCount(0);
}
//获取设备总数、在线设备、离线设备
if (CollectionUtil.isNotEmpty(currentDevIds)) {

View File

@@ -300,7 +300,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
List<CsLedgerVO> portables = ledger.stream()
.peek(c -> {
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
c.setPid(portable.getId());
c.setPid("2");
c.setComFlag(po.getRunStatus());
c.setNDId(po.getNdid());
c.setType("device");
@@ -365,13 +365,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
portable1.setLevel(0);
portable1.setName("便携式工程");
portable1.setPid("0");
portable1.setId(id);
portable1.setId("1");
CsLedgerVO portable2 = new CsLedgerVO();
portable2.setLevel(1);
portable2.setName("便携式项目");
portable2.setPid(id);
portable2.setId(IdUtil.simpleUUID());
portable2.setPid("1");
portable2.setId("2");
portable2.setChildren(portables);
portable1.setChildren(Collections.singletonList(portable2));
@@ -719,7 +719,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
List<CsLedgerVO> portables = ledger.stream()
.peek(c -> {
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
c.setPid(portable.getId());
c.setPid("2");
c.setComFlag(po.getRunStatus());
c.setNDId(po.getNdid());
c.setType("device");
@@ -776,18 +776,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
tree.addAll(new ArrayList<>(engineeringMap.values()));
if (CollUtil.isNotEmpty(portables)) {
String id = IdUtil.simpleUUID();
CsLedgerVO portable1 = new CsLedgerVO();
portable1.setLevel(0);
portable1.setName("便携式工程");
portable1.setPid("0");
portable1.setId(id);
portable1.setId("1");
CsLedgerVO portable2 = new CsLedgerVO();
portable2.setLevel(1);
portable2.setName("便携式项目");
portable2.setPid(id);
portable2.setId(IdUtil.simpleUUID());
portable2.setPid("1");
portable2.setId("2");
portable2.setChildren(portables);
List<CsLedgerVO> portable2List = new ArrayList<>();