|
@@ -166,25 +166,30 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
|
|
|
@Override
|
|
|
public void updateStatusbatch(Map<String, Integer> notInPairs) {
|
|
|
- // 构建查询条件
|
|
|
+ // 构建查询建大仁科条件
|
|
|
LambdaQueryWrapper<MonitorTargetRegion> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- // 将每个 (deviceCode, sensorRoute) 组合转换为 "deviceCode:sensorRoute" 格式的字符串
|
|
|
- List<String> notInConditions = notInPairs.entrySet().stream()
|
|
|
- .map(entry -> entry.getKey() + ":" + entry.getValue())
|
|
|
- .collect(Collectors.toList());
|
|
|
- queryWrapper.notIn(MonitorTargetRegion::getDeviceCodeAndSensorRoute, notInConditions);
|
|
|
+ queryWrapper.likeRight(MonitorTargetRegion::getModelName, "RS");
|
|
|
+ if(!notInPairs.isEmpty()){
|
|
|
+ // 将每个 (deviceCode, sensorRoute) 组合转换为 "deviceCode:sensorRoute" 格式的字符串
|
|
|
+ List<String> notInConditions = notInPairs.entrySet().stream()
|
|
|
+ .map(entry -> entry.getKey() + ":" + entry.getValue())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if(!notInConditions.isEmpty()){
|
|
|
+ queryWrapper.notIn(MonitorTargetRegion::getDeviceCodeAndSensorRoute, notInConditions);
|
|
|
+ }
|
|
|
+ }
|
|
|
// 查询不符合条件的 MonitorTargetRegion
|
|
|
List<MonitorTargetRegion> targetRegions = monitorTargetRegionService.list(queryWrapper);
|
|
|
// 使用 stream 过滤出 deviceCode 不为空的 monitorTargetId 列表
|
|
|
- List<String> monitorTargetIds = targetRegions.stream()
|
|
|
+ Set<String> monitorTargetIds = targetRegions.stream()
|
|
|
.filter(monitorTargetRegion -> monitorTargetRegion.getDeviceCode() != null)
|
|
|
.map(MonitorTargetRegion::getMonitorTargetId) // 提取 monitorTargetId
|
|
|
- .toList();
|
|
|
+ .collect(Collectors.toSet());
|
|
|
// 批量更新状态
|
|
|
if (!monitorTargetIds.isEmpty()) {
|
|
|
LambdaUpdateWrapper<MonitorTarget> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.in(MonitorTarget::getId, monitorTargetIds); // 条件:monitorTargetId 在列表中
|
|
|
- updateWrapper.set(MonitorTarget::getStatus, MonitorStatusEnum.OFF.getCode()); // 设置状态为 OFF
|
|
|
+ updateWrapper.in(MonitorTarget::getId, monitorTargetIds);
|
|
|
+ updateWrapper.set(MonitorTarget::getStatus, MonitorStatusEnum.OFF.getCode());
|
|
|
// 执行批量更新
|
|
|
boolean updateResult = this.update(updateWrapper);
|
|
|
if (updateResult) {
|
|
@@ -197,6 +202,19 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Page<MonitorTarget> selectMonitorTargetByPage(MonitorTargetPageParam monitorTargetPageParam) {
|
|
|
+ if (StrUtil.isBlank(monitorTargetPageParam.getOrgId())) {
|
|
|
+ monitorTargetPageParam.setOrgId(StpLoginUserUtil.getLoginUser().getOrgId());
|
|
|
+ }
|
|
|
+ List<MonitorTarget> list = monitorTargetMapper.selectMonitorTargetByPage(monitorTargetPageParam);
|
|
|
+ // 构造分页结果
|
|
|
+ Page<MonitorTarget> page = new Page<>(monitorTargetPageParam.getCurrent(), monitorTargetPageParam.getSize());
|
|
|
+ page.setRecords(list);
|
|
|
+ // 如果需要查询总数,可以再查询一遍总数
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
@@ -241,6 +259,13 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
return monitorTargetList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * jackzhou 重写 2025-1-7 新方法 selectMonitorTargetByPage
|
|
|
+ * @param monitorTargetPageParam
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
@Override
|
|
|
public Page<MonitorTarget> getPageByUser(MonitorTargetPageParam monitorTargetPageParam) {
|
|
|
QueryWrapper<MonitorTarget> queryWrapper = new QueryWrapper<MonitorTarget>().checkSqlInjection();
|
|
@@ -273,6 +298,7 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
monitorTarget.setRoomName(targetRoomService.queryEntity(monitorTarget.getRoomId()).getName());
|
|
|
});
|
|
|
return rlt;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|