mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、新增组件订单数据拉取接口;2、新增上传url产生文件数据/根据文件id获取文件地址接口;
This commit is contained in:
+32
@@ -2,6 +2,7 @@ package com.cf.imes.module.infra.api.file;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
|
||||
import com.cf.imes.module.infra.api.file.dto.ExternalFileCreateReqDTO;
|
||||
import com.cf.imes.module.infra.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@@ -102,4 +104,34 @@ public interface FileApi {
|
||||
@PostMapping(PREFIX + "/getFileHashByIds")
|
||||
@Operation(summary = "根据文件id请求和fileHash的对应关系")
|
||||
CommonResult<Map<Long, String>> getFileHashMapByIds(@RequestBody Set<Long> fileIds);
|
||||
|
||||
/**
|
||||
* 登记一个已由外部系统托管的文件地址,不上传或复制文件内容。
|
||||
*
|
||||
* @param createReqDTO 外部文件名称及访问地址
|
||||
* @return iMES 文件记录 ID
|
||||
*/
|
||||
@PostMapping(PREFIX + "/external")
|
||||
@Operation(summary = "登记外部文件地址并返回文件 ID")
|
||||
CommonResult<Long> createExternalFile(@Valid @RequestBody ExternalFileCreateReqDTO createReqDTO);
|
||||
|
||||
/**
|
||||
* 根据 iMES 文件记录 ID 获取外部文件地址。
|
||||
*
|
||||
* @param id iMES 文件记录 ID
|
||||
* @return 外部文件地址
|
||||
*/
|
||||
@GetMapping(PREFIX + "/external/{id}/url")
|
||||
@Operation(summary = "根据文件 ID 获取外部文件地址")
|
||||
CommonResult<String> getExternalFileUrl(@PathVariable("id") Long id);
|
||||
|
||||
/**
|
||||
* 删除外部文件在 iMES 中的登记记录,不删除外部存储中的实际文件。
|
||||
*
|
||||
* @param id iMES 文件记录 ID
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@DeleteMapping(PREFIX + "/external/{id}")
|
||||
@Operation(summary = "仅删除外部文件登记记录")
|
||||
CommonResult<Boolean> deleteExternalFileRecord(@PathVariable("id") Long id);
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.infra.api.file.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 外部文件地址登记请求。
|
||||
*
|
||||
* <p>仅保存文件元数据和访问地址,不读取、校验或上传地址对应的文件内容。</p>
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 外部文件地址登记 Request DTO")
|
||||
@Data
|
||||
public class ExternalFileCreateReqDTO {
|
||||
|
||||
/**
|
||||
* 展示用文件名称;为空时由服务端使用 URL 代替。
|
||||
*/
|
||||
@Schema(description = "文件名称", example = "cad-view-26072801000449.json")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 外部存储中的文件访问地址。
|
||||
*/
|
||||
@Schema(description = "外部文件地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "外部文件地址不能为空")
|
||||
private String url;
|
||||
}
|
||||
Reference in New Issue
Block a user