|
@@ -2,11 +2,13 @@ package com.example.controller.user;
|
|
|
|
|
|
import com.example.constant.MessageConstant;
|
|
|
import com.example.result.Result;
|
|
|
+import com.example.service.CommonService;
|
|
|
import com.example.utils.AliOssUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -27,6 +29,10 @@ public class CommonController {
|
|
|
@Autowired
|
|
|
private AliOssUtil aliOssUtil;
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+
|
|
|
/*
|
|
|
文件上传
|
|
|
*/
|
|
@@ -49,4 +55,11 @@ public class CommonController {
|
|
|
}
|
|
|
return Result.error(MessageConstant.UPLOAD_FAILED);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/download")
|
|
|
+ public Result<String> getUrl(Long id,Integer status){
|
|
|
+ log.info("下载指定文件:id,{},status,{}",id,status);
|
|
|
+ String url = commonService.getUrl(id,status);
|
|
|
+ return Result.success(url);
|
|
|
+ }
|
|
|
}
|