feat(device): 更新设备台账和事件查询功能
- 添加AppProjectService依赖以获取项目信息 - 修改项目数量获取逻辑,直接从接口获取项目信息而非设备关联数 - 在事件查询接口中添加线路ID参数支持 - 更新XML映射文件,添加线路ID过滤条件 - 修复便携式设备树结构中的固定ID分配 - 更新便携式工程和项目的固定ID为"1"和"2" - 优化事件查询服务中的设备和线路ID处理逻辑
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
|
||||
Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds);
|
||||
|
||||
|
||||
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect);
|
||||
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect,@Param("lineIds") List<String> collect2);
|
||||
|
||||
Page<EventDetailVO> queryEventPageWebDvr(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("lineIds") List<String> collect);
|
||||
|
||||
|
||||
@@ -267,6 +267,12 @@
|
||||
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="lineIds != null and lineIds.size() > 0">
|
||||
AND b.line_id IN
|
||||
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
||||
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
||||
|
||||
@@ -415,11 +415,17 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
cldDevTree = cldDevTree.get(0).getChildren();
|
||||
}
|
||||
if (ObjectUtil.isNull(csEventUserQueryPage.getDeviceId()) || StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())) {
|
||||
//便携式就1层下边就是设备
|
||||
List<String> portableDevIds = portableDevTree.stream().filter(
|
||||
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
||||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
|
||||
).map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
//便携式就1层下边就是设备 这边给便携式设备添加了假的工程和项目,id是写死的
|
||||
List<String> portableDevIds = new ArrayList<>();
|
||||
if (Objects.equals(csEventUserQueryPage.getEngineeringid(),"1")
|
||||
|| Objects.equals(csEventUserQueryPage.getProjectId(),"2")
|
||||
|| !ObjectUtil.isNull(csEventUserQueryPage.getLineId())
|
||||
|| !StringUtils.isEmpty(csEventUserQueryPage.getLineId())) {
|
||||
portableDevIds = portableDevTree.stream().map(CsLedgerVO::getId).filter(
|
||||
id -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
||||
Objects.equals(id, csEventUserQueryPage.getDeviceId())
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
||||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
||||
@@ -454,6 +460,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
if (CollectionUtils.isEmpty(devIds)){
|
||||
return returnpage;
|
||||
}
|
||||
if (!ObjectUtil.isNull(csEventUserQueryPage.getLineId()) && !StringUtils.isEmpty(csEventUserQueryPage.getLineId())) {
|
||||
lineIds.add(csEventUserQueryPage.getLineId());
|
||||
}
|
||||
}
|
||||
//获取tag
|
||||
if (Objects.equals(csEventUserQueryPage.getType(), "0")) {
|
||||
@@ -479,7 +488,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
if (!Objects.isNull(csEventUserQueryPage.getIsDvr()) && csEventUserQueryPage.getIsDvr() == 1) {
|
||||
returnpage = this.getBaseMapper().queryEventPageWebDvr(returnpage,csEventUserQueryPage,lineIds);
|
||||
} else {
|
||||
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
|
||||
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds,lineIds);
|
||||
}
|
||||
returnpage.getRecords().forEach(temp->{
|
||||
CsLineDTO dto = map.get(temp.getLineId());
|
||||
|
||||
Reference in New Issue
Block a user