|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @ClassName MonitorPointsVO | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|