fix:数据查询优化
This commit is contained in:
@@ -36,4 +36,7 @@ public class CreateDirReq {
|
||||
|
||||
@Schema(description = "标签请求参数")
|
||||
private TagReq tagReq;
|
||||
|
||||
@Schema(description = "是否跳过权限校验,默认为false", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Boolean skipPermissionCheck = false;
|
||||
}
|
||||
@@ -42,6 +42,9 @@ public class GetSimulationTaskFileReq extends BaseReq {
|
||||
@Schema(description = "文件类型字典值")
|
||||
private String fileTypeDictValue;
|
||||
|
||||
@Schema(description = "二次搜索需要满足的第二类文件类型字典值 (1,2,3,4)")
|
||||
private String secondFileTypeDictValue;
|
||||
|
||||
@Schema(description = "学科类型字典类")
|
||||
private String disciplineTypeDictClass;
|
||||
|
||||
|
||||
@@ -108,12 +108,40 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> fileIdsByDictTags = null;
|
||||
Set<Long> fileIdsByDictTags = null;
|
||||
if (CollectionUtils.isNotEmpty(req.getDictTags())) {
|
||||
fileIdsByDictTags = extractFileIdsByTags(req);
|
||||
|
||||
if (CollectionUtils.isEmpty(fileIdsByDictTags)) {
|
||||
return PageUtils.getJsonObjectSdmResponse(new ArrayList<>(), new PageInfo<>());
|
||||
}
|
||||
|
||||
// 二次搜索 文件类型,比如即时文件模型文件,又是曲线文件,又是网格文件,又是计算过程文件
|
||||
String secondFileTypeDictValues = req.getSecondFileTypeDictValue();
|
||||
if (StringUtils.isNotBlank(secondFileTypeDictValues)) {
|
||||
for (String secondFileTypeDictValue : secondFileTypeDictValues.split(",")) {
|
||||
GetSimulationTaskFileReq secondReq = new GetSimulationTaskFileReq();
|
||||
BeanUtils.copyProperties(req, secondReq);
|
||||
// 用二次文件类型比如 曲线文件 替换
|
||||
secondReq.setFileTypeDictValue(secondFileTypeDictValue);
|
||||
Set<Long> secondFileIdsByDictTags = extractFileIdsByTags(secondReq);
|
||||
if(CollectionUtils.isNotEmpty(secondFileIdsByDictTags)){
|
||||
// 合并筛选出满足既是第一次搜索结果,又是第二次搜索结果文件类型的文件
|
||||
fileIdsByDictTags.retainAll(secondFileIdsByDictTags);
|
||||
}else{
|
||||
// 二次搜索结果为空,说明不存在同时是两种类型的文件
|
||||
return PageUtils.getJsonObjectSdmResponse(new ArrayList<>(), new PageInfo<>());
|
||||
}
|
||||
|
||||
// 二次搜索有结果,但是合并后的文件为空,直接返回
|
||||
if (CollectionUtils.isEmpty(fileIdsByDictTags)) {
|
||||
return PageUtils.getJsonObjectSdmResponse(new ArrayList<>(), new PageInfo<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
@@ -214,7 +242,7 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
|
||||
/**
|
||||
* 复用listBigFile的逻辑:在目录范围内根据dictTags筛出文件ID
|
||||
*/
|
||||
private List<Long> extractFileIdsByTags(GetSimulationTaskFileReq req) {
|
||||
private Set<Long> extractFileIdsByTags(GetSimulationTaskFileReq req) {
|
||||
Map<String, Map<String, Integer>> dictIdMap = req.getDictTagIdsCache();
|
||||
if (dictIdMap == null || dictIdMap.isEmpty()) {
|
||||
log.warn("Dict tags cache is empty for update, trying to query manually");
|
||||
@@ -240,8 +268,7 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
|
||||
.list()
|
||||
.stream()
|
||||
.map(FileTagRel::getFileId)
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private void applyTagFilters(LambdaQueryChainWrapper<FileMetadataInfo> wrapper, TagReq tagReq, List<String> discipoTaskDirIds) {
|
||||
|
||||
@@ -370,10 +370,14 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
parDirId = req.getParDirId();
|
||||
}
|
||||
|
||||
FileMetadataInfo parDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parDirId).one();
|
||||
if (ObjectUtils.isEmpty(parDirInfo)) {
|
||||
log.error("上级目录不存在");
|
||||
return SdmResponse.failed("上级目录不存在");
|
||||
// 1. 权限校验(仅校验根目录删除权限)
|
||||
FileMetadataInfo parDirInfo = null;
|
||||
if (!Boolean.TRUE.equals(req.getSkipPermissionCheck())) {
|
||||
parDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parDirId).one();
|
||||
if (ObjectUtils.isEmpty(parDirInfo)) {
|
||||
log.error("上级目录不存在");
|
||||
return SdmResponse.failed("上级目录不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 构造子目录完整路径
|
||||
|
||||
@@ -173,6 +173,11 @@ public class SimulationSystemConfigController implements ISysConfigFeignClient {
|
||||
return service.deleteFormConfigure(configure);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询字典Ids
|
||||
* @param req 批量查询字典Ids请求参数
|
||||
* @return Map <dictClass, <dictValue,id>>
|
||||
*/
|
||||
@PostMapping(value = "/multiDictionaryIds")
|
||||
@ResponseBody
|
||||
public SdmResponse<Map<String, Map<String, Integer>>> multiQueryDictionaryIds(@RequestBody DictTagReq.BatchDictIdQueryReq req) {
|
||||
|
||||
Reference in New Issue
Block a user