|
|
@@ -404,8 +404,8 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<IotRyDailyReportTaskCountVO> countRepairTasksByDept() {
|
|
|
- return iotRyDailyReportMapper.countRepairTasksByDept();
|
|
|
+ public List<IotRyDailyReportTaskCountVO> countRepairTasksByDept(IotRyDailyReportPageReqVO pageReqVO) {
|
|
|
+ return iotRyDailyReportMapper.countRepairTasksByDept(pageReqVO);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -797,7 +797,7 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
if (ObjUtil.isEmpty(pageReqVO.getDeptId())) {
|
|
|
result = polylineStatisticsByProjectDept(pageReqVO, dailyReports, 158L, pageReqVO.getCreateTime());
|
|
|
} else {
|
|
|
- // 判断点击的组织树中的部门类型 类型(公司级1 项目部2 队伍3)
|
|
|
+ // 判断点击的组织树中的部门类型 (公司级1 项目部2 队伍3)
|
|
|
DeptDO selectedDept = deptService.getDept(pageReqVO.getDeptId());
|
|
|
if ("1".equals(selectedDept.getType())) {
|
|
|
// 以项目部为维度汇总数据
|
|
|
@@ -910,9 +910,14 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
Map<Long, BigDecimal> cumulativeProductTimePair = new HashMap<>();
|
|
|
// key队伍id/项目部id value额定生产时间(H)
|
|
|
Map<Long, BigDecimal> cumulativeRatedTimePair = new HashMap<>();
|
|
|
- // key队伍id/项目部id value累计运行时效 累计注气量/累计产能
|
|
|
+ // key队伍id/项目部id value累计运行时效
|
|
|
Map<Long, BigDecimal> cumulativeTransitTimePair = new HashMap<>();
|
|
|
|
|
|
+ // key部门id-任务id
|
|
|
+ Set<String> deptTaskConstrcts = new HashSet<>();
|
|
|
+ // key部门id-任务id
|
|
|
+ Set<String> deptTaskFinishes = new HashSet<>();
|
|
|
+
|
|
|
// 以项目部为维度统计数据
|
|
|
// 找到所有项目部与队伍的对应关系
|
|
|
// 查询指定根部门下的所有子部门
|
|
|
@@ -939,7 +944,7 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
Map<Long, BigDecimal> taskRatedProductionTimePair = new HashMap<>();
|
|
|
if ("2".equals(pageReqVO.getProjectClassification())) {
|
|
|
// 查询修井 累计施工井数 累计完工井数
|
|
|
- List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportMapper.countRepairTasksByDept();
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportMapper.countRepairTasksByDept(pageReqVO);
|
|
|
if (CollUtil.isNotEmpty(repairDeptTasks)) {
|
|
|
repairDeptTasks.forEach(task -> {
|
|
|
totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
@@ -1091,6 +1096,11 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
// key日期yyyy-MM-dd value额定生产时间(H)
|
|
|
Map<String, BigDecimal> dateRatedTimePair = new HashMap<>();
|
|
|
|
|
|
+ // key部门id-任务id value施工井对应的日期
|
|
|
+ Map<String, String> deptTaskConstructPair = new HashMap<>();
|
|
|
+ // key部门id-任务id value完工井对应的日期
|
|
|
+ Map<String, String> deptTaskFinishPair = new HashMap<>();
|
|
|
+
|
|
|
// 以项目部为维度统计数据
|
|
|
// 找到所有项目部与队伍的对应关系
|
|
|
// 查询指定根部门下的所有子部门
|
|
|
@@ -1116,30 +1126,47 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
// key任务id value额定生产时间
|
|
|
Map<Long, BigDecimal> taskRatedProductionTimePair = new HashMap<>();
|
|
|
if ("2".equals(pageReqVO.getProjectClassification())) {
|
|
|
+ // 计算累计施工井数 累计完工井数 时 过滤掉 taskId 为空的数据
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
+ if (ObjUtil.isNotEmpty(report.getTaskId()) && allRhChildDeptIds.contains(report.getDeptId())) {
|
|
|
+ String uniqueKey = StrUtil.join("-", report.getDeptId(), report.getTaskId());
|
|
|
+ String dateStr = LocalDateTimeUtil.format(report.getCreateTime(), DatePattern.NORM_DATE_PATTERN);
|
|
|
+ deptTaskConstructPair.put(uniqueKey, dateStr);
|
|
|
+ deptTaskFinishPair.put(uniqueKey, dateStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
// 查询 指定时间范围内的 修井 累计施工井数 累计完工井数
|
|
|
// 每天的任务数量 taskId 去重后的数量
|
|
|
- // 每天完工任务数量 taskId 去重后 状态为 wg 的数量
|
|
|
+ // 每天完工任务数量 deptId+taskId 去重后 状态为 wg 的数量
|
|
|
dailyReports.forEach(report -> {
|
|
|
+ String uniqueKey = StrUtil.join("-", report.getDeptId(), report.getTaskId());
|
|
|
String dateStr = LocalDateTimeUtil.format(report.getCreateTime(), DatePattern.NORM_DATE_PATTERN);
|
|
|
- if (dateConstructTaskPair.containsKey(dateStr)) {
|
|
|
- Set<Long> tempUniqueTaskIds = dateConstructTaskPair.get(dateStr);
|
|
|
- tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateConstructTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
- } else {
|
|
|
- Set<Long> tempUniqueTaskIds = new HashSet<>();
|
|
|
- tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateConstructTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
- }
|
|
|
- // 组装完工任务集合
|
|
|
- if ("wg".equals(report.getRepairStatus())) {
|
|
|
- if (dateFinishTaskPair.containsKey(dateStr)) {
|
|
|
- Set<Long> tempUniqueTaskIds = dateFinishTaskPair.get(dateStr);
|
|
|
+ if (deptTaskConstructPair.containsKey(uniqueKey)) {
|
|
|
+ String tempDateStr = deptTaskFinishPair.get(uniqueKey);
|
|
|
+
|
|
|
+ if (dateConstructTaskPair.containsKey(tempDateStr)) {
|
|
|
+ Set<Long> tempUniqueTaskIds = dateConstructTaskPair.get(tempDateStr);
|
|
|
tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateFinishTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
+ dateConstructTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
} else {
|
|
|
Set<Long> tempUniqueTaskIds = new HashSet<>();
|
|
|
tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateFinishTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
+ dateConstructTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 组装完工任务集合
|
|
|
+ if ("wg".equals(report.getRepairStatus())) {
|
|
|
+ if (deptTaskFinishPair.containsKey(uniqueKey)) {
|
|
|
+ String tempDateStr = deptTaskFinishPair.get(uniqueKey);
|
|
|
+ if (dateFinishTaskPair.containsKey(tempDateStr)) {
|
|
|
+ Set<Long> tempUniqueTaskIds = dateFinishTaskPair.get(tempDateStr);
|
|
|
+ tempUniqueTaskIds.add(report.getTaskId());
|
|
|
+ dateFinishTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
+ } else {
|
|
|
+ Set<Long> tempUniqueTaskIds = new HashSet<>();
|
|
|
+ tempUniqueTaskIds.add(report.getTaskId());
|
|
|
+ dateFinishTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1269,7 +1296,7 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
Map<Long, BigDecimal> cumulativeProductTimePair = new HashMap<>();
|
|
|
// key队伍id/项目部id value额定生产时间(H)
|
|
|
Map<Long, BigDecimal> cumulativeRatedTimePair = new HashMap<>();
|
|
|
- // key队伍id value累计运行时效 累计注气量/累计产能
|
|
|
+ // key队伍id value累计运行时效
|
|
|
Map<Long, BigDecimal> cumulativeTransitTimePair = new HashMap<>();
|
|
|
|
|
|
// 以 队伍 为维度统计数据
|
|
|
@@ -1298,7 +1325,7 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
Map<Long, BigDecimal> taskRatedProductionTimePair = new HashMap<>();
|
|
|
if ("2".equals(pageReqVO.getProjectClassification())) {
|
|
|
// 查询修井 累计施工井数 累计完工井数
|
|
|
- List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportMapper.countRepairTasksByDept();
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportMapper.countRepairTasksByDept(pageReqVO);
|
|
|
if (CollUtil.isNotEmpty(repairDeptTasks)) {
|
|
|
repairDeptTasks.forEach(task -> {
|
|
|
totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
@@ -1425,6 +1452,10 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
// key日期yyyy-MM-dd value额定生产时间(H)
|
|
|
Map<String, BigDecimal> dateRatedTimePair = new HashMap<>();
|
|
|
|
|
|
+ // key部门id-任务id value施工井对应的日期
|
|
|
+ Map<String, String> deptTaskConstructPair = new HashMap<>();
|
|
|
+ // key部门id-任务id value完工井对应的日期
|
|
|
+ Map<String, String> deptTaskFinishPair = new HashMap<>();
|
|
|
|
|
|
// 以 队伍 为维度统计数据
|
|
|
// 找到所有项目部与队伍的对应关系
|
|
|
@@ -1451,30 +1482,58 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
// key任务id value额定生产时间
|
|
|
Map<Long, BigDecimal> taskRatedProductionTimePair = new HashMap<>();
|
|
|
if ("2".equals(pageReqVO.getProjectClassification())) {
|
|
|
+
|
|
|
+ // 1. 先校验时间区间数组有效性
|
|
|
+ boolean isCreateTimesValid = createTimes != null && createTimes.length >= 2
|
|
|
+ && createTimes[0] != null && createTimes[1] != null;
|
|
|
+
|
|
|
+ // 计算累计施工井数 累计完工井数 时 过滤掉 taskId 为空的数据
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
+ // 2. 获取日报创建时间并校验非空
|
|
|
+ LocalDateTime reportCreateTime = report.getCreateTime();
|
|
|
+ if (ObjUtil.isNotEmpty(report.getTaskId()) && allRhChildDeptIds.contains(report.getDeptId())
|
|
|
+ && ObjUtil.isNotEmpty(reportCreateTime) && isCreateTimesValid
|
|
|
+ && !reportCreateTime.isBefore(createTimes[0]) && !reportCreateTime.isAfter(createTimes[1])) {
|
|
|
+ String uniqueKey = StrUtil.join("-", report.getDeptId(), report.getTaskId());
|
|
|
+ String dateStr = LocalDateTimeUtil.format(report.getCreateTime(), DatePattern.NORM_DATE_PATTERN);
|
|
|
+ deptTaskConstructPair.put(uniqueKey, dateStr);
|
|
|
+ deptTaskFinishPair.put(uniqueKey, dateStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
// 查询 指定时间范围内的 修井 累计施工井数 累计完工井数
|
|
|
// 每天的任务数量 taskId 去重后的数量
|
|
|
// 每天完工任务数量 taskId 去重后 状态为 wg 的数量
|
|
|
dailyReports.forEach(report -> {
|
|
|
+ String uniqueKey = StrUtil.join("-", report.getDeptId(), report.getTaskId());
|
|
|
String dateStr = LocalDateTimeUtil.format(report.getCreateTime(), DatePattern.NORM_DATE_PATTERN);
|
|
|
- if (dateConstructTaskPair.containsKey(dateStr)) {
|
|
|
- Set<Long> tempUniqueTaskIds = dateConstructTaskPair.get(dateStr);
|
|
|
- tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateConstructTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
- } else {
|
|
|
- Set<Long> tempUniqueTaskIds = new HashSet<>();
|
|
|
- tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateConstructTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
- }
|
|
|
- // 组装完工任务集合
|
|
|
- if ("wg".equals(report.getRepairStatus())) {
|
|
|
- if (dateFinishTaskPair.containsKey(dateStr)) {
|
|
|
- Set<Long> tempUniqueTaskIds = dateFinishTaskPair.get(dateStr);
|
|
|
+ if (deptTaskConstructPair.containsKey(uniqueKey)) {
|
|
|
+ String tempDateStr = deptTaskFinishPair.get(uniqueKey);
|
|
|
+
|
|
|
+ if (dateConstructTaskPair.containsKey(tempDateStr)) {
|
|
|
+ Set<Long> tempUniqueTaskIds = dateConstructTaskPair.get(tempDateStr);
|
|
|
tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateFinishTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
+ dateConstructTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
} else {
|
|
|
Set<Long> tempUniqueTaskIds = new HashSet<>();
|
|
|
tempUniqueTaskIds.add(report.getTaskId());
|
|
|
- dateFinishTaskPair.put(dateStr, tempUniqueTaskIds);
|
|
|
+ dateConstructTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 组装完工任务集合
|
|
|
+ if ("wg".equals(report.getRepairStatus())) {
|
|
|
+ if (deptTaskFinishPair.containsKey(uniqueKey)) {
|
|
|
+ String tempDateStr = deptTaskFinishPair.get(uniqueKey);
|
|
|
+
|
|
|
+ if (dateFinishTaskPair.containsKey(tempDateStr)) {
|
|
|
+ Set<Long> tempUniqueTaskIds = dateFinishTaskPair.get(tempDateStr);
|
|
|
+ tempUniqueTaskIds.add(report.getTaskId());
|
|
|
+ dateFinishTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
+ } else {
|
|
|
+ Set<Long> tempUniqueTaskIds = new HashSet<>();
|
|
|
+ tempUniqueTaskIds.add(report.getTaskId());
|
|
|
+ dateFinishTaskPair.put(tempDateStr, tempUniqueTaskIds);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|