处理问题
This commit is contained in:
parent
e89c104a43
commit
67ea450d18
@ -25,4 +25,6 @@ public @interface CheckEmptyAnnotation {
|
||||
|
||||
String regex() default "";
|
||||
|
||||
boolean noBlank() default false;
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import ink.wgink.gateway.exception.SearchException;
|
||||
import ink.wgink.gateway.handler.BaseHandler;
|
||||
import ink.wgink.gateway.pojo.result.SuccessResult;
|
||||
import ink.wgink.gateway.pojo.route.Route;
|
||||
import ink.wgink.gateway.pojo.routetype.RouteType;
|
||||
import ink.wgink.gateway.util.RegexUtil;
|
||||
import ink.wgink.gateway.util.RequestFieldCheckUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -165,7 +164,7 @@ public class RouteHandler extends BaseHandler implements ApplicationEventPublish
|
||||
String routeTypeTrim = routeType.get().trim();
|
||||
route.setRouteType(routeTypeTrim);
|
||||
}
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matching()
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAny()
|
||||
.withMatcher("title", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("summary", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("routeType", ExampleMatcher.GenericPropertyMatcher::exact)
|
||||
|
@ -126,10 +126,10 @@ public class RouteTypeHandler extends BaseHandler {
|
||||
routeType.setTitle(keywordTrim);
|
||||
routeType.setSummary(keywordTrim);
|
||||
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matching()
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAny()
|
||||
.withMatcher("title", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("summary", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withIgnoreCase("id");
|
||||
.withIgnoreCase("id", "summary");
|
||||
example = Example.of(routeType, exampleMatcher);
|
||||
}
|
||||
return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON_UTF8).body(routeTypeDao.findAll(example), RouteType.class);
|
||||
|
@ -22,7 +22,7 @@ public class RequestHeader extends BasePOJO {
|
||||
private String routeId;
|
||||
@CheckEmptyAnnotation(name = "类型")
|
||||
private String type;
|
||||
@CheckEmptyAnnotation(name = "名称")
|
||||
@CheckEmptyAnnotation(name = "名称", noBlank = true)
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class RequestParameter extends BasePOJO {
|
||||
private String routeId;
|
||||
@CheckEmptyAnnotation(name = "类型")
|
||||
private String type;
|
||||
@CheckEmptyAnnotation(name = "名称")
|
||||
@CheckEmptyAnnotation(name = "名称", noBlank = true)
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class ResponseHeader extends BasePOJO {
|
||||
private String routeId;
|
||||
@CheckEmptyAnnotation(name = "类型")
|
||||
private String type;
|
||||
@CheckEmptyAnnotation(name = "名称")
|
||||
@CheckEmptyAnnotation(name = "名称", noBlank = true)
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
|
@ -48,6 +48,9 @@ public class RequestFieldCheckUtil {
|
||||
if (fieldValue == null || StringUtils.isBlank(fieldValue.toString())) {
|
||||
throw new ParamsException(String.format("%s不能为空或空串", checkEmptyAnnotation.name()));
|
||||
}
|
||||
if(checkEmptyAnnotation.noBlank() && (fieldValue.toString().contains(" ") || fieldValue.toString().contains(" "))) {
|
||||
throw new ParamsException(String.format("%s不能有空格", checkEmptyAnnotation.name()));
|
||||
}
|
||||
checkRegular(checkEmptyAnnotation.name(), fieldValue.toString(), checkEmptyAnnotation.verifyType(), checkEmptyAnnotation.regex());
|
||||
checkTypes(checkEmptyAnnotation.name(), fieldValue.toString(), checkEmptyAnnotation.types());
|
||||
} else if (field.isAnnotationPresent(CheckNumberAnnotation.class)) {
|
||||
|
@ -10,9 +10,9 @@ spring:
|
||||
use-insecure-trust-manager: true
|
||||
data:
|
||||
mongodb:
|
||||
uri: mongodb://127.0.0.1:27017/gateway
|
||||
uri: mongodb://192.168.0.151:27017/gateway
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092
|
||||
bootstrap-servers: 192.168.0.151:9092
|
||||
producer:
|
||||
# 写入失败时,重试次数。当leader节点失效,一个repli节点会替代成为leader节点,此时可能出现写入失败,
|
||||
# 当retris为0时,produce不会重复。retirs重发,此时repli节点完全成为leader节点,不会产生消息丢失。
|
||||
|
Loading…
Reference in New Issue
Block a user