diff --git a/src/main/java/com/nis/domain/restful/MaatRelation.java b/src/main/java/com/nis/domain/restful/MaatRelation.java
deleted file mode 100644
index 20f2a17..0000000
--- a/src/main/java/com/nis/domain/restful/MaatRelation.java
+++ /dev/null
@@ -1,246 +0,0 @@
-package com.nis.domain.restful;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-/**
- *
- *
Title: MaatRelation
- * Description: 描述:编译id,分组关系id,域配置id等的对应关系
- * Company: IIE
- * @author rkg
- * @date 2018年6月1日
- *
- */
-public class MaatRelation implements Serializable {
-
- private static final long serialVersionUID = 1L;
- /**
- * 编译id与groupid的对应关系,key是编译id,value使用set不允许重复
- */
- private Map> compileAndGroupMap;
- /**
- * groupid与编译id的对应关系,key是groupid,value使用set不允许重复
- */
- private Map> groupAndCompileMap;
- // private Map> regionAndGroupMap;
- /**
- * groupid与regionid的对应关系,key是groupid,value使用set不允许重复
- */
- private Map> groupAndRegionMap;
-
- public Map> getCompileAndGroupMap() {
- return compileAndGroupMap;
- }
-
- public void setCompileAndGroupMap(Map> compileAndGroupMap) {
- this.compileAndGroupMap = compileAndGroupMap;
- }
-
- public Map> getGroupAndCompileMap() {
- return groupAndCompileMap;
- }
-
- public void setGroupAndCompileMap(Map> groupAndCompileMap) {
- this.groupAndCompileMap = groupAndCompileMap;
- }
-
- public Map> getGroupAndRegionMap() {
- return groupAndRegionMap;
- }
-
- public void setGroupAndRegionMap(Map> groupAndRegionMap) {
- this.groupAndRegionMap = groupAndRegionMap;
- }
-
- public static void removKey(MaatRelation maatRelation, long compileId) {
- if (maatRelation.getCompileAndGroupMap().containsKey(compileId)) {
- Set list = maatRelation.getCompileAndGroupMap().get(compileId);
- if (list != null && list.size() > 0) {
- for (Long groupId : list) {
- // }
- // for (Long groupId: list.size()) {
- if (maatRelation.getGroupAndCompileMap().containsKey(groupId)) {
- // && maatRelation.getGroupAndCompileMap().get(groupId).size() == 1
- // && maatRelation.getGroupAndCompileMap().get(groupId).get(0).longValue() ==
- // compileId) {
- Set compileIdList = maatRelation.getGroupAndCompileMap().get(groupId);
- if (compileIdList.size() == 1) {// 当前的groupid只属于当前的compileid,没有被分组复用,需要将编译配置,分组关系,域配置,置无效
- for (Long id : compileIdList) {
- if (id.longValue() == compileId) {
- // 这个group没有被分组复用,所以需要将这个组下面的域配置置为无效,组也要置为无效
- if (maatRelation.getGroupAndRegionMap().containsKey(groupId)) {
- // 把当前组置为无效,把当前组下的所有域置为无效
- maatRelation.getGroupAndRegionMap().remove(groupId);// 删除组对应的域
- maatRelation.getGroupAndCompileMap().remove(groupId);// 删除当前组所对应的编译
- // maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId);
- // maatRelation.getCompileAndGroupMap().get(compileId)
- // list.remove(maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId));//
- // 删除编译下面的组
- list.remove(groupId);// 删除编译下面的组
- }
- }
- }
- } else {
- // 这个组对应了多个编译配置被分组复用了,这时将这个组和编译的关系置为无效,编译置为无效
- // list.remove(maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId));//
- // 删除编译下面的这个组
- // maatRelation.getGroupAndCompileMap().get(groupId)
- // .remove(maatRelation.getGroupAndCompileMap().get(groupId).indexOf(compileId));//
- // 删除分组关系中的组和编译关系
-
- list.remove(groupId);// 删除编译下面的这个组
- maatRelation.getGroupAndCompileMap().get(groupId).remove(compileId);
- }
- } else {
- // 当前的groupid属于多个组,被分组复用了,所以不对这个组进行操作,也不对这个组下面的域进行操作
- }
- }
- }
-
- }
- }
-
- public static void syso(MaatRelation maatRelation) {
- Map> getCompileAndGroupMap = maatRelation.getCompileAndGroupMap();
- for (Long compile : getCompileAndGroupMap.keySet()) {
- Set groupList = getCompileAndGroupMap.get(compile);
- for (Long group : groupList) {
- System.out.println("编译:" + compile + "组:" + group);
- }
- }
- Map> getGroupAndCompileMap = maatRelation.getGroupAndCompileMap();
- for (Long group : getGroupAndCompileMap.keySet()) {
- Set compileList = getGroupAndCompileMap.get(group);
- for (Long compile : compileList) {
- System.out.println("组:" + group + "编译:" + compile);
- }
- }
- Map> getGroupAndRegionMap = maatRelation.getGroupAndRegionMap();
- for (Long group : getGroupAndRegionMap.keySet()) {
- Set regionList = getGroupAndRegionMap.get(group);
- for (String region : regionList) {
- System.out.println("组:" + group + "域:" + region);
- }
- }
-
- System.out.println();
- System.out.println();
- System.out.println();
- System.out.println();
- }
-
- public static void main(String[] args) {
- MaatRelation maatRelation = getMaat();
- syso(maatRelation);
-
- long compileId = 11;
- removKey(maatRelation, compileId);
- syso(maatRelation);
-
- compileId = 2;
- removKey(maatRelation, compileId);
- syso(maatRelation);
-
- addKey(maatRelation, setCGR());
- syso(maatRelation);
-
-
- compileId = 99999L;
- removKey(maatRelation, compileId);
- syso(maatRelation);
- }
-
- public static CompileAndGroupRelations setCGR() {
- CompileAndGroupRelations cGR = new CompileAndGroupRelations();
- cGR.setCompileId(99999L);
-
- List groupIdList = new ArrayList();
- GroupAndRegionRelations gRR = new GroupAndRegionRelations();
- gRR.setGroupId(100L);
- gRR.setRegionId("200");
- groupIdList.add(gRR);
-
- gRR = new GroupAndRegionRelations();
- gRR.setGroupId(100L);
- gRR.setRegionId("300");
- groupIdList.add(gRR);
- cGR.setGroupIdList(groupIdList);
- return cGR;
- }
-
- public static void addKey(MaatRelation maatRelation, CompileAndGroupRelations compileAndGroupRelations) {
-
- long compileId = compileAndGroupRelations.getCompileId();
- List groupIdList = compileAndGroupRelations.getGroupIdList();
- if (groupIdList != null && groupIdList.size() > 0) {
- for (GroupAndRegionRelations gRR : groupIdList) {
- Map> compileAndGroupMap2 = maatRelation.getCompileAndGroupMap();
- if (compileAndGroupMap2 != null && compileAndGroupMap2.size() > 0) {
- if (!compileAndGroupMap2.containsKey(compileId)) {
- Set set = new HashSet();
- set.add(gRR.getGroupId());
- compileAndGroupMap2.put(compileId, set);
- } else {
- compileAndGroupMap2.get(compileId).add(gRR.getGroupId());
- }
- }
-
- Map> groupAndCompileMap2 = maatRelation.getGroupAndCompileMap();
- if (groupAndCompileMap2 != null && groupAndCompileMap2.size() > 0) {
- if (!groupAndCompileMap2.containsKey(gRR.getGroupId())) {
- Set set = new HashSet();
- set.add(compileId);
- groupAndCompileMap2.put(gRR.getGroupId(), set);
- } else {
- groupAndCompileMap2.get(gRR.getGroupId()).add(compileId);
- }
- }
- Map> groupAndRegionMap2 = maatRelation.getGroupAndRegionMap();
- if (groupAndRegionMap2 != null && groupAndRegionMap2.size() > 0) {
- if (!groupAndRegionMap2.containsKey(gRR.getGroupId())) {
- Set set = new HashSet();
- set.add(gRR.getRegionId());
- groupAndRegionMap2.put(gRR.getGroupId(), set);
- } else {
- groupAndRegionMap2.get(gRR.getGroupId()).add(gRR.getRegionId());
- }
- }
-
- }
- }
- }
-
- public static MaatRelation getMaat() {
- MaatRelation maatRelation = new MaatRelation();
- Map> compileAndGroupMap = new HashMap>();
- Set list = new HashSet();
- list.add(1l);
- compileAndGroupMap.put(1l, list);
- list = new HashSet();
- list.add(1l);
- compileAndGroupMap.put(2l, list);
- Map> groupAndCompileMap = new HashMap>();
- list = new HashSet();
- list.add(1l);
- list.add(2l);
- groupAndCompileMap.put(1l, list);
- // Map> regionAndGroupMap = new HashMap>();
- Set list2 = new HashSet();
- list2.add("1");
- // regionAndGroupMap.put(1l, list);
- Map> groupAndRegionMap = new HashMap>();
- groupAndRegionMap.put(1l, list2);
- maatRelation.setCompileAndGroupMap(compileAndGroupMap);
- maatRelation.setGroupAndCompileMap(groupAndCompileMap);
- maatRelation.setGroupAndRegionMap(groupAndRegionMap);
- // maatRelation.setRegionAndGroupMap(regionAndGroupMap);
-
- return maatRelation;
- }
-
-}
diff --git a/src/main/java/com/nis/listener/CompileGroupRegionRela.java b/src/main/java/com/nis/listener/CompileGroupRegionRela.java
deleted file mode 100644
index 2efc1e7..0000000
--- a/src/main/java/com/nis/listener/CompileGroupRegionRela.java
+++ /dev/null
@@ -1,336 +0,0 @@
-package com.nis.listener;
-
-import com.nis.domain.restful.CompileAndGroupRelations;
-import com.nis.domain.restful.GroupAndRegionRelations;
-import com.nis.domain.restful.MaatRelation;
-import com.nis.util.Configurations;
-import com.nis.web.service.SpringContextHolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.context.ContextLoaderListener;
-
-import javax.servlet.ServletContextEvent;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * 项目启动时加载数据字典
- *
- * @author RenKaiGe-Office
- * @Date:2018-05-24
- */
-public class CompileGroupRegionRela extends ContextLoaderListener {
- private static Logger logger = LoggerFactory.getLogger(CompileGroupRegionRela.class);
- /**
- * 存储redis所有库中,编译分组域等配置关系,key是redis库
- */
- private static Map idRelationMap = new ConcurrentHashMap();
-
- @Override
- public void contextInitialized(ServletContextEvent event) {
- try {
- long begin = System.currentTimeMillis();
- for (int i = 0; i < Configurations.getIntProperty("maxRedisDBIndex", 6); i++) {
- RedisTemplate redisTemplate = SpringContextHolder.getBean("redisTemplate" + i);
- getAllId(redisTemplate, i);
- }
- long end = System.currentTimeMillis();
- logger.info("从redis读取数据需要" + ((end - begin) / 1000) + "秒");
- } catch (Exception e) {
- e.printStackTrace();
- }
-
-
- }
-
- private void getAllId(RedisTemplate redisTemplate, int redisDBIndex) {
- Map> groupCompileIdMap = new ConcurrentHashMap>();
- Map> groupRegionIdMap = new ConcurrentHashMap>();
- Set keySet = redisTemplate.keys("EFFECTIVE_RULE:*");
- if (keySet != null && keySet.size() > 0) {
- for (String keys : keySet) {
- if (!keys.toLowerCase().contains("compile")) {
- try {
- String value = redisTemplate.opsForValue().get(keys).toString();
- if (keys.toLowerCase().contains("group")) {
- String[] split = value.split("\t");
- String groupIdStr = split[0];
- String compileIdStr = split[1];
- if (groupCompileIdMap.containsKey(Long.valueOf(groupIdStr))) {
- groupCompileIdMap.get(Long.valueOf(groupIdStr)).add(Long.valueOf(compileIdStr));
- } else {
- Set list = new HashSet();
- list.add(Long.valueOf(compileIdStr));
- groupCompileIdMap.put(Long.valueOf(groupIdStr), list);
- }
-
- } else {
- // String[] split = value.split("\t");
- // String regionIdStr = split[0];
- // String groupIdStr = split[1];
- // if (groupRegionIdMap.containsKey(Long.valueOf(groupIdStr))) {
- // groupRegionIdMap.get(Long.valueOf(groupIdStr)).add(Long.valueOf(regionIdStr));
- // } else {
- // Set list = new HashSet();
- // list.add(Long.valueOf(regionIdStr));
- // groupRegionIdMap.put(Long.valueOf(groupIdStr), list);
- // }
- String[] split = value.split("\t");
- // String regionIdStr = split[0];
- String groupIdStr = split[1];
- if (groupRegionIdMap.containsKey(Long.valueOf(groupIdStr))) {
- groupRegionIdMap.get(Long.valueOf(groupIdStr)).add(keys);
- } else {
- Set list = new HashSet();
- list.add(keys);
- groupRegionIdMap.put(Long.valueOf(groupIdStr), list);
- }
- }
- } catch (Exception e) {
- logger.error("从redis中查询" + keys + "数据失败");
- }
- }
- }
- }
-
- for (Long groupId : groupCompileIdMap.keySet()) {
- if (idRelationMap.containsKey(redisDBIndex)) {
- Set regionIdSet = groupRegionIdMap.get(groupId);
- if (regionIdSet != null && regionIdSet.size() > 0) {// 防止出现错误数据,redis里面有域配置但是找不多对应的编译配置,分组配置,或者有分组配置但是找不到域或编译,或者有编译找不到分组和域
- MaatRelation maatRelation = idRelationMap.get(redisDBIndex);
- Map> compileAndGroupMap = maatRelation.getCompileAndGroupMap();
- Set compileIdList = groupCompileIdMap.get(groupId);
- for (Long compileId : compileIdList) {
- if (compileAndGroupMap.containsKey(compileId)) {
- compileAndGroupMap.get(compileId).add(groupId);
- } else {
- Set set = new HashSet();
- set.add(groupId);
- compileAndGroupMap.put(compileId, set);
- }
- }
- Map> groupAndCompileMap = maatRelation.getGroupAndCompileMap();
- if (groupAndCompileMap.containsKey(groupId)) {
- groupAndCompileMap.get(groupId).addAll(compileIdList);
- } else {
- groupAndCompileMap.put(groupId, compileIdList);
- }
-
- Map> groupAndRegionMap = maatRelation.getGroupAndRegionMap();
- if (groupAndRegionMap.containsKey(groupId)) {
- groupAndRegionMap.get(groupId).addAll(groupRegionIdMap.get(groupId));
- } else {
- groupAndRegionMap.put(groupId, groupRegionIdMap.get(groupId));
- }
-
- }
- } else {
- Set regionIdSet = groupRegionIdMap.get(groupId);
- if (regionIdSet != null && regionIdSet.size() > 0) {// 防止出现错误数据,redis里面有域配置但是找不多对应的编译配置,分组配置,或者有分组配置但是找不到域或编译,或者有编译找不到分组和域
- MaatRelation maatRelation = new MaatRelation();
- Map> compileAndGroupMap = new ConcurrentHashMap>();
- Set compileIdList = groupCompileIdMap.get(groupId);
- for (Long compileId : compileIdList) {
- if (compileAndGroupMap.containsKey(compileId)) {
- compileAndGroupMap.get(compileId).add(groupId);
- } else {
- Set set = new HashSet();
- set.add(groupId);
- compileAndGroupMap.put(compileId, set);
- }
- }
- maatRelation.setCompileAndGroupMap(compileAndGroupMap);
- Map> groupAndCompileMap = new ConcurrentHashMap>();
- groupAndCompileMap.put(groupId, compileIdList);
- maatRelation.setGroupAndCompileMap(groupAndCompileMap);
- Map> groupAndRegionMap = new ConcurrentHashMap>();
- groupAndRegionMap.put(groupId, groupRegionIdMap.get(groupId));
- maatRelation.setGroupAndRegionMap(groupAndRegionMap);
- idRelationMap.put(redisDBIndex, maatRelation);
- }
-
- }
- }
- }
-
- /**
- * 从字典中删除编译id的关系
- * @param redisDBIndex 哪个redis库
- * @param compileId
- */
- public static void delIdRelation(int redisDBIndex, long compileId) {
- MaatRelation maatRelation = idRelationMap.get(redisDBIndex);
- if (maatRelation != null) {
- removKey(maatRelation, compileId);
- } else {
- logger.error("redis" + redisDBIndex + "号库中没有id对应关系(没有配置),请检查redisDBIndex是否正确");
- }
- // syso(maatRelation);
-
- }
-
- private static void removKey(MaatRelation maatRelation, long compileId) {
- if (maatRelation.getCompileAndGroupMap().containsKey(compileId)) {
- Set list = maatRelation.getCompileAndGroupMap().get(compileId);
-
- if (list != null && list.size() > 0) {
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- Long groupId = iterator.next();
- if (maatRelation.getGroupAndCompileMap().containsKey(groupId)) {
- // && maatRelation.getGroupAndCompileMap().get(groupId).size() == 1
- // && maatRelation.getGroupAndCompileMap().get(groupId).get(0).longValue() ==
- // compileId) {
- Set compileIdList = maatRelation.getGroupAndCompileMap().get(groupId);
- if (compileIdList.size() == 1) {// 当前的groupid只属于当前的compileid,没有被分组复用,需要将编译配置,分组关系,域配置,置无效
- for (Long id : compileIdList) {
- if (id.longValue() == compileId) {
- // 这个group没有被分组复用,所以需要将这个组下面的域配置置为无效,组也要置为无效
- if (maatRelation.getGroupAndRegionMap().containsKey(groupId)) {
- // 把当前组置为无效,把当前组下的所有域置为无效
- maatRelation.getGroupAndRegionMap().remove(groupId);// 删除组对应的域
- maatRelation.getGroupAndCompileMap().remove(groupId);// 删除当前组所对应的编译
- // maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId);
- // maatRelation.getCompileAndGroupMap().get(compileId)
- // list.remove(maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId));//
- // 删除编译下面的组
- // list.remove(groupId);// 删除编译下面的组
- iterator.remove();// 删除编译下面的组
- }
- }
- }
- } else {
- // 这个组对应了多个编译配置被分组复用了,这时将这个组和编译的关系置为无效,编译置为无效
- // list.remove(maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId));//
- // 删除编译下面的这个组
- // maatRelation.getGroupAndCompileMap().get(groupId)
- // .remove(maatRelation.getGroupAndCompileMap().get(groupId).indexOf(compileId));//
- // 删除分组关系中的组和编译关系
- // list.remove(groupId);// 删除编译下面的这个组
- iterator.remove();// 删除编译下面的这个组
- maatRelation.getGroupAndCompileMap().get(groupId).remove(compileId);
- }
- } else {
- // 当前的groupid属于多个组,被分组复用了,所以不对这个组进行操作,也不对这个组下面的域进行操作
- }
- }
- }
-
- }
- }
-
- /**
- * 添加配置
- * @param redisDBIndex 向哪个库添加配置
- * @param compileAndGroupRelations id映射关系
- */
- public static void addIdRelation(int redisDBIndex, CompileAndGroupRelations compileAndGroupRelations) {
- MaatRelation maatRelation = idRelationMap.get(redisDBIndex);
- if (maatRelation != null) {
- addKey(maatRelation, compileAndGroupRelations);
- } else {
- maatRelation = new MaatRelation();
- addKey(maatRelation, compileAndGroupRelations);
- idRelationMap.put(redisDBIndex, maatRelation);
- }
- // syso(maatRelation);
-
- }
-
- private static void addKey(MaatRelation maatRelation, CompileAndGroupRelations compileAndGroupRelations) {
- long compileId = compileAndGroupRelations.getCompileId();
- List groupIdList = compileAndGroupRelations.getGroupIdList();
- if (groupIdList != null && groupIdList.size() > 0) {
- for (GroupAndRegionRelations gRR : groupIdList) {
- Map> compileAndGroupMap2 = maatRelation.getCompileAndGroupMap();
- if (compileAndGroupMap2 != null && compileAndGroupMap2.size() > 0) {
- if (!compileAndGroupMap2.containsKey(compileId)) {
- Set set = new HashSet();
- set.add(gRR.getGroupId());
- compileAndGroupMap2.put(compileId, set);
- } else {
- compileAndGroupMap2.get(compileId).add(gRR.getGroupId());
- }
- } else {
- Map> compileAndGroupMap = new ConcurrentHashMap>();
- Set set = new HashSet();
- set.add(gRR.getGroupId());
- compileAndGroupMap.put(compileId, set);
- maatRelation.setCompileAndGroupMap(compileAndGroupMap);
- }
-
- Map> groupAndCompileMap2 = maatRelation.getGroupAndCompileMap();
- if (groupAndCompileMap2 != null && groupAndCompileMap2.size() > 0) {
- if (!groupAndCompileMap2.containsKey(gRR.getGroupId())) {
- Set set = new HashSet();
- set.add(compileId);
- groupAndCompileMap2.put(gRR.getGroupId(), set);
- } else {
- groupAndCompileMap2.get(gRR.getGroupId()).add(compileId);
- }
- } else {
- Map> groupAndCompileMap = new ConcurrentHashMap>();
- Set set = new HashSet();
- set.add(compileId);
- groupAndCompileMap.put(gRR.getGroupId(), set);
-
- maatRelation.setGroupAndCompileMap(groupAndCompileMap);
- }
- Map> groupAndRegionMap2 = maatRelation.getGroupAndRegionMap();
- if (groupAndRegionMap2 != null && groupAndRegionMap2.size() > 0) {
- if (!groupAndRegionMap2.containsKey(gRR.getGroupId())) {
- Set set = new HashSet();
- set.add(gRR.getRegionId());
- groupAndRegionMap2.put(gRR.getGroupId(), set);
- } else {
- groupAndRegionMap2.get(gRR.getGroupId()).add(gRR.getRegionId());
- }
- } else {
- Map> groupAndRegionMap = new ConcurrentHashMap>();
- Set set = new HashSet();
- set.add(gRR.getRegionId());
- groupAndRegionMap.put(gRR.getGroupId(), set);
- maatRelation.setGroupAndRegionMap(groupAndRegionMap);
- }
- }
- }
- }
-
- public static Map getIdRelationMap() {
- return idRelationMap;
- }
-
- public static void setIdRelationMap(Map idRelationMap) {
- CompileGroupRegionRela.idRelationMap = idRelationMap;
- }
-
- private static void syso(MaatRelation maatRelation) {
- Map> getCompileAndGroupMap = maatRelation.getCompileAndGroupMap();
- for (Long compile : getCompileAndGroupMap.keySet()) {
- Set groupList = getCompileAndGroupMap.get(compile);
- for (Long group : groupList) {
- System.out.println("编译:" + compile + "组:" + group);
- }
- }
- Map> getGroupAndCompileMap = maatRelation.getGroupAndCompileMap();
- for (Long group : getGroupAndCompileMap.keySet()) {
- Set compileList = getGroupAndCompileMap.get(group);
- for (Long compile : compileList) {
- System.out.println("组:" + group + "编译:" + compile);
- }
- }
- Map> getGroupAndRegionMap = maatRelation.getGroupAndRegionMap();
- for (Long group : getGroupAndRegionMap.keySet()) {
- Set regionList = getGroupAndRegionMap.get(group);
- for (String region : regionList) {
- System.out.println("组:" + group + "域:" + region);
- }
- }
-
- System.out.println();
- System.out.println();
- System.out.println();
- System.out.println();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/nis/restful/RestBusinessCode.java b/src/main/java/com/nis/restful/RestBusinessCode.java
index 258ddce..20153c7 100644
--- a/src/main/java/com/nis/restful/RestBusinessCode.java
+++ b/src/main/java/com/nis/restful/RestBusinessCode.java
@@ -410,20 +410,7 @@ public enum RestBusinessCode {
* 当前编译配置service与域配置tableName的关系不存在
*/
TableNameUnmatchService(4002101, "当前编译配置service与域配置tableName的关系不存在"),
- /**
- * 域配置中的tableName不是分组复用的域表
- */
- TableNameUnReuse(4002102, "域配置中tableName不是分组复用的域表"),
- /**
- * 分组复用域配置下发到阀门时userRegion不能为空
- */
- ReUseUserRegionIsNull(4002102, "域配置需要下发到阀门,userRegion不能为空"),
-
- /**
- * 添加分组复用域配置时,service只能为空或1028
- */
- ReUseServiceRange(4002102, "添加分组复用域配置时,service只能为空或1028"),
-
+
/**
*数值域配置的lowBoundary值不在有效范围内
*/
@@ -478,14 +465,6 @@ public enum RestBusinessCode {
*/
CfdsLevelIsWrongRange(4002500,"摘要域-cfdsLevel的值只能是1到10"),
- /**
- * service不能为空并且必须是分组复用的业务类型
- */
- ServiceIsNullOrNotReuse(4002501, "service不能为空并且必须是分组复用的业务类型"),
- /**
- * 分组复用配置中域不能全为空
- */
- ReuseRegionIsNull(4002502, "分组复用配置中域不能全为空"),
//回调类
/**
* 回调类service配置不正确
@@ -601,11 +580,6 @@ public enum RestBusinessCode {
* 当前service不允许单独添加域配置
*/
ServiceNotAllowAddReion(5002009,"当前service不允许单独添加域配置"),
- /**
- * 删除分组复用域配置时,无法在关联关系中找到对应的域配置信息,之前该域没有添加过,或者关联关系被损坏请检查
- */
- RegionIsNotExist(5002010,"删除分组复用域配置时,无法在关联关系中找到对应的域配置信息,之前该域没有添加过,或者关联关系被损坏请检查"),
-
/**
*配置文件内容有误
diff --git a/src/main/java/com/nis/util/CompileVal.java b/src/main/java/com/nis/util/CompileVal.java
index 5a82ce3..86a5489 100644
--- a/src/main/java/com/nis/util/CompileVal.java
+++ b/src/main/java/com/nis/util/CompileVal.java
@@ -384,10 +384,6 @@ public class CompileVal {
}
}
}
-
- if (!hasRegionFlag&&!ServiceAndRDBIndexReal.serviceIsReuse(configCompile.getService())) {
- throw new RestServiceException("配置id为" + configCompile.getCompileId() + "的业务类型属于分组复用,域配置信息不能全为空",RestBusinessCode.RegionListIsNull.getValue());
- }
}
/**
diff --git a/src/main/java/com/nis/util/ServiceAndRDBIndexReal.java b/src/main/java/com/nis/util/ServiceAndRDBIndexReal.java
index 3207010..933c72a 100644
--- a/src/main/java/com/nis/util/ServiceAndRDBIndexReal.java
+++ b/src/main/java/com/nis/util/ServiceAndRDBIndexReal.java
@@ -3,12 +3,10 @@ package com.nis.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.zdjizhi.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -26,12 +24,7 @@ import com.nis.restful.ServiceRuntimeException;
*/
public class ServiceAndRDBIndexReal {
private static Logger logger = LoggerFactory.getLogger(ServiceAndRDBIndexReal.class);
- /**
- * 记录哪些service可以被分组复用(只有maat类配置可以被分组复用)
- * Map>
- */
- private static Map>> serviceGroupReuseMap = new HashMap>>();
-
+
/**
* 第一个key是业务类型,第二个key是type(编译配置,分组配置,域配置)value是表名
*/
@@ -180,33 +173,7 @@ public class ServiceAndRDBIndexReal {
}
}
}
-
- String serviceRepeatedReal = Configurations.getStringProperty("serviceRepeatedReal", "");
- if (!StringUtil.isEmpty(serviceRepeatedReal)) {
- String[] serviceRepeatedRealArr = serviceRepeatedReal.split(";");
- for (String serviceRepeated : serviceRepeatedRealArr) {
- String[] serInfos = serviceRepeated.split(":");
- String[] regionInfos = serInfos[1].split("[|]");
- for (String regionInfo : regionInfos) {
- String[] regionTabName = regionInfo.split("@");
- String[] tableNames = regionTabName[1].split(",");
- for (String tableName : tableNames) {
- Integer ser = Integer.valueOf(serInfos[0]);
- if (serviceGroupReuseMap.containsKey(ser)) {
- serviceGroupReuseMap.get(ser).get(regionTabName[0]).add(tableName);
- } else {
- Map> regTabMap = new HashMap>();
- List tabList = new ArrayList();
- tabList.add(tableName);
- regTabMap.put(regionTabName[0], tabList);
- serviceGroupReuseMap.put(ser, regTabMap);
- }
- }
- }
- }
- }
}
-
public static void main(String[] args) {
// getUnMaatTable();
getMaatTable();
@@ -349,20 +316,6 @@ public class ServiceAndRDBIndexReal {
}
- /**
- * 判断service是否被分组复用
- * @param service
- * @return
- */
- public static Boolean serviceIsReuse(Integer service) {
- if (service != null) {
- return serviceGroupReuseMap.containsKey(service);
- } else {
- throw new ServiceRuntimeException("判断service是否是分组复用时发生了异常,异常原因:service=null",
- RestBusinessCode.ServiceIsNull.getValue());
- }
- }
-
/**
* 验证当前service是否是向阀门添加action,service或者userregion等属性
* @param service
diff --git a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java
index ff12ffd..ac1ffff 100644
--- a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java
+++ b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java
@@ -545,7 +545,7 @@ public class ConfigSourcesController extends BaseRestController {
commonGroupSource.getCommonGroupList(), sb, false);
} else {
- throw new RestServiceException("分组复用信息不能为空" + sb.toString(),
+ throw new RestServiceException("公共组信息不能为空" + sb.toString(),
RestBusinessCode.ConfigSourceIsNull.getValue());
}
}
@@ -594,7 +594,7 @@ public class ConfigSourcesController extends BaseRestController {
configSourcesService.delCommonGroup(thread, start, commonGroupSource.getCommonGroupList(), sb);
} else {
- throw new RestServiceException("分组复用信息不能为空" + sb.toString(),
+ throw new RestServiceException("公共组信息不能为空" + sb.toString(),
RestBusinessCode.ConfigSourceIsNull.getValue());
}
}
@@ -659,7 +659,7 @@ public class ConfigSourcesController extends BaseRestController {
}
if (groupReuseSourceList.size() <= 0) {
- errorInfo = "分组复用的域配置列表不能为空";
+ errorInfo = "公共组的域配置列表不能为空";
}
if (!errorInfo.equals("")) {
thread.setExceptionInfo(errorInfo);
diff --git a/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java b/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java
index e1accf7..bf03307 100644
--- a/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java
+++ b/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java
@@ -188,8 +188,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (redisDBIndex >= 0 && redisDBIndex < Configurations.getIntProperty("maxRedisDBIndex", 6)) {
List maatConfigList = configMap.get(redisDBIndex);
if (maatConfigList != null && maatConfigList.size() > 0) {
- Map> compileAndGroupMap = new HashMap>();
- Map> groupAndCompileMap = new HashMap>();
+ Map> compileAndGroupMap = new HashMap>();// 记录编译下面有哪些组,在哪些redisdb中
+ Map> groupAndCompileMap = new HashMap>();// 记录每个组属于哪些编译,公共组可能会属于很多的编译redisdb中
for (MaatConfig maatConfig : maatConfigList) {
List