1、修改非maat配置取消接口请求参数;

2、添加maat配置 配置存储接口中service与action对应关系验证
This commit is contained in:
zhangdongxu
2018-06-04 15:14:52 +08:00
parent 9071c087d5
commit 1219fe0bc1
9 changed files with 223 additions and 291 deletions

View File

@@ -681,9 +681,11 @@ public class CompileVal {
public static String serviceConfigCompileVal(ConfigCompile configCompile) {
Long compileId = configCompile.getCompileId();
if (configCompile.getAction() != 1 && configCompile.getAction() != 2 && configCompile.getAction() != 5
&& configCompile.getAction() != 6 && configCompile.getAction() != 7) {
return "编译配置id为" + compileId + "的配置中action的值只能是1(阻断),2(监测),5(封堵白名单),6(监测白名单),7(封堵监测都白名单)";
Integer action = ServiceAndRDBIndexReal.getActionByService(configCompile.getService());
if (StringUtil.isEmpty(action)){
return "编译配置id为" + compileId + "的配置中service的值为"+configCompile.getService()+"时action不存在";
}else if(action.compareTo(configCompile.getAction())!=0) {
return "编译配置id为" + compileId + "的配置中service的值为"+configCompile.getService()+"时action只能为"+action;
}
if (configCompile.getDoBlacklist() != 1) {
return "编译配置id为" + compileId + "的配置中doBlacklist的值只能是1";

View File

@@ -24,13 +24,18 @@ public class ServiceAndRDBIndexReal {
* key是业务类型,value是业务类型对应的redisdbIndex
*/
private static Map<Integer, List<Integer>> serviceDBIndexmap = new HashMap<Integer, List<Integer>>();
/**
* key是业务类型,value是业务类型对应的动作(action)
*/
private static Map<Integer, Integer> serviceActionMap = new HashMap<Integer, Integer>();
static {
String service = Configurations.getStringProperty("service", "");
if (service != null && !service.trim().equals("")) {
String[] split = service.split(";");
for (String str : split) {
String type = Configurations.getStringProperty(str, "");
String[] serviceAction = str.split(":");
serviceActionMap.put(Integer.valueOf(serviceAction[0]), Integer.valueOf(serviceAction[1]));
String type = Configurations.getStringProperty(serviceAction[0], "");
if (type != null && !type.trim().equals("")) {
Map<Integer, String> typeMap = new HashMap<Integer, String>();
String[] typeArrs = type.split(";");
@@ -41,7 +46,7 @@ public class ServiceAndRDBIndexReal {
typeMap.put(Integer.parseInt(typeArr[0]), tableName.toUpperCase());
}
}
sercieNameMap.put(Integer.parseInt(str), typeMap);
sercieNameMap.put(Integer.parseInt(serviceAction[0]), typeMap);
}
}
@@ -88,7 +93,10 @@ public class ServiceAndRDBIndexReal {
}
}
public static Integer getActionByService(Integer service) {
return serviceActionMap.get(service);
}
public static Map<Integer, Map<Integer, String>> getSercieNameMap() {
return sercieNameMap;
}