Преглед на файлове

pms 瑞都 生产动态明细 查询 平台井 bug

zhangcl преди 3 дни
родител
ревизия
2f303f6bd9

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotprojecttask/vo/IotProjectTaskPlatformVO.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo;
 
+import cn.iocoder.yudao.module.pms.controller.admin.iotrddailyreportdetail.vo.IotRdDailyReportDetailRespVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotattachment.IotAttachmentDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttaskattrs.IotTaskAttrModelProperty;
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
@@ -63,6 +64,9 @@ public class IotProjectTaskPlatformVO {
     @Schema(description = "附件列表")
     private List<IotAttachmentDO> attachments;
 
+    @Schema(description = "生产动态明细")
+    private List<IotRdDailyReportDetailRespVO> reportDetails;
+
     /**
      * 非生产时间
      */

+ 42 - 8
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/IotRdDailyReportController.java

@@ -191,6 +191,7 @@ public class IotRdDailyReportController {
     private IotRdDailyReportRespVO buildDailyReport(IotRdDailyReportDO dailyReport) {
         IotRdDailyReportRespVO dailyReportVO = BeanUtils.toBean(dailyReport, IotRdDailyReportRespVO.class);
         // 查询日报生产动态明细
+        // 当前井及平台井的 taskId 依次查询有无 生产动态明细 哪个井有明细 用哪个任务井
         IotRdDailyReportDetailPageReqVO detailReqVO = new IotRdDailyReportDetailPageReqVO();
         detailReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         detailReqVO.setReportId(dailyReport.getId());
@@ -224,11 +225,6 @@ public class IotRdDailyReportController {
         // 查询当前日报是否已经绑定了油耗信息
         // 兼容主井完工 关联井 没有完工的情况 查询关联井的油耗信息
         boolean hasFuels = false;
-        /* IotDailyReportFuelPageReqVO fuelPageReqVO = new IotDailyReportFuelPageReqVO();
-        fuelPageReqVO.setType("RD");
-        fuelPageReqVO.setReportId(dailyReport.getId());
-        List<IotDailyReportFuelDO> reportFuels = iotDailyReportFuelService.getIotDailyReportFuels(fuelPageReqVO); */
-
         // 查询所有主井 关联井 油耗
         Map<Long, List<IotDailyReportFuelDO>> reportedFuelsPair = new HashMap<>();
         if (1 == dailyReport.getPlatformWell()) {
@@ -562,6 +558,8 @@ public class IotRdDailyReportController {
             List<IotRdDailyReportDO> reports = iotRdDailyReportService.dailyReports(reportReqVO);
             // 查询所有主井 关联井 附件
             Map<Long, List<IotAttachmentDO>> reportAttachmentsPair = new HashMap<>();
+            // 查询所有主井 关联井 生产动态明细
+            Map<Long, List<IotRdDailyReportDetailRespVO>> reportDetailsPair = new HashMap<>();
 
             if (CollUtil.isNotEmpty(reports)) {
                 List<Long> reportIds = convertList(reports, IotRdDailyReportDO::getId);
@@ -584,6 +582,29 @@ public class IotRdDailyReportController {
                         }
                     });
                 }
+
+                // 查询多个日报对应的生产动态明细
+                // 查询日报生产动态明细
+                // 当前井及平台井的 taskId 依次查询有无 生产动态明细 哪个井有明细 用哪个任务井
+                IotRdDailyReportDetailPageReqVO relatedDetailReqVO = new IotRdDailyReportDetailPageReqVO();
+                relatedDetailReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+                relatedDetailReqVO.setReportIds(reportIds);
+                PageResult<IotRdDailyReportDetailDO> relatedReportDetailPage = iotRdDailyReportDetailMapper.selectPage(relatedDetailReqVO);
+                List<IotRdDailyReportDetailDO> relatedReportDetails = relatedReportDetailPage.getList();
+                if (CollUtil.isNotEmpty(relatedReportDetails)) {
+                    relatedReportDetails.forEach(detail -> {
+                        IotRdDailyReportDetailRespVO dailyReportDetail = BeanUtils.toBean(detail, IotRdDailyReportDetailRespVO.class);
+                        if (reportDetailsPair.containsKey(detail.getReportId())) {
+                            List<IotRdDailyReportDetailRespVO> tempDetails = reportDetailsPair.get(detail.getReportId());
+                            tempDetails.add(dailyReportDetail);
+                            reportDetailsPair.put(detail.getReportId(), tempDetails);
+                        } else {
+                            List<IotRdDailyReportDetailRespVO> tempDetails = new ArrayList<>();
+                            tempDetails.add(dailyReportDetail);
+                            reportDetailsPair.put(detail.getReportId(), tempDetails);
+                        }
+                    });
+                }
             }
             // key任务id  value日报id
             Map<Long, Long> reportPair = new HashMap<>();
@@ -640,6 +661,9 @@ public class IotRdDailyReportController {
                     if (reportAttachmentsPair.containsKey(report.getId())) {
                         platformVO.setAttachments(reportAttachmentsPair.get(report.getId()));
                     }
+                    if (reportDetailsPair.containsKey(report.getId())) {
+                        platformVO.setReportDetails(reportDetailsPair.get(report.getId()));
+                    }
                     platformPair.put(report.getTaskId(), platformVO);
                 });
             }
@@ -662,8 +686,8 @@ public class IotRdDailyReportController {
                     }
                 });
             }
-            // 如果主井已经 完工 则显示 首个关联井 的 生产动态 下步计划 ...
 
+            // 如果主井已经 完工 则显示 首个关联井 的 生产动态 下步计划 ...
             List<IotProjectTaskPlatformVO> platforms = new ArrayList<>();
             if (CollUtil.isNotEmpty(tasks)) {
                 tasks.forEach(task -> {
@@ -688,6 +712,7 @@ public class IotRdDailyReportController {
                             platform.setMalfunction(tempPlatform.getMalfunction());
                             platform.setFaultDowntime(tempPlatform.getFaultDowntime());
                             platform.setAttachments(tempPlatform.getAttachments());
+                            platform.setReportDetails(tempPlatform.getReportDetails());
                             // 非生产时间
                             platform.setAccidentTime(tempPlatform.getAccidentTime());
                             platform.setRepairTime(tempPlatform.getRepairTime());
@@ -711,7 +736,6 @@ public class IotRdDailyReportController {
             }
 
             // 如果当前井id不存在集合 platforms 中 说明 主井已完工 关联井 未完工
-
             if (CollUtil.isEmpty(platforms)) {
                 List<IotProjectTaskPlatformVO> finishedPlatforms = new ArrayList<>();
                 // key任务井id   value任务井名称
@@ -790,6 +814,7 @@ public class IotRdDailyReportController {
                         dailyReportVO.setMalfunction(platform.getMalfunction());
                         dailyReportVO.setFaultDowntime(platform.getFaultDowntime());
                         dailyReportVO.setAttachments(platform.getAttachments());
+                        dailyReportVO.setReportDetails(platform.getReportDetails());
                     });
                 }
             }
@@ -2395,6 +2420,8 @@ public class IotRdDailyReportController {
             Set<Long> finishedMainPlatformIds = new HashSet<>();
             // 施工状态为空的主井任务 id
             Set<Long> nullStatusPlatformIds = new HashSet<>();
+            // 施工完成的任务id集合
+            Set<Long> finishedTaskIds = new HashSet<>();
             // 查询主井的关联井列表 当主井已经施工完成时,显示 关联井的井号 施工状态
             // 如果主井已经施工完成,并且主井日报 ‘施工状态’ 字段为空值,则显示关联井的井号、施工状态
             IotRdDailyReportPageReqVO relatedWellReqVO = new IotRdDailyReportPageReqVO();
@@ -2427,6 +2454,10 @@ public class IotRdDailyReportController {
                         finishedPlatformGroups.add(task.getPlatformGroup());
                         finishedMainPlatformIds.add(task.getId());
                     }
+                    // 收集施工完成的任务id集合
+                    if ("wg".equals(task.getStatus())) {
+                        finishedTaskIds.add(task.getId());
+                    }
                 });
                 // 查询 finishedPlatformGroups 相关的未施工完成的关联井任务井
                 if (CollUtil.isNotEmpty(finishedPlatformGroups)) {
@@ -2641,7 +2672,10 @@ public class IotRdDailyReportController {
                             tempTotalMixSand = tempTotalMixSand.add(actualValue);
                         }
                     }
-                    report.setCumulativeWorkingWell(tempTotalCumulativeWorkingWell);
+                    // 关联的任务完工 井数 +1
+                    if (finishedTaskIds.contains(report.getTaskId())) {
+                        report.setCumulativeWorkingWell(new BigDecimal(1));
+                    }
                     report.setCumulativeWorkingLayers(tempTotalCumulativeWorkingLayers);
                     report.setDailyPumpTrips(tempTotalPumpTrips);
                     report.setDailyToolsSand(tempTotalMixSand);

+ 13 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/vo/IotRdDailyReportRespVO.java

@@ -143,30 +143,43 @@ public class IotRdDailyReportRespVO {
     private String rdNptReason;
 
     @Schema(description = "事故非生产时间(H)")
+    @ExcelProperty("工程质量H")
     private BigDecimal accidentTime;
     @Schema(description = "修理非生产时间(H)")
+    @ExcelProperty("设备故障H")
     private BigDecimal repairTime;
     @Schema(description = "自停非生产时间(H)")
+    @ExcelProperty("设备保养H")
     private BigDecimal selfStopTime;
     @Schema(description = "复杂非生产时间(H)")
+    @ExcelProperty("技术受限H")
     private BigDecimal complexityTime;
     @Schema(description = "搬迁非生产时间(H)")
+    @ExcelProperty("生产配合H")
     private BigDecimal relocationTime;
     @Schema(description = "整改非生产时间(H)")
+    @ExcelProperty("H")
     private BigDecimal rectificationTime;
     @Schema(description = "等停非生产时间(H)")
+    @ExcelProperty("不可抗力H")
     private BigDecimal waitingStopTime;
     @Schema(description = "冬休非生产时间(H)")
+    @ExcelProperty("待命T")
     private BigDecimal winterBreakTime;
     @Schema(description = "甲方设计-非生产时间")
+    @ExcelProperty("甲方设计H")
     private BigDecimal partyaDesign;
     @Schema(description = "甲方准备-非生产时间")
+    @ExcelProperty("甲方准备H")
     private BigDecimal partyaPrepare;
     @Schema(description = "甲方资源-非生产时间")
+    @ExcelProperty("甲方资源H")
     private BigDecimal partyaResource;
     @Schema(description = "其它非生产时间")
+    @ExcelProperty("其它非生产时间H")
     private BigDecimal otherNptTime;
     @Schema(description = "其它非生产时间原因")
+    @ExcelProperty("其它非生产时间原因")
     private String otherNptReason;
 
     @Schema(description = "非生产时间填写标识 true false")

+ 0 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportRespVO.java

@@ -1,7 +1,6 @@
 package cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo;
 
 import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreportdetail.vo.IotRyDailyReportDetailRespVO;
-import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreportdetail.vo.IotRyDailyReportDetailSaveReqVO;
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotrddailyreportdetail/IotRdDailyReportDetailMapper.java

@@ -21,6 +21,7 @@ public interface IotRdDailyReportDetailMapper extends BaseMapperX<IotRdDailyRepo
                 .eqIfPresent(IotRdDailyReportDetailDO::getProjectId, reqVO.getProjectId())
                 .eqIfPresent(IotRdDailyReportDetailDO::getTaskId, reqVO.getTaskId())
                 .eqIfPresent(IotRdDailyReportDetailDO::getReportId, reqVO.getReportId())
+                .inIfPresent(IotRdDailyReportDetailDO::getReportId, reqVO.getReportIds())
                 .betweenIfPresent(IotRdDailyReportDetailDO::getReportDate, reqVO.getReportDate())
                 .betweenIfPresent(IotRdDailyReportDetailDO::getStartTime, reqVO.getStartTime())
                 .betweenIfPresent(IotRdDailyReportDetailDO::getEndTime, reqVO.getEndTime())

+ 14 - 5
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrddailyreport/IotRdDailyReportServiceImpl.java

@@ -446,6 +446,8 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         Map<Long, String> taskPeriodPair = new HashMap<>();
         // key任务id  value每个任务的施工开始日期
         Map<Long, LocalDateTime> taskStartDatePair = new HashMap<>();
+        // 已经完工的任务id集合
+        Set<Long> finishedTaskIds = new HashSet<>();
         if (CollUtil.isNotEmpty(dailyReports)) {
             // 遍历日报 找到每个日报关联的任务的 施工队伍
             List<Long> taskIds = convertList(dailyReports, IotRdDailyReportDO::getTaskId);
@@ -482,6 +484,10 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                                 .collect(Collectors.joining(",")); // 逗号分隔多项目部
                         taskProjectDeptPair.put(task.getId(), projectNames);
                     }
+                    // 筛选出 完工 的任务集合 任务完工 施工井数 +1
+                    if ("wg".equals(task.getRdStatus())) {
+                        finishedTaskIds.add(task.getId());
+                    }
                 });
             }
 
@@ -834,11 +840,11 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                         item.setWorkload(waterVolumePair.get(taskId));
                         items.add(item);
                     }
-                    if (cumulativeWorkingWellPair.containsKey(taskId)) {
-                        // 连续油管常规作业
+                    if (finishedTaskIds.contains(taskId)) {
+                        // 涉及到 井数 工作量 只有完工的任务 井数 +1
                         IotRdDailyReportStatisticsItemVO item = new IotRdDailyReportStatisticsItemVO();
                         item.setUnit("井数");
-                        item.setWorkload(cumulativeWorkingWellPair.get(taskId));
+                        item.setWorkload(new BigDecimal(1));
                         items.add(item);
                     }
                     if (cumulativeWorkingLayersPair.containsKey(taskId)) {
@@ -1038,6 +1044,8 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         List<IotRdDailyReportDO> dailyReports = iotRdDailyReportMapper.dailyReports(pageReqVO);
         // 累加所有日报的 工作量 数据 油耗 桥塞 趟数 井数...
         if (CollUtil.isNotEmpty(dailyReports)) {
+            // 筛选出所有日报关联的任务集合
+
             dailyReports.forEach(report -> {
                 // 筛选出日报中施工的 设备id集合
                 if (CollUtil.isNotEmpty(report.getDeviceIds())) {
@@ -1125,7 +1133,8 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                                 cumulativeWaterVolumePair.put("cumulativeWaterVolume", tempTotalWaterVolume);
                             }
                         }
-                        if ("井数".equals(unit)) {
+                        // 井数 日报关联任务 完工 井数 +1
+                        /* if ("井数".equals(unit)) {
                             tempTotalCumulativeWorkingWell = tempTotalCumulativeWorkingWell.add(actualValue);
                             if (cumulativeWorkingWellPair.containsKey("cumulativeWorkingWell")) {
                                 BigDecimal tempWorkingWell = cumulativeWorkingWellPair.get("cumulativeWorkingWell");
@@ -1133,7 +1142,7 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
                             } else {
                                 cumulativeWorkingWellPair.put("cumulativeWorkingWell", tempTotalCumulativeWorkingWell);
                             }
-                        }
+                        } */
                         if ("段数".equals(unit)) {
                             // 累计施工层
                             tempTotalCumulativeWorkingLayers = tempTotalCumulativeWorkingLayers.add(actualValue);

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrydailyreport/IotRyDailyReportService.java

@@ -48,7 +48,7 @@ public interface IotRyDailyReportService {
     IotRyDailyReportDO getIotRyDailyReport(Long id);
 
     /**
-     * 删除瑞鹰日报
+     * 查询瑞鹰日报 生产动态明细
      *
      * @param currentDate 当日日期
      * @param deptId 部门id