|
@@ -61,6 +61,7 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
.like(StrUtil.isNotBlank(equipmentCode), EquipmentBase::getEquipmentCode, equipmentCode)
|
|
.like(StrUtil.isNotBlank(equipmentCode), EquipmentBase::getEquipmentCode, equipmentCode)
|
|
|
.like(StrUtil.isNotBlank(equipmentLocation), EquipmentBase::getEquipmentLocation, equipmentLocation)
|
|
.like(StrUtil.isNotBlank(equipmentLocation), EquipmentBase::getEquipmentLocation, equipmentLocation)
|
|
|
.orderByDesc(EquipmentBase::getCreateTime);
|
|
.orderByDesc(EquipmentBase::getCreateTime);
|
|
|
|
|
+ constrainToMonitoringTypes(baseWrapper, "flow");
|
|
|
|
|
|
|
|
Page<EquipmentBase> basePage = equipmentBaseMapper.selectPage(new Page<>(pageNum, pageSize), baseWrapper);
|
|
Page<EquipmentBase> basePage = equipmentBaseMapper.selectPage(new Page<>(pageNum, pageSize), baseWrapper);
|
|
|
Page<FlowMonitoringVO> resultPage = new Page<>(pageNum, pageSize, basePage.getTotal());
|
|
Page<FlowMonitoringVO> resultPage = new Page<>(pageNum, pageSize, basePage.getTotal());
|
|
@@ -200,6 +201,7 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
.like(StrUtil.isNotBlank(equipmentCode), EquipmentBase::getEquipmentCode, equipmentCode)
|
|
.like(StrUtil.isNotBlank(equipmentCode), EquipmentBase::getEquipmentCode, equipmentCode)
|
|
|
.like(StrUtil.isNotBlank(equipmentLocation), EquipmentBase::getEquipmentLocation, equipmentLocation)
|
|
.like(StrUtil.isNotBlank(equipmentLocation), EquipmentBase::getEquipmentLocation, equipmentLocation)
|
|
|
.orderByDesc(EquipmentBase::getCreateTime);
|
|
.orderByDesc(EquipmentBase::getCreateTime);
|
|
|
|
|
+ constrainToMonitoringTypes(baseWrapper, "pressure");
|
|
|
|
|
|
|
|
Page<EquipmentBase> basePage = equipmentBaseMapper.selectPage(new Page<>(pageNum, pageSize), baseWrapper);
|
|
Page<EquipmentBase> basePage = equipmentBaseMapper.selectPage(new Page<>(pageNum, pageSize), baseWrapper);
|
|
|
Page<PressureMonitoringVO> resultPage = new Page<>(pageNum, pageSize, basePage.getTotal());
|
|
Page<PressureMonitoringVO> resultPage = new Page<>(pageNum, pageSize, basePage.getTotal());
|
|
@@ -282,6 +284,7 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
.like(StrUtil.isNotBlank(equipmentCode), EquipmentBase::getEquipmentCode, equipmentCode)
|
|
.like(StrUtil.isNotBlank(equipmentCode), EquipmentBase::getEquipmentCode, equipmentCode)
|
|
|
.like(StrUtil.isNotBlank(equipmentLocation), EquipmentBase::getEquipmentLocation, equipmentLocation)
|
|
.like(StrUtil.isNotBlank(equipmentLocation), EquipmentBase::getEquipmentLocation, equipmentLocation)
|
|
|
.orderByDesc(EquipmentBase::getCreateTime);
|
|
.orderByDesc(EquipmentBase::getCreateTime);
|
|
|
|
|
+ constrainToMonitoringTypes(baseWrapper, "leakage");
|
|
|
|
|
|
|
|
Page<EquipmentBase> basePage = equipmentBaseMapper.selectPage(new Page<>(pageNum, pageSize), baseWrapper);
|
|
Page<EquipmentBase> basePage = equipmentBaseMapper.selectPage(new Page<>(pageNum, pageSize), baseWrapper);
|
|
|
Page<LeakageMonitoringVO> resultPage = new Page<>(pageNum, pageSize, basePage.getTotal());
|
|
Page<LeakageMonitoringVO> resultPage = new Page<>(pageNum, pageSize, basePage.getTotal());
|
|
@@ -454,4 +457,33 @@ public class MonitoringServiceImpl implements MonitoringService {
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /** Restrict the equipment query before pagination so each monitoring page only contains its sub-devices. */
|
|
|
|
|
+ private void constrainToMonitoringTypes(LambdaQueryWrapper<EquipmentBase> wrapper, String monitorKind) {
|
|
|
|
|
+ String[] keywords;
|
|
|
|
|
+ switch (monitorKind) {
|
|
|
|
|
+ case "pressure":
|
|
|
|
|
+ keywords = new String[]{"压力", "pressure", "消防"};
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "leakage":
|
|
|
|
|
+ keywords = new String[]{"漏失", "漏损", "泄漏", "噪声", "音频", "noise"};
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ keywords = new String[]{"流量", "flow", "雷达", "遥测", "telemetry"};
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<EquipmentType> types = equipmentTypeMapper.selectList(new LambdaQueryWrapper<EquipmentType>());
|
|
|
|
|
+ Set<String> ids = types.stream()
|
|
|
|
|
+ .filter(type -> {
|
|
|
|
|
+ String value = ((type.getTypeId() == null ? "" : type.getTypeId()) + " "
|
|
|
|
|
+ + (type.getTypeName() == null ? "" : type.getTypeName())).toLowerCase(Locale.ROOT);
|
|
|
|
|
+ return Arrays.stream(keywords).anyMatch(keyword -> value.contains(keyword.toLowerCase(Locale.ROOT)));
|
|
|
|
|
+ })
|
|
|
|
|
+ .map(EquipmentType::getId)
|
|
|
|
|
+ .filter(StrUtil::isNotBlank)
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
|
+ // Keep an empty result portable across database drivers that reject IN ().
|
|
|
|
|
+ wrapper.in(EquipmentBase::getEquipmentTypeId,
|
|
|
|
|
+ ids.isEmpty() ? Collections.singleton("__NO_MONITORING_TYPE__") : ids);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|