|
|
@@ -2670,6 +2670,9 @@ public class IotStaticController {
|
|
|
// key施工队伍id value状态为LY的项目部id
|
|
|
Map<Long, Long> teamProjectIdPair = new HashMap<>();
|
|
|
|
|
|
+ // key施工队伍id value队伍上级项目部id
|
|
|
+ Map<Long, Long> teamIdProjectIdPair = new HashMap<>();
|
|
|
+
|
|
|
// key项目部id value项目部年累计注气量
|
|
|
Map<Long, BigDecimal> projectYearGasInjectionPair = new HashMap<>();
|
|
|
// key项目部id value项目部年累计注水量
|
|
|
@@ -2741,6 +2744,9 @@ public class IotStaticController {
|
|
|
// 设置队伍与上级项目部的关联关系集合
|
|
|
teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
}
|
|
|
+ if (projectDeptId.equals(dept.getParentId()) && teamDepartmentIds.contains(deptId)) {
|
|
|
+ teamIdProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -2768,27 +2774,29 @@ public class IotStaticController {
|
|
|
|
|
|
if (CollUtil.isNotEmpty(yearDailyReports)) {
|
|
|
yearDailyReports.forEach(yearReport -> {
|
|
|
+ Long deptId = yearReport.getDeptId();
|
|
|
+ BigDecimal dailyGasInjection = yearReport.getDailyGasInjection();
|
|
|
+ BigDecimal dailyWaterInjection = yearReport.getDailyWaterInjection();
|
|
|
+
|
|
|
if (CollUtil.isNotEmpty(projectTeamPair)) {
|
|
|
projectTeamPair.forEach((projectDeptId, teamDeptIds) -> {
|
|
|
if (teamDeptIds.contains(yearReport.getDeptId())) {
|
|
|
- BigDecimal dailyGasInjection = yearReport.getDailyGasInjection();
|
|
|
- BigDecimal dailyWaterInjection = yearReport.getDailyWaterInjection();
|
|
|
// 项目部 年累计注气量
|
|
|
- if (projectYearGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ /* if (projectYearGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
BigDecimal tempGasInjection = projectYearGasInjectionPair.get(projectDeptId);
|
|
|
BigDecimal subtotal = tempGasInjection.add(dailyGasInjection);
|
|
|
projectYearGasInjectionPair.put(projectDeptId, subtotal);
|
|
|
} else {
|
|
|
projectYearGasInjectionPair.put(projectDeptId, dailyGasInjection);
|
|
|
- }
|
|
|
+ } */
|
|
|
// 项目部 年累计注水量
|
|
|
- if (projectYearWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ /* if (projectYearWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
BigDecimal tempWaterInjection = projectYearWaterInjectionPair.get(projectDeptId);
|
|
|
BigDecimal subtotal = tempWaterInjection.add(dailyWaterInjection);
|
|
|
projectYearWaterInjectionPair.put(projectDeptId, subtotal);
|
|
|
} else {
|
|
|
projectYearWaterInjectionPair.put(projectDeptId, dailyWaterInjection);
|
|
|
- }
|
|
|
+ } */
|
|
|
// 各项目部年度 运行时效(按小时统计的设备利用率)
|
|
|
// 按小时数 统计设备利用率
|
|
|
BigDecimal gasInjectionTime = ObjUtil.defaultIfNull(yearReport.getDailyInjectGasTime(), BigDecimal.ZERO);
|
|
|
@@ -2805,6 +2813,39 @@ public class IotStaticController {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ // 年累计的工作量 注气 注水 运行时效 不考虑队伍是否包含主设备
|
|
|
+ if (teamIdProjectIdPair.containsKey(deptId)) {
|
|
|
+ Long projectDeptId = teamIdProjectIdPair.get(deptId);
|
|
|
+ // 项目部 年累计注气量
|
|
|
+ if (projectYearGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal tempGasInjection = projectYearGasInjectionPair.get(projectDeptId);
|
|
|
+ BigDecimal subtotal = tempGasInjection.add(dailyGasInjection);
|
|
|
+ projectYearGasInjectionPair.put(projectDeptId, subtotal);
|
|
|
+ } else {
|
|
|
+ projectYearGasInjectionPair.put(projectDeptId, dailyGasInjection);
|
|
|
+ }
|
|
|
+ // 项目部 年累计注水量
|
|
|
+ if (projectYearWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal tempWaterInjection = projectYearWaterInjectionPair.get(projectDeptId);
|
|
|
+ BigDecimal subtotal = tempWaterInjection.add(dailyWaterInjection);
|
|
|
+ projectYearWaterInjectionPair.put(projectDeptId, subtotal);
|
|
|
+ } else {
|
|
|
+ projectYearWaterInjectionPair.put(projectDeptId, dailyWaterInjection);
|
|
|
+ }
|
|
|
+ // 各项目部年度 运行时效(按小时统计的设备利用率)
|
|
|
+ // 按小时数 统计设备利用率
|
|
|
+ BigDecimal gasInjectionTime = ObjUtil.defaultIfNull(yearReport.getDailyInjectGasTime(), BigDecimal.ZERO);
|
|
|
+ BigDecimal waterInjectionTime = ObjUtil.defaultIfNull(yearReport.getDailyInjectWaterTime(), BigDecimal.ZERO);
|
|
|
+ // 取 注气时间 注水时间 的较大者
|
|
|
+ BigDecimal workTime = gasInjectionTime.compareTo(BigDecimal.ZERO) > 0
|
|
|
+ ? gasInjectionTime
|
|
|
+ : waterInjectionTime.compareTo(BigDecimal.ZERO) > 0
|
|
|
+ ? waterInjectionTime
|
|
|
+ : BigDecimal.ZERO;
|
|
|
+ if (workTime.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ projectYearWorkTimePair.merge(projectDeptId, workTime, BigDecimal::add);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -2845,9 +2886,13 @@ public class IotStaticController {
|
|
|
|
|
|
// 整理出每个项目部下的队伍填报的日报数量
|
|
|
dailyReports.forEach(report -> {
|
|
|
+ Long deptId = report.getDeptId();
|
|
|
+ BigDecimal dailyGasInjection = report.getDailyGasInjection();
|
|
|
+ BigDecimal dailyWaterInjection = report.getDailyWaterInjection();
|
|
|
+
|
|
|
if (CollUtil.isNotEmpty(projectTeamPair)) {
|
|
|
projectTeamPair.forEach((projectDeptId, teamDeptIds) -> {
|
|
|
- if (teamDeptIds.contains(report.getDeptId())) {
|
|
|
+ if (teamDeptIds.contains(deptId)) {
|
|
|
// 以施工区域为维度统计 队伍总数 施工队伍数 准备队伍数 待命队伍数量
|
|
|
Long taskId = report.getTaskId();
|
|
|
String taskLocation = StrUtil.EMPTY;
|
|
|
@@ -2855,16 +2900,13 @@ public class IotStaticController {
|
|
|
taskLocation = taskLocationPair.get(taskId);
|
|
|
}
|
|
|
|
|
|
- BigDecimal dailyGasInjection = report.getDailyGasInjection();
|
|
|
- BigDecimal dailyWaterInjection = report.getDailyWaterInjection();
|
|
|
-
|
|
|
// 项目部下 施工区域内 队伍总数量
|
|
|
if (StrUtil.isNotBlank(taskLocation)) {
|
|
|
// 总队伍(去重)
|
|
|
projectLocationTeamSet
|
|
|
.computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
|
.computeIfAbsent(taskLocation, k -> new HashSet<>())
|
|
|
- .add(report.getDeptId());
|
|
|
+ .add(deptId);
|
|
|
}
|
|
|
|
|
|
if (dailyGasInjection.compareTo(BigDecimal.ZERO) > 0 || dailyWaterInjection.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
@@ -2876,7 +2918,7 @@ public class IotStaticController {
|
|
|
projectReportPair.put(projectDeptId, 1);
|
|
|
}
|
|
|
// 施工队伍数量
|
|
|
- if (haveDeviceDeptIds.contains(report.getDeptId())) {
|
|
|
+ if (haveDeviceDeptIds.contains(deptId)) {
|
|
|
if (sgTeamCountPair.containsKey(projectDeptId)) {
|
|
|
Integer tempCount = sgTeamCountPair.get(projectDeptId);
|
|
|
sgTeamCountPair.put(projectDeptId, ++tempCount);
|
|
|
@@ -2889,7 +2931,7 @@ public class IotStaticController {
|
|
|
projectLocationSgTeamSet
|
|
|
.computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
|
.computeIfAbsent(taskLocation, k -> new HashSet<>())
|
|
|
- .add(report.getDeptId());
|
|
|
+ .add(deptId);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2905,21 +2947,21 @@ public class IotStaticController {
|
|
|
}
|
|
|
|
|
|
// 项目部 指定时间的注气量
|
|
|
- if (projectGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ /* if (projectGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
BigDecimal tempGasInjection = projectGasInjectionPair.get(projectDeptId);
|
|
|
BigDecimal subtotal = tempGasInjection.add(dailyGasInjection);
|
|
|
projectGasInjectionPair.put(projectDeptId, subtotal);
|
|
|
} else {
|
|
|
projectGasInjectionPair.put(projectDeptId, dailyGasInjection);
|
|
|
- }
|
|
|
+ } */
|
|
|
// 项目部 指定时间的注水量
|
|
|
- if (projectWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ /* if (projectWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
BigDecimal tempWaterInjection = projectWaterInjectionPair.get(projectDeptId);
|
|
|
BigDecimal subtotal = tempWaterInjection.add(dailyWaterInjection);
|
|
|
projectWaterInjectionPair.put(projectDeptId, subtotal);
|
|
|
} else {
|
|
|
projectWaterInjectionPair.put(projectDeptId, dailyWaterInjection);
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
// 日报关联的任务井号
|
|
|
Long reportTaskId = report.getTaskId();
|
|
|
@@ -2972,6 +3014,26 @@ public class IotStaticController {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ // 统计所有队伍的注气量 注水量 不区分是否包含主设备
|
|
|
+ if (teamIdProjectIdPair.containsKey(deptId)) {
|
|
|
+ Long projectId = teamIdProjectIdPair.get(deptId);
|
|
|
+ // 项目部 指定时间的注气量
|
|
|
+ if (projectGasInjectionPair.containsKey(projectId)) {
|
|
|
+ BigDecimal tempGasInjection = projectGasInjectionPair.get(projectId);
|
|
|
+ BigDecimal subtotal = tempGasInjection.add(dailyGasInjection);
|
|
|
+ projectGasInjectionPair.put(projectId, subtotal);
|
|
|
+ } else {
|
|
|
+ projectGasInjectionPair.put(projectId, dailyGasInjection);
|
|
|
+ }
|
|
|
+ // 项目部 指定时间的注水量
|
|
|
+ if (projectWaterInjectionPair.containsKey(projectId)) {
|
|
|
+ BigDecimal tempWaterInjection = projectWaterInjectionPair.get(projectId);
|
|
|
+ BigDecimal subtotal = tempWaterInjection.add(dailyWaterInjection);
|
|
|
+ projectWaterInjectionPair.put(projectId, subtotal);
|
|
|
+ } else {
|
|
|
+ projectWaterInjectionPair.put(projectId, dailyWaterInjection);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
// 计算指定时间区间内包含的天数
|
|
|
long daysCount;
|