|
|
@@ -1610,6 +1610,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
// key项目部id value 压裂井数
|
|
|
Map<Long, Set<Long>> ylWellsPair = new HashMap<>();
|
|
|
|
|
|
+ // 已经完工的任务id集合
|
|
|
+ Set<Long> finishedTaskIds = new HashSet<>();
|
|
|
+ // key队伍id/项目部id value累计 油耗
|
|
|
+ Map<Long, Set<Long>> cumulativeWellsPair = new HashMap<>();
|
|
|
+
|
|
|
// 队伍id 集合
|
|
|
Set<Long> teamIds = new HashSet<>();
|
|
|
|
|
|
@@ -1755,12 +1760,26 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
daysCount = 0L;
|
|
|
}
|
|
|
|
|
|
+ // 遍历日报 找到每个日报关联的任务的 施工队伍
|
|
|
+ List<Long> taskIds = convertList(dailyReports, IotRdDailyReportDO::getTaskId);
|
|
|
+ Set<Long> uniqueTaskIds = new HashSet<>(taskIds);
|
|
|
+ IotProjectTaskPageReqVO relatedTaskReqVO = new IotProjectTaskPageReqVO();
|
|
|
+ relatedTaskReqVO.setTaskIds(new ArrayList<>(uniqueTaskIds));
|
|
|
+ List<IotProjectTaskDO> relatedTasks = iotProjectTaskMapper.selectList(relatedTaskReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(relatedTasks)) {
|
|
|
+ relatedTasks.forEach(task -> {
|
|
|
+ // 筛选出 完工 的任务集合 任务完工 施工井数 +1
|
|
|
+ if ("wg".equals(task.getRdStatus())) {
|
|
|
+ finishedTaskIds.add(task.getId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 累计计算各项 工作量
|
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
dailyReports.forEach(report -> {
|
|
|
// 统计日报包含施工AB类设备的利用率
|
|
|
// 利用率暂时不考虑日报状态
|
|
|
- // if (lyStatuses.contains(report.getRdStatus())) {
|
|
|
Set<Long> reportDeviceIds = report.getDeviceIds();
|
|
|
// 获得当前日报施工队伍的上级项目部
|
|
|
if (teamProjectIdPair.containsKey(report.getDeptId())) {
|
|
|
@@ -1786,11 +1805,14 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // }
|
|
|
|
|
|
+ // 油耗
|
|
|
BigDecimal dailyFuel = report.getDailyFuel();
|
|
|
dailyFuel = ObjUtil.isEmpty(dailyFuel) ? BigDecimal.ZERO : dailyFuel;
|
|
|
|
|
|
+ // 日报关联的任务井id
|
|
|
+ Long taskId = report.getTaskId();
|
|
|
+
|
|
|
if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
|
|
|
// projectDeptId可能是项目部 也可能是项目的上级
|
|
|
Long projectDeptId = 0l;
|
|
|
@@ -1803,6 +1825,21 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
projectDeptId = report.getDeptId();
|
|
|
}
|
|
|
if (ObjUtil.isNotEmpty(projectDeptId) && (projectDeptId > 0)) {
|
|
|
+ // 完工井
|
|
|
+ if (ObjUtil.isNotEmpty(taskId) && finishedTaskIds.contains(taskId)) {
|
|
|
+ // 统计各项目部下的完工井
|
|
|
+ if (cumulativeWellsPair.containsKey(projectDeptId)) {
|
|
|
+ Set<Long> existTaskIds = cumulativeWellsPair.get(projectDeptId);
|
|
|
+ existTaskIds.add(taskId);
|
|
|
+ cumulativeWellsPair.put(projectDeptId, existTaskIds);
|
|
|
+ } else {
|
|
|
+ Set<Long> existTaskIds = new HashSet<>();
|
|
|
+ existTaskIds.add(taskId);
|
|
|
+ cumulativeWellsPair.put(projectDeptId, existTaskIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 油耗
|
|
|
if (cumulativeFuelsPair.containsKey(projectDeptId)) {
|
|
|
BigDecimal existTotalFuel = cumulativeFuelsPair.get(projectDeptId);
|
|
|
BigDecimal tempTotalFuel = existTotalFuel.add(dailyFuel);
|
|
|
@@ -1987,7 +2024,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
statistics.setUtilizationRate(utilizationRatePair.get(deptId));
|
|
|
statistics.setCumulativeBridgePlug(cumulativeBridgePlugPair.get(deptId));
|
|
|
statistics.setCumulativeRunCount(cumulativeRunCountPair.get(deptId));
|
|
|
- statistics.setCumulativeWorkingWell(cumulativeWorkingWellPair.get(deptId));
|
|
|
+ // 累计施工井 设置 查询区间累计已经完工的井数
|
|
|
+ if (cumulativeWellsPair.containsKey(deptId)) {
|
|
|
+ Set<Long> projectFinishedTaskIds = cumulativeWellsPair.get(deptId);
|
|
|
+ statistics.setCumulativeWorkingWell(BigDecimal.valueOf(projectFinishedTaskIds.size()));
|
|
|
+ }
|
|
|
statistics.setCumulativeHourCount(cumulativeHourCountPair.get(deptId));
|
|
|
statistics.setCumulativeWaterVolume(cumulativeWaterVolumePair.get(deptId));
|
|
|
statistics.setCumulativeWorkingLayers(cumulativeWorkingLayersPair.get(deptId));
|
|
|
@@ -2051,6 +2092,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
// key队伍id/项目部id value累计 台次 当日泵车台次
|
|
|
Map<Long, BigDecimal> cumulativePumpTripsPair = new HashMap<>();
|
|
|
|
|
|
+ // 已经完工的任务id集合
|
|
|
+ Set<Long> finishedTaskIds = new HashSet<>();
|
|
|
+ // key队伍id/项目部id value累计 油耗
|
|
|
+ Map<Long, Set<Long>> cumulativeWellsPair = new HashMap<>();
|
|
|
+
|
|
|
// 以 队伍 为维度统计数据
|
|
|
// 找到所有项目部与队伍的对应关系
|
|
|
// 查询指定根部门下的所有子部门
|
|
|
@@ -2167,6 +2213,21 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 遍历日报 找到每个日报关联的任务的 施工队伍
|
|
|
+ List<Long> taskIds = convertList(dailyReports, IotRdDailyReportDO::getTaskId);
|
|
|
+ Set<Long> uniqueTaskIds = new HashSet<>(taskIds);
|
|
|
+ IotProjectTaskPageReqVO relatedTaskReqVO = new IotProjectTaskPageReqVO();
|
|
|
+ relatedTaskReqVO.setTaskIds(new ArrayList<>(uniqueTaskIds));
|
|
|
+ List<IotProjectTaskDO> relatedTasks = iotProjectTaskMapper.selectList(relatedTaskReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(relatedTasks)) {
|
|
|
+ relatedTasks.forEach(task -> {
|
|
|
+ // 筛选出 完工 的任务集合 任务完工 施工井数 +1
|
|
|
+ if ("wg".equals(task.getRdStatus())) {
|
|
|
+ finishedTaskIds.add(task.getId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 累计计算 工作量
|
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
dailyReports.forEach(report -> {
|
|
|
@@ -2195,22 +2256,33 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ // 油耗
|
|
|
BigDecimal dailyFuel = report.getDailyFuel();
|
|
|
dailyFuel = ObjUtil.isEmpty(dailyFuel) ? BigDecimal.ZERO : dailyFuel;
|
|
|
+
|
|
|
+ // 日报关联的任务井id
|
|
|
+ Long taskId = report.getTaskId();
|
|
|
+
|
|
|
if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
|
|
|
// projectDeptId可能是项目部 也可能是项目的上级
|
|
|
Long detailDeptId = 0l;
|
|
|
detailDeptId = report.getDeptId();
|
|
|
- /* if (teamDeptPair.containsKey(report.getDeptId())) {
|
|
|
- // 日报deptId如果是队伍 获取队伍的上级项目部
|
|
|
- detailDeptId = teamProjectIdPair.get(report.getDeptId());
|
|
|
- }
|
|
|
- if (projectDeptPair.containsKey(report.getDeptId())) {
|
|
|
- // 日报deptId如果是项目部 使用当前项目部
|
|
|
- detailDeptId = report.getDeptId();
|
|
|
- } */
|
|
|
+ // 设置各项工作量
|
|
|
if (ObjUtil.isNotEmpty(detailDeptId) && (detailDeptId > 0)) {
|
|
|
+ // 完工井
|
|
|
+ if (ObjUtil.isNotEmpty(taskId) && finishedTaskIds.contains(taskId)) {
|
|
|
+ // 统计各项目部下的完工井
|
|
|
+ if (cumulativeWellsPair.containsKey(detailDeptId)) {
|
|
|
+ Set<Long> existTaskIds = cumulativeWellsPair.get(detailDeptId);
|
|
|
+ existTaskIds.add(taskId);
|
|
|
+ cumulativeWellsPair.put(detailDeptId, existTaskIds);
|
|
|
+ } else {
|
|
|
+ Set<Long> existTaskIds = new HashSet<>();
|
|
|
+ existTaskIds.add(taskId);
|
|
|
+ cumulativeWellsPair.put(detailDeptId, existTaskIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 油耗
|
|
|
if (cumulativeFuelsPair.containsKey(detailDeptId)) {
|
|
|
BigDecimal existTotalFuel = cumulativeFuelsPair.get(detailDeptId);
|
|
|
BigDecimal tempTotalFuel = existTotalFuel.add(dailyFuel);
|
|
|
@@ -2372,7 +2444,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
statistics.setUtilizationRate(utilizationRatePair.get(teamDeptId));
|
|
|
statistics.setCumulativeBridgePlug(cumulativeBridgePlugPair.get(teamDeptId));
|
|
|
statistics.setCumulativeRunCount(cumulativeRunCountPair.get(teamDeptId));
|
|
|
- statistics.setCumulativeWorkingWell(cumulativeWorkingWellPair.get(teamDeptId));
|
|
|
+ // 累计施工井 设置 查询区间累计已经完工的井数
|
|
|
+ if (cumulativeWellsPair.containsKey(teamDeptId)) {
|
|
|
+ Set<Long> teamFinishedTaskIds = cumulativeWellsPair.get(teamDeptId);
|
|
|
+ statistics.setCumulativeWorkingWell(BigDecimal.valueOf(teamFinishedTaskIds.size()));
|
|
|
+ }
|
|
|
statistics.setCumulativeHourCount(cumulativeHourCountPair.get(teamDeptId));
|
|
|
statistics.setCumulativeWaterVolume(cumulativeWaterVolumePair.get(teamDeptId));
|
|
|
statistics.setCumulativeWorkingLayers(cumulativeWorkingLayersPair.get(teamDeptId));
|