From b069101e1bf347ceab11e33d73b2fbb7f37d4686 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期六, 25 四月 2026 17:15:53 +0800
Subject: [PATCH] feat(production): 生产订单的工艺路线和参数的增删改逻辑

---
 src/main/java/com/ruoyi/inspectiontask/service/impl/QrCodeScanRecordServiceImpl.java |   88 +++++++++++++++++++++-----------------------
 1 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/QrCodeScanRecordServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/QrCodeScanRecordServiceImpl.java
index 00ece03..acc30a7 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/QrCodeScanRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/QrCodeScanRecordServiceImpl.java
@@ -6,12 +6,15 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
 import com.ruoyi.basic.mapper.StorageAttachmentMapper;
 import com.ruoyi.basic.mapper.StorageBlobMapper;
 import com.ruoyi.basic.pojo.StorageAttachment;
 import com.ruoyi.basic.pojo.StorageBlob;
 import com.ruoyi.basic.service.StorageAttachmentService;
-import com.ruoyi.common.utils.MinioUtils;
+import com.ruoyi.basic.utils.FileUtil;
 import com.ruoyi.common.utils.bean.BeanUtils;
 import com.ruoyi.inspectiontask.dto.QrCodeScanRecordDto;
 import com.ruoyi.inspectiontask.mapper.QrCodeMapper;
@@ -21,8 +24,8 @@
 import com.ruoyi.inspectiontask.service.QrCodeScanRecordService;
 import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.project.system.mapper.SysUserMapper;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -38,28 +41,23 @@
  */
 @Service
 @Slf4j
+@RequiredArgsConstructor
 public class QrCodeScanRecordServiceImpl extends ServiceImpl<QrCodeScanRecordMapper, QrCodeScanRecord> implements QrCodeScanRecordService {
 
-    @Autowired
-    private QrCodeScanRecordMapper qrCodeScanRecordMapper;
+    private final QrCodeScanRecordMapper qrCodeScanRecordMapper;
 
-    @Autowired
-    private QrCodeMapper qrCodeMapper;
+    private final QrCodeMapper qrCodeMapper;
 
-    @Autowired
-    private StorageAttachmentService storageAttachmentService;
+    private final StorageAttachmentService storageAttachmentService;
 
-    @Autowired
-    private StorageBlobMapper storageBlobMapper;
+    private final StorageBlobMapper storageBlobMapper;
 
-    @Autowired
-    private StorageAttachmentMapper storageAttachmentMapper;
+    private final StorageAttachmentMapper storageAttachmentMapper;
 
-    @Autowired
-    private MinioUtils minioUtils;
 
-    @Autowired
-    private SysUserMapper sysUserMapper;
+    private final SysUserMapper sysUserMapper;
+
+    private final FileUtil fileUtil;
 
     @Override
     public IPage<QrCodeScanRecordDto> selectQrCodeScanRecordList(Page<QrCodeScanRecord> page, QrCodeScanRecordDto qrCodeScanRecordDto) {
@@ -127,23 +125,24 @@
                     });
 
             // 6.2 璁剧疆闄勪欢淇℃伅
-            dto.setStorageBlobDTO(
-                    Optional.ofNullable(attachmentsMap.get(record.getId()))
-                            .orElse(Collections.emptyList())
-                            .stream()
-                            .map(att -> {
-                                StorageBlobDTO blobDTO = new StorageBlobDTO();
-                                Optional.ofNullable(blobMap.get(att.getStorageBlobId()))
-                                        .ifPresent(blob -> {
-                                            BeanUtils.copyProperties(blob, blobDTO);
-                                            blobDTO.setUrl(minioUtils.getPreviewUrls(blob.getBucketFilename(), blob.getBucketName(), true));
-                                            blobDTO.setDownloadUrl(minioUtils.getDownloadUrls(blob.getBucketFilename(),blob.getBucketName(),blob.getOriginalFilename(),true));
-                                        });
-                                return blobDTO;
-                            })
-                            .filter(blobDTO -> blobDTO.getId() != null) // 杩囨护鏃犳晥闄勪欢
-                            .collect(Collectors.toList())
-            );
+            // todo fileChange
+//            dto.setStorageBlobDTO(
+//                    Optional.ofNullable(attachmentsMap.get(record.getId()))
+//                            .orElse(Collections.emptyList())
+//                            .stream()
+//                            .map(att -> {
+//                                StorageBlobDTO blobDTO = new StorageBlobDTO();
+//                                Optional.ofNullable(blobMap.get(att.getStorageBlobId()))
+//                                        .ifPresent(blob -> {
+//                                            BeanUtils.copyProperties(blob, blobDTO);
+//                                            blobDTO.setUrl(minioUtils.getPreviewUrls(blob.getBucketFilename(), blob.getBucketName(), true));
+//                                            blobDTO.setDownloadUrl(minioUtils.getDownloadUrls(blob.getBucketFilename(),blob.getBucketName(),blob.getOriginalFilename(),true));
+//                                        });
+//                                return blobDTO;
+//                            })
+//                            .filter(blobDTO -> blobDTO.getId() != null) // 杩囨护鏃犳晥闄勪欢
+//                            .collect(Collectors.toList())
+//            );
             return dto;
         }).collect(Collectors.toList());
 
@@ -166,19 +165,16 @@
             i = qrCodeScanRecordMapper.updateById(qrCodeScanRecord);
         }
 
-        if (qrCodeScanRecordDto.getStorageBlobDTO() != null && !qrCodeScanRecordDto.getStorageBlobDTO().isEmpty()) {
-            List<StorageAttachment> attachments = new ArrayList<>();
-
-            for (StorageBlobDTO storageBlobDTO : qrCodeScanRecordDto.getStorageBlobDTO()) {
-                StorageAttachment storageAttachment = new StorageAttachment(
-                        StorageAttachmentFile,
-                        (long) QrCodeScanRecords.ordinal(),
-                        qrCodeScanRecord.getId()
-                );
-                storageAttachment.setStorageBlobDTO(storageBlobDTO);
-                attachments.add(storageAttachment);
+        if (qrCodeScanRecordDto.getStorageBlobVO() != null && !qrCodeScanRecordDto.getStorageBlobVO().isEmpty()) {
+            // vo 杞� dto
+            List<StorageBlobDTO> storageBlobDTOs = new ArrayList<>();
+            for (StorageBlobVO storageBlobVO : qrCodeScanRecordDto.getStorageBlobVO()) {
+                StorageBlobDTO storageBlobDTO = new StorageBlobDTO();
+                BeanUtils.copyProperties(storageBlobVO, storageBlobDTO);
+                storageBlobDTOs.add(storageBlobDTO);
             }
-            storageAttachmentService.saveStorageAttachment(attachments, qrCodeScanRecord.getId(), QrCodeScanRecords, StorageAttachmentFile);
+
+            fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.QR_CODE_SCAN_RECORDS, qrCodeScanRecord.getId(), storageBlobDTOs);
         }
         return i;
     }
@@ -188,4 +184,4 @@
         return qrCodeScanRecordMapper.deleteBatchIds(Arrays.asList(ids));
     }
 
-}
\ No newline at end of file
+}

--
Gitblit v1.9.3