更新了写真预约特殊产品处理
This commit is contained in:
parent
6c916c9c43
commit
b6386a8c9e
|
@ -11,6 +11,7 @@ import com.cultural.heritage.model.entity.User;
|
||||||
import com.cultural.heritage.model.enums.FileUploadBizEnum;
|
import com.cultural.heritage.model.enums.FileUploadBizEnum;
|
||||||
import com.cultural.heritage.service.file.IHweiYunOBSService;
|
import com.cultural.heritage.service.file.IHweiYunOBSService;
|
||||||
import com.cultural.heritage.service.user.UserService;
|
import com.cultural.heritage.service.user.UserService;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -25,6 +26,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/file")
|
@RequestMapping("/file")
|
||||||
|
@ -117,7 +120,7 @@ public class FileController {
|
||||||
|
|
||||||
@PostMapping("/upload/single")
|
@PostMapping("/upload/single")
|
||||||
@Operation(summary = "单独文件上传", description = "参数:file,文件对象(multipartFile),权限:所有人,方法名:uploadServerFile")
|
@Operation(summary = "单独文件上传", description = "参数:file,文件对象(multipartFile),权限:所有人,方法名:uploadServerFile")
|
||||||
public BaseResponse<String> uploadSingleServerFile(@RequestPart("file")MultipartFile multipartFile, HttpServletRequest request) {
|
public Object uploadSingleServerFile(@RequestPart("file")MultipartFile multipartFile, HttpServletRequest request) {
|
||||||
//
|
//
|
||||||
// 校验文件
|
// 校验文件
|
||||||
validFile(multipartFile, null);
|
validFile(multipartFile, null);
|
||||||
|
@ -137,7 +140,17 @@ public class FileController {
|
||||||
}
|
}
|
||||||
//返回可访问地址
|
//返回可访问地址
|
||||||
String url = iHweiYunOBSService.fileUpload(multipartFile, "feiyi" + filepath);
|
String url = iHweiYunOBSService.fileUpload(multipartFile, "feiyi" + filepath);
|
||||||
return ResultUtils.success(url);
|
|
||||||
|
Map<String, String> data = new HashMap<>();
|
||||||
|
data.put("url", url);
|
||||||
|
|
||||||
|
// 创建最终的响应对象
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("errno", 0);
|
||||||
|
response.put("data", data);
|
||||||
|
Gson gson = new Gson();
|
||||||
|
|
||||||
|
return gson.fromJson(gson.toJson(response), Object.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user