lyhzzz 1 year ago
parent
commit
34777b3cd0

+ 4 - 2
src/main/java/com/fdkankan/fusion/controller/CaseFilesController.java

@@ -17,6 +17,8 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.util.List;
 
 /**
@@ -55,7 +57,7 @@ public class CaseFilesController extends BaseController{
     public ResultData add(@RequestParam(required = false) MultipartFile file,
                           @RequestParam(required = false) Integer caseId ,
                           @RequestParam(required = false) Integer filesTypeId ,
-                          @RequestParam(required = false) String filesTitle ){
+                          @RequestParam(required = false) String filesTitle ) throws UnsupportedEncodingException {
         if(caseId == null || StringUtils.isEmpty(filesTitle)
                 || filesTypeId== null ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
@@ -66,7 +68,7 @@ public class CaseFilesController extends BaseController{
         caseFiles.setFilesTitle(filesTitle);
         caseFilesService.save(caseFiles);
         String url = uploadService.uploadFile(file, false, String.format(FilePath.File_OSS_PATH,environment,caseFiles.getFilesId() + "/"));
-        caseFiles.setFilesUrl(url);
+        caseFiles.setFilesUrl(URLEncoder.encode(url, "UTF-8"));
         caseFilesService.saveOrUpdate(caseFiles);
         //上传认定书,修改案例状态
         if(filesTypeId == 4){