[add] 接入萤石摄像头,新增子项目和摄像头预置位相关逻辑 [update] 修改geojson中方阵等重新上传逻辑
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package org.dromara.common.web.handler;
|
||||
|
||||
import cn.hutool.core.text.AntPathMatcher;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import jakarta.servlet.ServletException;
|
||||
@ -14,6 +15,7 @@ import org.dromara.common.core.exception.base.BaseException;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
@ -40,7 +42,7 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public R<Void> handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e,
|
||||
HttpServletRequest request) {
|
||||
HttpServletRequest request) {
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod());
|
||||
return R.fail(HttpStatus.HTTP_BAD_METHOD, e.getMessage());
|
||||
@ -106,6 +108,18 @@ public class GlobalExceptionHandler {
|
||||
return R.fail(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), e.getRequiredType().getName(), e.getValue()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public R<Void> handleHttpMessageNotReadable(HttpMessageNotReadableException ex, HttpServletRequest request) {
|
||||
String path = request.getRequestURI();
|
||||
AntPathMatcher matcher = new AntPathMatcher();
|
||||
String pattern = "/facility/**/geoJson";
|
||||
log.error("请求:{},参数格式错误:{}", path, ex.getMessage());
|
||||
if (matcher.match(pattern, path)) {
|
||||
return R.fail(HttpStatus.HTTP_BAD_REQUEST, "图层解析错误,请选择正确的设施或名称图层");
|
||||
}
|
||||
return R.fail(HttpStatus.HTTP_BAD_REQUEST, "请求参数格式错误:" + ex.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 找不到路由
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user