修改一个编译下有多个分组时,未完全将分组取消的问题
This commit is contained in:
@@ -1043,7 +1043,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
String compileStr = "COMPILEGROUP:" + id;
|
||||
// 获取当前编译配置与分组配置的关联关系
|
||||
String compileStrVal = JedisUtils.get(compileStr, idRelaRedisDBIndex);// 根据编译id获取该编译下的分组关系
|
||||
String groupCompileStrs = getRegionInfo(compileStrVal);// 获取编译对应的分组信息,去除后面的redisdb信息
|
||||
if (compileStrVal != null && !compileStrVal.trim().equals("")) {
|
||||
String[] compileGroupStrArr = compileStrVal.split(";");
|
||||
for (String compileGroup : compileGroupStrArr) {
|
||||
String groupCompileStrs = getRegionInfo(compileGroup);// 获取编译对应的分组信息,去除后面的redisdb信息
|
||||
if (groupCompileStrs != null && !groupCompileStrs.trim().equals("")) {// 遍历编译和分组的信息
|
||||
String[] split = groupCompileStrs.split(";");
|
||||
for (String groupId : split) {// GROUPCOMPILE:groupid-redisdb
|
||||
@@ -1063,8 +1066,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
String[] regionKeyArr = regionStr.split(";");
|
||||
if (regionKeyArr != null && regionKeyArr.length > 0) {
|
||||
// 根据分组与域关联关系找到对应域配置然后删除(重命名)
|
||||
removeRegionConfig(maatXmlConfig, regionKeyArr, maatVersion, service,
|
||||
transaction, redisDBIndex);
|
||||
removeRegionConfig(maatXmlConfig, regionKeyArr, maatVersion,
|
||||
service, transaction, redisDBIndex);
|
||||
}
|
||||
} else {
|
||||
throw new ServiceRuntimeException(
|
||||
@@ -1090,6 +1093,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
"从" + idRelaRedisDBIndex + "号redis库中无法获取MAAT配置编译与分组关联关系,key为" + compileStr,
|
||||
RestBusinessCode.KeyNotExistsInRedis.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new ServiceRuntimeException(
|
||||
"无法从applicationConfig-maatRedis.xml配置文件中获取service为" + service + "对应的规则,请检查业务类型是否正确",
|
||||
@@ -1279,7 +1284,11 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
// String compileStr = redisDBIndex + ":COMPILEGROUP:" + compileId;
|
||||
String compileStr = "COMPILEGROUP:" + compileId;
|
||||
String compileStrVal = JedisUtils.get(compileStr, idRelaRedisDBIndex);// 根据编译id获取该编译下的分组关系
|
||||
String groupCompileStr = getRegionInfo(compileStrVal);
|
||||
if (compileStrVal != null && !compileStrVal.trim().equals("")) {
|
||||
String[] split1 = compileStrVal.split(";");
|
||||
for (String str : split1) {
|
||||
String groupCompileStr = getRegionInfo(str);
|
||||
|
||||
// if (compileStrVal != null && compileStrVal.contains("-")) {
|
||||
// String[] split = compileStrVal.split("-");
|
||||
// groupCompileStr = split[0];// 去除后面的redisdb信息
|
||||
@@ -1297,15 +1306,16 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
// == 1
|
||||
// && compileGroupStr.equals(compileStr.toUpperCase())) {//
|
||||
// 当前的分组关系只属于当前的compileid,说明没有被分组复用,需要将编译配置,分组关系,域配置,置无效
|
||||
if (compileGroupStrSplit[0].toUpperCase().equals(compileStr.toUpperCase())) {
|
||||
String groupRegion = groupCompile.replace("GROUPCOMPILE", "GROUPREGION");// groupregion里面value是region的信息,key是group的信息,所以可以直接将GROUPCOMPILE替换为GROUPREGION
|
||||
if (compileGroupStrSplit[0].toUpperCase()
|
||||
.equals(compileStr.toUpperCase())) {
|
||||
String groupRegion = groupCompile.replace("GROUPCOMPILE",
|
||||
"GROUPREGION");// groupregion里面value是region的信息,key是group的信息,所以可以直接将GROUPCOMPILE替换为GROUPREGION
|
||||
// 删除分组与域的关联关系
|
||||
if (JedisUtils.exists(groupRegion, idRelaRedisDBIndex)) {
|
||||
transaction.del(groupRegion);
|
||||
} else {
|
||||
throw new ServiceRuntimeException(
|
||||
"从" + idRelaRedisDBIndex + "号redis库中无法获取MAAT配置分组与域的关联关系,key为"
|
||||
+ groupRegion,
|
||||
throw new ServiceRuntimeException("从" + idRelaRedisDBIndex
|
||||
+ "号redis库中无法获取MAAT配置分组与域的关联关系,key为" + groupRegion,
|
||||
RestBusinessCode.KeyNotExistsInRedis.getValue());
|
||||
}
|
||||
|
||||
@@ -1322,7 +1332,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
if (groupCompileAndDBStr.contains(compileStr.toUpperCase())
|
||||
&& split.length == 1) {
|
||||
transaction.del(groupCompile.toUpperCase());// 删除当前组所对应的编译
|
||||
} else if (!groupCompileAndDBStr.contains(compileStr.toUpperCase())) {
|
||||
} else if (!groupCompileAndDBStr
|
||||
.contains(compileStr.toUpperCase())) {
|
||||
sb.append(groupCompileAndDBStr + ";");
|
||||
}
|
||||
}
|
||||
@@ -1372,6 +1383,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
RestBusinessCode.KeyNotExistsInRedis.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new ServiceRuntimeException(
|
||||
"删除配置时,未从service与配置id的对应关系中找到service=" + service + "的配置id,请检查传入的参数是否正确",
|
||||
|
||||
Reference in New Issue
Block a user