|
@@ -2353,10 +2353,20 @@ public class IotRyDailyReportController {
|
|
|
Long deptId = pageReqVO.getDeptId();
|
|
Long deptId = pageReqVO.getDeptId();
|
|
|
// 钻井或修井部门 队伍
|
|
// 钻井或修井部门 队伍
|
|
|
List<Long> zjOrXjDeptIds = new ArrayList<>();
|
|
List<Long> zjOrXjDeptIds = new ArrayList<>();
|
|
|
|
|
+ // 可用的部门id集合
|
|
|
|
|
+ Set<Long> availableDeptIds = new HashSet<>();
|
|
|
if (ObjUtil.isNotEmpty(deptId)) {
|
|
if (ObjUtil.isNotEmpty(deptId)) {
|
|
|
// 查询指定部门下所有子部门
|
|
// 查询指定部门下所有子部门
|
|
|
Set<Long> childDeptIds = deptService.getChildDeptIdListFromCache(deptId);
|
|
Set<Long> childDeptIds = deptService.getChildDeptIdListFromCache(deptId);
|
|
|
Map<Long, DeptDO> allDeptPair = deptService.getDeptMap(childDeptIds);
|
|
Map<Long, DeptDO> allDeptPair = deptService.getDeptMap(childDeptIds);
|
|
|
|
|
+ // 过滤掉关闭的部门
|
|
|
|
|
+ if (CollUtil.isNotEmpty(allDeptPair)) {
|
|
|
|
|
+ allDeptPair.forEach((tempDeptId, dept) -> {
|
|
|
|
|
+ if (0 == dept.getStatus()) {
|
|
|
|
|
+ availableDeptIds.add(tempDeptId);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
// 钻井日报汇总 分母为 钻井施工队伍 修井日报汇总分母分母为修井施工队伍
|
|
// 钻井日报汇总 分母为 钻井施工队伍 修井日报汇总分母分母为修井施工队伍
|
|
|
// 1钻井 2修井
|
|
// 1钻井 2修井
|
|
|
String projectClassification = pageReqVO.getProjectClassification();
|
|
String projectClassification = pageReqVO.getProjectClassification();
|
|
@@ -2374,6 +2384,13 @@ public class IotRyDailyReportController {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // 取 availableDeptIds zjOrXjDeptIds 2个集合的交集 当前查询条件下 的钻井 或 修井 部门id集合
|
|
|
|
|
+ Set<Long> overlapDeptIds = Stream.of(availableDeptIds)
|
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
|
+ .flatMap(Set::stream)
|
|
|
|
|
+ .filter(tempDeptId -> CollUtil.isNotEmpty(zjOrXjDeptIds) && zjOrXjDeptIds.contains(tempDeptId))
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 统计设备利用率 查询非 dt zx 状态的日报
|
|
// 统计设备利用率 查询非 dt zx 状态的日报
|
|
|
// 钻井:日报状态 过滤掉 ‘等停dt’ 修井:日报状态过滤掉 ‘等停dt’、‘整修zx’
|
|
// 钻井:日报状态 过滤掉 ‘等停dt’ 修井:日报状态过滤掉 ‘等停dt’、‘整修zx’
|
|
@@ -2386,7 +2403,7 @@ public class IotRyDailyReportController {
|
|
|
List<IotRyDailyReportDO> dailyReports = iotRyDailyReportMapper.dailyReports(pageReqVO);
|
|
List<IotRyDailyReportDO> dailyReports = iotRyDailyReportMapper.dailyReports(pageReqVO);
|
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
for (IotRyDailyReportDO dailyReport : dailyReports) {
|
|
for (IotRyDailyReportDO dailyReport : dailyReports) {
|
|
|
- if (zjOrXjDeptIds.contains(dailyReport.getDeptId())) {
|
|
|
|
|
|
|
+ if (overlapDeptIds.contains(dailyReport.getDeptId())) {
|
|
|
++reportCount;
|
|
++reportCount;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2407,10 +2424,10 @@ public class IotRyDailyReportController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 所有项目部包含的队伍数量>0 并且 指定时间区间天数大于0
|
|
// 所有项目部包含的队伍数量>0 并且 指定时间区间天数大于0
|
|
|
- if (daysCount > 0 && zjOrXjDeptIds.size() > 0) {
|
|
|
|
|
|
|
+ if (daysCount > 0 && overlapDeptIds.size() > 0) {
|
|
|
// 当前项目部 设备利用率 公式 reportCount/(currentTeamNum*daysCount)
|
|
// 当前项目部 设备利用率 公式 reportCount/(currentTeamNum*daysCount)
|
|
|
// 计算设备利用率(处理除数为0的情况)
|
|
// 计算设备利用率(处理除数为0的情况)
|
|
|
- rate = new BigDecimal((double) reportCount / (zjOrXjDeptIds.size() * daysCount))
|
|
|
|
|
|
|
+ rate = new BigDecimal((double) reportCount / (overlapDeptIds.size() * daysCount))
|
|
|
.setScale(4, RoundingMode.HALF_UP) // 保留4位小数,四舍五入
|
|
.setScale(4, RoundingMode.HALF_UP) // 保留4位小数,四舍五入
|
|
|
.doubleValue();
|
|
.doubleValue();
|
|
|
}
|
|
}
|