1: 判断公共组下面是否有域配置,没有域配置时就不往下面下发了,避免添加版本号

2:在取消普通类配置时判断当需要保留的groupid为空时继续执行
This commit is contained in:
renkaige
2019-01-15 20:37:53 +06:00
parent ee5698f6cf
commit e4be9d82af
2 changed files with 38 additions and 9 deletions

View File

@@ -1137,8 +1137,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (groupAndCompileStr != null && !groupAndCompileStr.trim().equals("")) {
String compileId = getRegionInfo(groupAndCompileStr);// COMPILEGROUP:24070
if (compileId != null && !compileId.trim().equals("")) {
if (isStart || (keepGroupId != null && keepGroupId.size() > 0
&& !keepGroupId.contains(Long.parseLong(groupIdReal)))) {
if (isStart || keepGroupId == null || keepGroupId.size() == 0
|| (keepGroupId != null && keepGroupId.size() > 0
&& !keepGroupId.contains(Long.parseLong(groupIdReal)))) {
// 如果是生效则根据关联关系将组下的域都改为生效
// 如果是失效并且当前组不是需要保留的组,则将该组下的域置为失效
if (compileId.equals(compileStr)) {// 判断编译id是否一致
@@ -2296,7 +2297,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (groupIdAndregionIdMap != null && groupIdAndregionIdMap.size() > 0) {
int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15);
transaction.select(idRelaRedisDBIndex);
//获取需要删除的regionkey
// 获取需要删除的regionkey
Set<String> set = new HashSet<>();
Set<Long> groupIdSet = groupIdAndregionIdMap.keySet();
for (Long groupId : groupIdSet) {
@@ -2310,12 +2311,12 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
String[] keyAndDBArr = org.apache.commons.lang.StringUtils.split(regionKey, ";");
for (String keyAndDB : keyAndDBArr) {
String key = keyAndDB.substring(0, keyAndDB.indexOf("-"));
String regionId = key.substring(keyAndDB.indexOf(",")+1);
if(regionId!=null&&!regionId.trim().equals("")) {
if(regionSet.contains(Long.parseLong(regionId))) {
String regionId = key.substring(keyAndDB.indexOf(",") + 1);
if (regionId != null && !regionId.trim().equals("")) {
if (regionSet.contains(Long.parseLong(regionId))) {
set.add(key);
}
}else {
} else {
throw new ServiceRuntimeException("获取公共组下面域配置的id,域配置的key为" + key + ",请检查数据是否正确",
RestBusinessCode.CommonGroupIsNotExist.getValue());
}
@@ -2348,7 +2349,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.exec();
return true;
} else {
throw new ServiceRuntimeException("删除公共组中域配置时,参数为空,请检查", RestBusinessCode.ConfigSourceIsNull.getValue());
throw new ServiceRuntimeException("删除公共组中域配置时,参数为空,请检查",
RestBusinessCode.ConfigSourceIsNull.getValue());
}