fix:其他交付物文件上传创建文件夹和查询
This commit is contained in:
@@ -8,111 +8,126 @@ public enum FileBizTypeEnum {
|
||||
* 模型文件
|
||||
*/
|
||||
@Schema(description = "模型文件", example = "1")
|
||||
MODEL_FILE(1),
|
||||
MODEL_FILE(1, "模型文件"),
|
||||
|
||||
/**
|
||||
* 仿真报告
|
||||
*/
|
||||
@Schema(description = "仿真报告", example = "2")
|
||||
REPORT_FILE(2),
|
||||
REPORT_FILE(2, "仿真报告"),
|
||||
|
||||
/**
|
||||
* 计算文件
|
||||
*/
|
||||
@Schema(description = "计算文件", example = "3")
|
||||
COMPUTE_FILE(3),
|
||||
@Schema(description = "计算模型", example = "3")
|
||||
COMPUTE_FILE(3, "计算模型"),
|
||||
|
||||
/**
|
||||
* 曲线文件
|
||||
*/
|
||||
@Schema(description = "曲线文件", example = "4")
|
||||
CURVE_FILE(4),
|
||||
CURVE_FILE(4, "曲线文件"),
|
||||
/**
|
||||
* 云图文件
|
||||
*/
|
||||
@Schema(description = "云图文件", example = "5")
|
||||
CLOUD_FILE(5),
|
||||
CLOUD_FILE(5, "云图文件"),
|
||||
|
||||
/**
|
||||
* 流程脚本
|
||||
*/
|
||||
@Schema(description = "流程脚本", example = "6")
|
||||
FLOW_SCRIPT_FILE(6),
|
||||
FLOW_SCRIPT_FILE(6, "流程脚本"),
|
||||
|
||||
/**
|
||||
* 需求附件
|
||||
*/
|
||||
@Schema(description = "需求附件", example = "7")
|
||||
PROJECT_DEMAND_FILE(7),
|
||||
PROJECT_DEMAND_FILE(7, "需求附件"),
|
||||
|
||||
/**
|
||||
* 会议纪要-项目
|
||||
*/
|
||||
@Schema(description = "会议纪要-项目", example = "8")
|
||||
PROJECT_MEETING_FILE(8),
|
||||
PROJECT_MEETING_FILE(8, "会议纪要-项目"),
|
||||
|
||||
/**
|
||||
* 知识文件-项目
|
||||
*/
|
||||
@Schema(description = "知识文件-项目", example = "9")
|
||||
PROJECT_KNOWLEDGE_FILE(9),
|
||||
PROJECT_KNOWLEDGE_FILE(9, "知识文件-项目"),
|
||||
|
||||
/**
|
||||
* 附件-项目
|
||||
*/
|
||||
@Schema(description = "附件-项目", example = "10")
|
||||
PROJECT_ATTACHMENT_FILE(10),
|
||||
PROJECT_ATTACHMENT_FILE(10, "附件-项目"),
|
||||
|
||||
|
||||
/**
|
||||
* 交付物文件
|
||||
*/
|
||||
@Schema(description = "交付物文件", example = "11")
|
||||
DELIVERABLE_FILE(11),
|
||||
DELIVERABLE_FILE(11, "交付物文件"),
|
||||
|
||||
/**
|
||||
* 试验结果文件
|
||||
*/
|
||||
@Schema(description = "试验结果文件", example = "12")
|
||||
EXPERIMENT_FILE(12),
|
||||
@Schema(description = "试验结果", example = "12")
|
||||
EXPERIMENT_FILE(12, "试验结果"),
|
||||
|
||||
/**
|
||||
* 3D模型
|
||||
*/
|
||||
@Schema(description = "3D模型", example = "13")
|
||||
MODEL_3D_FILE(13),
|
||||
MODEL_3D_FILE(13, "3D模型"),
|
||||
|
||||
/**
|
||||
* 试验数据闭环报告
|
||||
*/
|
||||
@Schema(description = "试验数据闭环报告", example = "14")
|
||||
EXPERIMENT_CLOSING_REPORT_FILE(14),
|
||||
EXPERIMENT_CLOSING_REPORT_FILE(14, "试验数据闭环报告"),
|
||||
|
||||
/**
|
||||
* 复盘报告
|
||||
*/
|
||||
@Schema(description = "复盘报告", example = "15")
|
||||
REVIEW_REPORT_FILE(15),
|
||||
REVIEW_REPORT_FILE(15, "复盘报告"),
|
||||
|
||||
/**
|
||||
* 项目文件
|
||||
*/
|
||||
@Schema(description = "项目 文件", example = "101")
|
||||
PROJECT_FILE(101),
|
||||
PROJECT_FILE(101, "项目 文件"),
|
||||
|
||||
/**
|
||||
* 学科文件
|
||||
*/
|
||||
@Schema(description = "学科 文件", example = "102")
|
||||
DISCIPLINE_MAJOR_FILE(102);
|
||||
DISCIPLINE_MAJOR_FILE(102, "学科 文件");
|
||||
|
||||
int value;
|
||||
String dirName;
|
||||
|
||||
FileBizTypeEnum(int i) {
|
||||
value = i;
|
||||
FileBizTypeEnum(int value, String dirName) {
|
||||
this.value = value;
|
||||
this.dirName = dirName;
|
||||
}
|
||||
|
||||
public String getDirName() {
|
||||
return dirName;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String getDirNameByValue(int value) {
|
||||
for (FileBizTypeEnum fileBizTypeEnum : values()) {
|
||||
if (fileBizTypeEnum.value == value) {
|
||||
return fileBizTypeEnum.getDirName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.constants.CommonConstants;
|
||||
import com.sdm.common.entity.enums.FileBizTypeEnum;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.export.FileAnalysisExportExcelFormat;
|
||||
import com.sdm.common.entity.req.export.FileAnalysisExportExcelParam;
|
||||
@@ -111,20 +113,27 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
|
||||
}
|
||||
|
||||
private SdmResponse<PageDataResp<List<SimulationTaskResultCurveResp>>> getTaskLevelFile(GetSimulationTaskFileReq req, QueryBigFileReq queryBigFileReq) {
|
||||
// level=task,查task下的交付物文件夹 再根据fileType查具体的云图文件、曲线文件夹下的文件
|
||||
List<FileMetadataInfo> deliverableFileInfoList = fileMetadataInfoService.lambdaQuery()
|
||||
.eq(FileMetadataInfo::getParentId, queryBigFileReq.getDirId())
|
||||
.eq(FileMetadataInfo::getOriginalName, CommonConstants.DELIVERABLE_DIR_NAME)
|
||||
.eq(FileMetadataInfo::getTenantId, ThreadLocalContext.getTenantId())
|
||||
.list();
|
||||
if (CollectionUtils.isNotEmpty(deliverableFileInfoList)) {
|
||||
// 交付物文件夹id
|
||||
Long deliverableDirId = deliverableFileInfoList.get(0).getId();
|
||||
// 云图/曲线/文件夹名称
|
||||
String secondDirName = FileBizTypeEnum.getDirNameByValue(req.getFileBizType());
|
||||
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<FileMetadataInfo> fileMetadataInfoList = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getParentId, queryBigFileReq.getDirId())
|
||||
.eq(FileMetadataInfo::getFileType, req.getFileBizType())
|
||||
List<FileMetadataInfo> fileMetadataInfoList = fileMetadataInfoService.lambdaQuery()
|
||||
.eq(FileMetadataInfo::getParentId, deliverableDirId)
|
||||
.eq(FileMetadataInfo::getOriginalName, secondDirName)
|
||||
.eq(FileMetadataInfo::getTenantId, ThreadLocalContext.getTenantId())
|
||||
.list();
|
||||
PageInfo<FileMetadataInfo> page = new PageInfo<>(fileMetadataInfoList);
|
||||
long total = page.getTotal();
|
||||
|
||||
// List<SimulationTaskResultCurveResp> resultCurveRespList = fileMetadataInfoList.stream().map(i -> {
|
||||
// SimulationTaskResultCurveResp resultCurveResp = new SimulationTaskResultCurveResp();
|
||||
// BeanUtils.copyProperties(i,resultCurveResp);
|
||||
// resultCurveResp.setFormatFileSize(FileSizeUtils.formatFileSize(BigDecimal.valueOf(i.getFileSize())));
|
||||
// return resultCurveResp;
|
||||
// }).toList();
|
||||
List<Long> fileIdList = fileMetadataInfoList.stream().map(FileMetadataInfo::getId).toList();
|
||||
List<SimulationTaskResultCurveResp> finalResultList = hierarchyHelper.processFileHierarchy(
|
||||
fileIdList,
|
||||
@@ -136,6 +145,27 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
|
||||
page1.setTotal(total);
|
||||
return PageUtils.getJsonObjectSdmResponse(finalResultList, page1);
|
||||
}
|
||||
return PageUtils.getJsonObjectSdmResponse(new ArrayList<>(), new PageInfo<>());
|
||||
|
||||
// PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
// List<FileMetadataInfo> fileMetadataInfoList = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getParentId, queryBigFileReq.getDirId())
|
||||
// .eq(FileMetadataInfo::getFileType, req.getFileBizType())
|
||||
// .eq(FileMetadataInfo::getTenantId, ThreadLocalContext.getTenantId())
|
||||
// .list();
|
||||
// PageInfo<FileMetadataInfo> page = new PageInfo<>(fileMetadataInfoList);
|
||||
// long total = page.getTotal();
|
||||
//
|
||||
// List<Long> fileIdList = fileMetadataInfoList.stream().map(FileMetadataInfo::getId).toList();
|
||||
// List<SimulationTaskResultCurveResp> finalResultList = hierarchyHelper.processFileHierarchy(
|
||||
// fileIdList,
|
||||
// SimulationTaskResultCurveResp.class,
|
||||
// FileMetadataHierarchyHelper::setFileHierarchy
|
||||
// );
|
||||
//
|
||||
// PageInfo<SimulationTaskResultCurveResp> page1 = new PageInfo<>(finalResultList);
|
||||
// page1.setTotal(total);
|
||||
// return PageUtils.getJsonObjectSdmResponse(finalResultList, page1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getCSVData(List<Long> fileIds) {
|
||||
|
||||
@@ -405,4 +405,10 @@ public class SimulationRunController implements ISimulationRunFeignClient {
|
||||
return runService.updateStatusByProcessInstanceId(processInstanceId, statusCode);
|
||||
}
|
||||
|
||||
@PostMapping("/batchAddFileInfoForTask")
|
||||
@Operation(summary = "文件分片上传批量入库")
|
||||
public SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfoForTask(@RequestBody UploadFilesReq req) {
|
||||
return runService.batchAddFileInfoForTask(req);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,4 +119,5 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
*/
|
||||
SdmResponse updateStatusByProcessInstanceId(String processInstanceId, Integer statusCode);
|
||||
|
||||
SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfoForTask(UploadFilesReq req);
|
||||
}
|
||||
@@ -2108,7 +2108,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(req.getFileInfoList())) {
|
||||
// 试验结果文件不直接放在task下面,要放在task的交付物文件夹的试验结果文件夹下面
|
||||
Long parentId = getParentDirId(req.getTaskId());
|
||||
Long parentId = getParentDirId(req.getTaskId(), CommonConstants.EXPERIMENT_DIR_NAME);
|
||||
|
||||
UploadFilesReq filesReq = new UploadFilesReq();
|
||||
BeanUtils.copyProperties(req, filesReq);
|
||||
@@ -2133,7 +2133,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return SdmResponse.success(experimentResult.getUuid());
|
||||
}
|
||||
|
||||
private Long getParentDirId(String taskId) {
|
||||
private Long getParentDirId(String taskId, String dirName) {
|
||||
Long parentId = null;
|
||||
QueryDirReq queryDirReq = new QueryDirReq();
|
||||
queryDirReq.setUuid(taskId);
|
||||
@@ -2149,14 +2149,14 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
// 再查是否建过试验结果文件夹,没有则新建
|
||||
queryDirReq.setUuid(null);
|
||||
queryDirReq.setFileId(parentDirId);
|
||||
queryDirReq.setFileName(CommonConstants.EXPERIMENT_DIR_NAME);
|
||||
queryDirReq.setFileName(dirName);
|
||||
SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> expResponse = dataFeignClient.queryDir(queryDirReq);
|
||||
if (expResponse.getData() != null && CollectionUtils.isNotEmpty(expResponse.getData().getData())) {
|
||||
FileMetadataInfoResp expFileMetadataInfo = expResponse.getData().getData().get(0);
|
||||
parentId = expFileMetadataInfo.getId();
|
||||
} else {
|
||||
// 再建试验结果文件夹
|
||||
SdmResponse expResultResponse = createDir(null, parentDirId, CommonConstants.EXPERIMENT_DIR_NAME, DirTypeEnum.PROJECT_NODE_DIR.getValue(), null);
|
||||
SdmResponse expResultResponse = createDir(null, parentDirId, dirName, DirTypeEnum.PROJECT_NODE_DIR.getValue(), null);
|
||||
parentId = Long.parseLong(expResultResponse.getData().toString());
|
||||
}
|
||||
} else {
|
||||
@@ -2164,7 +2164,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
SdmResponse deliverableDirResponse = createDir(null, taskId, CommonConstants.DELIVERABLE_DIR_NAME, DirTypeEnum.PROJECT_NODE_DIR.getValue(), null);
|
||||
Long parentDirId = Long.parseLong(deliverableDirResponse.getData().toString());
|
||||
// 再建试验结果文件夹
|
||||
SdmResponse expResultResponse = createDir(null, parentDirId, CommonConstants.EXPERIMENT_DIR_NAME, DirTypeEnum.PROJECT_NODE_DIR.getValue(), null);
|
||||
SdmResponse expResultResponse = createDir(null, parentDirId, dirName, DirTypeEnum.PROJECT_NODE_DIR.getValue(), null);
|
||||
parentId = Long.parseLong(expResultResponse.getData().toString());
|
||||
}
|
||||
return parentId;
|
||||
@@ -2261,7 +2261,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
|
||||
// 再处理新增的文件
|
||||
if (CollectionUtils.size(req.getAddFileInfoList()) > 0) {
|
||||
Long parentId = getParentDirId(req.getTaskId());
|
||||
Long parentId = getParentDirId(req.getTaskId(), CommonConstants.EXPERIMENT_DIR_NAME);
|
||||
|
||||
UploadFilesReq filesReq = new UploadFilesReq();
|
||||
BeanUtils.copyProperties(req, filesReq);
|
||||
@@ -2459,4 +2459,14 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return SdmResponse.failed("更新状态异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfoForTask(UploadFilesReq req) {
|
||||
// 3D模型、计算模型、图片文件、曲线文件、仿真报告 获取文件夹名
|
||||
String dirName = FileBizTypeEnum.getDirNameByValue(req.getFileType());
|
||||
// 获取文件夹id
|
||||
Long parentId = getParentDirId(req.getUuid(), dirName);
|
||||
req.setDirId(parentId);
|
||||
return dataFeignClient.batchAddFileInfo(req);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ public class GroupQueryReq extends BaseReq {
|
||||
@Schema(description = "用户组名称")
|
||||
private String groupName;
|
||||
|
||||
@Schema(description = "用户组编码")
|
||||
private String groupCode;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
Reference in New Issue
Block a user