|
@@ -396,10 +396,13 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
pageReqVO.getTaskIds(), pageReqVO.getProjectIds(), ids);
|
|
pageReqVO.getTaskIds(), pageReqVO.getProjectIds(), ids);
|
|
|
List<IotRhDailyReportDO> dailyReports = page.getRecords();
|
|
List<IotRhDailyReportDO> dailyReports = page.getRecords();
|
|
|
|
|
|
|
|
|
|
+ // key队伍id/项目部id value累计注气量
|
|
|
Map<Long, BigDecimal> cumulativeGasInjectionPair = new HashMap<>();
|
|
Map<Long, BigDecimal> cumulativeGasInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计注水量
|
|
|
Map<Long, BigDecimal> cumulativeWaterInjectionPair = new HashMap<>();
|
|
Map<Long, BigDecimal> cumulativeWaterInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计用电
|
|
|
Map<Long, BigDecimal> cumulativePowerConsumptionPair = new HashMap<>();
|
|
Map<Long, BigDecimal> cumulativePowerConsumptionPair = new HashMap<>();
|
|
|
- // key项目部id value累计油耗
|
|
|
|
|
|
|
+ // key队伍id/项目部id value累计油耗
|
|
|
Map<Long, BigDecimal> cumulativeFuelConsumptionPair = new HashMap<>();
|
|
Map<Long, BigDecimal> cumulativeFuelConsumptionPair = new HashMap<>();
|
|
|
// 默认显示所有项目部的汇总数据(新疆分公司也展示 下属各项目部的数据)
|
|
// 默认显示所有项目部的汇总数据(新疆分公司也展示 下属各项目部的数据)
|
|
|
// 点击项目部 显示 下属队伍的数据
|
|
// 点击项目部 显示 下属队伍的数据
|
|
@@ -407,7 +410,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
if (ObjUtil.isEmpty(pageReqVO.getDeptId())) {
|
|
if (ObjUtil.isEmpty(pageReqVO.getDeptId())) {
|
|
|
Set<Long> projectDeptIds = new HashSet<>();
|
|
Set<Long> projectDeptIds = new HashSet<>();
|
|
|
// key项目部id value项目部名称
|
|
// key项目部id value项目部名称
|
|
|
- Map<Long, String> projectDeptPair = new HashMap<>();
|
|
|
|
|
|
|
+ Map<Long, DeptDO> projectDeptPair = new HashMap<>();
|
|
|
// key部门id value部门parentId
|
|
// key部门id value部门parentId
|
|
|
Map<Long, Long> teamProjectIdPair = new HashMap<>();
|
|
Map<Long, Long> teamProjectIdPair = new HashMap<>();
|
|
|
|
|
|
|
@@ -421,7 +424,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
depts.forEach(dept -> {
|
|
depts.forEach(dept -> {
|
|
|
if ("2".equals(dept.getType())) {
|
|
if ("2".equals(dept.getType())) {
|
|
|
projectDeptIds.add(dept.getId());
|
|
projectDeptIds.add(dept.getId());
|
|
|
- projectDeptPair.put(dept.getId(), dept.getName());
|
|
|
|
|
|
|
+ projectDeptPair.put(dept.getId(), dept);
|
|
|
}
|
|
}
|
|
|
teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
});
|
|
});
|
|
@@ -429,10 +432,50 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
dailyReports.forEach(report -> {
|
|
dailyReports.forEach(report -> {
|
|
|
if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
|
|
if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
|
|
|
Long projectDeptId = teamProjectIdPair.get(report.getDeptId());
|
|
Long projectDeptId = teamProjectIdPair.get(report.getDeptId());
|
|
|
-
|
|
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(projectDeptId) && projectDeptPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ DeptDO tempDept = projectDeptPair.get(projectDeptId);
|
|
|
|
|
+ // 累计注气量
|
|
|
|
|
+ if (cumulativeGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal tempGasInjection = cumulativeGasInjectionPair.get(projectDeptId);
|
|
|
|
|
+ cumulativeGasInjectionPair.put(projectDeptId, report.getDailyGasInjection().add(tempGasInjection));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cumulativeGasInjectionPair.put(projectDeptId, report.getDailyGasInjection());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 累计注水量
|
|
|
|
|
+ if (cumulativeWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal tempWaterInjection = cumulativeWaterInjectionPair.get(projectDeptId);
|
|
|
|
|
+ cumulativeWaterInjectionPair.put(projectDeptId, report.getDailyWaterInjection().add(tempWaterInjection));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cumulativeWaterInjectionPair.put(projectDeptId, report.getDailyWaterInjection());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 累计用电量
|
|
|
|
|
+ if (cumulativePowerConsumptionPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal tempPower = cumulativePowerConsumptionPair.get(projectDeptId);
|
|
|
|
|
+ cumulativePowerConsumptionPair.put(projectDeptId, report.getDailyPowerUsage().add(tempPower));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cumulativePowerConsumptionPair.put(projectDeptId, report.getDailyPowerUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ // 生成返回的数据列表集合
|
|
|
|
|
+ projectDeptPair.forEach((deptId, dept) -> {
|
|
|
|
|
+ IotRhDailyReportStatisticsRespVO statistics = new IotRhDailyReportStatisticsRespVO();
|
|
|
|
|
+ statistics.setProjectDeptId(deptId);
|
|
|
|
|
+ statistics.setProjectDeptName(dept.getName());
|
|
|
|
|
+ statistics.setSort(dept.getSort());
|
|
|
|
|
+ if (cumulativeGasInjectionPair.containsKey(deptId)) {
|
|
|
|
|
+ statistics.setCumulativeGasInjection(cumulativeGasInjectionPair.get(deptId));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (cumulativeWaterInjectionPair.containsKey(deptId)) {
|
|
|
|
|
+ statistics.setCumulativeWaterInjection(cumulativeWaterInjectionPair.get(deptId));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (cumulativePowerConsumptionPair.containsKey(deptId)) {
|
|
|
|
|
+ statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(deptId));
|
|
|
|
|
+ }
|
|
|
|
|
+ result.add(statistics);
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
// 判断点击的组织树中的部门类型 类型(公司级1 项目部2 队伍3)
|
|
// 判断点击的组织树中的部门类型 类型(公司级1 项目部2 队伍3)
|
|
|
DeptDO selectedDept = deptService.getDept(pageReqVO.getDeptId());
|
|
DeptDO selectedDept = deptService.getDept(pageReqVO.getDeptId());
|
|
@@ -451,6 +494,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // 根据result集合内对象的 sort 属性正序排列 sort 类型为 integer 类型
|
|
|
|
|
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|