1:修改id映射关系存放到redis中

2:修改存储配置时分组关系的key为groupid+编译id
3:新增redistemplete15
This commit is contained in:
RenKaiGe-Office
2018-06-07 18:37:30 +08:00
parent bca5da1f29
commit ac35d32941
7 changed files with 494 additions and 143 deletions

View File

@@ -1299,11 +1299,8 @@ public class ConfigSourcesService extends BaseService {
}
}
if (configRedisService.saveMaatConfig(configMap)) {
configRedisService.addMaatRelation(configMap);
}
configRedisService.saveMaatConfig(configMap);
logger1.info("---------------调用maat配置新增接口---------------------");
return "ok";
}
private Map<String, String> convertObjectToMap(Object obj,Class clazz){
@@ -1385,9 +1382,7 @@ public class ConfigSourcesService extends BaseService {
}
}
try {
if(configRedisService.delMaatConfig(restMap)){
configRedisService.delMaatRelation(restMap);
}else{
if(!configRedisService.delMaatConfig(restMap)){
RuntimeException e = new RuntimeException("不存在映射关系");
msgList.add(e);
return "error";
@@ -2461,6 +2456,29 @@ public class ConfigSourcesService extends BaseService {
throw new RestServiceException(thread, System.currentTimeMillis() - start,"请检查service配置是否正确",
RestBusinessCode.wrong_range.getValue());
}
//获取IP类型
Integer ipType = null;
String ipTypeName ="";
for (CommonSourceFieldCfg commonSourceFieldCfg : commonSourceFieldCfgList) {
if(commonSourceFieldCfg.getDstName().equals("ip_type")){
String dstVal = srcMap.get(commonSourceFieldCfg.getSrcName()).toString();
ipTypeName = commonSourceFieldCfg.getSrcName();
//regexp 特殊格式正则验证
Boolean valFlag = true;
if(!StringUtil.isEmpty(commonSourceFieldCfg.getRegexp())){
Pattern pattern = Pattern.compile(commonSourceFieldCfg.getRegexp());
Matcher matcher = pattern.matcher(dstVal);
valFlag = valFlag&matcher.matches();
}
if (!valFlag) {
logger1.error(commonSourceFieldCfg.getSrcName()+"参数格式与正则不匹配");
thread.setExceptionInfo(commonSourceFieldCfg.getSrcName()+"参数格式与正则不匹配");
throw new RestServiceException(thread, System.currentTimeMillis() - start, commonSourceFieldCfg.getSrcName()+"参数格式不正确或数据不在有效范围",
RestBusinessCode.param_formate_error.getValue());
}
ipType = Integer.parseInt(dstVal);
}
}
for (CommonSourceFieldCfg commonSourceFieldCfg : commonSourceFieldCfgList) {
//是否必填
if(commonSourceFieldCfg.getIsRequired()&&!srcMap.containsKey(commonSourceFieldCfg.getSrcName())){
@@ -2498,10 +2516,10 @@ public class ConfigSourcesService extends BaseService {
}
break;
case "Ip":
if (!isIp(dstStr)) {
logger1.error(commonSourceFieldCfg.getSrcName()+"参数格式不正确不是合法的IP地址");
thread.setExceptionInfo(commonSourceFieldCfg.getSrcName()+"参数格式不正确不是合法的IP地址");
throw new RestServiceException(thread, System.currentTimeMillis() - start,commonSourceFieldCfg.getSrcName()+"参数不能格式不正确不是合法的IP地址",
if (!BasicProvingUtil.isIpOrIpMask(dstStr,ipType)) {
logger1.error(commonSourceFieldCfg.getSrcName()+"参数格式不正确或与"+ipTypeName+"不一致");
thread.setExceptionInfo(commonSourceFieldCfg.getSrcName()+"参数格式不正确或与"+ipTypeName+"不一致");
throw new RestServiceException(thread, System.currentTimeMillis() - start,commonSourceFieldCfg.getSrcName()+"参数格式不正确或与"+ipTypeName+"不一致",
RestBusinessCode.missing_args.getValue());
}
break;