diff --git a/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/FileController.java b/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/FileController.java index 6a0cfdc..5e23b27 100644 --- a/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/FileController.java +++ b/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/FileController.java @@ -8,6 +8,7 @@ import com.wmyun.framework.common.pojo.PageResult; import com.wmyun.framework.common.util.object.BeanUtils; import com.wmyun.module.infra.controller.admin.file.vo.file.*; import com.wmyun.module.infra.dal.dataobject.file.FileDO; +import com.wmyun.module.infra.service.file.FilePreviewService; import com.wmyun.module.infra.service.file.FileService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -37,6 +38,9 @@ public class FileController { @Resource private FileService fileService; + @Resource + private FilePreviewService filePreviewService; + @PostMapping("/upload") @Operation(summary = "上传文件", description = "模式一:后端上传文件") public CommonResult uploadFile(FileUploadReqVO uploadReqVO) throws Exception { @@ -45,6 +49,14 @@ public class FileController { return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()))); } + @PostMapping("/upload-full") + @Operation(summary = "上传文件,返回完整文件信息", description = "后端上传文件") + public CommonResult uploadFileDO(FileUploadReqVO uploadReqVO) throws Exception { + MultipartFile file = uploadReqVO.getFile(); + String path = uploadReqVO.getPath(); + return success(fileService.createFileDO(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()))); + } + @GetMapping("/presigned-url") @Operation(summary = "获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器") public CommonResult getFilePresignedUrl(@RequestParam("path") String path) throws Exception { @@ -91,6 +103,16 @@ public class FileController { writeAttachment(response, path, content); } + @GetMapping("/download/{fileId}") + @PermitAll + @Operation(summary = "下载文件") + @Parameter(name = "configId", description = "配置编号", required = true) + public void downloadFile(HttpServletResponse response, @PathVariable String fileId) { + if (!StrUtil.isEmpty(fileId)) { + filePreviewService.getFileContent(fileId, response); + } + } + @GetMapping("/page") @Operation(summary = "获得文件分页") @PreAuthorize("@ss.hasPermission('infra:file:query')") diff --git a/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/vo/preview/CheckFileInfoVo.java b/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/vo/preview/CheckFileInfoVo.java index 4f72290..f6efc15 100644 --- a/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/vo/preview/CheckFileInfoVo.java +++ b/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/controller/admin/file/vo/preview/CheckFileInfoVo.java @@ -101,4 +101,8 @@ public class CheckFileInfoVo { @Schema(description = "HOST地址") @JsonProperty("HostEditUrl") private String hostEditUrl; + + @Schema(description = "PostMessageOrigin") + @JsonProperty("PostMessageOrigin") + private String postMessageOrigin; } diff --git a/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/service/file/FilePreviewServiceImpl.java b/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/service/file/FilePreviewServiceImpl.java index dab7166..69af282 100644 --- a/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/service/file/FilePreviewServiceImpl.java +++ b/wmyun-module-infra/wmyun-module-infra-biz/src/main/java/com/wmyun/module/infra/service/file/FilePreviewServiceImpl.java @@ -76,6 +76,7 @@ public class FilePreviewServiceImpl implements FilePreviewService { .fileUrl(file.getUrl()) .hostViewUrl(hostUrl) .hostEditUrl(hostUrl) + .postMessageOrigin("http://localhost") .build(); } diff --git a/wmyun-module-shipping/wmyun-module-shipping-biz/src/main/java/com/wmyun/module/shipping/service/YunDangAuthServiceImpl.java b/wmyun-module-shipping/wmyun-module-shipping-biz/src/main/java/com/wmyun/module/shipping/service/YunDangAuthServiceImpl.java index 230c125..738ab8d 100644 --- a/wmyun-module-shipping/wmyun-module-shipping-biz/src/main/java/com/wmyun/module/shipping/service/YunDangAuthServiceImpl.java +++ b/wmyun-module-shipping/wmyun-module-shipping-biz/src/main/java/com/wmyun/module/shipping/service/YunDangAuthServiceImpl.java @@ -3,18 +3,12 @@ package com.wmyun.module.shipping.service; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Maps; import com.wmyun.module.shipping.exception.ShippingException; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.ArrayUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.annotation.Cacheable; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import java.util.Map; - /** * @Description: 获取云当网访问token * @Date: 2025/3/10 15:04