|
@@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
|
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojectinfo.vo.IotProjectInfoPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojectinfo.vo.IotProjectInfoPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.*;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.*;
|
|
@@ -43,6 +44,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
|
|
import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
|
|
|
|
|
|
|
|
@Tag(name = "管理后台 - 瑞鹰日报")
|
|
@Tag(name = "管理后台 - 瑞鹰日报")
|
|
@@ -189,6 +191,72 @@ public class IotRyDailyReportController {
|
|
|
return success(new PageResult<>(buildRyDailyReports(pageResult.getList(), pageReqVO), pageResult.getTotal()));
|
|
return success(new PageResult<>(buildRyDailyReports(pageResult.getList(), pageReqVO), pageResult.getTotal()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @GetMapping("/teamReports")
|
|
|
|
|
+ @Operation(summary = "根据井号查询瑞鹰日报列表 按照队伍分组统计工作量")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:query')")
|
|
|
|
|
+ public CommonResult<PageResult<IotRyDailyReportRespVO>> teamReports(@Valid IotRyDailyReportPageReqVO pageReqVO) {
|
|
|
|
|
+ // 根据查询参数筛选出 符合条件 的记录id 再传入 分页查询
|
|
|
|
|
+ Set<Long> projectIds = new HashSet<>();
|
|
|
|
|
+ Set<Long> taskIds = new HashSet<>();
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getContractName())) {
|
|
|
|
|
+ IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
|
|
|
|
|
+ reqVO.setContractName(pageReqVO.getContractName());
|
|
|
|
|
+ List<IotProjectInfoDO> projects = iotProjectInfoService.getIotProjectInfos(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(projects)) {
|
|
|
|
|
+ projects.forEach(project -> {
|
|
|
|
|
+ projectIds.add(project.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ pageReqVO.setProjectIds(projectIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getTaskName())) {
|
|
|
|
|
+ IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
|
|
|
|
|
+ reqVO.setSearchKey(pageReqVO.getTaskName());
|
|
|
|
|
+ List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tasks)) {
|
|
|
|
|
+ tasks.forEach(task -> {
|
|
|
|
|
+ taskIds.add(task.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ pageReqVO.setTaskIds(taskIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ PageResult<IotRyDailyReportDO> pageResult = iotRyDailyReportService.teamReports(pageReqVO);
|
|
|
|
|
+ return success(new PageResult<>(buildSubtotalRyDailyReports(pageResult.getList(), pageReqVO), pageResult.getTotal()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/wellReports")
|
|
|
|
|
+ @Operation(summary = "根据井号查询瑞鹰日报列表 按照队伍分组统计工作量")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:query')")
|
|
|
|
|
+ public CommonResult<PageResult<IotRyDailyReportRespVO>> wellReports(@Valid IotRyDailyReportPageReqVO pageReqVO) {
|
|
|
|
|
+ // 根据查询参数筛选出 符合条件 的记录id 再传入 分页查询
|
|
|
|
|
+ Set<Long> projectIds = new HashSet<>();
|
|
|
|
|
+ Set<Long> taskIds = new HashSet<>();
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getContractName())) {
|
|
|
|
|
+ IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
|
|
|
|
|
+ reqVO.setContractName(pageReqVO.getContractName());
|
|
|
|
|
+ List<IotProjectInfoDO> projects = iotProjectInfoService.getIotProjectInfos(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(projects)) {
|
|
|
|
|
+ projects.forEach(project -> {
|
|
|
|
|
+ projectIds.add(project.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ pageReqVO.setProjectIds(projectIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getTaskName())) {
|
|
|
|
|
+ IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
|
|
|
|
|
+ reqVO.setSearchKey(pageReqVO.getTaskName());
|
|
|
|
|
+ List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tasks)) {
|
|
|
|
|
+ tasks.forEach(task -> {
|
|
|
|
|
+ taskIds.add(task.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ pageReqVO.setTaskIds(taskIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ PageResult<IotRyDailyReportDO> pageResult = iotRyDailyReportService.wellReports(pageReqVO);
|
|
|
|
|
+ return success(new PageResult<>(buildWellRyDailyReports(pageResult.getList(), pageReqVO), pageResult.getTotal()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@GetMapping("/statistics")
|
|
@GetMapping("/statistics")
|
|
|
@Operation(summary = "获得瑞鹰日报汇总统计")
|
|
@Operation(summary = "获得瑞鹰日报汇总统计")
|
|
|
@PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:query')")
|
|
@PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:query')")
|
|
@@ -370,6 +438,705 @@ public class IotRyDailyReportController {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 瑞鹰日报分页 设置关联查询信息
|
|
|
|
|
+ * @param reports
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<IotRyDailyReportRespVO> buildSubtotalRyDailyReports(List<IotRyDailyReportDO> reports, IotRyDailyReportPageReqVO pageReqVO) {
|
|
|
|
|
+ if (CollUtil.isEmpty(reports)) {
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设备部门信息
|
|
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(reports, IotRyDailyReportDO::getDeptId));
|
|
|
|
|
+ // key项目id value项目合同号
|
|
|
|
|
+ Map<Long, String> projectPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value任务井号-施工区域
|
|
|
|
|
+ Map<Long, String> taskPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value设计井深
|
|
|
|
|
+ Map<Long, BigDecimal> taskExtPropertyPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value额定生产时间
|
|
|
|
|
+ Map<Long, BigDecimal> taskRatedProductionTimePair = new HashMap<>();
|
|
|
|
|
+ // key任务id value套生段产管尺寸
|
|
|
|
|
+ Map<Long, String> taskCasingPipeSizePair = new HashMap<>();
|
|
|
|
|
+ // key任务id value井控级别
|
|
|
|
|
+ Map<Long, String> taskWellControlLevelPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value施工工艺
|
|
|
|
|
+ Map<Long, String> taskTechniquePair = new HashMap<>();
|
|
|
|
|
+ // key任务id value井别
|
|
|
|
|
+ Map<Long, String> taskWellCategoryPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value设计井身结构
|
|
|
|
|
+ Map<Long, String> taskWellStructPair = new HashMap<>();
|
|
|
|
|
+ // key部门id value设备型号编号
|
|
|
|
|
+ AtomicReference<Map<Long, String>> equipmentTypePair = new AtomicReference<>(new HashMap<>());
|
|
|
|
|
+ // key施工队伍id value最近完工日期
|
|
|
|
|
+ Map<Long, LocalDateTime> latestWellDoneTimePair = new HashMap<>();
|
|
|
|
|
+ // key施工队伍id value施工井数量
|
|
|
|
|
+ Map<Long, Integer> totalTasksPair = new HashMap<>();
|
|
|
|
|
+ // key施工队伍id value完工井数量
|
|
|
|
|
+ Map<Long, Integer> completedTasksPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key部门id-队伍id value 队伍累计进尺
|
|
|
|
|
+ Map<String, BigDecimal> groupFootagePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 队伍当年累计用电量
|
|
|
|
|
+ Map<String, BigDecimal> groupPowerPair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 队伍当年累计油耗
|
|
|
|
|
+ Map<String, BigDecimal> groupFuelPair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 进尺工作时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupFootageTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 钻井 其他生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupOtherProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 修井 生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 修井 非生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 钻井非生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupZjNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 小计平均运行时效
|
|
|
|
|
+ Map<String, BigDecimal> groupTransTimePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key小组最后1条记录id value 队伍累计进尺
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdFootagePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 队伍累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdPowerPair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 队伍累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdFuelPair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 进尺工作时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdFootageTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 钻井 其他生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdOtherProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 修井 生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 修井 非生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 钻井 非生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdZjNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 小计平均运行时效
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdTransTimePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 查询 当前分页 所有部门 任务井 日报数据 小计工作量
|
|
|
|
|
+ IotRyDailyReportPageReqVO currentTaskReqVO = new IotRyDailyReportPageReqVO();
|
|
|
|
|
+ currentTaskReqVO.setTaskIds(convertSet(reports, IotRyDailyReportDO::getTaskId));
|
|
|
|
|
+ currentTaskReqVO.setDeptIds(convertSet(reports, IotRyDailyReportDO::getDeptId));
|
|
|
|
|
+ currentTaskReqVO.setCreateTime(pageReqVO.getCreateTime());
|
|
|
|
|
+ currentTaskReqVO.setProjectIds(pageReqVO.getProjectIds());
|
|
|
|
|
+ currentTaskReqVO.setTaskIds(pageReqVO.getTaskIds());
|
|
|
|
|
+ List<IotRyDailyReportDO> deptTaskDailyReports = iotRyDailyReportMapper.dailyReports(currentTaskReqVO);
|
|
|
|
|
+
|
|
|
|
|
+ // 以 deptId-taskId 为唯一键 小计日报工作量
|
|
|
|
|
+ if (CollUtil.isNotEmpty(deptTaskDailyReports)) {
|
|
|
|
|
+ deptTaskDailyReports.forEach(report -> {
|
|
|
|
|
+ String uniqueKey = StrUtil.join("-", report.getDeptId(), report.getTaskId());
|
|
|
|
|
+ // 进尺
|
|
|
|
|
+ if (groupFootagePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempFootage = groupFootagePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempFootage.add(report.getDailyFootage());
|
|
|
|
|
+ groupFootagePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupFootagePair.put(uniqueKey, report.getDailyFootage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 进尺工作时间
|
|
|
|
|
+ if (groupFootageTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempFootageTime = groupFootageTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempFootageTime.add(report.getDrillingWorkingTime());
|
|
|
|
|
+ groupFootageTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupFootageTimePair.put(uniqueKey, report.getDrillingWorkingTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 电量
|
|
|
|
|
+ if (groupPowerPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempPower = groupPowerPair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempPower.add(report.getDailyPowerUsage());
|
|
|
|
|
+ groupPowerPair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupPowerPair.put(uniqueKey, report.getDailyPowerUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 油耗
|
|
|
|
|
+ if (groupFuelPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempFuel = groupFuelPair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempFuel.add(report.getDailyFuel());
|
|
|
|
|
+ groupFuelPair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupFuelPair.put(uniqueKey, report.getDailyFuel());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其他生产时间 钻井
|
|
|
|
|
+ if (groupOtherProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempNoProductTime = groupOtherProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempNoProductTime.add(report.getOtherProductionTime());
|
|
|
|
|
+ groupOtherProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupOtherProductTimePair.put(uniqueKey, report.getOtherProductionTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 生产时间 修井
|
|
|
|
|
+ if (groupProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempProductTime = groupProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempProductTime.add(report.getProductionTime());
|
|
|
|
|
+ groupProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupProductTimePair.put(uniqueKey, report.getProductionTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 非生产时间 修井
|
|
|
|
|
+ if (groupNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempNoProductTime = groupNoProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempNoProductTime.add(report.getNonProductionTime());
|
|
|
|
|
+ groupNoProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupNoProductTimePair.put(uniqueKey, report.getNonProductionTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 钻井 非生产时间 事故 修理 自停 复杂 搬迁 整改 等停 冬休
|
|
|
|
|
+ BigDecimal accidentTime = report.getAccidentTime();
|
|
|
|
|
+ BigDecimal repairTime = report.getRepairTime();
|
|
|
|
|
+ BigDecimal selfStopTime = report.getSelfStopTime();
|
|
|
|
|
+ BigDecimal complexityTime = report.getComplexityTime();
|
|
|
|
|
+ BigDecimal relocationTime = report.getRelocationTime();
|
|
|
|
|
+ BigDecimal rectificationTime = report.getRectificationTime();
|
|
|
|
|
+ BigDecimal waitingStopTime = report.getWaitingStopTime();
|
|
|
|
|
+ BigDecimal winterBreakTime = report.getWinterBreakTime();
|
|
|
|
|
+ BigDecimal totalNonProductionTime = Arrays.asList(
|
|
|
|
|
+ accidentTime,
|
|
|
|
|
+ repairTime,
|
|
|
|
|
+ selfStopTime,
|
|
|
|
|
+ complexityTime,
|
|
|
|
|
+ relocationTime,
|
|
|
|
|
+ rectificationTime,
|
|
|
|
|
+ waitingStopTime,
|
|
|
|
|
+ winterBreakTime
|
|
|
|
|
+ ).stream()
|
|
|
|
|
+ // 将null转换为BigDecimal.ZERO,避免空指针
|
|
|
|
|
+ .map(bd -> bd == null ? BigDecimal.ZERO : bd)
|
|
|
|
|
+ // 累加所有元素,初始值为BigDecimal.ZERO
|
|
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
+ // 非生产时间 钻井
|
|
|
|
|
+ if (groupZjNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempZjNoProductTime = groupZjNoProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempZjNoProductTime.add(totalNonProductionTime);
|
|
|
|
|
+ groupZjNoProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupZjNoProductTimePair.put(uniqueKey, totalNonProductionTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ TenantUtils.executeIgnore(() -> {
|
|
|
|
|
+ currentTaskReqVO.setDeptId(pageReqVO.getDeptId());
|
|
|
|
|
+ // 查询 deptId-taskId 分组内最后1条记录id 设置展开列标识
|
|
|
|
|
+ List<IotRyDailyReportDO> currentGroupIds = iotRyDailyReportService.ryWellNameDailyReportsGroupIds(currentTaskReqVO);
|
|
|
|
|
+ // key部门id-任务id value小组内最后1条记录id
|
|
|
|
|
+ Map<String, Long> groupIdPair = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(currentGroupIds)) {
|
|
|
|
|
+ currentGroupIds.forEach(groupId -> {
|
|
|
|
|
+ String uniqueKey = StrUtil.join("-", groupId.getDeptId(), groupId.getTaskId());
|
|
|
|
|
+ groupIdPair.put(uniqueKey, groupId.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 设置 分组内最后1条记录id 与 deptId-taskId 唯一键的对应关系
|
|
|
|
|
+ if (CollUtil.isNotEmpty(groupIdPair)) {
|
|
|
|
|
+ groupIdPair.forEach((uniqueKey, groupId) -> {
|
|
|
|
|
+ if (groupFootagePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdFootagePair.put(groupId, groupFootagePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupFootageTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdFootageTimePair.put(groupId, groupFootageTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupOtherProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdOtherProductTimePair.put(groupId, groupOtherProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdProductTimePair.put(groupId, groupProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupFuelPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdFuelPair.put(groupId, groupFuelPair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupPowerPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdPowerPair.put(groupId, groupPowerPair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdNoProductTimePair.put(groupId, groupNoProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupZjNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdZjNoProductTimePair.put(groupId, groupZjNoProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ DataPermissionUtils.executeIgnore(() -> {
|
|
|
|
|
+ // 查询日报关联的项目信息
|
|
|
|
|
+ IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
|
|
|
|
|
+ reqVO.setProjectIds(convertList(reports, IotRyDailyReportDO::getProjectId));
|
|
|
|
|
+ List<IotProjectInfoDO> projects = iotProjectInfoService.getIotProjectInfos(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(projects)) {
|
|
|
|
|
+ projects.forEach(project -> {
|
|
|
|
|
+ projectPair.put(project.getId(), project.getContractName());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询日报关联的任务信息
|
|
|
|
|
+ IotProjectTaskPageReqVO taskReqVO = new IotProjectTaskPageReqVO();
|
|
|
|
|
+ taskReqVO.setTaskIds(convertList(reports, IotRyDailyReportDO::getTaskId));
|
|
|
|
|
+ List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(taskReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tasks)) {
|
|
|
|
|
+ tasks.forEach(task -> {
|
|
|
|
|
+ taskPair.put(task.getId(), task.getWellName());
|
|
|
|
|
+ taskTechniquePair.put(task.getId(), task.getTechnique());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(task.getExtProperty())) {
|
|
|
|
|
+ List<IotTaskAttrModelProperty> taskAttrs = task.getExtProperty();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(taskAttrs)) {
|
|
|
|
|
+ // 找到 设计注气量 属性 对应的值
|
|
|
|
|
+ taskAttrs.forEach(attr -> {
|
|
|
|
|
+ if ("设计井深".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskExtPropertyPair.put(task.getId(), new BigDecimal(attr.getActualValue()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("设计井身结构".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskWellStructPair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("额定生产时间".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskRatedProductionTimePair.put(task.getId(), new BigDecimal(attr.getActualValue()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("套生段产管尺寸".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskCasingPipeSizePair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("井控级别".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskWellControlLevelPair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("井别".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskWellCategoryPair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询当前日报所属施工队伍中包含 井架 的型号
|
|
|
|
|
+ equipmentTypePair.set(iotRyDailyReportService.queryEquipmentType(convertList(reports, IotRyDailyReportDO::getDeptId)));
|
|
|
|
|
+ // 查询当前日报所属部门的 上井次完井时间 已经绑定任务的情况下
|
|
|
|
|
+ List<IotRyDailyReportDO> latestWellDoneTimes = iotRyDailyReportService.latestWellDoneTimes(null);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(latestWellDoneTimes)) {
|
|
|
|
|
+ latestWellDoneTimes.forEach(time -> {
|
|
|
|
|
+ latestWellDoneTimePair.put(time.getDeptId(), time.getConstructionStartDate());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 按施工队伍统计 钻井日报 施工井数 完工井数
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> deptTasks = iotRyDailyReportService.countTasksByDept();
|
|
|
|
|
+ // 修井日报 不存在既填写钻井日报 又填写修井日报的队伍
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportService.countRepairTasksByDept(pageReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(repairDeptTasks)) {
|
|
|
|
|
+ repairDeptTasks.forEach(task -> {
|
|
|
|
|
+ totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
|
|
+ completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (CollUtil.isNotEmpty(deptTasks)) {
|
|
|
|
|
+ deptTasks.forEach(task -> {
|
|
|
|
|
+ totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
|
|
+ completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // 2. 拼接数据
|
|
|
|
|
+ return BeanUtils.toBean(reports, IotRyDailyReportRespVO.class, (reportVO) -> {
|
|
|
|
|
+ // 2.1 拼接部门信息
|
|
|
|
|
+ findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
|
|
+
|
|
|
|
|
+ // 小组内最后1条记录标识
|
|
|
|
|
+ findAndThen(groupIdFootagePair, reportVO.getId(), footage -> reportVO.setLastGroupIdFlag(true));
|
|
|
|
|
+ // 小组内累计进尺
|
|
|
|
|
+ findAndThen(groupIdFootagePair, reportVO.getId(), footage -> reportVO.setGroupIdFootage(footage));
|
|
|
|
|
+ // 小组内累计 进尺工作时间
|
|
|
|
|
+ findAndThen(groupIdFootageTimePair, reportVO.getId(), footageTime -> reportVO.setGroupIdFootageTime(footageTime));
|
|
|
|
|
+ // 小组内累计 其他生产时间
|
|
|
|
|
+ findAndThen(groupIdOtherProductTimePair, reportVO.getId(), otherProductTime -> reportVO.setGroupIdOtherProductTime(otherProductTime));
|
|
|
|
|
+ // 小组内累计 钻井 非生产时间
|
|
|
|
|
+ findAndThen(groupIdZjNoProductTimePair, reportVO.getId(), zjNoProductTime -> reportVO.setGroupIdZjNoProductTime(zjNoProductTime));
|
|
|
|
|
+ // 小组内累计用电量
|
|
|
|
|
+ findAndThen(groupIdPowerPair, reportVO.getId(), power -> reportVO.setGroupIdPower(power));
|
|
|
|
|
+ // 小组内累计油耗
|
|
|
|
|
+ findAndThen(groupIdFuelPair, reportVO.getId(), fuel -> reportVO.setGroupIdFuel(fuel));
|
|
|
|
|
+ // 修井 非生产时间
|
|
|
|
|
+ findAndThen(groupIdNoProductTimePair, reportVO.getId(), noProductTime -> reportVO.setNonProductionTime(noProductTime));
|
|
|
|
|
+ // 修井 生产时间
|
|
|
|
|
+ findAndThen(groupIdProductTimePair, reportVO.getId(), productTime -> reportVO.setGroupIdProductTime(productTime));
|
|
|
|
|
+
|
|
|
|
|
+ // 2.2 日报关联的项目信息
|
|
|
|
|
+ findAndThen(projectPair, reportVO.getProjectId(), contractName -> reportVO.setContractName(contractName));
|
|
|
|
|
+ // 2.3 日报关联的任务信息
|
|
|
|
|
+ findAndThen(taskPair, reportVO.getTaskId(), taskName -> reportVO.setTaskName(taskName));
|
|
|
|
|
+ // 2.4 设计井深
|
|
|
|
|
+ findAndThen(taskExtPropertyPair, reportVO.getTaskId(), wellDepth -> reportVO.setDesignWellDepth(wellDepth));
|
|
|
|
|
+ // 施工工艺
|
|
|
|
|
+ findAndThen(taskTechniquePair, reportVO.getTaskId(), technique -> reportVO.setTechnique(technique));
|
|
|
|
|
+ // 井别
|
|
|
|
|
+ findAndThen(taskWellCategoryPair, reportVO.getTaskId(), wellCategory -> reportVO.setWellCategory(wellCategory));
|
|
|
|
|
+ // 额定生产时间
|
|
|
|
|
+ findAndThen(taskRatedProductionTimePair, reportVO.getTaskId(), ratedProductionTime -> reportVO.setRatedProductionTime(ratedProductionTime));
|
|
|
|
|
+ // 套生段产管尺寸
|
|
|
|
|
+ findAndThen(taskCasingPipeSizePair, reportVO.getTaskId(), casingPipeSize -> reportVO.setCasingPipeSize(casingPipeSize));
|
|
|
|
|
+ // 井控级别
|
|
|
|
|
+ findAndThen(taskWellControlLevelPair, reportVO.getTaskId(), wellControlLevel -> reportVO.setWellControlLevel(wellControlLevel));
|
|
|
|
|
+ // 2.5 设计井身结构
|
|
|
|
|
+ findAndThen(taskWellStructPair, reportVO.getTaskId(), wellStruct -> reportVO.setDesignWellStruct(wellStruct));
|
|
|
|
|
+ // 2.6 设备型号
|
|
|
|
|
+ findAndThen(equipmentTypePair.get(), reportVO.getDeptId(), equipmentType -> reportVO.setEquipmentType(equipmentType));
|
|
|
|
|
+ // 2.7 上井次完井时间
|
|
|
|
|
+ findAndThen(latestWellDoneTimePair, reportVO.getDeptId(), latestWellDoneTime -> reportVO.setLatestWellDoneTime(latestWellDoneTime));
|
|
|
|
|
+ // 2.8 总施工井数 完工井数
|
|
|
|
|
+ findAndThen(totalTasksPair, reportVO.getDeptId(), totalTaskCount -> reportVO.setTotalConstructionWells(totalTaskCount));
|
|
|
|
|
+ findAndThen(completedTasksPair, reportVO.getDeptId(), completedTaskCount -> reportVO.setCompletedWells(completedTaskCount));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 瑞鹰日报分页 设置关联查询信息
|
|
|
|
|
+ * @param reports
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<IotRyDailyReportRespVO> buildWellRyDailyReports(List<IotRyDailyReportDO> reports, IotRyDailyReportPageReqVO pageReqVO) {
|
|
|
|
|
+ if (CollUtil.isEmpty(reports)) {
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设备部门信息
|
|
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(reports, IotRyDailyReportDO::getDeptId));
|
|
|
|
|
+ // key项目id value项目合同号
|
|
|
|
|
+ Map<Long, String> projectPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value任务井号-施工区域
|
|
|
|
|
+ Map<Long, String> taskPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value设计井深
|
|
|
|
|
+ Map<Long, BigDecimal> taskExtPropertyPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value额定生产时间
|
|
|
|
|
+ Map<Long, BigDecimal> taskRatedProductionTimePair = new HashMap<>();
|
|
|
|
|
+ // key任务id value套生段产管尺寸
|
|
|
|
|
+ Map<Long, String> taskCasingPipeSizePair = new HashMap<>();
|
|
|
|
|
+ // key任务id value井控级别
|
|
|
|
|
+ Map<Long, String> taskWellControlLevelPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value施工工艺
|
|
|
|
|
+ Map<Long, String> taskTechniquePair = new HashMap<>();
|
|
|
|
|
+ // key任务id value井别
|
|
|
|
|
+ Map<Long, String> taskWellCategoryPair = new HashMap<>();
|
|
|
|
|
+ // key任务id value设计井身结构
|
|
|
|
|
+ Map<Long, String> taskWellStructPair = new HashMap<>();
|
|
|
|
|
+ // key部门id value设备型号编号
|
|
|
|
|
+ AtomicReference<Map<Long, String>> equipmentTypePair = new AtomicReference<>(new HashMap<>());
|
|
|
|
|
+ // key施工队伍id value最近完工日期
|
|
|
|
|
+ Map<Long, LocalDateTime> latestWellDoneTimePair = new HashMap<>();
|
|
|
|
|
+ // key施工队伍id value施工井数量
|
|
|
|
|
+ Map<Long, Integer> totalTasksPair = new HashMap<>();
|
|
|
|
|
+ // key施工队伍id value完工井数量
|
|
|
|
|
+ Map<Long, Integer> completedTasksPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key部门id-队伍id value 队伍累计进尺
|
|
|
|
|
+ Map<String, BigDecimal> groupFootagePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 队伍当年累计用电量
|
|
|
|
|
+ Map<String, BigDecimal> groupPowerPair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 队伍当年累计油耗
|
|
|
|
|
+ Map<String, BigDecimal> groupFuelPair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 进尺工作时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupFootageTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 钻井 其他生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupOtherProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 修井 生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 修井 非生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 钻井非生产时间小计
|
|
|
|
|
+ Map<String, BigDecimal> groupZjNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key部门id-队伍id value 小计平均运行时效
|
|
|
|
|
+ Map<String, BigDecimal> groupTransTimePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key小组最后1条记录id value 队伍累计进尺
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdFootagePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 队伍累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdPowerPair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 队伍累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdFuelPair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 进尺工作时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdFootageTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 钻井 其他生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdOtherProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 修井 生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 修井 非生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 钻井 非生产时间小计
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdZjNoProductTimePair = new HashMap<>();
|
|
|
|
|
+ // key小组最后1条记录id value 小计平均运行时效
|
|
|
|
|
+ Map<Long, BigDecimal> groupIdTransTimePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 查询 当前分页 所有部门 任务井 日报数据 小计工作量
|
|
|
|
|
+ IotRyDailyReportPageReqVO currentTaskReqVO = new IotRyDailyReportPageReqVO();
|
|
|
|
|
+ currentTaskReqVO.setTaskIds(convertSet(reports, IotRyDailyReportDO::getTaskId));
|
|
|
|
|
+ currentTaskReqVO.setDeptIds(convertSet(reports, IotRyDailyReportDO::getDeptId));
|
|
|
|
|
+ currentTaskReqVO.setCreateTime(pageReqVO.getCreateTime());
|
|
|
|
|
+ currentTaskReqVO.setProjectIds(pageReqVO.getProjectIds());
|
|
|
|
|
+ currentTaskReqVO.setTaskIds(pageReqVO.getTaskIds());
|
|
|
|
|
+ List<IotRyDailyReportDO> deptTaskDailyReports = iotRyDailyReportMapper.dailyReports(currentTaskReqVO);
|
|
|
|
|
+
|
|
|
|
|
+ // 以 deptId-taskId 为唯一键 小计日报工作量
|
|
|
|
|
+ if (CollUtil.isNotEmpty(deptTaskDailyReports)) {
|
|
|
|
|
+ deptTaskDailyReports.forEach(report -> {
|
|
|
|
|
+ String uniqueKey = StrUtil.join("-", report.getDeptId(), report.getTaskId());
|
|
|
|
|
+ // 进尺
|
|
|
|
|
+ if (groupFootagePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempFootage = groupFootagePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempFootage.add(report.getDailyFootage());
|
|
|
|
|
+ groupFootagePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupFootagePair.put(uniqueKey, report.getDailyFootage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 进尺工作时间
|
|
|
|
|
+ if (groupFootageTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempFootageTime = groupFootageTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempFootageTime.add(report.getDrillingWorkingTime());
|
|
|
|
|
+ groupFootageTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupFootageTimePair.put(uniqueKey, report.getDrillingWorkingTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 电量
|
|
|
|
|
+ if (groupPowerPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempPower = groupPowerPair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempPower.add(report.getDailyPowerUsage());
|
|
|
|
|
+ groupPowerPair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupPowerPair.put(uniqueKey, report.getDailyPowerUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 油耗
|
|
|
|
|
+ if (groupFuelPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempFuel = groupFuelPair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempFuel.add(report.getDailyFuel());
|
|
|
|
|
+ groupFuelPair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupFuelPair.put(uniqueKey, report.getDailyFuel());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其他生产时间 钻井
|
|
|
|
|
+ if (groupOtherProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempNoProductTime = groupOtherProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempNoProductTime.add(report.getOtherProductionTime());
|
|
|
|
|
+ groupOtherProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupOtherProductTimePair.put(uniqueKey, report.getOtherProductionTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 生产时间 修井
|
|
|
|
|
+ if (groupProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempProductTime = groupProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempProductTime.add(report.getProductionTime());
|
|
|
|
|
+ groupProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupProductTimePair.put(uniqueKey, report.getProductionTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 非生产时间 修井
|
|
|
|
|
+ if (groupNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempNoProductTime = groupNoProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempNoProductTime.add(report.getNonProductionTime());
|
|
|
|
|
+ groupNoProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupNoProductTimePair.put(uniqueKey, report.getNonProductionTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 钻井 非生产时间 事故 修理 自停 复杂 搬迁 整改 等停 冬休
|
|
|
|
|
+ BigDecimal accidentTime = report.getAccidentTime();
|
|
|
|
|
+ BigDecimal repairTime = report.getRepairTime();
|
|
|
|
|
+ BigDecimal selfStopTime = report.getSelfStopTime();
|
|
|
|
|
+ BigDecimal complexityTime = report.getComplexityTime();
|
|
|
|
|
+ BigDecimal relocationTime = report.getRelocationTime();
|
|
|
|
|
+ BigDecimal rectificationTime = report.getRectificationTime();
|
|
|
|
|
+ BigDecimal waitingStopTime = report.getWaitingStopTime();
|
|
|
|
|
+ BigDecimal winterBreakTime = report.getWinterBreakTime();
|
|
|
|
|
+ BigDecimal totalNonProductionTime = Arrays.asList(
|
|
|
|
|
+ accidentTime,
|
|
|
|
|
+ repairTime,
|
|
|
|
|
+ selfStopTime,
|
|
|
|
|
+ complexityTime,
|
|
|
|
|
+ relocationTime,
|
|
|
|
|
+ rectificationTime,
|
|
|
|
|
+ waitingStopTime,
|
|
|
|
|
+ winterBreakTime
|
|
|
|
|
+ ).stream()
|
|
|
|
|
+ // 将null转换为BigDecimal.ZERO,避免空指针
|
|
|
|
|
+ .map(bd -> bd == null ? BigDecimal.ZERO : bd)
|
|
|
|
|
+ // 累加所有元素,初始值为BigDecimal.ZERO
|
|
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
+ // 非生产时间 钻井
|
|
|
|
|
+ if (groupZjNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ BigDecimal tempZjNoProductTime = groupZjNoProductTimePair.get(uniqueKey);
|
|
|
|
|
+ BigDecimal tempResult = tempZjNoProductTime.add(totalNonProductionTime);
|
|
|
|
|
+ groupZjNoProductTimePair.put(uniqueKey, tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ groupZjNoProductTimePair.put(uniqueKey, totalNonProductionTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询 deptId-taskId 分组内最后1条记录id 设置展开列标识
|
|
|
|
|
+ // 暂时过滤掉租户
|
|
|
|
|
+ TenantUtils.executeIgnore(() -> {
|
|
|
|
|
+ currentTaskReqVO.setDeptId(pageReqVO.getDeptId());
|
|
|
|
|
+ List<IotRyDailyReportDO> currentGroupIds = iotRyDailyReportService.ryDeptDailyReportsGroupIds(currentTaskReqVO);
|
|
|
|
|
+ // key部门id-任务id value小组内最后1条记录id
|
|
|
|
|
+ Map<String, Long> groupIdPair = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(currentGroupIds)) {
|
|
|
|
|
+ currentGroupIds.forEach(groupId -> {
|
|
|
|
|
+ String uniqueKey = StrUtil.join("-", groupId.getDeptId(), groupId.getTaskId());
|
|
|
|
|
+ groupIdPair.put(uniqueKey, groupId.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 设置 分组内最后1条记录id 与 deptId-taskId 唯一键的对应关系
|
|
|
|
|
+ if (CollUtil.isNotEmpty(groupIdPair)) {
|
|
|
|
|
+ groupIdPair.forEach((uniqueKey, groupId) -> {
|
|
|
|
|
+ if (groupFootagePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdFootagePair.put(groupId, groupFootagePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupFootageTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdFootageTimePair.put(groupId, groupFootageTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupOtherProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdOtherProductTimePair.put(groupId, groupOtherProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdProductTimePair.put(groupId, groupProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupFuelPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdFuelPair.put(groupId, groupFuelPair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupPowerPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdPowerPair.put(groupId, groupPowerPair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdNoProductTimePair.put(groupId, groupNoProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (groupZjNoProductTimePair.containsKey(uniqueKey)) {
|
|
|
|
|
+ groupIdZjNoProductTimePair.put(groupId, groupZjNoProductTimePair.get(uniqueKey));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ DataPermissionUtils.executeIgnore(() -> {
|
|
|
|
|
+ // 查询日报关联的项目信息
|
|
|
|
|
+ IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
|
|
|
|
|
+ reqVO.setProjectIds(convertList(reports, IotRyDailyReportDO::getProjectId));
|
|
|
|
|
+ List<IotProjectInfoDO> projects = iotProjectInfoService.getIotProjectInfos(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(projects)) {
|
|
|
|
|
+ projects.forEach(project -> {
|
|
|
|
|
+ projectPair.put(project.getId(), project.getContractName());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询日报关联的任务信息
|
|
|
|
|
+ IotProjectTaskPageReqVO taskReqVO = new IotProjectTaskPageReqVO();
|
|
|
|
|
+ taskReqVO.setTaskIds(convertList(reports, IotRyDailyReportDO::getTaskId));
|
|
|
|
|
+ List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(taskReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tasks)) {
|
|
|
|
|
+ tasks.forEach(task -> {
|
|
|
|
|
+ taskPair.put(task.getId(), task.getWellName());
|
|
|
|
|
+ taskTechniquePair.put(task.getId(), task.getTechnique());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(task.getExtProperty())) {
|
|
|
|
|
+ List<IotTaskAttrModelProperty> taskAttrs = task.getExtProperty();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(taskAttrs)) {
|
|
|
|
|
+ // 找到 设计注气量 属性 对应的值
|
|
|
|
|
+ taskAttrs.forEach(attr -> {
|
|
|
|
|
+ if ("设计井深".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskExtPropertyPair.put(task.getId(), new BigDecimal(attr.getActualValue()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("设计井身结构".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskWellStructPair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("额定生产时间".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskRatedProductionTimePair.put(task.getId(), new BigDecimal(attr.getActualValue()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("套生段产管尺寸".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskCasingPipeSizePair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("井控级别".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskWellControlLevelPair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("井别".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
|
|
+ taskWellCategoryPair.put(task.getId(), attr.getActualValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询当前日报所属施工队伍中包含 井架 的型号
|
|
|
|
|
+ equipmentTypePair.set(iotRyDailyReportService.queryEquipmentType(convertList(reports, IotRyDailyReportDO::getDeptId)));
|
|
|
|
|
+ // 查询当前日报所属部门的 上井次完井时间 已经绑定任务的情况下
|
|
|
|
|
+ List<IotRyDailyReportDO> latestWellDoneTimes = iotRyDailyReportService.latestWellDoneTimes(null);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(latestWellDoneTimes)) {
|
|
|
|
|
+ latestWellDoneTimes.forEach(time -> {
|
|
|
|
|
+ latestWellDoneTimePair.put(time.getDeptId(), time.getConstructionStartDate());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 按施工队伍统计 钻井日报 施工井数 完工井数
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> deptTasks = iotRyDailyReportService.countTasksByDept();
|
|
|
|
|
+ // 修井日报 不存在既填写钻井日报 又填写修井日报的队伍
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportService.countRepairTasksByDept(pageReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(repairDeptTasks)) {
|
|
|
|
|
+ repairDeptTasks.forEach(task -> {
|
|
|
|
|
+ totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
|
|
+ completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (CollUtil.isNotEmpty(deptTasks)) {
|
|
|
|
|
+ deptTasks.forEach(task -> {
|
|
|
|
|
+ totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
|
|
+ completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // 2. 拼接数据
|
|
|
|
|
+ return BeanUtils.toBean(reports, IotRyDailyReportRespVO.class, (reportVO) -> {
|
|
|
|
|
+ // 2.1 拼接部门信息
|
|
|
|
|
+ findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
|
|
+
|
|
|
|
|
+ // 小组内最后1条记录标识
|
|
|
|
|
+ findAndThen(groupIdFootagePair, reportVO.getId(), footage -> reportVO.setLastGroupIdFlag(true));
|
|
|
|
|
+ // 小组内累计进尺
|
|
|
|
|
+ findAndThen(groupIdFootagePair, reportVO.getId(), footage -> reportVO.setGroupIdFootage(footage));
|
|
|
|
|
+ // 小组内累计 进尺工作时间
|
|
|
|
|
+ findAndThen(groupIdFootageTimePair, reportVO.getId(), footageTime -> reportVO.setGroupIdFootageTime(footageTime));
|
|
|
|
|
+ // 小组内累计 钻井 其他生产时间
|
|
|
|
|
+ findAndThen(groupIdOtherProductTimePair, reportVO.getId(), otherProductTime -> reportVO.setGroupIdOtherProductTime(otherProductTime));
|
|
|
|
|
+ // 小组内累计 钻井 非生产时间
|
|
|
|
|
+ findAndThen(groupIdZjNoProductTimePair, reportVO.getId(), zjNoProductTime -> reportVO.setGroupIdZjNoProductTime(zjNoProductTime));
|
|
|
|
|
+ // 小组内累计用电量
|
|
|
|
|
+ findAndThen(groupIdPowerPair, reportVO.getId(), power -> reportVO.setGroupIdPower(power));
|
|
|
|
|
+ // 小组内累计油耗
|
|
|
|
|
+ findAndThen(groupIdFuelPair, reportVO.getId(), fuel -> reportVO.setGroupIdFuel(fuel));
|
|
|
|
|
+ // 修井 非生产时间
|
|
|
|
|
+ findAndThen(groupIdNoProductTimePair, reportVO.getId(), noProductTime -> reportVO.setNonProductionTime(noProductTime));
|
|
|
|
|
+ // 修井 生产时间
|
|
|
|
|
+ findAndThen(groupIdProductTimePair, reportVO.getId(), productTime -> reportVO.setGroupIdProductTime(productTime));
|
|
|
|
|
+
|
|
|
|
|
+ // 2.2 日报关联的项目信息
|
|
|
|
|
+ findAndThen(projectPair, reportVO.getProjectId(), contractName -> reportVO.setContractName(contractName));
|
|
|
|
|
+ // 2.3 日报关联的任务信息
|
|
|
|
|
+ findAndThen(taskPair, reportVO.getTaskId(), taskName -> reportVO.setTaskName(taskName));
|
|
|
|
|
+ // 2.4 设计井深
|
|
|
|
|
+ findAndThen(taskExtPropertyPair, reportVO.getTaskId(), wellDepth -> reportVO.setDesignWellDepth(wellDepth));
|
|
|
|
|
+ // 施工工艺
|
|
|
|
|
+ findAndThen(taskTechniquePair, reportVO.getTaskId(), technique -> reportVO.setTechnique(technique));
|
|
|
|
|
+ // 井别
|
|
|
|
|
+ findAndThen(taskWellCategoryPair, reportVO.getTaskId(), wellCategory -> reportVO.setWellCategory(wellCategory));
|
|
|
|
|
+ // 额定生产时间
|
|
|
|
|
+ findAndThen(taskRatedProductionTimePair, reportVO.getTaskId(), ratedProductionTime -> reportVO.setRatedProductionTime(ratedProductionTime));
|
|
|
|
|
+ // 套生段产管尺寸
|
|
|
|
|
+ findAndThen(taskCasingPipeSizePair, reportVO.getTaskId(), casingPipeSize -> reportVO.setCasingPipeSize(casingPipeSize));
|
|
|
|
|
+ // 井控级别
|
|
|
|
|
+ findAndThen(taskWellControlLevelPair, reportVO.getTaskId(), wellControlLevel -> reportVO.setWellControlLevel(wellControlLevel));
|
|
|
|
|
+ // 2.5 设计井身结构
|
|
|
|
|
+ findAndThen(taskWellStructPair, reportVO.getTaskId(), wellStruct -> reportVO.setDesignWellStruct(wellStruct));
|
|
|
|
|
+ // 2.6 设备型号
|
|
|
|
|
+ findAndThen(equipmentTypePair.get(), reportVO.getDeptId(), equipmentType -> reportVO.setEquipmentType(equipmentType));
|
|
|
|
|
+ // 2.7 上井次完井时间
|
|
|
|
|
+ findAndThen(latestWellDoneTimePair, reportVO.getDeptId(), latestWellDoneTime -> reportVO.setLatestWellDoneTime(latestWellDoneTime));
|
|
|
|
|
+ // 2.8 总施工井数 完工井数
|
|
|
|
|
+ findAndThen(totalTasksPair, reportVO.getDeptId(), totalTaskCount -> reportVO.setTotalConstructionWells(totalTaskCount));
|
|
|
|
|
+ findAndThen(completedTasksPair, reportVO.getDeptId(), completedTaskCount -> reportVO.setCompletedWells(completedTaskCount));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@GetMapping("/polylineStatistics")
|
|
@GetMapping("/polylineStatistics")
|
|
|
@Operation(summary = "获得瑞鹰日报汇总统计 折线图")
|
|
@Operation(summary = "获得瑞鹰日报汇总统计 折线图")
|
|
|
@PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:query')")
|
|
@PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:query')")
|