add(req-2119):下载接口API-调试5

This commit is contained in:
胡朝飞 2024-03-07 16:59:52 +08:00
parent e303b86532
commit 0d57dc75f9
3 changed files with 35 additions and 8 deletions

View File

@ -18,6 +18,7 @@ import cn.axzo.oss.manager.api.dto.response.*;
import cn.axzo.oss.service.api.FileService;
import cn.azxo.framework.common.model.CommonResponse;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -39,6 +40,7 @@ import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
**/
@RestController
@RequestMapping("/webApi")
@Slf4j
public class WebFileController {
private static int FILE_NAME_MAX_LENGTH = 128;
@ -327,4 +329,10 @@ public class WebFileController {
e.printStackTrace();
}
}
@GetMapping("/v1/obs/test")
public CommonResponse<String> test() {
log.info("test");
return CommonResponse.success("success");
}
}

View File

@ -0,0 +1,27 @@
package cn.axzo.oss.http.api;
import cn.axzo.oss.http.model.DownloadFileFromObsRequest;
import cn.azxo.framework.common.model.CommonResponse;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.validation.Valid;
/**
* @author axzo
* @since 2024/3/7 16:56
**/
@FeignClient(
name = "oss",
url = "http://oss:9123"
)
public interface DownloadFileApi {
@RequestMapping("/webApi/v1/obs/downloadFileFromObs")
CommonResponse<Response> downloadFileFromObs(@Valid @RequestBody DownloadFileFromObsRequest req);
@GetMapping("/v1/obs/test")
CommonResponse<String> test();
}

View File

@ -1,14 +1,9 @@
package cn.axzo.oss.http.api;
import cn.axzo.oss.http.model.DownloadFileFromObsRequest;
import cn.axzo.oss.http.model.WebFileUploadVo;
import cn.azxo.framework.common.model.CommonResponse;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
@ -38,7 +33,4 @@ public interface WebFileServiceApi {
CommonResponse<WebFileUploadVo> uploadObs(@Valid @RequestParam("appCode") String appCode,
@Valid @RequestParam("bizScene") String bizScene,
@Valid @RequestPart MultipartFile file);
@RequestMapping("/webApi/v1/obs/downloadFileFromObs")
CommonResponse<Response> downloadFileFromObs(@Valid @RequestBody DownloadFileFromObsRequest req);
}