Просмотр исходного кода

pms 瑞都 日报维护非生产时效 逻辑调整

zhangcl 11 часов назад
Родитель
Сommit
e3c4364e8e

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

@@ -2321,6 +2321,7 @@ public class IotRdDailyReportController {
                 constructStatusPair.put(data.getValue(), data.getLabel());
                 constructStatusPair.put(data.getValue(), data.getLabel());
             });
             });
         }
         }
+        Map<String, Boolean> reportNonProductFlagPair = new HashMap<>();
         DataPermissionUtils.executeIgnore(() -> {
         DataPermissionUtils.executeIgnore(() -> {
             // 查询日报关联的项目信息
             // 查询日报关联的项目信息
             IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
             IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
@@ -2348,6 +2349,7 @@ public class IotRdDailyReportController {
             // relatedWellReqVO.setPlatformWell(2);
             // relatedWellReqVO.setPlatformWell(2);
             List<IotRdDailyReportDO> relatedWellReports = iotRdDailyReportService.dailyReports(relatedWellReqVO);
             List<IotRdDailyReportDO> relatedWellReports = iotRdDailyReportService.dailyReports(relatedWellReqVO);
 
 
+
             // 按照日报创建时间倒序排列
             // 按照日报创建时间倒序排列
             if (CollUtil.isNotEmpty(relatedWellReports)) {
             if (CollUtil.isNotEmpty(relatedWellReports)) {
                 relatedWellReports = relatedWellReports.stream()
                 relatedWellReports = relatedWellReports.stream()
@@ -2389,6 +2391,7 @@ public class IotRdDailyReportController {
                     }
                     }
                 }
                 }
             }
             }
+
             // 平台井 主井施工完成 需要显示 关联井的施工状态 井号
             // 平台井 主井施工完成 需要显示 关联井的施工状态 井号
             if (CollUtil.isNotEmpty(relatedWellReports)) {
             if (CollUtil.isNotEmpty(relatedWellReports)) {
                 Map<String, IotRdDailyReportDO> relatedPlatformGroupPair = new HashMap<>();
                 Map<String, IotRdDailyReportDO> relatedPlatformGroupPair = new HashMap<>();
@@ -2398,6 +2401,12 @@ public class IotRdDailyReportController {
                         if (!relatedPlatformGroupPair.containsKey(report.getPlatformGroup())) {
                         if (!relatedPlatformGroupPair.containsKey(report.getPlatformGroup())) {
                             relatedPlatformGroupPair.put(report.getPlatformGroup(), report);
                             relatedPlatformGroupPair.put(report.getPlatformGroup(), report);
                         }
                         }
+                        // 查询关联井的 非生产时间填写情况 只要有1个关联井填写了 非生产时间 就显示为 已填写
+                        IotRdDailyReportRespVO reportRespVO = BeanUtils.toBean(report, IotRdDailyReportRespVO.class);
+                        Boolean flag = setNoProductFlag(reportRespVO);
+                        if (flag) {
+                            reportNonProductFlagPair.put(report.getPlatformGroup(), true);
+                        }
                     }
                     }
                 });
                 });
                 relatedWellReports.forEach(report -> {
                 relatedWellReports.forEach(report -> {
@@ -2564,25 +2573,8 @@ public class IotRdDailyReportController {
                     reportVO.setRdStatusLabel(constructStatusPair.get(reportVO.getRdStatus()));
                     reportVO.setRdStatusLabel(constructStatusPair.get(reportVO.getRdStatus()));
                 }
                 }
             }
             }
-            BigDecimal accidentTime = reportVO.getAccidentTime();
-            BigDecimal repairTime = reportVO.getRepairTime();
-            BigDecimal selfStopTime = reportVO.getSelfStopTime();
-            BigDecimal complexityTime = reportVO.getComplexityTime();
-            BigDecimal relocationTime = reportVO.getRelocationTime();
-            BigDecimal rectificationTime = reportVO.getRectificationTime();
-            BigDecimal waitingStopTime = reportVO.getWaitingStopTime();
-            BigDecimal winterBreakTime = reportVO.getWinterBreakTime();
-            BigDecimal partyaDesignTime = reportVO.getPartyaDesign();
-            BigDecimal partyaPrepareTime = reportVO.getPartyaPrepare();
-            BigDecimal partyaResourceTime = reportVO.getPartyaResource();
-            BigDecimal otherNptTime = reportVO.getOtherNptTime();
-            if (accidentTime.compareTo(BigDecimal.ZERO) > 0 || repairTime.compareTo(BigDecimal.ZERO) > 0 || selfStopTime.compareTo(BigDecimal.ZERO) > 0
-            || complexityTime.compareTo(BigDecimal.ZERO) > 0 || relocationTime.compareTo(BigDecimal.ZERO) > 0 || rectificationTime.compareTo(BigDecimal.ZERO) > 0
-            || waitingStopTime.compareTo(BigDecimal.ZERO) > 0 || winterBreakTime.compareTo(BigDecimal.ZERO) > 0 || partyaDesignTime.compareTo(BigDecimal.ZERO) > 0
-            || partyaPrepareTime.compareTo(BigDecimal.ZERO) > 0 || partyaResourceTime.compareTo(BigDecimal.ZERO) > 0 || otherNptTime.compareTo(BigDecimal.ZERO) > 0) {
-                // 设置非生产时间填写标识
-                reportVO.setNonProductFlag(true);
-            }
+            // 设置非生产时间填写标识
+            reportVO.setNonProductFlag(setNoProductFlag(reportVO));
             // 创建时间 格式化 yyyy-MM-dd
             // 创建时间 格式化 yyyy-MM-dd
             if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
             if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
                 reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
                 reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
@@ -2595,6 +2587,8 @@ public class IotRdDailyReportController {
             findAndThen(taskPair, reportVO.getTaskId(), taskName -> reportVO.setTaskName(taskName));
             findAndThen(taskPair, reportVO.getTaskId(), taskName -> reportVO.setTaskName(taskName));
             // 日报关联的任务信息(兼容主井完工 关联井未完工的情况)
             // 日报关联的任务信息(兼容主井完工 关联井未完工的情况)
             findAndThen(relatedPlatformPair, reportVO.getPlatformGroup(), relatedTaskName -> reportVO.setTaskName(relatedTaskName));
             findAndThen(relatedPlatformPair, reportVO.getPlatformGroup(), relatedTaskName -> reportVO.setTaskName(relatedTaskName));
+            // 平台井相关的非生产时间标识
+            findAndThen(reportNonProductFlagPair, reportVO.getPlatformGroup(), nonProductFlag -> reportVO.setNonProductFlag(nonProductFlag));
             // 日报关联的任务施工状态(兼容主井完工 关联井未完工的情况)
             // 日报关联的任务施工状态(兼容主井完工 关联井未完工的情况)
             findAndThen(relatedWellStatusPair, reportVO.getPlatformGroup(), rdStatus -> reportVO.setRdStatus(rdStatus));
             findAndThen(relatedWellStatusPair, reportVO.getPlatformGroup(), rdStatus -> reportVO.setRdStatus(rdStatus));
             // 日报关联的责任人
             // 日报关联的责任人
@@ -2604,6 +2598,34 @@ public class IotRdDailyReportController {
         });
         });
     }
     }
 
 
+    /**
+     *
+     * @param dailyReport
+     * @return
+     */
+    private Boolean setNoProductFlag(IotRdDailyReportRespVO dailyReport){
+        BigDecimal accidentTime = dailyReport.getAccidentTime();
+        BigDecimal repairTime = dailyReport.getRepairTime();
+        BigDecimal selfStopTime = dailyReport.getSelfStopTime();
+        BigDecimal complexityTime = dailyReport.getComplexityTime();
+        BigDecimal relocationTime = dailyReport.getRelocationTime();
+        BigDecimal rectificationTime = dailyReport.getRectificationTime();
+        BigDecimal waitingStopTime = dailyReport.getWaitingStopTime();
+        BigDecimal winterBreakTime = dailyReport.getWinterBreakTime();
+        BigDecimal partyaDesignTime = dailyReport.getPartyaDesign();
+        BigDecimal partyaPrepareTime = dailyReport.getPartyaPrepare();
+        BigDecimal partyaResourceTime = dailyReport.getPartyaResource();
+        BigDecimal otherNptTime = dailyReport.getOtherNptTime();
+        if (accidentTime.compareTo(BigDecimal.ZERO) > 0 || repairTime.compareTo(BigDecimal.ZERO) > 0 || selfStopTime.compareTo(BigDecimal.ZERO) > 0
+                || complexityTime.compareTo(BigDecimal.ZERO) > 0 || relocationTime.compareTo(BigDecimal.ZERO) > 0 || rectificationTime.compareTo(BigDecimal.ZERO) > 0
+                || waitingStopTime.compareTo(BigDecimal.ZERO) > 0 || winterBreakTime.compareTo(BigDecimal.ZERO) > 0 || partyaDesignTime.compareTo(BigDecimal.ZERO) > 0
+                || partyaPrepareTime.compareTo(BigDecimal.ZERO) > 0 || partyaResourceTime.compareTo(BigDecimal.ZERO) > 0 || otherNptTime.compareTo(BigDecimal.ZERO) > 0) {
+            // 设置非生产时间填写标识
+            return true;
+        }
+        return false;
+    }
+
     @GetMapping("/taskActualProgress")
     @GetMapping("/taskActualProgress")
     @Operation(summary = "查询日报所属任务的实际进度")
     @Operation(summary = "查询日报所属任务的实际进度")
     @PreAuthorize("@ss.hasPermission('pms:iot-rd-daily-report:query')")
     @PreAuthorize("@ss.hasPermission('pms:iot-rd-daily-report:query')")

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

@@ -180,4 +180,7 @@ public class IotRdDailyReportSaveReqVO {
 
 
     @Schema(description = "车辆油耗")
     @Schema(description = "车辆油耗")
     private List<IotDailyReportFuelSaveReqVO> reportFuels;
     private List<IotDailyReportFuelSaveReqVO> reportFuels;
+
+    @Schema(description = "非生产时间标识 Y 修改非生产时间后不再审批")
+    private String nonProduct;
 }
 }

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

@@ -61,6 +61,7 @@ import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -130,10 +131,13 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         }
         }
         // 更新
         // 更新
         IotRdDailyReportDO updateObj = BeanUtils.toBean(updateReqVO, IotRdDailyReportDO.class);
         IotRdDailyReportDO updateObj = BeanUtils.toBean(updateReqVO, IotRdDailyReportDO.class);
-        // 设置 日报填写状态 保存 已完成
-        updateObj.setStatus(1);
-        // 设置 日报审批状态为 审批中 auditStatus = 10
-        updateObj.setAuditStatus(10);
+        // 如果是修改 非生产时间 ,则不必再发起审批
+        if (StrUtil.isBlank(updateReqVO.getNonProduct())) {
+            // 设置 日报填写状态 保存 已完成
+            updateObj.setStatus(1);
+            // 设置 日报审批状态为 审批中 auditStatus = 10
+            updateObj.setAuditStatus(10);
+        }
         iotRdDailyReportMapper.updateById(updateObj);
         iotRdDailyReportMapper.updateById(updateObj);
         // 保存油耗信息
         // 保存油耗信息
         if (CollUtil.isNotEmpty(updateReqVO.getReportFuels())) {
         if (CollUtil.isNotEmpty(updateReqVO.getReportFuels())) {
@@ -2190,7 +2194,12 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
         List<IotRdDailyReportDO> mainPlatformReports = new ArrayList<>();
         List<IotRdDailyReportDO> mainPlatformReports = new ArrayList<>();
         // 关联井日报
         // 关联井日报
         List<IotRdDailyReportDO> relatePlatformReports = new ArrayList<>();
         List<IotRdDailyReportDO> relatePlatformReports = new ArrayList<>();
+        // 维护非生产时间标识 nonProduct
+        AtomicReference<String> nonProduct = new AtomicReference<>(StrUtil.EMPTY);
         reports.forEach(report -> {
         reports.forEach(report -> {
+            if (StrUtil.isNotBlank(report.getNonProduct())) {
+                nonProduct.set(report.getNonProduct());
+            }
             IotRdDailyReportDO updatedReport = updateIotRdDailyReport(report);
             IotRdDailyReportDO updatedReport = updateIotRdDailyReport(report);
             // 标识当前任务井是 普通井 或 平台井主井 关联的任务审批人发送提醒消息
             // 标识当前任务井是 普通井 或 平台井主井 关联的任务审批人发送提醒消息
             if (1 == updatedReport.getPlatformWell() || 0 == updatedReport.getPlatformWell()) {
             if (1 == updatedReport.getPlatformWell() || 0 == updatedReport.getPlatformWell()) {
@@ -2217,7 +2226,7 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
             reqVO.setPlatformGroup(platformGroup);
             reqVO.setPlatformGroup(platformGroup);
             reqVO.setPlatformWell(1);
             reqVO.setPlatformWell(1);
             List<IotRdDailyReportDO> mainWellReports = iotRdDailyReportMapper.dailyReports(reqVO);
             List<IotRdDailyReportDO> mainWellReports = iotRdDailyReportMapper.dailyReports(reqVO);
-            if (CollUtil.isNotEmpty(mainWellReports)) {
+            if (CollUtil.isNotEmpty(mainWellReports) && StrUtil.isBlank(nonProduct.get())) {
                 IotRdDailyReportDO mainWellReport = mainWellReports.get(0);
                 IotRdDailyReportDO mainWellReport = mainWellReports.get(0);
                 // 设置 日报审批状态为 审批中 auditStatus = 10
                 // 设置 日报审批状态为 审批中 auditStatus = 10
                 mainWellReport.setAuditStatus(10);
                 mainWellReport.setAuditStatus(10);