| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | 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.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.enums.FileNameType; |
| | |
| | | import java.io.IOException; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.common.constant.StorageAttachmentConstants.StorageAttachmentFile; |
| | | import static com.ruoyi.common.enums.StorageAttachmentRecordType.InspectionTasks; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | if(commonFiles == null){ |
| | | commonFiles = new ArrayList<>(); |
| | | } |
| | | List<CommonFile> finalCommonFiles = commonFiles; |
| | | AtomicReference<List<CommonFile>> finalCommonFiles = new AtomicReference<>(commonFiles); |
| | | |
| | | List<InspectionTaskDto> dtoList = entityPage.getRecords().stream().map(inspectionTask -> { |
| | | InspectionTaskDto dto = new InspectionTaskDto(); |
| | |
| | | } |
| | | |
| | | dto.setDateStr(inspectionTask.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | |
| | | finalCommonFiles.set(finalCommonFiles.get().stream().filter(commonFile -> commonFile.getCommonId().equals(inspectionTask.getId())).collect(Collectors.toList())); |
| | | // 初始化三个附件列表 |
| | | dto.setCommonFileList(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListAfter(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListBefore(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileList(finalCommonFiles.get().stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListAfter(finalCommonFiles.get().stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListBefore(finalCommonFiles.get().stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue())).collect(Collectors.toList())); |
| | | |
| | | |
| | | return dto; |
| | |
| | | } |
| | | |
| | | // 提取创建BlobDTO的公共方法 |
| | | private StorageBlobDTO createBlobDto(StorageBlob blob) { |
| | | StorageBlobDTO dto = new StorageBlobDTO(); |
| | | private StorageBlobVO createBlobDto(StorageBlob blob) { |
| | | StorageBlobVO dto = new StorageBlobVO(); |
| | | BeanUtils.copyProperties(blob, dto); |
| | | |
| | | // 设置URL |
| | | dto.setUrl(minioUtils.getPreviewUrls( |
| | | blob.getBucketFilename(), |
| | | blob.getBucketName(), |
| | | true |
| | | )); |
| | | |
| | | // 设置下载URL |
| | | dto.setDownloadUrl(minioUtils.getDownloadUrls( |
| | | blob.getBucketFilename(), |
| | | blob.getBucketName(), |
| | | blob.getOriginalFilename(), |
| | | true |
| | | )); |
| | | // todo fileChange |
| | | // // 设置URL |
| | | // dto.setUrl(minioUtils.getPreviewUrls( |
| | | // blob.getBucketFilename(), |
| | | // blob.getBucketName(), |
| | | // true |
| | | // )); |
| | | // |
| | | // // 设置下载URL |
| | | // dto.setDownloadUrl(minioUtils.getDownloadUrls( |
| | | // blob.getBucketFilename(), |
| | | // blob.getBucketName(), |
| | | // blob.getOriginalFilename(), |
| | | // true |
| | | // )); |
| | | return dto; |
| | | } |
| | | |