全局异常发飞书通知

master
wyq 5 months ago
parent 7de9136ca0
commit c1109d8516
  1. 5
      crmeb-service/src/main/java/com/zbkj/service/exception/GlobalExceptionHandler.java

@ -4,6 +4,7 @@ import com.zbkj.common.exception.CrmebException;
import com.zbkj.common.model.exception.ExceptionLog; import com.zbkj.common.model.exception.ExceptionLog;
import com.zbkj.common.result.CommonResult; import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.ExceptionLogService; import com.zbkj.service.service.ExceptionLogService;
import com.zbkj.service.service.RetryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
@ -41,7 +42,8 @@ import java.util.Objects;
@Slf4j @Slf4j
@RestControllerAdvice @RestControllerAdvice
public class GlobalExceptionHandler { public class GlobalExceptionHandler {
@Autowired
private RetryService retryService;
// private static String REQUESTBODY = "requestBodyMessage"; // private static String REQUESTBODY = "requestBodyMessage";
@Autowired @Autowired
@ -122,6 +124,7 @@ public class GlobalExceptionHandler {
if (e instanceof MissingServletRequestParameterException) { if (e instanceof MissingServletRequestParameterException) {
return CommonResult.failed().setMessage(Objects.requireNonNull(e.getMessage())); return CommonResult.failed().setMessage(Objects.requireNonNull(e.getMessage()));
} }
retryService.systemErrNc(e.getMessage());
//未知错误 //未知错误
return CommonResult.failed().setMessage(e.getMessage()); return CommonResult.failed().setMessage(e.getMessage());
} }

Loading…
Cancel
Save