feat:工作负载/项目上传文件
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
package com.sdm.common.entity.req.data;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.sdm.common.entity.enums.FileBizTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "文件上传请求参数")
|
||||
public class UploadFilesReq {
|
||||
|
||||
@Schema(description = "文件路径")
|
||||
private String path;
|
||||
|
||||
// 当前为第几分片
|
||||
@Schema(description = "当前为第几分片")
|
||||
private Integer chunk;
|
||||
|
||||
// 每个分块的大小
|
||||
@Schema(description = "每个分块的大小")
|
||||
private Long size;
|
||||
|
||||
// 分片总数
|
||||
@Schema(description = "分片总数")
|
||||
private Integer chunkTotal;
|
||||
|
||||
// 分块文件传输对象
|
||||
@Schema(description = "分块文件传输对象")
|
||||
@JSONField(serialize = false)
|
||||
private MultipartFile file;
|
||||
|
||||
@Schema(description = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
// 是否上传CAD数据文件,做权限控制,0 不是, 1是
|
||||
// private Integer isCAD = 0;
|
||||
|
||||
// 0相对路径,1绝对路径
|
||||
@Schema(description = "路径类型,0相对路径,1绝对路径", defaultValue = "0")
|
||||
private Integer type = 0;
|
||||
|
||||
// 是否加密
|
||||
@Schema(description = "是否加密", defaultValue = "false")
|
||||
private Boolean encrypt = false;
|
||||
|
||||
@Schema(description = "加密密钥")
|
||||
private String encryptKey;
|
||||
|
||||
@Schema(description = "文件夹id")
|
||||
private Long dirId;
|
||||
|
||||
@Schema(description = "节点id")
|
||||
private String uuid;
|
||||
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "文件类型 1:模型文件 2:仿真报告 3:计算文件 4:曲线文件 5:云图文件",implementation = FileBizTypeEnum.class)
|
||||
private Integer fileType;
|
||||
|
||||
/**
|
||||
* 关联项目id
|
||||
*/
|
||||
@Schema(description = "关联项目id")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 关联分析项目id
|
||||
*
|
||||
*/
|
||||
@Schema(description = "关联分析项目id")
|
||||
private String analysisDirectionId;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@Schema(description = "备注信息")
|
||||
private String remarks;
|
||||
|
||||
@Schema(description = "知识库文件审批模板id")
|
||||
private String templateId;
|
||||
|
||||
@Schema(description = "知识库文件审批模板名称")
|
||||
private String templateName;
|
||||
|
||||
/**
|
||||
* 扩展信息
|
||||
*/
|
||||
@Schema(description = "扩展信息")
|
||||
private List<FileMetadataExtensionRequest> fileMetadataExtensionRequest;
|
||||
|
||||
@Data
|
||||
public class FileMetadataExtensionRequest {
|
||||
/**
|
||||
* 扩展字段名
|
||||
*/
|
||||
@Schema(description = "扩展字段名")
|
||||
private String extensionKey;
|
||||
|
||||
/**
|
||||
* 扩展字段值
|
||||
*/
|
||||
@Schema(description = "扩展字段值")
|
||||
private String extensionValue;
|
||||
|
||||
/**
|
||||
* 值的数据类型(string, number, boolean, json等)
|
||||
*/
|
||||
@Schema(description = "值的数据类型(string, number, boolean, json等)")
|
||||
private String dataType;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.RenameDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
@@ -84,4 +85,17 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse uploadFiles(UploadFilesReq req) {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = dataClient.uploadFiles(req);
|
||||
log.info("上传文件响应:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return SdmResponse.failed("上传文件失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.RenameDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -35,4 +37,7 @@ public interface IDataFeignClient {
|
||||
@PostMapping("/data/approveDataFile")
|
||||
SdmResponse approveDataFile(@RequestBody LaunchApproveReq req);
|
||||
|
||||
@PostMapping(value = "/uploadSimulationNodeFiles",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
SdmResponse uploadFiles(UploadFilesReq req);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user