lyhzzz 2 ヶ月 前
コミット
13710efe4c

+ 1 - 1
src/main/java/com/fdkankan/fusion/down/CaseDownService.java

@@ -520,7 +520,7 @@ public class CaseDownService {
         for (Object object : jsonArray) {
             String res = (String) object;
             log.info("下载模型:{}",res);
-            if(res.contains(".json") || res.contains(".shp") || res.contains(".obj")){
+            if(res.contains(".json")  || res.contains(".obj")){
                 res = new File(res).getParentFile().getPath();
             }
             localToOssUtil.downForm(res,path+queryPath+res);

+ 12 - 0
src/main/java/com/fdkankan/fusion/exception/GlobalExceptionHandler.java

@@ -1,8 +1,10 @@
 package com.fdkankan.fusion.exception;
 
+import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.common.ResultData;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.tomcat.util.http.fileupload.impl.IOFileUploadException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
@@ -33,4 +35,14 @@ public class GlobalExceptionHandler {
         log.info("业务异常code:{},message:{}", e.getCode(), e.getMessage());
         return ResultData.error(e.getCode(), e.getMessage());
     }
+
+    /**
+     * 处理未知异常
+     */
+    @ResponseBody
+    @ExceptionHandler(value = IOFileUploadException.class)
+    public ResultData iOFileUploadExceptionExceptionHandler(IOFileUploadException e)  {
+        log.info("IOFileUploadException:", e);
+        return ResultData.error( ResultCode.USE_SPACE_ERROR);
+    }
 }

+ 4 - 0
src/main/java/com/fdkankan/fusion/service/impl/CommonUploadServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -94,6 +95,9 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         }catch ( BusinessException e){
             log.info("upload-file-error:{}",e);
             throw e;
+        }catch (IOException e){
+            log.info("upload-file-IOException:{}",e);
+            throw new BusinessException(ResultCode.SPACE_ERROR);
         }catch (Exception e){
             log.info("upload-file-error:{}",e);
             throw new BusinessException(ResultCode.UPLOAD_ERROR);