1:整理下发或取消配置时返回的异常信息

2:整理业务类型142的redisdb,表等关系
This commit is contained in:
RenKaiGe-Office
2018-07-20 11:59:49 +08:00
parent 60706c2043
commit adb4a1f015
4 changed files with 85 additions and 79 deletions

View File

@@ -39,24 +39,24 @@ public class DefaultRestErrorResolver implements RestErrorResolver,InitializingB
private RestResult buildError(Exception ex, HttpServletRequest request) { private RestResult buildError(Exception ex, HttpServletRequest request) {
RestResult error = new RestResult(); RestResult error = new RestResult();
error.setStatus(this.getHttpStatusByEx(ex));// 设置http状态 error.setStatus(this.getHttpStatusByEx(ex));// 设置http状态
//获取日志源[只有日志需要返回日志源和ActiveSys]
int logSource = ((RestServiceException) ex).getLogSource();
//RestServiceException 包含有错误code //RestServiceException 包含有错误code
if(ex instanceof RestServiceException){ if(ex instanceof RestServiceException){
//获取日志源[只有日志需要返回日志源和ActiveSys]
int logSource = ((RestServiceException) ex).getLogSource();
error.setTraceCode(((RestServiceException) ex).getTraceCode());
int errorCode = ((RestServiceException) ex).getErrorCode(); int errorCode = ((RestServiceException) ex).getErrorCode();
error.setBusinessCode(RestBusinessCode.valueOf(errorCode)); error.setBusinessCode(RestBusinessCode.valueOf(errorCode));
} else { } else {
error.setBusinessCode(RestBusinessCode.valueOf(998)); error.setBusinessCode(RestBusinessCode.valueOf(998));
} }
error.setMsg(ex.getMessage()); error.setMsg(ex.getMessage());
if(null != request){ if(null != request){
error.setFromUri(request.getRequestURI()); error.setFromUri(request.getRequestURI());
}else { }else {
error.setFromUri("unknow url"); error.setFromUri("unknow url");
} }
error.setTraceCode(((RestServiceException) ex).getTraceCode());
return error; return error;
} }

View File

@@ -71,7 +71,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
.getUnMaatTableName(service); .getUnMaatTableName(service);
if (maatTableName == null) { if (maatTableName == null) {
throw new RuntimeException( throw new RuntimeException(
"后台错误:未从业务类型和表对应关系中,找到非maat配置业务类型:" + service "未从业务类型和表对应关系中,找到非maat配置业务类型:" + service
+ "对应的真实表名"); + "对应的真实表名");
} else { } else {
keyBF.append(maatTableName); keyBF.append(maatTableName);
@@ -146,7 +146,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
throw new RuntimeException( throw new RuntimeException(
"后台错误:无法从maat.xml中获取业务类型" + service + "对应的规则,请检查业务类型是否正确"); "无法从maat.xml中获取业务类型" + service + "对应的规则,请检查业务类型是否正确");
} }
} }
transaction.incrBy("MAAT_VERSION", 1l); transaction.incrBy("MAAT_VERSION", 1l);
@@ -155,11 +155,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
count++; count++;
} }
} else { } else {
throw new RuntimeException( throw new RuntimeException("" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
"后台错误:向" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
} }
} else { } else {
throw new RuntimeException("后台错误:redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号"); throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
} }
} }
if (count == configMap.size()) { if (count == configMap.size()) {
@@ -169,13 +168,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.discard(); transaction.discard();
} }
} catch (JedisConnectionException e) { } catch (JedisConnectionException e) {
// transaction.discard(); String error = "后台错误:连接redis异常,保存非maat类配置失败," + e.getMessage();
logger.error("后台错误:连接redis异常,保存非maat类配置失败,{}", e.getMessage()); logger.error(error);
throw new RuntimeException("后台错误:连接redis异常,保存非maat类配置失败", e); throw new RuntimeException(error, e);
} catch (Exception e) { } catch (Exception e) {
transaction.discard(); transaction.discard();
logger.error("后台错误:保存非maat类配置发生了异常,{}", e.getMessage()); String error = "后台错误:保存非maat类配置发生了异常," + e.getMessage();
throw new RuntimeException("后台错误:保存非maat类配置发生了异常", e); logger.error(error);
throw new RuntimeException(error, e);
} finally { } finally {
// 释放连接到连接池 // 释放连接到连接池
JedisUtils.returnResource(resource); JedisUtils.returnResource(resource);
@@ -289,11 +289,11 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
throw new RuntimeException("后台错误:redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号"); throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
} }
} }
} else { } else {
throw new RuntimeException("后台错误:参数不能为空"); throw new RuntimeException("参数不能为空");
} }
} }
@@ -339,7 +339,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
keyBF.append(keyVal); keyBF.append(keyVal);
} else { } else {
throw new RuntimeException( throw new RuntimeException(
"后台错误:未从map中获取到" + keyStr + "的值,无法拼接redisKey,请检查数据是否正确"); "未从map中获取到" + keyStr + "的值,无法拼接redisKey,请检查数据是否正确");
} }
} else if (!StringUtils.isEmpty(keyStr) && keyStr.trim().startsWith("{")) { } else if (!StringUtils.isEmpty(keyStr) && keyStr.trim().startsWith("{")) {
keyStr = keyStr.trim().replace("{", "").replace("}", ""); keyStr = keyStr.trim().replace("{", "").replace("}", "");
@@ -348,8 +348,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
String maatTableName = ServiceAndRDBIndexReal.getMaatTableName( String maatTableName = ServiceAndRDBIndexReal.getMaatTableName(
service, 10, argTableName == null ? null : argTableName); service, 10, argTableName == null ? null : argTableName);
if (maatTableName == null) { if (maatTableName == null) {
throw new RuntimeException("后台错误:未从业务类型和表对应关系中,找到业务类型:" throw new RuntimeException(
+ service + ",配置类型:10,对应的真实表名"); "未从业务类型和表对应关系中,找到业务类型:" + service + ",配置类型:10,对应的真实表名");
} else { } else {
keyBF.append(maatTableName); keyBF.append(maatTableName);
} }
@@ -373,7 +373,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
// valStr.toLowerCase().equals("action") // valStr.toLowerCase().equals("action")
// &&!valStr.toLowerCase().equals("user_region") &&type==10) { // &&!valStr.toLowerCase().equals("user_region") &&type==10) {
throw new RuntimeException( throw new RuntimeException(
"后台错误:未从map中获取到" + valStr + "的值,无法拼接redisValue,请检查数据是否正确"); "未从map中获取到" + valStr + "的值,无法拼接redisValue,请检查数据是否正确");
} }
} else if (valStr.equals("\t")) {// xml中是字符串的\t这里判断的时候需要转义为\\t,但是添加的时候需要添加\t不是\\t } else if (valStr.equals("\t")) {// xml中是字符串的\t这里判断的时候需要转义为\\t,但是添加的时候需要添加\t不是\\t
@@ -398,11 +398,11 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
throw new RuntimeException( throw new RuntimeException(
"后台错误:" + redisStatisticsRealDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确"); "" + redisStatisticsRealDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
} }
} else { } else {
throw new RuntimeException("后台错误:redis数据库编号:" + redisStatisticsRealDBIndex + "不正确,请检查数据库编号"); throw new RuntimeException("redis数据库编号:" + redisStatisticsRealDBIndex + "不正确,请检查数据库编号");
} }
break;// configMap中所有的value都是相同的,在记录配置新增或者取消时只记录一次即可 break;// configMap中所有的value都是相同的,在记录配置新增或者取消时只记录一次即可
} }
@@ -437,7 +437,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
argTableName == null ? null : argTableName); argTableName == null ? null : argTableName);
if (maatTableName == null) { if (maatTableName == null) {
throw new RuntimeException( throw new RuntimeException(
"后台错误:未从业务类型和表对应关系中,找到业务类型:" + service + ",配置类型:" + type + ",对应的真实表名"); "未从业务类型和表对应关系中,找到业务类型:" + service + ",配置类型:" + type + ",对应的真实表名");
} else { } else {
keyBF.append(maatTableName); keyBF.append(maatTableName);
} }
@@ -496,12 +496,11 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
Integer.valueOf(maatVersionStr) + 1); Integer.valueOf(maatVersionStr) + 1);
count++; count++;
} else { } else {
throw new RuntimeException( throw new RuntimeException("" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
"后台错误:向" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
} }
} }
} else { } else {
throw new RuntimeException("后台错误:redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号"); throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
} }
} }
if (count == configMap.size()) { if (count == configMap.size()) {
@@ -513,11 +512,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.exec(); transaction.exec();
} }
} catch (JedisConnectionException e) { } catch (JedisConnectionException e) {
// transaction.discard(); String error = "后台错误:连接redis异常,保存maat类配置失败" + e.getMessage();
throw new RuntimeException("后台错误:连接redis异常,保存maat类配置失败", e); logger.error(error);
throw new RuntimeException(error, e);
} catch (Exception e) { } catch (Exception e) {
transaction.discard(); transaction.discard();
throw new RuntimeException("后台错误:保存maat类配置发生了异常", e); String error = "后台错误:保存maat类配置发生了异常" + e.getMessage();
logger.error(error);
throw new RuntimeException(error, e);
} finally { } finally {
// 释放连接到连接池 // 释放连接到连接池
JedisUtils.returnResource(resource); JedisUtils.returnResource(resource);
@@ -546,8 +548,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
setCommonConfig(maatXmlConfig, compileMap, 10, maatVersion.doubleValue(), service, transaction, setCommonConfig(maatXmlConfig, compileMap, 10, maatVersion.doubleValue(), service, transaction,
redisDBIndex, null);// 10代表是编译配置 redisDBIndex, null);// 10代表是编译配置
} else { } else {
throw new RuntimeException( throw new RuntimeException("无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service + "的编译配置信息,请检查配置参数是否正确");
"后台错误:无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service + "的编译配置信息,请检查配置参数是否正确");
} }
List<Map<String, String>> groupMapList = maatConfig.getGroupMapList(); List<Map<String, String>> groupMapList = maatConfig.getGroupMapList();
@@ -557,8 +558,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
compileId);// 11代表是分组配置 compileId);// 11代表是分组配置
} }
} else { } else {
throw new RuntimeException( throw new RuntimeException("无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service + "的分组配置信息,请检查配置参数是否正确");
"后台错误:无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service + "的分组配置信息,请检查配置参数是否正确");
} }
List<Map<String, String>> ipRegionMapList = maatConfig.getIpRegionMapList(); List<Map<String, String>> ipRegionMapList = maatConfig.getIpRegionMapList();
@@ -641,7 +641,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (keyVal != null && !keyVal.equals("")) { if (keyVal != null && !keyVal.equals("")) {
keyBF.append(keyVal); keyBF.append(keyVal);
} else { } else {
throw new RuntimeException("后台错误:未从map中获取到" + keyStr + "的值,无法拼接redisKey,请检查数据是否正确"); throw new RuntimeException("未从map中获取到" + keyStr + "的值,无法拼接redisKey,请检查数据是否正确");
} }
if (type == 11 && keyStr.toLowerCase().equals("group_id")) { if (type == 11 && keyStr.toLowerCase().equals("group_id")) {
keyBF.append(compileId); keyBF.append(compileId);
@@ -654,7 +654,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
argTableName == null ? null : argTableName); argTableName == null ? null : argTableName);
if (maatTableName == null) { if (maatTableName == null) {
throw new RuntimeException( throw new RuntimeException(
"后台错误:未从业务类型和表对应关系中,找到业务类型:" + service + ",配置类型:" + type + ",对应的真实表名"); "未从业务类型和表对应关系中,找到业务类型:" + service + ",配置类型:" + type + ",对应的真实表名");
} else { } else {
keyBF.append(maatTableName); keyBF.append(maatTableName);
} }
@@ -703,7 +703,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
valBF.append(val); valBF.append(val);
} else { } else {
// 所有在maat.xml中配置的属性都不可以为空 // 所有在maat.xml中配置的属性都不可以为空
throw new RuntimeException("后台错误:未从map中获取到" + valStr + "的值,无法拼接redisValue,请检查数据是否正确"); throw new RuntimeException("未从map中获取到" + valStr + "的值,无法拼接redisValue,请检查数据是否正确");
} }
} else if (valStr.equals("&nbsp")) { } else if (valStr.equals("&nbsp")) {
valBF.append(" "); valBF.append(" ");
@@ -748,9 +748,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
if (maatXmlConfig == null) { if (maatXmlConfig == null) {
throw new RuntimeException("后台错误:无法获取业务类型" + service + "对应的maat规则,请检查maat.xml"); throw new RuntimeException("无法获取业务类型" + service + "对应的maat规则,请检查maat.xml");
} else { } else {
throw new RuntimeException("后台错误:后台组装的配置信息有误,请联系管理员检查"); throw new RuntimeException("后台组装的配置信息有误,请联系管理员检查");
} }
} }
} }
@@ -775,7 +775,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisDBIndex); String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisDBIndex);
if (maatVersionStr == null) { if (maatVersionStr == null) {
throw new RuntimeException("后台错误:" + redisDBIndex throw new RuntimeException("" + redisDBIndex
+ "号redis库中获取MAAT_VERSION的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "号redis库中获取MAAT_VERSION的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
} }
if (maatVersionStr != null) { if (maatVersionStr != null) {
@@ -815,8 +815,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
.getUnMaatTableName(service); .getUnMaatTableName(service);
if (maatTableName == null) { if (maatTableName == null) {
throw new RuntimeException( throw new RuntimeException(
"后台错误:未从业务类型和表对应关系中,找到非maat配置业务类型:" "未从业务类型和表对应关系中,找到非maat配置业务类型:" + service
+ service + "对应的真实表名"); + "对应的真实表名");
} else { } else {
keyBF.append(maatTableName); keyBF.append(maatTableName);
} }
@@ -842,8 +842,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
maatKey.toString().toUpperCase()); maatKey.toString().toUpperCase());
break; break;
} else { } else {
throw new RuntimeException("后台错误:" + redisDBIndex throw new RuntimeException(redisDBIndex + "号redis库中不存在key="
+ "号redis库中不存在key=" + oldKey + "请检查id映射关系是否正确"); + oldKey + "请检查id映射关系是否正确");
} }
} }
} }
@@ -899,7 +899,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
throw new RuntimeException( throw new RuntimeException(
"后台错误:无法从maat.xml中获取业务类型" + service + "对应的规则,请检查业务类型是否正确"); "无法从maat.xml中获取业务类型" + service + "对应的规则,请检查业务类型是否正确");
} }
} }
transaction.incrBy("MAAT_VERSION", 1l); transaction.incrBy("MAAT_VERSION", 1l);
@@ -908,14 +908,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
Integer.valueOf(maatVersionStr) + 1); Integer.valueOf(maatVersionStr) + 1);
count++; count++;
} else { } else {
throw new RuntimeException("后台错误:无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" throw new RuntimeException("无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service
+ service + "的配置id信息,请检查配置参数是否正确"); + "的配置id信息,请检查配置参数是否正确");
} }
} }
} }
} else { } else {
throw new RuntimeException("后台错误:" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确"); throw new RuntimeException("" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
} }
} }
@@ -926,11 +926,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.discard(); transaction.discard();
} }
} catch (JedisConnectionException e) { } catch (JedisConnectionException e) {
// transaction.discard(); String error = "后台错误:连接redis异常,删除非maat类配置失败," + e.getMessage();
throw new RuntimeException("后台错误:连接redis异常,删除非maat类配置失败", e); logger.error(error);
throw new RuntimeException(error, e);
} catch (Exception e) { } catch (Exception e) {
transaction.discard(); transaction.discard();
throw new RuntimeException("后台错误:删除非maat类配置发生了异常", e); String error = "后台错误:删除非maat类配置发生了异常," + e.getMessage();
logger.error(error);
throw new RuntimeException(error, e);
} finally { } finally {
// 释放连接到连接池 // 释放连接到连接池
JedisUtils.returnResource(resource); JedisUtils.returnResource(resource);
@@ -955,7 +958,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (serviceConfigMap != null && serviceConfigMap.size() > 0) { if (serviceConfigMap != null && serviceConfigMap.size() > 0) {
String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisDBIndex); String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisDBIndex);
if (maatVersionStr == null) { if (maatVersionStr == null) {
throw new RuntimeException("后台错误:" + redisDBIndex throw new RuntimeException("" + redisDBIndex
+ "号redis库中获取MAAT_VERSION的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "号redis库中获取MAAT_VERSION的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
} }
if (maatVersionStr != null) { if (maatVersionStr != null) {
@@ -972,7 +975,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
count++; count++;
} }
} else { } else {
throw new RuntimeException("后台错误:" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确"); throw new RuntimeException("" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
} }
} }
if (count == idMap.size()) { if (count == idMap.size()) {
@@ -985,11 +988,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} catch (JedisConnectionException e) { } catch (JedisConnectionException e) {
// transaction.discard(); String error = "后台错误:连接redis异常,删除maat类配置失败," + e.getMessage();
throw new RuntimeException("后台错误:连接redis异常,删除maat类配置失败", e); logger.error(error);
throw new RuntimeException(error, e);
} catch (Exception e) { } catch (Exception e) {
transaction.discard(); transaction.discard();
throw new RuntimeException("后台错误:删除maat类配置发生了异常", e); String error = "后台错误:删除maat类配置发生了异常," + e.getMessage();
logger.error(error);
throw new RuntimeException(error, e);
} finally { } finally {
// 释放连接到连接池 // 释放连接到连接池
JedisUtils.returnResource(resource); JedisUtils.returnResource(resource);
@@ -1038,7 +1044,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
throw new RuntimeException( throw new RuntimeException(
"后台错误:" + idRelaRedisDBIndex + "号redis库中获取" + groupRegionKey "" + idRelaRedisDBIndex + "号redis库中获取" + groupRegionKey
+ "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
} }
@@ -1049,18 +1055,18 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
groupId.replace(redisDBIndex + ":GROUPCOMPILE:", ""), 11, maatVersion.doubleValue(), groupId.replace(redisDBIndex + ":GROUPCOMPILE:", ""), 11, maatVersion.doubleValue(),
service, transaction, redisDBIndex, id + "");// 11代表是分组配置 service, transaction, redisDBIndex, id + "");// 11代表是分组配置
} else { } else {
throw new RuntimeException("后台错误:" + idRelaRedisDBIndex + "号redis库中获取" + groupId throw new RuntimeException("" + idRelaRedisDBIndex + "号redis库中获取" + groupId
+ "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
} }
} }
} else { } else {
throw new RuntimeException("后台错误:" + idRelaRedisDBIndex + "号redis库中获取" + compileStr throw new RuntimeException("" + idRelaRedisDBIndex + "号redis库中获取" + compileStr
+ "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
} }
} }
} else { } else {
throw new RuntimeException("后台错误:无法获取内存中记录的id映射关系,无法获取业务类型" + service + "对应的maat规则或传入的配置id有误,请检查!"); throw new RuntimeException("无法获取内存中记录的id映射关系,无法获取业务类型" + service + "对应的maat规则或传入的配置id有误,请检查!");
} }
} }
@@ -1092,7 +1098,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
String maatTableName = ServiceAndRDBIndexReal.getMaatTableName(service, type, null); String maatTableName = ServiceAndRDBIndexReal.getMaatTableName(service, type, null);
if (maatTableName == null) { if (maatTableName == null) {
throw new RuntimeException( throw new RuntimeException(
"后台错误:未从业务类型和表对应关系中,找到业务类型:" + service + ",配置类型:" + type + ",对应的真实表名"); "未从业务类型和表对应关系中,找到业务类型:" + service + ",配置类型:" + type + ",对应的真实表名");
} else { } else {
keyBF.append(maatTableName); keyBF.append(maatTableName);
} }
@@ -1113,7 +1119,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
maatKey.toUpperCase()); maatKey.toUpperCase());
break; break;
} else { } else {
throw new RuntimeException("后台错误:" + redisDBIndex + "号redis库中不存在key=" + oldKey throw new RuntimeException(redisDBIndex + "号redis库中不存在key=" + oldKey
+ "请检查id映射关系是否正确,或该配置已经被取消,已经被取消的配置不可再次取消,否则将抛出异常"); + "请检查id映射关系是否正确,或该配置已经被取消,已经被取消的配置不可再次取消,否则将抛出异常");
} }
} }
@@ -1147,7 +1153,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} }
} else { } else {
throw new RuntimeException("后台错误:无法获取业务类型" + service + "对应的maat规则,请检查!"); throw new RuntimeException("无法获取业务类型" + service + "对应的maat规则,请检查!");
} }
} }
@@ -1172,7 +1178,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.rename(oldKey, maatKey.toUpperCase()); transaction.rename(oldKey, maatKey.toUpperCase());
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是{}", redisDBIndex, oldKey, maatKey.toUpperCase()); logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是{}", redisDBIndex, oldKey, maatKey.toUpperCase());
} else { } else {
throw new RuntimeException("后台错误:" + redisDBIndex + "号redis库中不存在key=" + oldKey + "请检查id映射关系是否正确"); throw new RuntimeException(redisDBIndex + "号redis库中不存在key=" + oldKey + "请检查id映射关系是否正确");
} }
for (MaatXmlExpr maatXmlExpr : expressionList) { for (MaatXmlExpr maatXmlExpr : expressionList) {
@@ -1205,10 +1211,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
if (maatXmlConfig == null) { if (maatXmlConfig == null) {
throw new RuntimeException("后台错误:无法获取业务类型" + service + "对应的maat规则,请检查maat.xml"); throw new RuntimeException("无法获取业务类型" + service + "对应的maat规则,请检查maat.xml");
} else { } else {
int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15); int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15);
throw new RuntimeException("后台错误:" + idRelaRedisDBIndex + "号redis库中存储的分组和域关系有误,请联系管理员检查数据"); throw new RuntimeException(idRelaRedisDBIndex + "号redis库中存储的分组和域关系有误,请联系管理员检查数据");
} }
} }
@@ -1223,7 +1229,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.select(redisStatisticsRealDBIndex); transaction.select(redisStatisticsRealDBIndex);
String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisStatisticsRealDBIndex); String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisStatisticsRealDBIndex);
if (maatVersionStr == null) { if (maatVersionStr == null) {
throw new RuntimeException("后台错误:" + redisStatisticsRealDBIndex throw new RuntimeException("" + redisStatisticsRealDBIndex
+ "号redis库中获取MAAT_VERSION的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "号redis库中获取MAAT_VERSION的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
} }
double maatVersion = Double.valueOf(maatVersionStr) + 1D; double maatVersion = Double.valueOf(maatVersionStr) + 1D;
@@ -1251,7 +1257,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}", logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
redisStatisticsRealDBIndex, zset.toUpperCase(), maatVersion); redisStatisticsRealDBIndex, zset.toUpperCase(), maatVersion);
} else { } else {
throw new RuntimeException("后台错误:" + redisStatisticsRealDBIndex + "号redis库中判断" throw new RuntimeException("" + redisStatisticsRealDBIndex + "号redis库中判断"
+ effectiveRuleKey.toUpperCase() + effectiveRuleKey.toUpperCase()
+ "组和域关系时不存在,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "组和域关系时不存在,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
@@ -1259,7 +1265,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
throw new RuntimeException("后台错误:删除配置时,配置id不能为空,请联系开发人员检查删除逻辑是否正确"); throw new RuntimeException("删除配置时,配置id不能为空,请联系开发人员检查删除逻辑是否正确");
} }
} }
@@ -1268,11 +1274,11 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
Integer.valueOf(maatVersionStr) + 1); Integer.valueOf(maatVersionStr) + 1);
} else { } else {
throw new RuntimeException("后台错误:删除配置时,配置id不能为空,请联系开发人员检查删除逻辑是否正确"); throw new RuntimeException("删除配置时,配置id不能为空,请联系开发人员检查删除逻辑是否正确");
} }
} else { } else {
throw new RuntimeException("后台错误:redis数据库编号:" + redisStatisticsRealDBIndex + "不正确,请检查数据库编号"); throw new RuntimeException("redis数据库编号:" + redisStatisticsRealDBIndex + "不正确,请检查数据库编号");
} }
break;// 因为所有的value都是相同的所以只取消一次就可以了 break;// 因为所有的value都是相同的所以只取消一次就可以了
} }
@@ -1319,7 +1325,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (JedisUtils.exists(groupRegion, idRelaRedisDBIndex)) { if (JedisUtils.exists(groupRegion, idRelaRedisDBIndex)) {
transaction.del(groupRegion);// 删除组对应的域 transaction.del(groupRegion);// 删除组对应的域
} else { } else {
throw new RuntimeException("后台错误:" + idRelaRedisDBIndex throw new RuntimeException("" + idRelaRedisDBIndex
+ "号redis库中判断" + groupRegion + "号redis库中判断" + groupRegion
+ "组和域关系时不存在,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "组和域关系时不存在,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
@@ -1329,7 +1335,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
idRelaRedisDBIndex)) { idRelaRedisDBIndex)) {
transaction.del(groupCompile.toUpperCase());// 删除当前组所对应的编译 transaction.del(groupCompile.toUpperCase());// 删除当前组所对应的编译
} else { } else {
throw new RuntimeException("后台错误:" + idRelaRedisDBIndex throw new RuntimeException("" + idRelaRedisDBIndex
+ "号redis库中判断" + groupCompile.toUpperCase() + "号redis库中判断" + groupCompile.toUpperCase()
+ "组和域关系时不存在,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "组和域关系时不存在,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
@@ -1352,7 +1358,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.set(groupCompile, sb.substring(0, sb.length() - 1)); transaction.set(groupCompile, sb.substring(0, sb.length() - 1));
} }
} else { } else {
throw new RuntimeException("后台错误:" + idRelaRedisDBIndex + "号redis库中获取" throw new RuntimeException("" + idRelaRedisDBIndex + "号redis库中获取"
+ groupCompile.toUpperCase() + groupCompile.toUpperCase()
+ "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
@@ -1363,8 +1369,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} else { } else {
throw new RuntimeException("后台错误:" + idRelaRedisDBIndex + "号redis库中获取" throw new RuntimeException("" + idRelaRedisDBIndex + "号redis库中获取" + compileStr
+ compileStr + "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常"); + "的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常");
} }
} }
@@ -1372,11 +1378,11 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} }
} else { } else {
throw new RuntimeException("后台错误:redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号"); throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
} }
} }
} else { } else {
throw new RuntimeException("后台错误:参数不能为空"); throw new RuntimeException("参数不能为空");
} }
} }
} }

View File

@@ -242,7 +242,7 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;64:16;65:16;261:16;262:16;263:16;264:16
#0x19 IPSec丢弃 25:7; #0x19 IPSec丢弃 25:7;
#0x340 IP复用地址池配置回调832:2,4,7 #0x340 IP复用地址池配置回调832:2,4,7
########## ##########
serviceDBIndex=1:2,3,4,6,7;2:2,3,4,6,7;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,6,7;34:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;141:2;143:2;144:2;145:2,6,7;256:3;257:3;258:3;259:3;260:3;384:3;385:3;386:3;387:3;388:3;512:4,7;513:4,2,7;528:4;529:4;544:4;545:4;560:4;561:4;768:5;1024:2,6,7;1026:2,6,7;1027:2;1028:2,6,7;1040:2,6,7;1056:2,6,7;1057:6,7;1058:6,2,7;3:7;4:7;5:2;25:7;28:7;64:2;65:2;261:8;262:9;263:10;264:11;265:3;266:3;389:3;390:3;391:3;392:3;393:3;394:3;832:2,4,7 serviceDBIndex=1:2,3,4,6,7;2:2,3,4,6,7;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,6,7;34:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;141:2;142:2;143:2;144:2;145:2,6,7;256:3;257:3;258:3;259:3;260:3;384:3;385:3;386:3;387:3;388:3;512:4,7;513:4,2,7;528:4;529:4;544:4;545:4;560:4;561:4;768:5;1024:2,6,7;1026:2,6,7;1027:2;1028:2,6,7;1040:2,6,7;1056:2,6,7;1057:6,7;1058:6,2,7;3:7;4:7;5:2;25:7;28:7;64:2;65:2;261:8;262:9;263:10;264:11;265:3;266:3;389:3;390:3;391:3;392:3;393:3;394:3;832:2,4,7
##maat配置入阀门需要将编译中的部分参数写到域配置中目前最多包含ACTIONSERVICEUSER_REGION三个属性 ##maat配置入阀门需要将编译中的部分参数写到域配置中目前最多包含ACTIONSERVICEUSER_REGION三个属性

View File

@@ -138,7 +138,7 @@
</p:maatType> </p:maatType>
<p:maatType <p:maatType
service="1;2;16;17;18;19;20;21;22;23;24;26;27;30;31;32;33;34;128;129;130;131;132;133;134;135;136;137;138;139;140;141;143;144;145;256;257;258;259;260;384;385;386;387;388;512;513;528;529;544;545;560;561;768;848;1024;1025;1026;1027;1028;1040;1056;1057;1058"> service="1;2;16;17;18;19;20;21;22;23;24;26;27;30;31;32;33;34;128;129;130;131;132;133;134;135;136;137;138;139;140;141;142;143;144;145;256;257;258;259;260;384;385;386;387;388;512;513;528;529;544;545;560;561;768;848;1024;1025;1026;1027;1028;1040;1056;1057;1058">
<p:expressions> <p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{compile_table_name};,;[compile_id]</p:keyExpression> <p:keyExpression>EFFECTIVE_RULE;:;{compile_table_name};,;[compile_id]</p:keyExpression>
<p:valueExpression>[compile_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time];&amp;nbsp;0;\n</p:valueExpression> <p:valueExpression>[compile_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time];&amp;nbsp;0;\n</p:valueExpression>