吉安感知网项目-后端
linwei
2026-07-08 79c2d5fa54ca680f5fc439b3607d7f0482a2ff32
drone-ops/drone-resource/src/main/java/org/sxkj/resource/endpoint/OssEndpoint.java
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@@ -143,7 +144,7 @@
    @PostMapping("/put-file")
    @ApiOperation(value = "上传文件", notes = "上传文件")
    public R<BladeFile> putFile(@RequestParam MultipartFile file) {
        BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
        BladeFile bladeFile = ossBuilder.template("estack").putFile(file.getOriginalFilename(), file.getInputStream());
        return R.data(bladeFile);
    }
@@ -188,7 +189,7 @@
    @PostMapping("/put-file-attach-by-name")
    @ApiOperation(value = "上传文件并保存至附件表", notes = "上传文件并保存至附件表-存储桶对象名称")
    public R<BladeFile> putFileAttach(@RequestParam String fileName,
                                      @RequestParam Integer resultType,
                                      @RequestParam List<List<String>> resultType,
                                      @RequestParam MultipartFile file) {
        BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
        Long attachId = buildAttach(fileName, resultType, file.getSize(), bladeFile);
@@ -223,7 +224,7 @@
    @NotNull
    private BladeFile getBladeFile(@RequestParam MultipartFile file) throws IOException {
        String fileName = file.getOriginalFilename();
        BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
        BladeFile bladeFile = ossBuilder.template("estack").putFile(fileName, file.getInputStream());
        Long attachId = buildAttach(fileName, null, file.getSize(), bladeFile);
        bladeFile.setAttachId(attachId);
        return bladeFile;
@@ -237,7 +238,7 @@
     * @param bladeFile 对象存储文件
     * @return attachId
     */
    private Long buildAttach(String fileName, Integer resultType, Long fileSize, BladeFile bladeFile) {
    private Long buildAttach(String fileName, List<List<String>> resultType, Long fileSize, BladeFile bladeFile) {
        String fileExtension = FileUtil.getFileExtension(fileName);
        Attach attach = new Attach();
        attach.setDomainUrl(bladeFile.getDomain());