fix
This commit is contained in:
+3
-29
@@ -1,10 +1,7 @@
|
||||
package com.sunyard.ssp.common.exception;
|
||||
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.ssp.common.Result;
|
||||
import com.sunyard.ssp.utils.ResultUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.MyBatisSystemException;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
@@ -31,38 +28,15 @@ import java.util.Optional;
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionResolver {
|
||||
|
||||
/**
|
||||
* 处理所有不可知异常
|
||||
*
|
||||
* @param e 异常
|
||||
* @return json结果
|
||||
*/
|
||||
// @ExceptionHandler(Exception.class)
|
||||
// @ResponseBody
|
||||
// public Result<Object> handleException(Exception e) {
|
||||
// // 打印异常堆栈信息
|
||||
// return new ResultUtil().setErrorMsg(e.getMessage());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 数据持久层
|
||||
*/
|
||||
@ExceptionHandler(MyBatisSystemException.class)
|
||||
@ResponseBody
|
||||
public Result<Object> handleMyBatisSystemException(MyBatisSystemException e) {
|
||||
log.info("数据持久层");
|
||||
return new ResultUtil().setErrorMsg(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验器
|
||||
*/
|
||||
@ExceptionHandler(BindException.class)
|
||||
@ResponseBody
|
||||
public Result<Object> handleBindException(BindException e) {
|
||||
log.info("校验器");
|
||||
public R<?> handleBindException(BindException e) {
|
||||
log.info("校验器异常", e);
|
||||
FieldError fieldError = e.getBindingResult().getFieldError();
|
||||
return new ResultUtil().setErrorMsg(fieldError.getDefaultMessage());
|
||||
return R.error(400, fieldError.getDefaultMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.zip.ZipOutputStream;
|
||||
@Service
|
||||
public class LogDownloadServiceImpl implements LogDownloadService {
|
||||
|
||||
private static final String LOG_BASE_PATH = "/app/log/";
|
||||
private static final String LOG_BASE_PATH = "./log/";
|
||||
private static final DateTimeFormatter folderFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); // 用于遍历月份的目录格式
|
||||
private static final DateTimeFormatter fileFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 用于解析文件名中的日期格式
|
||||
|
||||
|
||||
Reference in New Issue
Block a user