更新了写真预约特殊产品处理

This commit is contained in:
chen-xin-zhi 2025-03-07 13:56:35 +08:00
parent 70c5284a71
commit 074f4fd742

View File

@ -11,6 +11,7 @@ import com.cultural.heritage.model.entity.User;
import com.cultural.heritage.model.enums.FileUploadBizEnum;
import com.cultural.heritage.service.file.IHweiYunOBSService;
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.tags.Tag;
import jakarta.annotation.Resource;
@ -25,6 +26,8 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/file")
@ -143,7 +146,7 @@ public class FileController {
@PostMapping("/upload/only")
@Operation(summary = "单独文件上传(只返回url)", description = "参数file文件对象multipartFile)权限所有人方法名uploadServerFile")
public String uploadOnlyServerFile(@RequestPart("file")MultipartFile multipartFile, HttpServletRequest request) {
public Object uploadOnlyServerFile(@RequestPart("file")MultipartFile multipartFile, HttpServletRequest request) {
//
// 校验文件
validFile(multipartFile, null);
@ -162,7 +165,12 @@ public class FileController {
}
}
//返回可访问地址
return iHweiYunOBSService.fileUpload(multipartFile, "feiyi" + filepath);
String url = iHweiYunOBSService.fileUpload(multipartFile, "feiyi" + filepath);
Map<String, String> map = new HashMap<>();
map.put("url", url);
Gson gson = new Gson();
Object obj = gson.fromJson(gson.toJson(map), Object.class);
return obj;
}