Browse Source

更新文档异常说明

陈长荣 3 tháng trước cách đây
mục cha
commit
bf9280e9df

+ 1 - 1
src/main/java/com/github/jfcloud/excel/editor/docdeal/bean/DocumentResponse.java

@@ -56,7 +56,7 @@ public class DocumentResponse<T> implements Serializable {
         return dr.code(ErrorCodeEnum.SUCCESS.getCode()).msg(ErrorCodeEnum.SUCCESS.getMsg()).dataList(dataList);
     }
 
-    public static DocumentResponse failue(ErrorCodeEnum errorCodeEnum) {
+    public static DocumentResponse failure(ErrorCodeEnum errorCodeEnum) {
         DocumentResponse dr = new DocumentResponse<>();
         return dr.code(errorCodeEnum.getCode()).msg(errorCodeEnum.getMsg());
     }

+ 5 - 11
src/main/java/com/github/jfcloud/excel/editor/docdeal/config/LogAspect.java

@@ -1,25 +1,19 @@
 package com.github.jfcloud.excel.editor.docdeal.config;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.*;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.springframework.beans.factory.annotation.Value;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
 import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.Objects;
-import java.util.concurrent.TimeUnit;
 
 /**
  * 接口日志切面配置
@@ -36,7 +30,7 @@ public class LogAspect {
     /**
      * 操作版本号
      */
-    private final String operVer ="ONLY.12";
+    private final String operVer = "ONLY OFFICE 7.3.2.0";
 
     /**
      * 设置web日志切入点

+ 1 - 1
src/main/java/com/github/jfcloud/excel/editor/docdeal/controller/FileController.java

@@ -112,7 +112,7 @@ public class FileController {
         try {
             if (size < 0) {
                 log.error("文档不存在 name={}, bucket={}", name, bucket);
-                response.getWriter().println("文档 " + name + " 不存在");
+                response.getWriter().println("Sorry, we cannot find the file, pls check the file name and try again.");
                 return;
             }
 

+ 5 - 3
src/main/java/com/github/jfcloud/excel/editor/docdeal/exception/WebExceptionHandler.java

@@ -16,18 +16,20 @@ public class WebExceptionHandler {
     @ExceptionHandler(DocumentException.class)
     public DocumentResponse<?> documentException(DocumentException e) {
         log.error("$$$ 文档异常~~", e);
-        return DocumentResponse.failue(e.getErrorCode());
+        return DocumentResponse.failure(e.getErrorCode());
    }
 
     @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
     public DocumentResponse<?> requestException(HttpRequestMethodNotSupportedException e) {
         log.error("$$$ 不支持的请求类型~~", e);
-        return DocumentResponse.failue(ErrorCodeEnum.UNSUPPORTED_REQUEST_METHOD);
+        return DocumentResponse.failure(ErrorCodeEnum.UNSUPPORTED_REQUEST_METHOD);
     }
 
     @ExceptionHandler(Exception.class)
     public DocumentResponse<?> unknownException(Exception e) {
         log.error("$$$ 未知异常~~", e);
-        return DocumentResponse.failue(ErrorCodeEnum.SYSTEM_UNKNOWN_ERROR);
+        DocumentResponse<String> failure = DocumentResponse.failure(ErrorCodeEnum.SYSTEM_UNKNOWN_ERROR);
+        failure.setData(e.getMessage());
+        return failure;
     }
 }