|
@@ -1139,8 +1139,11 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
// key队伍id value队伍名称
|
|
// key队伍id value队伍名称
|
|
|
Map<Long, String> teamPair = new HashMap<>();
|
|
Map<Long, String> teamPair = new HashMap<>();
|
|
|
|
|
|
|
|
- // key项目部id value项目部包含的队伍id集合
|
|
|
|
|
|
|
+ // key项目部id value项目部包含的队伍id集合 包含主设备的队伍
|
|
|
Map<Long, Set<Long>> projectTeamPair = new HashMap<>();
|
|
Map<Long, Set<Long>> projectTeamPair = new HashMap<>();
|
|
|
|
|
+ // key项目部id value项目部包含的队伍id集合 所有队伍
|
|
|
|
|
+ Map<Long, Set<Long>> projectTeamsPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
// key项目部id value项目部包含的队伍集合
|
|
// key项目部id value项目部包含的队伍集合
|
|
|
Map<Long, Set<DeptDO>> projectDepartmentPair = new HashMap<>();
|
|
Map<Long, Set<DeptDO>> projectDepartmentPair = new HashMap<>();
|
|
|
// 队伍id 集合
|
|
// 队伍id 集合
|
|
@@ -1210,16 +1213,47 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
});
|
|
});
|
|
|
// 遍历所有部门 只筛选出有设备的队伍
|
|
// 遍历所有部门 只筛选出有设备的队伍
|
|
|
allDeptPair.forEach((deptId, dept) -> {
|
|
allDeptPair.forEach((deptId, dept) -> {
|
|
|
|
|
+ if (!"3".equals(dept.getType())) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Long parentId = dept.getParentId();
|
|
|
|
|
+ if (ObjUtil.isEmpty(parentId) || !projectPair.containsKey(parentId)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 所有队伍只挂到自己的直接父项目部
|
|
|
|
|
+ projectTeamsPair.computeIfAbsent(parentId, k -> new HashSet<>()).add(deptId);
|
|
|
|
|
+ teamIdProjectIdPair.put(deptId, parentId);
|
|
|
|
|
+
|
|
|
|
|
+ // 有主设备的队伍
|
|
|
|
|
+ if (haveDeviceDeptIds.contains(deptId)) {
|
|
|
|
|
+ projectTeamPair.computeIfAbsent(parentId, k -> new HashSet<>()).add(deptId);
|
|
|
|
|
+ teamProjectIdPair.put(deptId, parentId);
|
|
|
|
|
+ projectSortedTeamIdPair.computeIfAbsent(parentId, k -> new ArrayList<>()).add(deptId);
|
|
|
|
|
+ }
|
|
|
// 找出每个项目部下的队伍
|
|
// 找出每个项目部下的队伍
|
|
|
- if (projectPair.containsKey(dept.getParentId())) {
|
|
|
|
|
|
|
+ /* if (projectPair.containsKey(dept.getParentId())) {
|
|
|
// 获得当前部门的上级项目部
|
|
// 获得当前部门的上级项目部
|
|
|
projectPair.forEach((projectDeptId, projectDeptName) -> {
|
|
projectPair.forEach((projectDeptId, projectDeptName) -> {
|
|
|
|
|
+ // 项目部下所有队伍
|
|
|
|
|
+ if (projectTeamsPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ Set<Long> teamIds = projectTeamsPair.get(projectDeptId);
|
|
|
|
|
+ teamIds.add(deptId);
|
|
|
|
|
+ projectTeamsPair.put(projectDeptId, teamIds);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Set<Long> teamIds = new HashSet<>();
|
|
|
|
|
+ teamIds.add(deptId);
|
|
|
|
|
+ projectTeamsPair.put(projectDeptId, teamIds);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 项目部下包含主设备的队伍
|
|
|
if (projectDeptId.equals(dept.getParentId()) && haveDeviceDeptIds.contains(deptId) && teamDepartmentIds.contains(deptId)) {
|
|
if (projectDeptId.equals(dept.getParentId()) && haveDeviceDeptIds.contains(deptId) && teamDepartmentIds.contains(deptId)) {
|
|
|
// 项目部下各队伍id列表初始化
|
|
// 项目部下各队伍id列表初始化
|
|
|
projectSortedTeamIdPair
|
|
projectSortedTeamIdPair
|
|
|
.computeIfAbsent(dept.getParentId(), k -> new ArrayList<>())
|
|
.computeIfAbsent(dept.getParentId(), k -> new ArrayList<>())
|
|
|
.add(deptId);
|
|
.add(deptId);
|
|
|
-
|
|
|
|
|
|
|
+ // 项目部下包含主设备的队伍
|
|
|
if (projectTeamPair.containsKey(projectDeptId)) {
|
|
if (projectTeamPair.containsKey(projectDeptId)) {
|
|
|
Set<Long> teamIds = projectTeamPair.get(projectDeptId);
|
|
Set<Long> teamIds = projectTeamPair.get(projectDeptId);
|
|
|
teamIds.add(deptId);
|
|
teamIds.add(deptId);
|
|
@@ -1237,7 +1271,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
teamIdProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
teamIdProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ } */
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 对每个项目部下的队伍ID列表,根据队伍的 sort 字段正序排序
|
|
// 对每个项目部下的队伍ID列表,根据队伍的 sort 字段正序排序
|
|
@@ -1402,6 +1436,32 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
location = taskLocationPair.get(reportTaskId);
|
|
location = taskLocationPair.get(reportTaskId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 日报关联的任务井id
|
|
|
|
|
+ Long taskId = report.getTaskId();
|
|
|
|
|
+
|
|
|
|
|
+ if (CollUtil.isNotEmpty(projectTeamsPair)) {
|
|
|
|
|
+ for (Map.Entry<Long, Set<Long>> longSetEntry : projectTeamsPair.entrySet()) {
|
|
|
|
|
+ Long projectDeptId = longSetEntry.getKey();
|
|
|
|
|
+ Set<Long> teamDeptIds = longSetEntry.getValue();
|
|
|
|
|
+ if (teamDeptIds.contains(deptId)) {
|
|
|
|
|
+ // 以施工区域为维度统计 队伍总数 施工队伍数 准备队伍数 待命队伍数量
|
|
|
|
|
+ String taskLocation = StrUtil.EMPTY;
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(taskId) && taskLocationPair.containsKey(taskId)) {
|
|
|
|
|
+ taskLocation = taskLocationPair.get(taskId);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 项目部下 施工区域内 队伍总数量
|
|
|
|
|
+ if (StrUtil.isNotBlank(taskLocation)) {
|
|
|
|
|
+ // 总队伍(去重)
|
|
|
|
|
+ projectLocationTeamSet
|
|
|
|
|
+ .computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
|
|
|
+ .computeIfAbsent(taskLocation, k -> new HashSet<>())
|
|
|
|
|
+ .add(deptId);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (CollUtil.isNotEmpty(projectTeamPair)) {
|
|
if (CollUtil.isNotEmpty(projectTeamPair)) {
|
|
|
for (Map.Entry<Long, Set<Long>> longSetEntry : projectTeamPair.entrySet()) {
|
|
for (Map.Entry<Long, Set<Long>> longSetEntry : projectTeamPair.entrySet()) {
|
|
|
Long projectDeptId = longSetEntry.getKey();
|
|
Long projectDeptId = longSetEntry.getKey();
|
|
@@ -1409,20 +1469,19 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
|
|
|
|
|
if (teamDeptIds.contains(deptId)) {
|
|
if (teamDeptIds.contains(deptId)) {
|
|
|
// 以施工区域为维度统计 队伍总数 施工队伍数 准备队伍数 待命队伍数量
|
|
// 以施工区域为维度统计 队伍总数 施工队伍数 准备队伍数 待命队伍数量
|
|
|
- Long taskId = report.getTaskId();
|
|
|
|
|
String taskLocation = StrUtil.EMPTY;
|
|
String taskLocation = StrUtil.EMPTY;
|
|
|
if (ObjUtil.isNotEmpty(taskId) && taskLocationPair.containsKey(taskId)) {
|
|
if (ObjUtil.isNotEmpty(taskId) && taskLocationPair.containsKey(taskId)) {
|
|
|
taskLocation = taskLocationPair.get(taskId);
|
|
taskLocation = taskLocationPair.get(taskId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 项目部下 施工区域内 队伍总数量
|
|
// 项目部下 施工区域内 队伍总数量
|
|
|
- if (StrUtil.isNotBlank(taskLocation)) {
|
|
|
|
|
|
|
+ /* if (StrUtil.isNotBlank(taskLocation)) {
|
|
|
// 总队伍(去重)
|
|
// 总队伍(去重)
|
|
|
projectLocationTeamSet
|
|
projectLocationTeamSet
|
|
|
.computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
.computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
|
.computeIfAbsent(taskLocation, k -> new HashSet<>())
|
|
.computeIfAbsent(taskLocation, k -> new HashSet<>())
|
|
|
.add(deptId);
|
|
.add(deptId);
|
|
|
- }
|
|
|
|
|
|
|
+ } */
|
|
|
|
|
|
|
|
if (dailyGasInjection.compareTo(BigDecimal.ZERO) > 0 || dailyWaterInjection.compareTo(BigDecimal.ZERO) > 0) {
|
|
if (dailyGasInjection.compareTo(BigDecimal.ZERO) > 0 || dailyWaterInjection.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
// 项目部日报数量 20260608 统计 注气量 or 注水量 > 0 的日报数量
|
|
// 项目部日报数量 20260608 统计 注气量 or 注水量 > 0 的日报数量
|
|
@@ -1878,7 +1937,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
rate.setConstructionDays((ObjUtil.isNotEmpty(rate.getConstructionDays()) ? rate.getConstructionDays() : 0) + mergeConstructionDays.get());
|
|
rate.setConstructionDays((ObjUtil.isNotEmpty(rate.getConstructionDays()) ? rate.getConstructionDays() : 0) + mergeConstructionDays.get());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Map<String, Map<String, List<String>>> locationMap = productionMap.get(rate.getProjectDeptId());
|
|
|
|
|
|
|
+ /* Map<String, Map<String, List<String>>> locationMap = productionMap.get(rate.getProjectDeptId());
|
|
|
// 组装各项目部 按照施工区域维度统计 的 队伍数量 生产动态明细
|
|
// 组装各项目部 按照施工区域维度统计 的 队伍数量 生产动态明细
|
|
|
if (locationMap != null && !locationMap.isEmpty() && !specialProjectIds.contains(rate.getProjectDeptId())) {
|
|
if (locationMap != null && !locationMap.isEmpty() && !specialProjectIds.contains(rate.getProjectDeptId())) {
|
|
|
Map<String, Set<Long>> teamMap = projectLocationTeamSet.getOrDefault(rate.getProjectDeptId(), Collections.emptyMap());
|
|
Map<String, Set<Long>> teamMap = projectLocationTeamSet.getOrDefault(rate.getProjectDeptId(), Collections.emptyMap());
|
|
@@ -1912,6 +1971,69 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
rate.setProductionSummary(sb.toString());
|
|
rate.setProductionSummary(sb.toString());
|
|
|
|
|
+ } */
|
|
|
|
|
+
|
|
|
|
|
+ if (!specialProjectIds.contains(rate.getProjectDeptId())) {
|
|
|
|
|
+ Map<String, Set<Long>> teamMap = projectLocationTeamSet
|
|
|
|
|
+ .getOrDefault(rate.getProjectDeptId(), Collections.emptyMap());
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Set<Long>> sgTeamMap = projectLocationSgTeamSet
|
|
|
|
|
+ .getOrDefault(rate.getProjectDeptId(), Collections.emptyMap());
|
|
|
|
|
+
|
|
|
|
|
+ // productionMap 只表示:有“非生产时间和=24H”的井动态,不是区域全集
|
|
|
|
|
+ Map<String, Map<String, List<String>>> locationMap = productionMap
|
|
|
|
|
+ .getOrDefault(rate.getProjectDeptId(), Collections.emptyMap());
|
|
|
|
|
+
|
|
|
|
|
+ // 关键:以区域统计全集为准,而不是只遍历 locationMap.keySet()
|
|
|
|
|
+ Set<String> locations = new TreeSet<>();
|
|
|
|
|
+ locations.addAll(teamMap.keySet());
|
|
|
|
|
+ locations.addAll(sgTeamMap.keySet());
|
|
|
|
|
+ locations.addAll(locationMap.keySet()); // 防止有动态但统计集合缺失
|
|
|
|
|
+
|
|
|
|
|
+ if (!locations.isEmpty()) {
|
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
|
+
|
|
|
|
|
+ for (String location : locations) {
|
|
|
|
|
+ int total = teamMap.getOrDefault(location, Collections.emptySet()).size();
|
|
|
|
|
+ int sg = sgTeamMap.getOrDefault(location, Collections.emptySet()).size();
|
|
|
|
|
+ int zb = Math.max(total - sg, 0);
|
|
|
|
|
+
|
|
|
|
|
+ // 无论有没有“非生产时间和=24H”,区域统计行都输出
|
|
|
|
|
+ sb.append(location)
|
|
|
|
|
+ .append(":施工").append(sg)
|
|
|
|
|
+ .append("套设备,准备").append(zb)
|
|
|
|
|
+ .append("套设备(共").append(total).append("套设备)\n");
|
|
|
|
|
+
|
|
|
|
|
+ // 没有该区域的 24H 非生产动态时,只输出上面区域统计行
|
|
|
|
|
+ Map<String, List<String>> wellMap = locationMap.get(location);
|
|
|
|
|
+ if (wellMap == null || wellMap.isEmpty()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<String> sortedWells = new ArrayList<>(wellMap.keySet());
|
|
|
|
|
+ Collections.sort(sortedWells);
|
|
|
|
|
+
|
|
|
|
|
+ for (String well : sortedWells) {
|
|
|
|
|
+ List<String> dynamics = wellMap.get(well);
|
|
|
|
|
+ List<String> nonEmptyDynamics = dynamics == null
|
|
|
|
|
+ ? Collections.emptyList()
|
|
|
|
|
+ : dynamics.stream()
|
|
|
|
|
+ .filter(s -> s != null && !s.trim().isEmpty())
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ if (nonEmptyDynamics.isEmpty()) {
|
|
|
|
|
+ sb.append(well).append(",;\n");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sb.append(well)
|
|
|
|
|
+ .append(",")
|
|
|
|
|
+ .append(String.join(";", nonEmptyDynamics))
|
|
|
|
|
+ .append(";\n");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rate.setProductionSummary(sb.toString());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
// 删除projectDeptId为166的对象 克拉玛依项目部
|
|
// 删除projectDeptId为166的对象 克拉玛依项目部
|