cjl
2023-12-14 6992aaf0587c09f7c511c1afd12e1519d91363d3
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;
    }