fix:文件查询
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.sdm.common.entity.resp.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,6 +13,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
@Schema(name = "FileMetadataDTO", description = "文件元数据传输对象")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FileMetadataInfoResp implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -52,12 +55,14 @@ public class FileMetadataInfoResp implements Serializable {
|
||||
private Long creatorId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新者ID")
|
||||
private Long updaterId;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "所属项目ID")
|
||||
@@ -85,4 +90,28 @@ public class FileMetadataInfoResp implements Serializable {
|
||||
|
||||
@Schema(description = "完整访问URL(拼接minio网关地址 + objectKey)")
|
||||
private String fileUrl;
|
||||
|
||||
private String relatedResourceUuid;
|
||||
private String relatedResourceUuidOwnType;
|
||||
private String dirType;
|
||||
private String dirStatus;
|
||||
private String fileStatus;
|
||||
private String fileType;
|
||||
private String approvalStatus;
|
||||
private String approveType;
|
||||
private String tempMetadata;
|
||||
private String cidFlowId;
|
||||
private String uploadTaskId;
|
||||
private String uploadStatus;
|
||||
private String cidFlowReviewer;
|
||||
private String tag1;
|
||||
private String tag2;
|
||||
private String tag3;
|
||||
private String tag4;
|
||||
private String tag5;
|
||||
private String tag6;
|
||||
private String tag7;
|
||||
private String tag8;
|
||||
private String tag9;
|
||||
private String tag10;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.sdm.common.feign.impl.data;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -42,8 +43,8 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse queryDir(QueryDirReq req) {
|
||||
SdmResponse response;
|
||||
public SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryDir(QueryDirReq req) {
|
||||
SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> response;
|
||||
try {
|
||||
response = dataClient.queryDir(req);
|
||||
log.info("创建文响应件夹:"+ response);
|
||||
@@ -109,10 +110,10 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType) {
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType, Integer dirId) {
|
||||
SdmResponse<FileMetadataInfoResp> response;
|
||||
try {
|
||||
response = dataClient.queryFileMetadataInfo(uuid, uuidOwnType);
|
||||
response = dataClient.queryFileMetadataInfo(uuid, uuidOwnType, dirId);
|
||||
log.info("查询文件夹响应:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.sdm.common.feign.inter.data;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@@ -25,7 +26,7 @@ public interface IDataFeignClient {
|
||||
SdmResponse createDir(@RequestBody @Validated CreateDirReq req);
|
||||
|
||||
@PostMapping("/data/queryDir")
|
||||
SdmResponse queryDir(@RequestBody @Validated QueryDirReq req);
|
||||
SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryDir(@RequestBody @Validated QueryDirReq req);
|
||||
|
||||
@PostMapping("/data/renameDirNew")
|
||||
SdmResponse renameDirNew(@RequestBody @Validated RenameDirReq req);
|
||||
@@ -41,7 +42,7 @@ public interface IDataFeignClient {
|
||||
SdmResponse uploadFiles(UploadFilesReq req);
|
||||
|
||||
@GetMapping("/data/queryFileMetadataInfo")
|
||||
SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(@RequestParam(value = "uuid") String uuid, @RequestParam(value = "uuidOwnType") String uuidOwnType);
|
||||
SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(@RequestParam(value = "uuid") String uuid, @RequestParam(value = "uuidOwnType") String uuidOwnType, @RequestParam(value = "dirId") Integer dirId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class DataFileController implements IDataFeignClient {
|
||||
*/
|
||||
@PostMapping("/queryDir")
|
||||
@Operation(summary = "获取文件夹下子文件夹和文件内容信息", description = "查询指定文件夹的内容信息")
|
||||
public SdmResponse<PageDataResp<List<FileMetadataInfo>>> queryDir(@RequestBody @Validated QueryDirReq req) {
|
||||
public SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryDir(@RequestBody @Validated QueryDirReq req) {
|
||||
return IDataFileService.queryDir(req);
|
||||
}
|
||||
|
||||
@@ -380,8 +380,8 @@ public class DataFileController implements IDataFeignClient {
|
||||
|
||||
@GetMapping("/queryFileMetadataInfo")
|
||||
@Operation(summary = "根据节点uuid获取节点文件夹信息", description = "获取节点文件夹信息")
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(@RequestParam(value = "uuid") String uuid, @RequestParam(value = "uuidOwnType") String uuidOwnType) {
|
||||
return IDataFileService.queryFileMetadataInfo(uuid, uuidOwnType);
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(@RequestParam(value = "uuid") String uuid, @RequestParam(value = "uuidOwnType") String uuidOwnType, @RequestParam(value = "dirId") Integer dirId) {
|
||||
return IDataFileService.queryFileMetadataInfo(uuid, uuidOwnType, dirId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.sdm.data.model.req.*;
|
||||
import com.sdm.data.model.resp.KKFileViewURLFromMinioResp;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
@@ -47,7 +48,7 @@ public interface IDataFileService {
|
||||
* @param req 查询目录请求参数
|
||||
* @return 目录信息响应
|
||||
*/
|
||||
SdmResponse<PageDataResp<List<FileMetadataInfo>>> queryDir(QueryDirReq req);
|
||||
SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryDir(QueryDirReq req);
|
||||
|
||||
/**
|
||||
* 当前目录下的下一层级目录树查询
|
||||
@@ -314,7 +315,7 @@ public interface IDataFileService {
|
||||
default SdmResponse approveDataFile(LaunchApproveReq req){return null;};
|
||||
|
||||
|
||||
SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType);
|
||||
SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType, Integer dirId);
|
||||
|
||||
SdmResponse<ChunkUploadMinioFileResp> chunkUploadToMinio(ChunkUploadMinioFileReq req);
|
||||
|
||||
|
||||
@@ -32,10 +32,7 @@ import com.sdm.common.utils.CidSysUserUtil;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.common.utils.ProjectUtil;
|
||||
import com.sdm.data.model.bo.ApprovalFileDataContentsModel;
|
||||
import com.sdm.data.model.entity.FileMetadataExtension;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.entity.FileStorage;
|
||||
import com.sdm.data.model.entity.FileUserPermission;
|
||||
import com.sdm.data.model.entity.*;
|
||||
import com.sdm.data.model.req.*;
|
||||
import com.sdm.data.model.resp.KKFileViewURLFromMinioResp;
|
||||
import com.sdm.data.service.*;
|
||||
@@ -208,10 +205,16 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType) {
|
||||
FileMetadataInfo entity = fileMetadataInfoService.lambdaQuery()
|
||||
.eq(FileMetadataInfo::getRelatedResourceUuid,uuid)
|
||||
.eq(FileMetadataInfo::getRelatedResourceUuidOwnType,uuidOwnType).one();
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType, Integer dirId) {
|
||||
LambdaQueryWrapper<FileMetadataInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (dirId != null) {
|
||||
queryWrapper.eq(FileMetadataInfo::getId,dirId);
|
||||
} else {
|
||||
queryWrapper.eq(FileMetadataInfo::getRelatedResourceUuid,uuid);
|
||||
queryWrapper.eq(FileMetadataInfo::getRelatedResourceUuidOwnType,uuidOwnType);
|
||||
}
|
||||
|
||||
FileMetadataInfo entity = fileMetadataInfoService.getBaseMapper().selectOne(queryWrapper);
|
||||
FileMetadataInfoResp dto = new FileMetadataInfoResp();
|
||||
BeanUtils.copyProperties(entity, dto);
|
||||
return SdmResponse.success(dto);
|
||||
@@ -307,9 +310,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
|
||||
String fileMinioObjectKey = getFileMinioObjectKey(dirMetadataInfo.getObjectKey() + modifiedFileName);
|
||||
// 检查此文件夹下是否有历史同名文件 提示
|
||||
if (CollectionUtils.isNotEmpty(fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getObjectKey, fileMinioObjectKey).list())) {
|
||||
return SdmResponse.failed("该文件夹下存在同名文件:" + fileReq.getFileName() + ",请确认是否覆盖");
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getObjectKey, fileMinioObjectKey).list())) {
|
||||
// return SdmResponse.failed("该文件夹下存在同名文件:" + fileReq.getFileName() + ",请确认是否覆盖");
|
||||
// }
|
||||
|
||||
boolean hasUploadPermission = fileUserPermissionService.hasFilePermission(dirMetadataInfo.getId(), ThreadLocalContext.getUserId(), FilePermissionEnum.UPLOAD);
|
||||
if (!hasUploadPermission) {
|
||||
@@ -891,7 +894,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<FileMetadataInfo>>> queryDir(QueryDirReq req) {
|
||||
public SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryDir(QueryDirReq req) {
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
Long parentId;
|
||||
if (ObjectUtils.isNotEmpty(req.getFileId())) {
|
||||
@@ -927,8 +930,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
setCidInfos(list);
|
||||
setProjectName(list);
|
||||
setAnalysisDirectionName(list);
|
||||
PageInfo<FileMetadataInfo> page = new PageInfo<>(list);
|
||||
return PageUtils.getJsonObjectSdmResponse(list, page);
|
||||
List<FileMetadataInfoResp> dtoList = list.stream().map(entity -> {
|
||||
FileMetadataInfoResp dto = new FileMetadataInfoResp();
|
||||
BeanUtils.copyProperties(entity, dto);
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
PageInfo<FileMetadataInfoResp> page = new PageInfo<>(dtoList);
|
||||
return PageUtils.getJsonObjectSdmResponse(dtoList, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1276,7 +1276,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType) {
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType, Integer dirId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user