From dfaf7c908dfd78ff95af7848de411ca7d02a3c70 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Wed, 16 Aug 2023 09:20:52 +0800
Subject: [PATCH] feat:页面组织增加在线状态
---
screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java | 17 ++++++++++++++++-
screen-api/src/main/java/com/moral/api/pojo/vo/monitorPoint/MonitorPointsVO.java | 15 ++++++++++++---
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java b/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java
index 96b0729..190bc4e 100644
--- a/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java
@@ -62,7 +62,22 @@
List<MonitorPoint> monitorPoints = monitorPointService.queryByOrgIdAndRegionCode(form);
//������������������
- MonitorPointsVO vo = MonitorPointsVO.convert(monitorPoints);
+ MonitorPointsVO vo = MonitorPointsVO.convert(monitorPoints,false);
+
+ return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo);
+ }
+
+ @GetMapping("queryMonitorPointsState")
+ public ResultMessage queryMonitorPointsState(MonitorPointQueryForm form) {
+ //������������������������
+ if (!form.valid())
+ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
+ ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+ //������������������
+ List<MonitorPoint> monitorPoints = monitorPointService.queryByOrgIdAndRegionCode(form);
+
+ //������������������
+ MonitorPointsVO vo = MonitorPointsVO.convert(monitorPoints,true);
return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo);
}
diff --git a/screen-api/src/main/java/com/moral/api/pojo/vo/monitorPoint/MonitorPointsVO.java b/screen-api/src/main/java/com/moral/api/pojo/vo/monitorPoint/MonitorPointsVO.java
index fd1d4bc..d54852a 100644
--- a/screen-api/src/main/java/com/moral/api/pojo/vo/monitorPoint/MonitorPointsVO.java
+++ b/screen-api/src/main/java/com/moral/api/pojo/vo/monitorPoint/MonitorPointsVO.java
@@ -7,6 +7,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
/**
* @ClassName MonitorPointsVO
@@ -20,7 +21,7 @@
private List<MonitorPointVO> monitorPoints;
- public static MonitorPointsVO convert(List<MonitorPoint> monitorPoints){
+ public static MonitorPointsVO convert(List<MonitorPoint> monitorPoints,boolean type){
MonitorPointsVO monitorPointsVO = new MonitorPointsVO();
List<MonitorPointVO> monitorPointVOS = new ArrayList<>();
for (MonitorPoint monitorPoint : monitorPoints) {
@@ -31,14 +32,22 @@
DeviceVO deviceVO = deviceConvert(device);
deviceVOS.add(deviceVO);
}
+ List<Device> resultState = devices.stream().filter(it->!it.getState().equals("0")).collect(Collectors.toList());
monitorPointVO.setId(monitorPoint.getId());
- monitorPointVO.setName(monitorPoint.getName());
+ StringBuffer stringBuffer = new StringBuffer(monitorPoint.getName());
+ if(type){
+ stringBuffer.append("(");
+ stringBuffer.append("������:").append(resultState.size()+"���;");
+ stringBuffer.append("���:").append(devices.size()+"���");
+ stringBuffer.append(")");
+ }
+ monitorPointVO.setName(stringBuffer.toString());
monitorPointVO.setLatitude(monitorPoint.getLatitude());
monitorPointVO.setLongitude(monitorPoint.getLongitude());
monitorPointVO.setDevices(deviceVOS);
monitorPointVOS.add(monitorPointVO);
}
- monitorPointsVO.setMonitorPoints(monitorPointVOS);
+ monitorPointsVO.setMonitorPoints(monitorPointVOS);
return monitorPointsVO;
}
--
Gitblit v1.8.0