|
@@ -2357,6 +2357,8 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
Map<String, BigDecimal> dateMixSandPair = new HashMap<>();
|
|
Map<String, BigDecimal> dateMixSandPair = new HashMap<>();
|
|
|
// key日期yyyy-MM-dd value 累计 油耗
|
|
// key日期yyyy-MM-dd value 累计 油耗
|
|
|
Map<String, BigDecimal> dateFuelsPair = new HashMap<>();
|
|
Map<String, BigDecimal> dateFuelsPair = new HashMap<>();
|
|
|
|
|
+ // key日期yyyy-MM-dd value 累计的压裂连油主设备id列表
|
|
|
|
|
+ Map<String, List<Long>> dateDeviceIdsPair = new HashMap<>();
|
|
|
|
|
|
|
|
// 以项目部为维度统计数据
|
|
// 以项目部为维度统计数据
|
|
|
// 找到所有项目部与队伍的对应关系
|
|
// 找到所有项目部与队伍的对应关系
|
|
@@ -2375,6 +2377,20 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ Set<Long> mainDeviceIds = new HashSet<>();
|
|
|
|
|
+ // 瑞都 压裂 连油 主设备
|
|
|
|
|
+ IotDeviceAssociatePageReqVO deviceAssocReqVO = new IotDeviceAssociatePageReqVO();
|
|
|
|
|
+ deviceAssocReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ deviceAssocReqVO.setDeptIds(allRhChildDeptIds);
|
|
|
|
|
+ PageResult<IotDeviceAssociateDO> pageResult = iotDeviceAssociateMapper.selectPage(deviceAssocReqVO);
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageResult)) {
|
|
|
|
|
+ List<IotDeviceAssociateDO> deviceAssociates = pageResult.getList();
|
|
|
|
|
+ // 查询出选择部门内 瑞都压裂 连油主设备
|
|
|
|
|
+ deviceAssociates.forEach(assoc -> {
|
|
|
|
|
+ mainDeviceIds.add(assoc.getDeviceId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 累计计算各项指标
|
|
// 累计计算各项指标
|
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
dailyReports.forEach(report -> {
|
|
dailyReports.forEach(report -> {
|
|
@@ -2393,6 +2409,24 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
dateFuelsPair.put(reportDateStr, dailyFuel);
|
|
dateFuelsPair.put(reportDateStr, dailyFuel);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 计算查询时间区间内每天的设备利用率 组装每天内所有队伍使用到的 压裂 连油 主设备列表
|
|
|
|
|
+ Set<Long> currentReportDeviceIds = report.getDeviceIds();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(currentReportDeviceIds)) {
|
|
|
|
|
+ // 1. 求交集:实际使用的A B类设备
|
|
|
|
|
+ Set<Long> utilizedDeviceIds = currentReportDeviceIds.stream()
|
|
|
|
|
+ .filter(mainDeviceIds::contains)
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
|
+ if (dateDeviceIdsPair.containsKey(reportDateStr)) {
|
|
|
|
|
+ List<Long> tempDeviceIds = dateDeviceIdsPair.get(reportDateStr);
|
|
|
|
|
+ tempDeviceIds.addAll(new ArrayList<>(utilizedDeviceIds));
|
|
|
|
|
+ dateDeviceIdsPair.put(reportDateStr, tempDeviceIds);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ List<Long> tempDeviceIds = new ArrayList<>();
|
|
|
|
|
+ tempDeviceIds.addAll(new ArrayList<>(utilizedDeviceIds));
|
|
|
|
|
+ dateDeviceIdsPair.put(reportDateStr, tempDeviceIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 设置每个任务的工作量数据 单位相同的工作量值作合并处理
|
|
// 设置每个任务的工作量数据 单位相同的工作量值作合并处理
|
|
|
List<IotTaskAttrModelProperty> taskAttrs = report.getExtProperty();
|
|
List<IotTaskAttrModelProperty> taskAttrs = report.getExtProperty();
|
|
|
// 暂存不同单位的工作量属性值
|
|
// 暂存不同单位的工作量属性值
|
|
@@ -2550,6 +2584,20 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
statistics.setCumulativeMixSand(dateMixSandPair.get(date));
|
|
statistics.setCumulativeMixSand(dateMixSandPair.get(date));
|
|
|
statistics.setCumulativePumpTrips(datePumpTripsPair.get(date));
|
|
statistics.setCumulativePumpTrips(datePumpTripsPair.get(date));
|
|
|
statistics.setTaici(taici);
|
|
statistics.setTaici(taici);
|
|
|
|
|
+ // 计算查询周期内每天的设备利用率
|
|
|
|
|
+ if (dateDeviceIdsPair.containsKey(date)) {
|
|
|
|
|
+ List<Long> dateDeviceIds = dateDeviceIdsPair.get(date);
|
|
|
|
|
+ Integer dateDeviceIdCount = dateDeviceIds.size();
|
|
|
|
|
+ Integer mainDeviceIdCount = mainDeviceIds.size();
|
|
|
|
|
+ BigDecimal rate = BigDecimal.ZERO;
|
|
|
|
|
+ if (mainDeviceIdCount > 0) {
|
|
|
|
|
+ BigDecimal total = new BigDecimal(mainDeviceIdCount);
|
|
|
|
|
+ BigDecimal current = new BigDecimal(dateDeviceIdCount);
|
|
|
|
|
+ rate = current.divide(total, 4, RoundingMode.HALF_UP);
|
|
|
|
|
+ }
|
|
|
|
|
+ statistics.setUtilizationRate(rate);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
result.add(statistics);
|
|
result.add(statistics);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|