|
@@ -284,44 +284,46 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
DataPermissionUtils.executeIgnore(() -> {
|
|
DataPermissionUtils.executeIgnore(() -> {
|
|
|
- BigDecimal maxWaterInjectionTime = BigDecimal.ZERO;
|
|
|
|
|
- // 过滤数据权限 查询 运行记录 日志
|
|
|
|
|
- // 根据 当前日期 deptId pumpDeviceIds 查询运行记录工单关联的 deviceId
|
|
|
|
|
- String reportDateStr = LocalDateTimeUtil.format(reportDate, DatePattern.NORM_DATE_PATTERN);
|
|
|
|
|
- IotOpeationFillPageReqVO fillReqVO = new IotOpeationFillPageReqVO();
|
|
|
|
|
- fillReqVO.setCreateTimeStr(reportDateStr);
|
|
|
|
|
- fillReqVO.setDeptId(deptId);
|
|
|
|
|
- fillReqVO.setDeviceIds(pumpDeviceIds);
|
|
|
|
|
- List<IotOpeationFillDO> fills = iotOpeationFillMapper.selectList(fillReqVO);
|
|
|
|
|
- Set<Long> fillPumpDeviceIds = new HashSet<>();
|
|
|
|
|
- if (CollUtil.isNotEmpty(fills)) {
|
|
|
|
|
- fills.forEach(fill -> {
|
|
|
|
|
- fillPumpDeviceIds.add(fill.getDeviceId());
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- // 根据 device_id createTime is_sum=0 在表 rq_iot_device_run_log 中查询 "当日运转时间H" 的值 fill_content
|
|
|
|
|
- // 如果有多个注水泵的 运转时间 取 较大值
|
|
|
|
|
- if (CollUtil.isNotEmpty(fillPumpDeviceIds)) {
|
|
|
|
|
- IotDeviceRunLogPageReqVO runLogReqVO = new IotDeviceRunLogPageReqVO();
|
|
|
|
|
- runLogReqVO.setCreateTimeStr(reportDateStr);
|
|
|
|
|
- runLogReqVO.setDeviceIds(new ArrayList<>(fillPumpDeviceIds));
|
|
|
|
|
- runLogReqVO.setIsSum(0);
|
|
|
|
|
- List<IotDeviceRunLogDO> runLogs = iotDeviceRunLogMapper.selectList(runLogReqVO);
|
|
|
|
|
- if (CollUtil.isNotEmpty(runLogs)) {
|
|
|
|
|
- // 查询 注水泵 当日注水时间 参数名称
|
|
|
|
|
- DictTypeDO pointNameDict = dictTypeService.getDictType("rq_iot_rh_water_point_name");
|
|
|
|
|
- if (ObjUtil.isNotEmpty(pointNameDict) && StrUtil.isNotBlank(pointNameDict.getRemark())) {
|
|
|
|
|
- String pointName = pointNameDict.getRemark();
|
|
|
|
|
- // 当日填报的 注水泵 的运行时间 即 注水时间
|
|
|
|
|
- maxWaterInjectionTime = runLogs.stream()
|
|
|
|
|
- .filter(log -> pointName.equals(log.getPointName()))
|
|
|
|
|
- .map(IotDeviceRunLogDO::getFillContent)
|
|
|
|
|
- .filter(StrUtil::isNotBlank)
|
|
|
|
|
- .filter(NumberUtil::isNumber)
|
|
|
|
|
- .map(BigDecimal::new)
|
|
|
|
|
- .max(BigDecimal::compareTo)
|
|
|
|
|
- .orElse(BigDecimal.ZERO);
|
|
|
|
|
- iotRhDailyReport.setDailyInjectWaterTime(maxWaterInjectionTime);
|
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(pumpDeviceIds)) {
|
|
|
|
|
+ BigDecimal maxWaterInjectionTime = BigDecimal.ZERO;
|
|
|
|
|
+ // 过滤数据权限 查询 运行记录 日志
|
|
|
|
|
+ // 根据 当前日期 deptId pumpDeviceIds 查询运行记录工单关联的 deviceId
|
|
|
|
|
+ String reportDateStr = LocalDateTimeUtil.format(reportDate, DatePattern.NORM_DATE_PATTERN);
|
|
|
|
|
+ IotOpeationFillPageReqVO fillReqVO = new IotOpeationFillPageReqVO();
|
|
|
|
|
+ fillReqVO.setCreateTimeStr(reportDateStr);
|
|
|
|
|
+ fillReqVO.setDeptId(deptId);
|
|
|
|
|
+ fillReqVO.setDeviceIds(pumpDeviceIds);
|
|
|
|
|
+ List<IotOpeationFillDO> fills = iotOpeationFillMapper.selectList(fillReqVO);
|
|
|
|
|
+ Set<Long> fillPumpDeviceIds = new HashSet<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(fills)) {
|
|
|
|
|
+ fills.forEach(fill -> {
|
|
|
|
|
+ fillPumpDeviceIds.add(fill.getDeviceId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 根据 device_id createTime is_sum=0 在表 rq_iot_device_run_log 中查询 "当日运转时间H" 的值 fill_content
|
|
|
|
|
+ // 如果有多个注水泵的 运转时间 取 较大值
|
|
|
|
|
+ if (CollUtil.isNotEmpty(fillPumpDeviceIds)) {
|
|
|
|
|
+ IotDeviceRunLogPageReqVO runLogReqVO = new IotDeviceRunLogPageReqVO();
|
|
|
|
|
+ runLogReqVO.setCreateTimeStr(reportDateStr);
|
|
|
|
|
+ runLogReqVO.setDeviceIds(new ArrayList<>(fillPumpDeviceIds));
|
|
|
|
|
+ runLogReqVO.setIsSum(0);
|
|
|
|
|
+ List<IotDeviceRunLogDO> runLogs = iotDeviceRunLogMapper.selectList(runLogReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(runLogs)) {
|
|
|
|
|
+ // 查询 注水泵 当日注水时间 参数名称
|
|
|
|
|
+ DictTypeDO pointNameDict = dictTypeService.getDictType("rq_iot_rh_water_point_name");
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pointNameDict) && StrUtil.isNotBlank(pointNameDict.getRemark())) {
|
|
|
|
|
+ String pointName = pointNameDict.getRemark();
|
|
|
|
|
+ // 当日填报的 注水泵 的运行时间 即 注水时间
|
|
|
|
|
+ maxWaterInjectionTime = runLogs.stream()
|
|
|
|
|
+ .filter(log -> pointName.equals(log.getPointName()))
|
|
|
|
|
+ .map(IotDeviceRunLogDO::getFillContent)
|
|
|
|
|
+ .filter(StrUtil::isNotBlank)
|
|
|
|
|
+ .filter(NumberUtil::isNumber)
|
|
|
|
|
+ .map(BigDecimal::new)
|
|
|
|
|
+ .max(BigDecimal::compareTo)
|
|
|
|
|
+ .orElse(BigDecimal.ZERO);
|
|
|
|
|
+ iotRhDailyReport.setDailyInjectWaterTime(maxWaterInjectionTime);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|