|
@@ -69,13 +69,14 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
Map<Integer, EquipmentType> typeMap = selectTypeMap(devices);
|
|
Map<Integer, EquipmentType> typeMap = selectTypeMap(devices);
|
|
|
Map<String, RadarData> radarMap = selectLatestRadar(devices, startTime, endTime, flowMin, flowMax);
|
|
Map<String, RadarData> radarMap = selectLatestRadar(devices, startTime, endTime, flowMin, flowMax);
|
|
|
Map<String, TelemetryData> telemetryMap = selectLatestTelemetry(devices, startTime, endTime, flowMin, flowMax);
|
|
Map<String, TelemetryData> telemetryMap = selectLatestTelemetry(devices, startTime, endTime, flowMin, flowMax);
|
|
|
|
|
+ boolean measurementFiltered = startTime != null || endTime != null || flowMin != null || flowMax != null;
|
|
|
|
|
|
|
|
List<FlowMonitoringVO> allRows = new ArrayList<>();
|
|
List<FlowMonitoringVO> allRows = new ArrayList<>();
|
|
|
for (EquipmentBase device : devices) {
|
|
for (EquipmentBase device : devices) {
|
|
|
String code = device.getEquipmentCode();
|
|
String code = device.getEquipmentCode();
|
|
|
RadarData radar = radarMap.get(code);
|
|
RadarData radar = radarMap.get(code);
|
|
|
TelemetryData telemetry = telemetryMap.get(code);
|
|
TelemetryData telemetry = telemetryMap.get(code);
|
|
|
- if (radar == null && telemetry == null) {
|
|
|
|
|
|
|
+ if (measurementFiltered && radar == null && telemetry == null) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -87,7 +88,7 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
vo.setInstantFlow(radar.getMeter1InstantFlow());
|
|
vo.setInstantFlow(radar.getMeter1InstantFlow());
|
|
|
vo.setFlowSpeed(radar.getFlowSpeed());
|
|
vo.setFlowSpeed(radar.getFlowSpeed());
|
|
|
vo.setMonitorTime(radar.getCreateTime());
|
|
vo.setMonitorTime(radar.getCreateTime());
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if (telemetry != null) {
|
|
|
vo.setDataSource(TELEMETRY_SOURCE);
|
|
vo.setDataSource(TELEMETRY_SOURCE);
|
|
|
vo.setInstantFlow(telemetry.getMeter1InstantFlow());
|
|
vo.setInstantFlow(telemetry.getMeter1InstantFlow());
|
|
|
vo.setPositiveTotal(telemetry.getMeter1PositiveTotal());
|
|
vo.setPositiveTotal(telemetry.getMeter1PositiveTotal());
|
|
@@ -113,6 +114,7 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
|
|
|
|
|
Map<Integer, EquipmentType> typeMap = selectTypeMap(devices);
|
|
Map<Integer, EquipmentType> typeMap = selectTypeMap(devices);
|
|
|
Map<String, FirefightingPressure> pressureMap = new HashMap<>();
|
|
Map<String, FirefightingPressure> pressureMap = new HashMap<>();
|
|
|
|
|
+ boolean measurementFiltered = startTime != null || endTime != null || pressureMin != null || pressureMax != null;
|
|
|
List<String> deviceCodes = deviceCodes(devices);
|
|
List<String> deviceCodes = deviceCodes(devices);
|
|
|
if (!deviceCodes.isEmpty()) {
|
|
if (!deviceCodes.isEmpty()) {
|
|
|
List<FirefightingPressure> records = firefightingPressureMapper.selectList(
|
|
List<FirefightingPressure> records = firefightingPressureMapper.selectList(
|
|
@@ -128,13 +130,15 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
List<PressureMonitoringVO> allRows = new ArrayList<>();
|
|
List<PressureMonitoringVO> allRows = new ArrayList<>();
|
|
|
for (EquipmentBase device : devices) {
|
|
for (EquipmentBase device : devices) {
|
|
|
FirefightingPressure pressure = pressureMap.get(device.getEquipmentCode());
|
|
FirefightingPressure pressure = pressureMap.get(device.getEquipmentCode());
|
|
|
- if (pressure == null) {
|
|
|
|
|
|
|
+ if (measurementFiltered && pressure == null) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
PressureMonitoringVO vo = new PressureMonitoringVO();
|
|
PressureMonitoringVO vo = new PressureMonitoringVO();
|
|
|
fillBaseFields(vo, device, typeMap.get(device.getEquipmentTypeId()));
|
|
fillBaseFields(vo, device, typeMap.get(device.getEquipmentTypeId()));
|
|
|
- vo.setPressureValue(pressure.getPressureValue());
|
|
|
|
|
- vo.setMonitorTime(pressure.getCreateTime());
|
|
|
|
|
|
|
+ if (pressure != null) {
|
|
|
|
|
+ vo.setPressureValue(pressure.getPressureValue());
|
|
|
|
|
+ vo.setMonitorTime(pressure.getCreateTime());
|
|
|
|
|
+ }
|
|
|
allRows.add(vo);
|
|
allRows.add(vo);
|
|
|
}
|
|
}
|
|
|
return pageOf(allRows, pageNum, pageSize);
|
|
return pageOf(allRows, pageNum, pageSize);
|
|
@@ -153,6 +157,7 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
|
|
|
|
|
Map<Integer, EquipmentType> typeMap = selectTypeMap(devices);
|
|
Map<Integer, EquipmentType> typeMap = selectTypeMap(devices);
|
|
|
Map<String, NoiseInfo> noiseMap = new HashMap<>();
|
|
Map<String, NoiseInfo> noiseMap = new HashMap<>();
|
|
|
|
|
+ boolean measurementFiltered = startTime != null || endTime != null || powerMin != null || powerMax != null;
|
|
|
List<String> deviceCodes = deviceCodes(devices);
|
|
List<String> deviceCodes = deviceCodes(devices);
|
|
|
if (!deviceCodes.isEmpty()) {
|
|
if (!deviceCodes.isEmpty()) {
|
|
|
List<NoiseInfo> records = noiseInfoMapper.selectList(
|
|
List<NoiseInfo> records = noiseInfoMapper.selectList(
|
|
@@ -168,16 +173,18 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
List<LeakageMonitoringVO> allRows = new ArrayList<>();
|
|
List<LeakageMonitoringVO> allRows = new ArrayList<>();
|
|
|
for (EquipmentBase device : devices) {
|
|
for (EquipmentBase device : devices) {
|
|
|
NoiseInfo noise = noiseMap.get(device.getEquipmentCode());
|
|
NoiseInfo noise = noiseMap.get(device.getEquipmentCode());
|
|
|
- if (noise == null) {
|
|
|
|
|
|
|
+ if (measurementFiltered && noise == null) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
LeakageMonitoringVO vo = new LeakageMonitoringVO();
|
|
LeakageMonitoringVO vo = new LeakageMonitoringVO();
|
|
|
fillBaseFields(vo, device, typeMap.get(device.getEquipmentTypeId()));
|
|
fillBaseFields(vo, device, typeMap.get(device.getEquipmentTypeId()));
|
|
|
- vo.setPower(noise.getPower());
|
|
|
|
|
- vo.setGain(noise.getGain());
|
|
|
|
|
- vo.setRms(noise.getRms());
|
|
|
|
|
- vo.setCenterFrequency(noise.getCenterFrequency());
|
|
|
|
|
- vo.setMonitorTime(noise.getCreateTime());
|
|
|
|
|
|
|
+ if (noise != null) {
|
|
|
|
|
+ vo.setPower(noise.getPower());
|
|
|
|
|
+ vo.setGain(noise.getGain());
|
|
|
|
|
+ vo.setRms(noise.getRms());
|
|
|
|
|
+ vo.setCenterFrequency(noise.getCenterFrequency());
|
|
|
|
|
+ vo.setMonitorTime(noise.getCreateTime());
|
|
|
|
|
+ }
|
|
|
allRows.add(vo);
|
|
allRows.add(vo);
|
|
|
}
|
|
}
|
|
|
return pageOf(allRows, pageNum, pageSize);
|
|
return pageOf(allRows, pageNum, pageSize);
|
|
@@ -515,16 +522,17 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
|
|
|
|
|
/** Restrict monitoring pages and trends to the canonical water-supply monitoring types. */
|
|
/** Restrict monitoring pages and trends to the canonical water-supply monitoring types. */
|
|
|
private Set<Integer> selectMonitoringTypeIds(String monitorKind) {
|
|
private Set<Integer> selectMonitoringTypeIds(String monitorKind) {
|
|
|
- Integer typeId;
|
|
|
|
|
|
|
+ Set<Integer> typeIds;
|
|
|
switch (monitorKind) {
|
|
switch (monitorKind) {
|
|
|
case "pressure":
|
|
case "pressure":
|
|
|
- typeId = EquipmentTypeEnum.PRESSURE_GAUGE.getId();
|
|
|
|
|
|
|
+ typeIds = Set.of(EquipmentTypeEnum.PRESSURE_GAUGE.getId(),
|
|
|
|
|
+ EquipmentTypeEnum.FIRE_HYDRANT_PRESSURE_TERMINAL.getId());
|
|
|
break;
|
|
break;
|
|
|
case "leakage":
|
|
case "leakage":
|
|
|
- typeId = EquipmentTypeEnum.LEAK_MONITOR.getId();
|
|
|
|
|
|
|
+ typeIds = Collections.singleton(EquipmentTypeEnum.LEAK_MONITOR.getId());
|
|
|
break;
|
|
break;
|
|
|
case "flow":
|
|
case "flow":
|
|
|
- typeId = EquipmentTypeEnum.ULTRASONIC_FLOWMETER.getId();
|
|
|
|
|
|
|
+ typeIds = Collections.singleton(EquipmentTypeEnum.ULTRASONIC_FLOWMETER.getId());
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
return Collections.emptySet();
|
|
return Collections.emptySet();
|
|
@@ -538,7 +546,7 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
return Collections.emptySet();
|
|
return Collections.emptySet();
|
|
|
}
|
|
}
|
|
|
return types.stream()
|
|
return types.stream()
|
|
|
- .filter(type -> typeId.equals(type.getId())
|
|
|
|
|
|
|
+ .filter(type -> typeIds.contains(type.getId())
|
|
|
&& EquipmentTypeEnum.ROOT_WATER_SUPPLY_DEVICE.getId().equals(type.getParentId()))
|
|
&& EquipmentTypeEnum.ROOT_WATER_SUPPLY_DEVICE.getId().equals(type.getParentId()))
|
|
|
.map(EquipmentType::getId)
|
|
.map(EquipmentType::getId)
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|