|
|
@@ -745,13 +745,13 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
// 点击项目部 显示 下属队伍的数据
|
|
|
// 首先判断点击的部门是属于 公司 还是 队伍 如果没有点击任何部门 默认查询所有项目部数据
|
|
|
if (ObjUtil.isEmpty(pageReqVO.getDeptId())) {
|
|
|
- result = statisticsByProjectDept(dailyReports, 157L);
|
|
|
+ result = statisticsByProjectDept(dailyReports, 157L, pageReqVO);
|
|
|
} else {
|
|
|
// 判断点击的组织树中的部门类型 类型(公司级1 项目部2 队伍3)
|
|
|
DeptDO selectedDept = deptService.getDept(pageReqVO.getDeptId());
|
|
|
if ("1".equals(selectedDept.getType())) {
|
|
|
// 以项目部为维度汇总数据
|
|
|
- result = statisticsByProjectDept(dailyReports, pageReqVO.getDeptId());
|
|
|
+ result = statisticsByProjectDept(dailyReports, pageReqVO.getDeptId(), pageReqVO);
|
|
|
} else if ("2".equals(selectedDept.getType())) {
|
|
|
// 以队伍为维度汇总数据
|
|
|
result = statisticsByProjectDepartment(dailyReports, pageReqVO.getDeptId());
|
|
|
@@ -761,7 +761,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
} else {
|
|
|
// 点击的部门没有类型 判断部门下的是否包含 项目部类型部门 新疆分公司
|
|
|
// 以项目部为维度汇总数据
|
|
|
- result = statisticsByProjectDept(dailyReports, pageReqVO.getDeptId());
|
|
|
+ result = statisticsByProjectDept(dailyReports, pageReqVO.getDeptId(), pageReqVO);
|
|
|
}
|
|
|
}
|
|
|
// 根据result集合内对象的 sort 属性正序排列 sort 类型为 integer 类型
|
|
|
@@ -780,7 +780,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
* @param rootDeptId 根部门ID(如157L为瑞恒根部门,或其他公司级部门ID)
|
|
|
* @return 项目部维度统计结果列表
|
|
|
*/
|
|
|
- private List<IotRhDailyReportStatisticsRespVO> statisticsByProjectDept(List<IotRhDailyReportDO> dailyReports, Long rootDeptId) {
|
|
|
+ private List<IotRhDailyReportStatisticsRespVO> statisticsByProjectDept(List<IotRhDailyReportDO> dailyReports,
|
|
|
+ Long rootDeptId, IotRhDailyReportPageReqVO pageReqVO) {
|
|
|
List<IotRhDailyReportStatisticsRespVO> result = new ArrayList<>();
|
|
|
|
|
|
Set<Long> projectDeptIds = new HashSet<>();
|
|
|
@@ -801,6 +802,16 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
Map<Long, BigDecimal> cumulativeCapacityPair = new HashMap<>();
|
|
|
// key队伍id/项目部id value累计运行时效 累计注气量/累计产能
|
|
|
Map<Long, BigDecimal> cumulativeTransitTimePair = new HashMap<>();
|
|
|
+ // key项目部id value项目部下包含的队伍总数
|
|
|
+ Map<Long, Integer> teamCountPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部下包含的 施工 队伍数量
|
|
|
+ Map<Long, Integer> sgTeamCountPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部下包含的 施工准备 队伍数量
|
|
|
+ Map<Long, Integer> zbTeamCountPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部下包含的 驻地待命 队伍数量
|
|
|
+ Map<Long, Integer> zddmTeamCountPair = new HashMap<>();
|
|
|
+ // 队伍id 集合
|
|
|
+ Set<Long> teamIds = new HashSet<>();
|
|
|
|
|
|
// 以项目部为维度统计数据
|
|
|
// 找到所有项目部与队伍的对应关系
|
|
|
@@ -813,12 +824,79 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
// 构建项目部映射和父子部门关系
|
|
|
depts.forEach(dept -> {
|
|
|
if ("2".equals(dept.getType())) {
|
|
|
+ // 项目部
|
|
|
projectDeptIds.add(dept.getId());
|
|
|
projectDeptPair.put(dept.getId(), dept);
|
|
|
}
|
|
|
+ if ("3".equals(dept.getType())) {
|
|
|
+ // 队伍
|
|
|
+ teamIds.add(dept.getId());
|
|
|
+ }
|
|
|
teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
});
|
|
|
|
|
|
+ LocalDateTime[] createTime = pageReqVO.getCreateTime();
|
|
|
+ // 如果 createTime 包含的时间是 1天则查询 这1天时间内的 队伍总数 施工队伍数量 施工准备队伍数量 驻地待命队伍数量
|
|
|
+ if (ObjUtil.isNotEmpty(createTime)) {
|
|
|
+ LocalDateTime startTime = createTime[0];
|
|
|
+ LocalDateTime endTime = createTime[1];
|
|
|
+ if (ObjUtil.isNotEmpty(startTime) && ObjUtil.isNotEmpty(endTime)) {
|
|
|
+ LocalDate startLocalDate = startTime.toLocalDate();
|
|
|
+ LocalDate endLocalDate = endTime.toLocalDate();
|
|
|
+ if (startLocalDate.isEqual(endLocalDate)) {
|
|
|
+ // 查询日期区间是 同一天
|
|
|
+ // 设置每个项目部下的队伍数量
|
|
|
+ projectDeptPair.forEach((projectDeptId, projectDept) -> {
|
|
|
+ // 找到每个项目部下的队伍
|
|
|
+ teamProjectIdPair.forEach((deptId, parentDeptId) -> {
|
|
|
+ if (parentDeptId.equals(projectDeptId)) {
|
|
|
+ if (teamCountPair.containsKey(projectDeptId)) {
|
|
|
+ Integer tempCount = teamCountPair.get(projectDeptId);
|
|
|
+ teamCountPair.put(projectDeptId, ++tempCount);
|
|
|
+ } else {
|
|
|
+ teamCountPair.put(projectDeptId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 找出日报列表中 状态为 施工 施工准备 驻地待命的 记录
|
|
|
+ if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
+ if (teamProjectIdPair.containsKey(report.getDeptId())) {
|
|
|
+ // 找到队伍所属的上级项目部
|
|
|
+ Long projectDeptId = teamProjectIdPair.get(report.getDeptId());
|
|
|
+ // 施工状态
|
|
|
+ if ("sg".equals(report.getConstructionStatus())) {
|
|
|
+ if (sgTeamCountPair.containsKey(projectDeptId)) {
|
|
|
+ Integer tempCount = sgTeamCountPair.get(projectDeptId);
|
|
|
+ sgTeamCountPair.put(projectDeptId, ++tempCount);
|
|
|
+ } else {
|
|
|
+ sgTeamCountPair.put(projectDeptId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("zb".equals(report.getConstructionStatus())) {
|
|
|
+ if (zbTeamCountPair.containsKey(projectDeptId)) {
|
|
|
+ Integer tempCount = zbTeamCountPair.get(projectDeptId);
|
|
|
+ zbTeamCountPair.put(projectDeptId, ++tempCount);
|
|
|
+ } else {
|
|
|
+ zbTeamCountPair.put(projectDeptId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("zddm".equals(report.getConstructionStatus())) {
|
|
|
+ if (zddmTeamCountPair.containsKey(projectDeptId)) {
|
|
|
+ Integer tempCount = zddmTeamCountPair.get(projectDeptId);
|
|
|
+ zddmTeamCountPair.put(projectDeptId, ++tempCount);
|
|
|
+ } else {
|
|
|
+ zddmTeamCountPair.put(projectDeptId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 查询指定部门下相关设备的产能
|
|
|
// key队伍id value队伍下相关设备产能
|
|
|
Map<Long, BigDecimal> teamCapacityPair = queryCapacities(new ArrayList<>(allRhChildDeptIds));
|
|
|
@@ -873,6 +951,22 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(deptId));
|
|
|
statistics.setCumulativeFuelConsumption(cumulativeOilConsumptionPair.get(deptId));
|
|
|
statistics.setTransitTime(cumulativeTransitTimePair.get(deptId));
|
|
|
+ // 队伍数量
|
|
|
+ if (CollUtil.isNotEmpty(teamCountPair)) {
|
|
|
+ statistics.setTeamCount(teamCountPair.get(deptId));
|
|
|
+ }
|
|
|
+ // 施工队伍 数量
|
|
|
+ if (CollUtil.isNotEmpty(sgTeamCountPair)) {
|
|
|
+ statistics.setSgTeamCount(sgTeamCountPair.get(deptId));
|
|
|
+ }
|
|
|
+ // 施工准备队伍数量
|
|
|
+ if (CollUtil.isNotEmpty(zbTeamCountPair)) {
|
|
|
+ statistics.setZbTeamCount(zbTeamCountPair.get(deptId));
|
|
|
+ }
|
|
|
+ // 驻地待命 队伍数量
|
|
|
+ if (CollUtil.isNotEmpty(zddmTeamCountPair)) {
|
|
|
+ statistics.setZddmTeamCount(zddmTeamCountPair.get(deptId));
|
|
|
+ }
|
|
|
result.add(statistics);
|
|
|
});
|
|
|
|