优化文件搜索
This commit is contained in:
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GetSimulationTaskFileReq extends BaseReq {
|
||||
@@ -18,6 +19,9 @@ public class GetSimulationTaskFileReq extends BaseReq {
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "上传人id")
|
||||
private List<Long> uploadUserId;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "文件搜索请求参数")
|
||||
@@ -70,7 +71,7 @@ public class FileSearchReq extends BaseReq {
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Schema(description = "文件业务类型(1:模型文件 2:仿真报告、3:计算文件、4:曲线文件、5:云图文件,6:网格文件,7:计算过程文件)",enumAsRef = true)
|
||||
private Integer fileBizType;
|
||||
private List<Integer> fileBizType;
|
||||
|
||||
/**
|
||||
* 是否过滤空数据
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QueryBigFileReq extends BaseReq {
|
||||
@@ -47,9 +48,15 @@ public class QueryBigFileReq extends BaseReq {
|
||||
private String fileSuffix;
|
||||
|
||||
@Schema(description = "文件业务类型(1:模型文件 2:仿真报告、3:计算文件、4:曲线文件、5:云图文件,6:网格文件,7:计算过程文件)")
|
||||
private Integer fileBizType;
|
||||
private List<Integer> fileBizType;
|
||||
|
||||
@Schema(description = "上传人id")
|
||||
private String uploadUserId;
|
||||
private List<Long> uploadUserId;
|
||||
|
||||
@Schema(description = "审批类型")
|
||||
private List<Integer> approveTypeList;
|
||||
|
||||
@Schema(description = "是否最新")
|
||||
Boolean isLatest=true;
|
||||
|
||||
}
|
||||
|
||||
@@ -169,6 +169,12 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<FileStorage>>> listBigFile(QueryBigFileReq queryBigFileReq) {
|
||||
List<FileStorage> list = getFileStorages(queryBigFileReq);
|
||||
PageInfo<FileStorage> page = new PageInfo<>(list);
|
||||
return PageUtils.getJsonObjectSdmResponse(list, page);
|
||||
}
|
||||
|
||||
private List<FileStorage> getFileStorages(QueryBigFileReq queryBigFileReq) {
|
||||
// 将前端传入的 fileSize 和 fileSizeUnit 转换为字节(B)
|
||||
Long fileSizeInBytes = null;
|
||||
if (queryBigFileReq.getFileSize() != null && queryBigFileReq.getFileSizeUnit() != null) {
|
||||
@@ -177,8 +183,7 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
|
||||
PageHelper.startPage(queryBigFileReq.getCurrent(), queryBigFileReq.getSize());
|
||||
List<FileStorage> list = fileStorageService.selectBigFiles(queryBigFileReq, fileSizeInBytes);
|
||||
PageInfo<FileStorage> page = new PageInfo<>(list);
|
||||
return PageUtils.getJsonObjectSdmResponse(list, page);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,32 +278,8 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
* */
|
||||
@Override
|
||||
public List<Long> getListBigFileId(QueryBigFileReq queryBigFileReq) {
|
||||
// 将前端传入的 fileSize 和 fileSizeUnit 转换为字节(B)
|
||||
Long fileSizeInBytes = null;
|
||||
if (queryBigFileReq.getFileSize() != null && queryBigFileReq.getFileSizeUnit() != null) {
|
||||
fileSizeInBytes = convertToBytes(queryBigFileReq.getFileSize(), queryBigFileReq.getFileSizeUnit());
|
||||
}
|
||||
List<Long> userIds = StringUtils.isBlank(queryBigFileReq.getUploadUserId())
|
||||
? new ArrayList<>()
|
||||
: Arrays.stream(queryBigFileReq.getUploadUserId().split(","))
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
List<Long> fileIds = fileStorageService.lambdaQuery()
|
||||
.select(FileStorage::getFileId)
|
||||
.eq(ObjectUtils.isNotEmpty(queryBigFileReq.getDirId()), FileStorage::getDirId, queryBigFileReq.getDirId())
|
||||
.eq(ObjectUtils.isNotEmpty(queryBigFileReq.getFileSuffix()), FileStorage::getFileSuffix, queryBigFileReq.getFileSuffix())
|
||||
.eq(ObjectUtils.isNotEmpty(queryBigFileReq.getFileBizType()), FileStorage::getFileBizType, queryBigFileReq.getFileBizType())
|
||||
.like(ObjectUtils.isNotEmpty(queryBigFileReq.getFileName()), FileStorage::getFileName, queryBigFileReq.getFileName())
|
||||
.gt(ObjectUtils.isNotEmpty(queryBigFileReq.getStartTime()), FileStorage::getCreateTime, queryBigFileReq.getStartTime())
|
||||
.lt(ObjectUtils.isNotEmpty(queryBigFileReq.getEndTime()), FileStorage::getCreateTime, queryBigFileReq.getEndTime())
|
||||
.gt(ObjectUtils.isNotEmpty(fileSizeInBytes), FileStorage::getFileSize, fileSizeInBytes)
|
||||
.in(org.apache.commons.collections4.CollectionUtils.isNotEmpty(userIds), FileStorage::getUserId, userIds)
|
||||
.list().stream()
|
||||
return getFileStorages(queryBigFileReq).stream()
|
||||
.map(FileStorage::getFileId)
|
||||
.collect(Collectors.toList());
|
||||
return fileIds ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -879,29 +879,31 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
fileMetadataInfo = fileMetadataInfoService.getById(minioFileSearchReq.getParentDirId());
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties(minioFileSearchReq, queryBigFileReq);
|
||||
if (ObjectUtils.isNotEmpty(fileMetadataInfo)) {
|
||||
queryBigFileReq.setDirId(fileMetadataInfo.getId());
|
||||
queryBigFileReq.setCurrent(minioFileSearchReq.getCurrent());
|
||||
queryBigFileReq.setSize(minioFileSearchReq.getSize());
|
||||
}
|
||||
BeanUtils.copyProperties(minioFileSearchReq, queryBigFileReq);
|
||||
// 这里是知识库文件:排除新增在审批的文件
|
||||
queryBigFileReq.setApproveTypeList(fileDatdList);
|
||||
queryBigFileReq.setIsLatest(true);
|
||||
|
||||
List<Long> creatorIds = org.apache.commons.lang3.StringUtils.isBlank(minioFileSearchReq.getUploadUserId())
|
||||
? new ArrayList<>()
|
||||
: Arrays.stream(minioFileSearchReq.getUploadUserId().split(","))
|
||||
.filter(org.apache.commons.lang3.StringUtils::isNotBlank)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
queryBigFileReq.setUploadUserId(creatorIds);
|
||||
|
||||
List<Long> fileIdList =dataStorageAnalysis.getListBigFileId(queryBigFileReq);
|
||||
if(CollectionUtils.isEmpty(fileIdList)){
|
||||
return SdmResponse.success();
|
||||
}
|
||||
// 可变查询条件
|
||||
List<Long> creatorIds = org.apache.commons.lang3.StringUtils.isBlank(queryBigFileReq.getUploadUserId())
|
||||
? new ArrayList<>()
|
||||
: Arrays.stream(queryBigFileReq.getUploadUserId().split(","))
|
||||
.filter(org.apache.commons.lang3.StringUtils::isNotBlank)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
PageHelper.startPage(minioFileSearchReq.getCurrent(), minioFileSearchReq.getSize());
|
||||
List<FileMetadataInfo> files = fileMetadataInfoService
|
||||
.lambdaQuery()
|
||||
.in(FileMetadataInfo::getId, fileIdList)
|
||||
.eq(FileMetadataInfo::getIsLatest, FileIsLastEnum.YES.getValue())
|
||||
// 这里是知识库文件:排除新增在审批的文件
|
||||
.in(FileMetadataInfo::getApproveType,fileDatdList)
|
||||
.in(org.apache.commons.collections4.CollectionUtils.isNotEmpty(creatorIds), FileMetadataInfo::getCreatorId, creatorIds)
|
||||
.list();
|
||||
setCreatorNames(files);
|
||||
setCidInfos(files);
|
||||
|
||||
@@ -105,26 +105,42 @@
|
||||
left join file_metadata_info on file_storage.fileId = file_metadata_info.id
|
||||
<where>
|
||||
file_metadata_info.id is not null
|
||||
and file_metadata_info.isLatest = #{queryBigFileReq.isLatest}
|
||||
<if test="queryBigFileReq.approveTypeList != null and queryBigFileReq.approveTypeList.size()>0">
|
||||
AND file_metadata_info.approveType IN
|
||||
<foreach collection="queryBigFileReq.approveTypeList" item="approveType" open="(" separator="," close=")">
|
||||
#{approveType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="queryBigFileReq.dirId != null">
|
||||
AND dirId = #{queryBigFileReq.dirId}
|
||||
AND file_storage.dirId = #{queryBigFileReq.dirId}
|
||||
</if>
|
||||
<if test="queryBigFileReq.fileSuffix != null and queryBigFileReq.fileSuffix != ''">
|
||||
AND fileSuffix = #{queryBigFileReq.fileSuffix}
|
||||
AND file_storage.fileSuffix = #{queryBigFileReq.fileSuffix}
|
||||
</if>
|
||||
<if test="queryBigFileReq.fileBizType != null">
|
||||
AND fileBizType = #{queryBigFileReq.fileBizType}
|
||||
<if test="queryBigFileReq.fileBizType != null and queryBigFileReq.fileBizType.size()>0">
|
||||
AND file_storage.fileBizType IN
|
||||
<foreach collection="queryBigFileReq.fileBizType" item="type" open="(" separator="," close=")">
|
||||
#{type}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="queryBigFileReq.fileName != null and queryBigFileReq.fileName != ''">
|
||||
AND fileName LIKE CONCAT('%', #{queryBigFileReq.fileName}, '%')
|
||||
AND file_storage.fileName LIKE CONCAT('%', #{queryBigFileReq.fileName}, '%')
|
||||
</if>
|
||||
<if test="queryBigFileReq.startTime != null">
|
||||
AND createTime >= #{queryBigFileReq.startTime}
|
||||
AND file_storage.createTime >= #{queryBigFileReq.startTime}
|
||||
</if>
|
||||
<if test="queryBigFileReq.endTime != null">
|
||||
AND createTime <= #{queryBigFileReq.endTime}
|
||||
AND file_storage.createTime <= #{queryBigFileReq.endTime}
|
||||
</if>
|
||||
<if test="fileSizeInBytes != null">
|
||||
AND fileSize > #{fileSizeInBytes}
|
||||
AND file_storage.fileSize > #{fileSizeInBytes}
|
||||
</if>
|
||||
<if test="queryBigFileReq.uploadUserId != null and queryBigFileReq.uploadUserId.size()>0">
|
||||
AND file_storage.userId IN
|
||||
<foreach collection="queryBigFileReq.uploadUserId" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -5,20 +5,20 @@
|
||||
},
|
||||
"flowElements": [
|
||||
{
|
||||
"id": "start",
|
||||
"id": "开始",
|
||||
"type": "startEvent",
|
||||
"name": "开始",
|
||||
"outgoingFlows": ["flow1"]
|
||||
},
|
||||
{
|
||||
"id": "task_localApp",
|
||||
"id": "本地应用操作",
|
||||
"type": "userTask",
|
||||
"name": "本地应用操作",
|
||||
"incomingFlows": ["flow1"],
|
||||
"outgoingFlows": ["flow2"]
|
||||
},
|
||||
{
|
||||
"id": "task_HPC",
|
||||
"id": "执行HPC任务",
|
||||
"type": "serviceTask",
|
||||
"name": "执行HPC任务",
|
||||
"incomingFlows": ["flow2"],
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "task_exportReport",
|
||||
"id": "生成报告脚本",
|
||||
"type": "serviceTask",
|
||||
"name": "生成报告脚本",
|
||||
"incomingFlows": ["flow3"],
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "end",
|
||||
"id": "结束",
|
||||
"type": "endEvent",
|
||||
"name": "结束",
|
||||
"incomingFlows": ["flow4"]
|
||||
@@ -51,26 +51,26 @@
|
||||
{
|
||||
"id": "flow1",
|
||||
"type": "sequenceFlow",
|
||||
"sourceRef": "start",
|
||||
"targetRef": "task_localApp"
|
||||
"sourceRef": "开始",
|
||||
"targetRef": "本地应用操作"
|
||||
},
|
||||
{
|
||||
"id": "flow2",
|
||||
"type": "sequenceFlow",
|
||||
"sourceRef": "task_localApp",
|
||||
"targetRef": "task_HPC"
|
||||
"sourceRef": "本地应用操作",
|
||||
"targetRef": "执行HPC任务"
|
||||
},
|
||||
{
|
||||
"id": "flow3",
|
||||
"type": "sequenceFlow",
|
||||
"sourceRef": "task_HPC",
|
||||
"targetRef": "task_exportReport"
|
||||
"sourceRef": "执行HPC任务",
|
||||
"targetRef": "生成报告脚本"
|
||||
},
|
||||
{
|
||||
"id": "flow4",
|
||||
"type": "sequenceFlow",
|
||||
"sourceRef": "task_exportReport",
|
||||
"targetRef": "end"
|
||||
"sourceRef": "生成报告脚本",
|
||||
"targetRef": "结束"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -145,8 +145,8 @@ public class ProcessController implements IFlowableFeignClient {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/continueServiceTask")
|
||||
public void continueServiceTask(@RequestBody CompleteTaskReq req) {
|
||||
processService.continueServiceTask(req);
|
||||
public SdmResponse continueServiceTask(@RequestBody CompleteTaskReq req) {
|
||||
return processService.continueServiceTask(req);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -337,7 +337,7 @@ public class ProcessService {
|
||||
|
||||
|
||||
|
||||
public void continueServiceTask(@RequestBody CompleteTaskReq req) {
|
||||
public SdmResponse continueServiceTask(@RequestBody CompleteTaskReq req) {
|
||||
log.info("开始继续服务任务处理, 请求参数: {}", req);
|
||||
|
||||
String taskDefKey;
|
||||
@@ -368,6 +368,8 @@ public class ProcessService {
|
||||
log.info("准备完成任务, 任务ID: {}, 变量数量: {}", task.getId(),
|
||||
req.getVariables() != null ? req.getVariables().size() : 0);
|
||||
|
||||
|
||||
try {
|
||||
// 完成任务
|
||||
if (req.getVariables() != null) {
|
||||
taskService.complete(task.getId(), req.getVariables());
|
||||
@@ -376,8 +378,13 @@ public class ProcessService {
|
||||
taskService.complete(task.getId());
|
||||
log.info("任务完成(无变量), 任务ID: {}", task.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("完成任务时发生错误, 任务ID: {}, 异常信息: {}", task.getId(), e.getMessage());
|
||||
throw new RuntimeException("完成任务时发生错误, 错误信息: " + e.getMessage());
|
||||
}
|
||||
|
||||
log.info("服务任务处理完成, 任务ID: {}", task.getId());
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
public void asyncCallback(AsyncCallbackRequest request) {
|
||||
|
||||
Reference in New Issue
Block a user