From b801ae3807276a960b205bf2e51b1f934cd605ac Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期四, 18 六月 2026 16:56:47 +0800
Subject: [PATCH] feat 设备巡检 调整为一次性完成

---
 src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java |   48 +++++++-----------------------------------------
 1 files changed, 7 insertions(+), 41 deletions(-)

diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
index c8a3f9a..8e1f365 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
@@ -134,7 +134,7 @@
         //澶勭悊闄勪欢
         List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>()
                 .in(CommonFile::getCommonId, ids)
-                .in(CommonFile::getType, Arrays.asList(FileNameType.INSPECTION.getValue(), FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue(), FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())));
+                .eq(CommonFile::getType, FileNameType.INSPECTION.getValue()));
         if(commonFiles == null){
             commonFiles = new ArrayList<>();
         }
@@ -181,16 +181,10 @@
 
             dto.setDateStr(inspectionTask.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
 
-            // 鍒濆鍖栦笁涓檮浠跺垪琛紝鎸塩ommonId鍜宼ype杩囨护
+            // 鍒濆鍖栭檮浠跺垪琛�
             Long taskId = inspectionTask.getId();
             dto.setCommonFileList(finalCommonFiles.stream()
-                    .filter(commonFile -> commonFile.getCommonId().equals(taskId) && commonFile.getType().equals(FileNameType.INSPECTION.getValue()))
-                    .collect(Collectors.toList()));
-            dto.setCommonFileListAfter(finalCommonFiles.stream()
-                    .filter(commonFile -> commonFile.getCommonId().equals(taskId) && commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_AFTER.getValue()))
-                    .collect(Collectors.toList()));
-            dto.setCommonFileListBefore(finalCommonFiles.stream()
-                    .filter(commonFile -> commonFile.getCommonId().equals(taskId) && commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue()))
+                    .filter(commonFile -> commonFile.getCommonId().equals(taskId))
                     .collect(Collectors.toList()));
 
             // 璁$畻鐘舵�侊細宸茶繃鏈� > 宸℃涓� > 寰呭贰妫�
@@ -239,11 +233,10 @@
 
     /**
      * 璁$畻宸℃浠诲姟鐘舵��
-     * 浼樺厛绾э細宸插畬鎴愬贰妫� > 宸℃涓�(宸茶繃鏈�) > 宸℃涓� > 宸茶繃鏈� > 寰呭贰妫�
      * @param inspectionTask 宸℃浠诲姟
      * @param timingTaskMap 瀹氭椂浠诲姟Map
      * @param now 褰撳墠鏃堕棿
-     * @return 鐘舵�侊細COMPLETED-宸插畬鎴愬贰妫�锛孖N_PROGRESS_EXPIRED-宸℃涓�(宸茶繃鏈�)锛孖N_PROGRESS-宸℃涓紝EXPIRED-宸茶繃鏈燂紝PENDING-寰呭贰妫�
+     * @return COMPLETED-宸插畬鎴愬贰妫�锛孍XPIRED-宸茶繃鏈燂紝PENDING-寰呭贰妫�
      */
     private String calculateStatus(InspectionTask inspectionTask, Map<Long, TimingTask> timingTaskMap, LocalDateTime now) {
         if(inspectionTask.getTimingTaskId() == null){
@@ -258,18 +251,9 @@
             }
         }
 
-        // 1. 鍒ゆ柇鏄惁宸插畬鎴愬贰妫�锛堜笁涓紓甯稿瓧娈甸兘涓嶄负null锛�
-        if (inspectionTask.getHasExceptionBefore() != null
-                && inspectionTask.getHasExceptionAfter() != null
-                && inspectionTask.getHasExceptionIssue() != null) {
+        // 1. 鍒ゆ柇鏄惁宸插畬鎴愬贰妫�
+        if (inspectionTask.getHasException() != null) {
             return "COMPLETED";
-        }
-
-        // 2. 鍒ゆ柇鏄惁宸℃涓紙浠讳竴寮傚父瀛楁涓嶄负null锛�
-        if (inspectionTask.getHasExceptionBefore() != null
-                || inspectionTask.getHasExceptionAfter() != null
-                || inspectionTask.getHasExceptionIssue() != null) {
-            return isExpired ? "IN_PROGRESS_EXPIRED" : "IN_PROGRESS";
         }
 
         // 3. 宸茶繃鏈�
@@ -305,13 +289,9 @@
      * 澶勭悊闄勪欢鍒犻櫎閫昏緫锛氬姣斿師鏈夐檮浠跺拰浼犲叆鐨勯檮浠讹紝鍒犻櫎琚Щ闄ょ殑闄勪欢
      */
     private void handleFileDeletion(Long taskId, InspectionTaskDto inspectionTaskDto) {
-        // 鏌ヨ鍘熸湁鐨勪笁绉嶇被鍨嬮檮浠�
         List<CommonFile> existingFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>()
                 .eq(CommonFile::getCommonId, taskId)
-                .in(CommonFile::getType, Arrays.asList(
-                        FileNameType.INSPECTION.getValue(),
-                        FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue(),
-                        FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())));
+                .eq(CommonFile::getType, FileNameType.INSPECTION.getValue()));
 
         if (CollectionUtils.isEmpty(existingFiles)) {
             return;
@@ -321,18 +301,6 @@
         Set<Long> submittedFileIds = new HashSet<>();
         if (inspectionTaskDto.getCommonFileList() != null) {
             inspectionTaskDto.getCommonFileList().stream()
-                    .map(CommonFile::getId)
-                    .filter(Objects::nonNull)
-                    .forEach(submittedFileIds::add);
-        }
-        if (inspectionTaskDto.getCommonFileListBefore() != null) {
-            inspectionTaskDto.getCommonFileListBefore().stream()
-                    .map(CommonFile::getId)
-                    .filter(Objects::nonNull)
-                    .forEach(submittedFileIds::add);
-        }
-        if (inspectionTaskDto.getCommonFileListAfter() != null) {
-            inspectionTaskDto.getCommonFileListAfter().stream()
                     .map(CommonFile::getId)
                     .filter(Objects::nonNull)
                     .forEach(submittedFileIds::add);
@@ -358,8 +326,6 @@
             return 0;
         }
         commonFileService.deleteByBusinessIds(Arrays.asList(ids),FileNameType.INSPECTION.getValue());
-        commonFileService.deleteByBusinessIds(Arrays.asList(ids),FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue());
-        commonFileService.deleteByBusinessIds(Arrays.asList(ids),FileNameType.INSPECTION_PRODUCTION_AFTER.getValue());
         return inspectionTaskMapper.deleteBatchIds(Arrays.asList(ids));
     }
 

--
Gitblit v1.9.3