配置转换改为多线程转换,一个组类型一个线程;审核与更新组配置是查询配置下的所有域的查询改为多线程查询。在多个组的情况下处理速度会加快。
This commit is contained in:
@@ -10,6 +10,8 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
import com.nis.domain.FunctionServiceDict;
|
import com.nis.domain.FunctionServiceDict;
|
||||||
import com.nis.domain.basics.*;
|
import com.nis.domain.basics.*;
|
||||||
import com.nis.domain.configuration.*;
|
import com.nis.domain.configuration.*;
|
||||||
|
import com.nis.web.service.configuration.ObjGroupCfgConvert;
|
||||||
|
import com.nis.web.service.configuration.ObjectGroupService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
@@ -141,7 +143,7 @@ public class SchedulerTaskUtil {
|
|||||||
//查询子域配置详情
|
//查询子域配置详情
|
||||||
if(cfgList!=null){
|
if(cfgList!=null){
|
||||||
if(isCommonGroup){
|
if(isCommonGroup){
|
||||||
groupIdSet=new HashSet<>();
|
groupIdSet=Collections.synchronizedSet(new HashSet<Integer>());
|
||||||
commGroupMap=ConfigConvertUtil.gsonFromJson(list.get(0).getCommonGroupIds(),Map.class);
|
commGroupMap=ConfigConvertUtil.gsonFromJson(list.get(0).getCommonGroupIds(),Map.class);
|
||||||
//将组中的域设置到cfg_index_info中
|
//将组中的域设置到cfg_index_info中
|
||||||
covertCommongroupIdsMap(commGroupMap,"ipGroup",list.get(0),configSynchronizationDao,IpCommCfg.class);
|
covertCommongroupIdsMap(commGroupMap,"ipGroup",list.get(0),configSynchronizationDao,IpCommCfg.class);
|
||||||
@@ -195,10 +197,10 @@ public class SchedulerTaskUtil {
|
|||||||
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
|
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
|
||||||
entity.setAuditTime(updateTime);
|
entity.setAuditTime(updateTime);
|
||||||
for(CfgIndexInfo cfg:list){
|
for(CfgIndexInfo cfg:list){
|
||||||
groupRelationList = new ArrayList();
|
groupRelationList = Collections.synchronizedList(new ArrayList());
|
||||||
ipRegionList = new ArrayList();
|
ipRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
strRegionList = new ArrayList();
|
strRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
numRegionList = new ArrayList();
|
numRegionList =Collections.synchronizedList(new ArrayList());
|
||||||
digestRegionList = new ArrayList();
|
digestRegionList = new ArrayList();
|
||||||
areaIpRegionList = new ArrayList();
|
areaIpRegionList = new ArrayList();
|
||||||
if(StringUtils.isNotBlank(cfg.getCommonGroupIds())){//公共分组
|
if(StringUtils.isNotBlank(cfg.getCommonGroupIds())){//公共分组
|
||||||
@@ -207,45 +209,82 @@ public class SchedulerTaskUtil {
|
|||||||
userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(null,cfg.getServiceId()));
|
userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(null,cfg.getServiceId()));
|
||||||
//子配置
|
//子配置
|
||||||
Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
|
Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
|
||||||
|
//多线程转换
|
||||||
|
ObjGroupCfgConvert ipConvert=new ObjGroupCfgConvert("ipGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
ipConvert.setGroupRelationList(groupRelationList);
|
||||||
|
ipConvert.setIpRegionList(ipRegionList);
|
||||||
|
ipConvert.setNumRegionList(numRegionList);
|
||||||
|
ipConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert subscribeIdConvert=new ObjGroupCfgConvert("subscribeIdGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
subscribeIdConvert.setGroupRelationList(groupRelationList);
|
||||||
|
subscribeIdConvert.setIpRegionList(ipRegionList);
|
||||||
|
subscribeIdConvert.setNumRegionList(numRegionList);
|
||||||
|
subscribeIdConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert urlConvert=new ObjGroupCfgConvert("urlGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
urlConvert.setGroupRelationList(groupRelationList);
|
||||||
|
urlConvert.setIpRegionList(ipRegionList);
|
||||||
|
urlConvert.setNumRegionList(numRegionList);
|
||||||
|
urlConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert domainConvert=new ObjGroupCfgConvert("domainGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
domainConvert.setGroupRelationList(groupRelationList);
|
||||||
|
domainConvert.setIpRegionList(ipRegionList);
|
||||||
|
domainConvert.setNumRegionList(numRegionList);
|
||||||
|
domainConvert.setStrRegionList(strRegionList);
|
||||||
|
Thread t1=new Thread(ipConvert);
|
||||||
|
Thread t2=new Thread(subscribeIdConvert);
|
||||||
|
Thread t3=new Thread(urlConvert);
|
||||||
|
Thread t4=new Thread(domainConvert);
|
||||||
|
t1.start();
|
||||||
|
t2.start();
|
||||||
|
t3.start();
|
||||||
|
t4.start();
|
||||||
|
try {
|
||||||
|
t1.join();
|
||||||
|
t2.join();
|
||||||
|
t3.join();
|
||||||
|
t4.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("多线程join异常",e);
|
||||||
|
}
|
||||||
//IP公共分组
|
//IP公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
|
||||||
IpPortCfg _cfg = new IpPortCfg();
|
// IpPortCfg _cfg = new IpPortCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
ipRegionList=map.get("dstList");
|
// ipRegionList=map.get("dstList");
|
||||||
if(map.get("numRegionList")!=null){
|
// if(map.get("numRegionList")!=null){
|
||||||
numRegionList.addAll(map.get("numRegionList"));
|
// numRegionList.addAll(map.get("numRegionList"));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
//URL公共分组
|
//URL公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
|
||||||
CommonStringCfg _cfg = new CommonStringCfg();
|
// CommonStringCfg _cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
//账号公共分组
|
//账号公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
|
||||||
CommonStringCfg _cfg = new CommonStringCfg();
|
// CommonStringCfg _cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
|
//
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
//域名公共分组
|
//域名公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
|
||||||
CommonStringCfg _cfg = new CommonStringCfg();
|
// CommonStringCfg _cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
|
//
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
BeanUtils.copyProperties(cfg, maatCfg);
|
BeanUtils.copyProperties(cfg, maatCfg);
|
||||||
if(cfg.getServiceId().equals(512)){
|
if(cfg.getServiceId().equals(512)){
|
||||||
maatCfg.setAction(2);
|
maatCfg.setAction(2);
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ package com.nis.web.controller.configuration;
|
|||||||
|
|
||||||
import com.nis.domain.FunctionServiceDict;
|
import com.nis.domain.FunctionServiceDict;
|
||||||
import com.nis.domain.Page;
|
import com.nis.domain.Page;
|
||||||
|
import com.nis.domain.SysDataDictionaryItem;
|
||||||
import com.nis.domain.basics.PolicyGroupInfo;
|
import com.nis.domain.basics.PolicyGroupInfo;
|
||||||
import com.nis.domain.configuration.BaseCfg;
|
import com.nis.domain.configuration.BaseCfg;
|
||||||
import com.nis.domain.configuration.CfgIndexInfo;
|
import com.nis.domain.configuration.CfgIndexInfo;
|
||||||
import com.nis.domain.configuration.ObjGroupCfg;
|
import com.nis.domain.configuration.ObjGroupCfg;
|
||||||
|
import com.nis.domain.specific.SpecificServiceCfg;
|
||||||
import com.nis.exceptions.CallExternalProceduresException;
|
import com.nis.exceptions.CallExternalProceduresException;
|
||||||
import com.nis.exceptions.MaatConvertException;
|
import com.nis.exceptions.MaatConvertException;
|
||||||
import com.nis.util.*;
|
import com.nis.util.*;
|
||||||
|
|||||||
@@ -454,7 +454,7 @@
|
|||||||
AND r.group_id in(${commonGroupIds})
|
AND r.group_id in(${commonGroupIds})
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${sqlMap.dsf}
|
<!--${sqlMap.dsf}-->
|
||||||
</trim>
|
</trim>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -642,7 +642,7 @@
|
|||||||
AND r.group_id in(${commonGroupIds})
|
AND r.group_id in(${commonGroupIds})
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${sqlMap.dsf}
|
<!-- ${sqlMap.dsf} -->
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -725,4 +725,4 @@
|
|||||||
delete from ip_comm_cfg where group_id in (${groupIds})
|
delete from ip_comm_cfg where group_id in (${groupIds})
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -454,7 +454,7 @@
|
|||||||
AND r.group_id in(${commonGroupIds})
|
AND r.group_id in(${commonGroupIds})
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${sqlMap.dsf}
|
<!-- ${sqlMap.dsf}-->
|
||||||
</trim>
|
</trim>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@@ -522,4 +522,4 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -466,7 +466,7 @@
|
|||||||
AND r.group_id in(${commonGroupIds})
|
AND r.group_id in(${commonGroupIds})
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据范围过滤 -->
|
<!-- 数据范围过滤 -->
|
||||||
${sqlMap.dsf}
|
<!--${sqlMap.dsf}-->
|
||||||
</trim>
|
</trim>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -8,22 +8,17 @@ import java.math.BigDecimal;
|
|||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.concurrent.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import com.nis.domain.basics.*;
|
import com.nis.domain.basics.*;
|
||||||
import com.nis.domain.configuration.*;
|
import com.nis.domain.configuration.*;
|
||||||
import com.nis.util.*;
|
import com.nis.util.*;
|
||||||
import com.nis.web.dao.CrudDao;
|
import com.nis.web.dao.CrudDao;
|
||||||
import com.nis.web.dao.basics.*;
|
import com.nis.web.dao.basics.*;
|
||||||
import com.nis.web.dao.configuration.*;
|
import com.nis.web.dao.configuration.*;
|
||||||
|
import com.nis.web.service.configuration.ObjGroupCfgConvert;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
@@ -3379,23 +3374,56 @@ public abstract class BaseService {
|
|||||||
Integer serviceId=cfgIndexInfo.getServiceId();
|
Integer serviceId=cfgIndexInfo.getServiceId();
|
||||||
if(serviceId!=null&&StringUtils.isNotBlank(cfgIndexInfo.getCommonGroupIds())){
|
if(serviceId!=null&&StringUtils.isNotBlank(cfgIndexInfo.getCommonGroupIds())){
|
||||||
MaatCfg maatCfg = new MaatCfg();
|
MaatCfg maatCfg = new MaatCfg();
|
||||||
Set<Integer> groupIdSet=new HashSet<>();
|
Set<Integer> groupIdSet=Collections.synchronizedSet(new HashSet<Integer>());
|
||||||
List<MaatCfg> configCompileList = new ArrayList();
|
List<MaatCfg> configCompileList = new ArrayList();
|
||||||
List<MaatCfg> cancelConfigCompileList = new ArrayList();
|
List<MaatCfg> cancelConfigCompileList = new ArrayList();
|
||||||
List<GroupCfg> groupRelationList = new ArrayList();
|
List<GroupCfg> groupRelationList = Collections.synchronizedList(new ArrayList());
|
||||||
List<IpCfg> ipRegionList = new ArrayList();
|
List<IpCfg> ipRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
List<StringCfg> strRegionList = new ArrayList();
|
List<StringCfg> strRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
List<NumBoundaryCfg> numRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
List<DigestCfg> digestRegionList = new ArrayList();
|
List<DigestCfg> digestRegionList = new ArrayList();
|
||||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||||
Map<String,Object> userRgionMap=gsonFromJson(cfgIndexInfo.getCommonGroupIds(),Map.class);
|
Map<String,Object> userRgionMap=gsonFromJson(cfgIndexInfo.getCommonGroupIds(),Map.class);
|
||||||
cfgIndexInfo.setUserRegion(userRgionMap);
|
cfgIndexInfo.setUserRegion(userRgionMap);
|
||||||
String oldCommonGroupIds=cfgIndexInfo.getCommonGroupIds();
|
String oldCommonGroupIds=cfgIndexInfo.getCommonGroupIds();
|
||||||
//将所有要从配置中删除的组从配置中删除
|
//将所有要从配置中删除的组从配置中删除
|
||||||
this.processUserRegionMap(userRgionMap,"ipGroup",ipDeletedGroups,cfgIndexInfo,ipCommGroupCfgDao,IpCommCfg.class);
|
IpCommCfg ipCommCfg=(IpCommCfg)this.processUserRegionMap(userRgionMap,"ipGroup",ipDeletedGroups,cfgIndexInfo,ipCommGroupCfgDao,IpCommCfg.class);
|
||||||
this.processUserRegionMap(userRgionMap,"urlGroup",urlDeletedGroups,cfgIndexInfo,urlCommGroupCfgDao,UrlCommCfg.class);
|
UrlCommCfg urlCommCfg=(UrlCommCfg)this.processUserRegionMap(userRgionMap,"urlGroup",urlDeletedGroups,cfgIndexInfo,urlCommGroupCfgDao,UrlCommCfg.class);
|
||||||
this.processUserRegionMap(userRgionMap,"subscribeIdGroup",subIdDeletedGroups,cfgIndexInfo,scriberIdCommGroupDao,ScriberIdCommCfg.class);
|
ScriberIdCommCfg scriberIdCommCfg=(ScriberIdCommCfg)this.processUserRegionMap(userRgionMap,"subscribeIdGroup",subIdDeletedGroups,cfgIndexInfo,scriberIdCommGroupDao,ScriberIdCommCfg.class);
|
||||||
this.processUserRegionMap(userRgionMap,"domainGroup",domainDeletedGroups,cfgIndexInfo,domainCommGroupDao,DomainCommCfg.class);
|
DomainCommCfg domainCommCfg=(DomainCommCfg)this.processUserRegionMap(userRgionMap,"domainGroup",domainDeletedGroups,cfgIndexInfo,domainCommGroupDao,DomainCommCfg.class);
|
||||||
|
ExecutorService executorService= Executors.newFixedThreadPool(4);
|
||||||
|
Future<List<IpCommCfg>> ipCommCfgF= executorService.submit(new ProcessUserRegionMapThread<IpCommCfg>(ipCommCfg,ipCommGroupCfgDao));
|
||||||
|
Future<List<UrlCommCfg>> urlCommCfgF=executorService.submit(new ProcessUserRegionMapThread<UrlCommCfg>(urlCommCfg,urlCommGroupCfgDao));
|
||||||
|
Future<List<ScriberIdCommCfg>> scriberIdCommCfgF=executorService.submit(new ProcessUserRegionMapThread<ScriberIdCommCfg>(scriberIdCommCfg,scriberIdCommGroupDao));
|
||||||
|
Future<List<DomainCommCfg>> domainCommCfgF=executorService.submit(new ProcessUserRegionMapThread<DomainCommCfg>(domainCommCfg,domainCommGroupDao));
|
||||||
|
executorService.shutdown();
|
||||||
|
while(!executorService.isTerminated()){
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(1);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("error occured while sleeping",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
List<IpCommCfg> ipCommCfgList=ipCommCfgF.get();
|
||||||
|
if(CollectionUtils.isNotEmpty(ipCommCfgList)){
|
||||||
|
cfgIndexInfo.setIpCommGroupCfgList(ipCommCfgList);
|
||||||
|
}
|
||||||
|
List<UrlCommCfg> urlCommCfgList=urlCommCfgF.get();
|
||||||
|
if(CollectionUtils.isNotEmpty(urlCommCfgList)){
|
||||||
|
cfgIndexInfo.setUrlCommGroupList(urlCommCfgList);
|
||||||
|
}
|
||||||
|
List<ScriberIdCommCfg> scriberIdCommCfgList=scriberIdCommCfgF.get();
|
||||||
|
if(CollectionUtils.isNotEmpty(scriberIdCommCfgList)){
|
||||||
|
cfgIndexInfo.setScriberIdCommGroupList(scriberIdCommCfgList);
|
||||||
|
}
|
||||||
|
List<DomainCommCfg> domainCommCfgList=domainCommCfgF.get();
|
||||||
|
if(CollectionUtils.isNotEmpty(domainCommCfgList)){
|
||||||
|
cfgIndexInfo.setDomainCommGroupList(domainCommCfgList);
|
||||||
|
}
|
||||||
|
} catch (InterruptedException |ExecutionException e) {
|
||||||
|
logger.error("error occured while future get",e);
|
||||||
|
}
|
||||||
|
|
||||||
//需要更新的组,组可能增加了,可能减少了,也有可能清空了(所有的域全删了)
|
//需要更新的组,组可能增加了,可能减少了,也有可能清空了(所有的域全删了)
|
||||||
cfgIndexInfo.setCommonGroupIds(gsonToJson(userRgionMap));
|
cfgIndexInfo.setCommonGroupIds(gsonToJson(userRgionMap));
|
||||||
@@ -3457,47 +3485,84 @@ public abstract class BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileIds.add(cfgIndexInfo.getCompileId());
|
compileIds.add(cfgIndexInfo.getCompileId());
|
||||||
|
//多线程转换配置
|
||||||
|
ObjGroupCfgConvert ipConvert=new ObjGroupCfgConvert("ipGroup",cfgIndexInfo,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
ipConvert.setGroupRelationList(groupRelationList);
|
||||||
|
ipConvert.setIpRegionList(ipRegionList);
|
||||||
|
ipConvert.setNumRegionList(numRegionList);
|
||||||
|
ipConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert subscribeIdConvert=new ObjGroupCfgConvert("subscribeIdGroup",cfgIndexInfo,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
subscribeIdConvert.setGroupRelationList(groupRelationList);
|
||||||
|
subscribeIdConvert.setIpRegionList(ipRegionList);
|
||||||
|
subscribeIdConvert.setNumRegionList(numRegionList);
|
||||||
|
subscribeIdConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert urlConvert=new ObjGroupCfgConvert("urlGroup",cfgIndexInfo,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
urlConvert.setGroupRelationList(groupRelationList);
|
||||||
|
urlConvert.setIpRegionList(ipRegionList);
|
||||||
|
urlConvert.setNumRegionList(numRegionList);
|
||||||
|
urlConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert domainConvert=new ObjGroupCfgConvert("domainGroup",cfgIndexInfo,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
domainConvert.setGroupRelationList(groupRelationList);
|
||||||
|
domainConvert.setIpRegionList(ipRegionList);
|
||||||
|
domainConvert.setNumRegionList(numRegionList);
|
||||||
|
domainConvert.setStrRegionList(strRegionList);
|
||||||
|
Thread t1=new Thread(ipConvert);
|
||||||
|
Thread t2=new Thread(subscribeIdConvert);
|
||||||
|
Thread t3=new Thread(urlConvert);
|
||||||
|
Thread t4=new Thread(domainConvert);
|
||||||
|
t1.start();
|
||||||
|
t2.start();
|
||||||
|
t3.start();
|
||||||
|
t4.start();
|
||||||
|
try {
|
||||||
|
t1.join();
|
||||||
|
t2.join();
|
||||||
|
t3.join();
|
||||||
|
t4.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("多线程join异常",e);
|
||||||
|
}
|
||||||
//子表
|
//子表
|
||||||
//IP公共分组
|
//IP公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getIpCommGroupCfgList())){
|
// if(CollectionUtils.isNotEmpty(cfgIndexInfo.getIpCommGroupCfgList())){
|
||||||
IpPortCfg cfg = new IpPortCfg();
|
// IpPortCfg cfg = new IpPortCfg();
|
||||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfgIndexInfo.getIpCommGroupCfgList(),1,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfgIndexInfo.getIpCommGroupCfgList(),1,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
ipRegionList=map.get("dstList");
|
// ipRegionList=map.get("dstList");
|
||||||
if(map.get("numRegionList")!=null){
|
// if(map.get("numRegionList")!=null){
|
||||||
numRegionList.addAll(map.get("numRegionList"));
|
// numRegionList.addAll(map.get("numRegionList"));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
//URL公共分组
|
//URL公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getUrlCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfgIndexInfo.getUrlCommGroupList())){
|
||||||
CommonStringCfg cfg = new CommonStringCfg();
|
// CommonStringCfg cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getUrlCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getUrlCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
//账号公共分组
|
//账号公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getScriberIdCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfgIndexInfo.getScriberIdCommGroupList())){
|
||||||
CommonStringCfg cfg = new CommonStringCfg();
|
// CommonStringCfg cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||||
|
//
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getScriberIdCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getScriberIdCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
//域名公共分组
|
//域名公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfgIndexInfo.getDomainCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfgIndexInfo.getDomainCommGroupList())){
|
||||||
CommonStringCfg cfg = new CommonStringCfg();
|
// CommonStringCfg cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId"});
|
||||||
|
//
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getDomainCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getDomainCommGroupList(),2,cfgIndexInfo,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
//构造提交综合服务参数格式
|
//构造提交综合服务参数格式
|
||||||
maatCfg.initDefaultValue();
|
maatCfg.initDefaultValue();
|
||||||
BeanUtils.copyProperties(cfgIndexInfo, maatCfg);
|
BeanUtils.copyProperties(cfgIndexInfo, maatCfg);
|
||||||
@@ -3594,7 +3659,12 @@ public abstract class BaseService {
|
|||||||
if(CollectionUtils.isNotEmpty(maatBean.getConfigCompileList())){
|
if(CollectionUtils.isNotEmpty(maatBean.getConfigCompileList())){
|
||||||
//调用服务接口下发配置数据
|
//调用服务接口下发配置数据
|
||||||
String json=gsonToJson(maatBean);
|
String json=gsonToJson(maatBean);
|
||||||
logger.info("策略对象组下发配置参数:"+json);
|
if(json.length()<Constants.JSON_PRINT_LENTH) {
|
||||||
|
logger.info("策略对象组下发配置参数:" + json);
|
||||||
|
}else{
|
||||||
|
logger.info("策略对象组下发配置内容超过"+Constants.JSON_PRINT_LENTH+",不打印");
|
||||||
|
// FileUtils.writeToFile("D:\\send.json",json,false);
|
||||||
|
}
|
||||||
//调用服务接口下发配置
|
//调用服务接口下发配置
|
||||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||||
logger.info("策略对象组下发响应信息:"+result.getMsg());
|
logger.info("策略对象组下发响应信息:"+result.getMsg());
|
||||||
@@ -3602,7 +3672,7 @@ public abstract class BaseService {
|
|||||||
//commonPolicyDao.auditCfgBatch(CfgIndexInfo.getTablename(),auditCfg,compileIds,null);
|
//commonPolicyDao.auditCfgBatch(CfgIndexInfo.getTablename(),auditCfg,compileIds,null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
private void processUserRegionMap(Map<String,Object> userRgionMap, String key, Set deletedGroups, CfgIndexInfo cfgIndexInfo, CrudDao dao,Class clazz) {
|
private BaseCfg processUserRegionMap(Map<String,Object> userRgionMap, String key, Set deletedGroups, CfgIndexInfo cfgIndexInfo, CrudDao dao,Class clazz) {
|
||||||
if(userRgionMap.containsKey(key)){
|
if(userRgionMap.containsKey(key)){
|
||||||
//排除删除的组,添加新的组
|
//排除删除的组,添加新的组
|
||||||
for(String urlGroup:((String)userRgionMap.get(key)).split(",")){
|
for(String urlGroup:((String)userRgionMap.get(key)).split(",")){
|
||||||
@@ -3620,35 +3690,56 @@ public abstract class BaseService {
|
|||||||
if("IpCommCfg".equals(clazz.getSimpleName())){
|
if("IpCommCfg".equals(clazz.getSimpleName())){
|
||||||
IpCommCfg searchCfg=new IpCommCfg();
|
IpCommCfg searchCfg=new IpCommCfg();
|
||||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||||
List commCfgs=dao.findAllList(searchCfg);
|
//searchCfg.getSqlMap().put("dsf", configScopeFilter(UserUtils.getUser(),"r"));
|
||||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
return searchCfg;
|
||||||
cfgIndexInfo.setIpCommGroupCfgList(commCfgs);
|
// List commCfgs=dao.findAllList(searchCfg);
|
||||||
}
|
// if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||||
|
// cfgIndexInfo.setIpCommGroupCfgList(commCfgs);
|
||||||
|
// }
|
||||||
}else if("ScriberIdCommCfg".equals(clazz.getSimpleName()) ){
|
}else if("ScriberIdCommCfg".equals(clazz.getSimpleName()) ){
|
||||||
ScriberIdCommCfg searchCfg=new ScriberIdCommCfg();
|
ScriberIdCommCfg searchCfg=new ScriberIdCommCfg();
|
||||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||||
List commCfgs=dao.findAllList(searchCfg);
|
//searchCfg.getSqlMap().put("dsf", configScopeFilter(UserUtils.getUser(),"r"));
|
||||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
return searchCfg;
|
||||||
cfgIndexInfo.setScriberIdCommGroupList(commCfgs);
|
// List commCfgs=dao.findAllList(searchCfg);
|
||||||
}
|
// if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||||
|
// cfgIndexInfo.setScriberIdCommGroupList(commCfgs);
|
||||||
|
// }
|
||||||
}else if("UrlCommCfg".equals(clazz.getSimpleName())){
|
}else if("UrlCommCfg".equals(clazz.getSimpleName())){
|
||||||
UrlCommCfg searchCfg=new UrlCommCfg();
|
UrlCommCfg searchCfg=new UrlCommCfg();
|
||||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||||
List commCfgs=dao.findAllList(searchCfg);
|
//searchCfg.getSqlMap().put("dsf", configScopeFilter(UserUtils.getUser(),"r"));
|
||||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
return searchCfg;
|
||||||
cfgIndexInfo.setUrlCommGroupList(commCfgs);
|
// List commCfgs=dao.findAllList(searchCfg);
|
||||||
}
|
// if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||||
|
// cfgIndexInfo.setUrlCommGroupList(commCfgs);
|
||||||
|
// }
|
||||||
}else if("DomainCommCfg".equals(clazz.getSimpleName())){
|
}else if("DomainCommCfg".equals(clazz.getSimpleName())){
|
||||||
DomainCommCfg searchCfg=new DomainCommCfg();
|
DomainCommCfg searchCfg=new DomainCommCfg();
|
||||||
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
searchCfg.setCommonGroupIds(userRgionMap.get(key).toString().substring(1,userRgionMap.get(key).toString().length()-1));
|
||||||
List commCfgs=dao.findAllList(searchCfg);
|
//searchCfg.getSqlMap().put("dsf", configScopeFilter(UserUtils.getUser(),"r"));
|
||||||
if(CollectionUtils.isNotEmpty(commCfgs)){
|
return searchCfg;
|
||||||
cfgIndexInfo.setDomainCommGroupList(commCfgs);
|
// List commCfgs=dao.findAllList(searchCfg);
|
||||||
}
|
// if(CollectionUtils.isNotEmpty(commCfgs)){
|
||||||
|
// cfgIndexInfo.setDomainCommGroupList(commCfgs);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class ProcessUserRegionMapThread<T extends BaseCfg> implements Callable<List<T>> {
|
||||||
|
private T searchCfg;
|
||||||
|
private CrudDao dao;
|
||||||
|
public ProcessUserRegionMapThread(T searchCfg, CrudDao dao){
|
||||||
|
this.searchCfg=searchCfg;
|
||||||
|
this.dao=dao;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<T> call() throws Exception {
|
||||||
|
List<T> commCfgs=dao.findAllList(searchCfg);
|
||||||
|
return commCfgs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2430,55 +2430,100 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
List<Map<String,Object>> cfgList=(List<Map<String,Object>>)cfgMap.get(cfg.getServiceId());
|
List<Map<String,Object>> cfgList=(List<Map<String,Object>>)cfgMap.get(cfg.getServiceId());
|
||||||
Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
|
Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
|
||||||
Set<Integer> groupIdSet=new HashSet<>();
|
Set<Integer> groupIdSet=new HashSet<>();
|
||||||
|
//多线程转换配置
|
||||||
|
ObjGroupCfgConvert ipConvert=new ObjGroupCfgConvert("ipGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
ipConvert.setGroupRelationList(groupRelationList);
|
||||||
|
ipConvert.setIpRegionList(ipRegionList);
|
||||||
|
ipConvert.setNumRegionList(numRegionList);
|
||||||
|
ipConvert.setStrRegionList(strRegionList);
|
||||||
|
ipConvert.setIsValid(entity.getIsValid());
|
||||||
|
ipConvert.setAuditTime(entity.getAuditTime());
|
||||||
|
ObjGroupCfgConvert subscribeIdConvert=new ObjGroupCfgConvert("subscribeIdGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
subscribeIdConvert.setGroupRelationList(groupRelationList);
|
||||||
|
subscribeIdConvert.setIpRegionList(ipRegionList);
|
||||||
|
subscribeIdConvert.setNumRegionList(numRegionList);
|
||||||
|
subscribeIdConvert.setStrRegionList(strRegionList);
|
||||||
|
subscribeIdConvert.setIsValid(entity.getIsValid());
|
||||||
|
subscribeIdConvert.setAuditTime(entity.getAuditTime());
|
||||||
|
ObjGroupCfgConvert urlConvert=new ObjGroupCfgConvert("urlGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
urlConvert.setGroupRelationList(groupRelationList);
|
||||||
|
urlConvert.setIpRegionList(ipRegionList);
|
||||||
|
urlConvert.setNumRegionList(numRegionList);
|
||||||
|
urlConvert.setStrRegionList(strRegionList);
|
||||||
|
urlConvert.setIsValid(entity.getIsValid());
|
||||||
|
urlConvert.setAuditTime(entity.getAuditTime());
|
||||||
|
ObjGroupCfgConvert domainConvert=new ObjGroupCfgConvert("domainGroup",cfg,1,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
domainConvert.setGroupRelationList(groupRelationList);
|
||||||
|
domainConvert.setIpRegionList(ipRegionList);
|
||||||
|
domainConvert.setNumRegionList(numRegionList);
|
||||||
|
domainConvert.setStrRegionList(strRegionList);
|
||||||
|
domainConvert.setIsValid(entity.getIsValid());
|
||||||
|
domainConvert.setAuditTime(entity.getAuditTime());
|
||||||
|
Thread t1=new Thread(ipConvert);
|
||||||
|
Thread t2=new Thread(subscribeIdConvert);
|
||||||
|
Thread t3=new Thread(urlConvert);
|
||||||
|
Thread t4=new Thread(domainConvert);
|
||||||
|
t1.start();
|
||||||
|
t2.start();
|
||||||
|
t3.start();
|
||||||
|
t4.start();
|
||||||
|
try {
|
||||||
|
t1.join();
|
||||||
|
t2.join();
|
||||||
|
t3.join();
|
||||||
|
t4.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("多线程join异常",e);
|
||||||
|
}
|
||||||
//IP公共分组
|
//IP公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
|
||||||
IpPortCfg _cfg = new IpPortCfg();
|
// IpPortCfg _cfg = new IpPortCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
||||||
_cfg.setIsValid(entity.getIsValid());
|
// _cfg.setIsValid(entity.getIsValid());
|
||||||
_cfg.setIsAudit(entity.getIsAudit());
|
// _cfg.setIsAudit(entity.getIsAudit());
|
||||||
_cfg.setAuditTime(entity.getAuditTime());
|
// _cfg.setAuditTime(entity.getAuditTime());
|
||||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
ipRegionList=map.get("dstList");
|
// ipRegionList=map.get("dstList");
|
||||||
if(map.get("numRegionList")!=null){
|
// if(map.get("numRegionList")!=null){
|
||||||
numRegionList.addAll(map.get("numRegionList"));
|
// numRegionList.addAll(map.get("numRegionList"));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
//URL公共分组
|
//URL公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
|
||||||
CommonStringCfg _cfg = new CommonStringCfg();
|
// CommonStringCfg _cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
||||||
_cfg.setIsValid(entity.getIsValid());
|
// _cfg.setIsValid(entity.getIsValid());
|
||||||
_cfg.setIsAudit(entity.getIsAudit());
|
// _cfg.setIsAudit(entity.getIsAudit());
|
||||||
_cfg.setAuditTime(entity.getAuditTime());
|
// _cfg.setAuditTime(entity.getAuditTime());
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
//账号公共分组
|
//账号公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
|
||||||
CommonStringCfg _cfg = new CommonStringCfg();
|
// CommonStringCfg _cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId"});
|
||||||
_cfg.setIsValid(entity.getIsValid());
|
// _cfg.setIsValid(entity.getIsValid());
|
||||||
_cfg.setIsAudit(entity.getIsAudit());
|
// _cfg.setIsAudit(entity.getIsAudit());
|
||||||
_cfg.setAuditTime(entity.getAuditTime());
|
// _cfg.setAuditTime(entity.getAuditTime());
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
//域名公共分组
|
//域名公共分组
|
||||||
if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
|
||||||
CommonStringCfg _cfg = new CommonStringCfg();
|
// CommonStringCfg _cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId",});
|
// BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId",});
|
||||||
_cfg.setIsValid(entity.getIsValid());
|
// _cfg.setIsValid(entity.getIsValid());
|
||||||
_cfg.setIsAudit(entity.getIsAudit());
|
// _cfg.setIsAudit(entity.getIsAudit());
|
||||||
_cfg.setAuditTime(entity.getAuditTime());
|
// _cfg.setAuditTime(entity.getAuditTime());
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
BeanUtils.copyProperties(cfg, maatCfg);
|
BeanUtils.copyProperties(cfg, maatCfg);
|
||||||
if(cfg.getServiceId().equals(512)){
|
if(cfg.getServiceId().equals(512)){
|
||||||
maatCfg.setAction(2);
|
maatCfg.setAction(2);
|
||||||
@@ -2514,6 +2559,7 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
//调用服务接口下发配置数据
|
//调用服务接口下发配置数据
|
||||||
if(isUpdateCfg) {
|
if(isUpdateCfg) {
|
||||||
//logger.info("配置批量下发:"+json);
|
//logger.info("配置批量下发:"+json);
|
||||||
|
// FileUtils.writeToFile("D:\\send.json",json,false);
|
||||||
//调用服务接口同步回调类配置
|
//调用服务接口同步回调类配置
|
||||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||||
if(result!=null){
|
if(result!=null){
|
||||||
|
|||||||
@@ -0,0 +1,159 @@
|
|||||||
|
package com.nis.web.service.configuration;
|
||||||
|
|
||||||
|
import com.nis.domain.FunctionServiceDict;
|
||||||
|
import com.nis.domain.configuration.CfgIndexInfo;
|
||||||
|
import com.nis.domain.configuration.CommonStringCfg;
|
||||||
|
import com.nis.domain.configuration.IpPortCfg;
|
||||||
|
import com.nis.domain.maat.MaatCfg;
|
||||||
|
import com.nis.util.ConfigConvertUtil;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class ObjGroupCfgConvert implements Runnable{
|
||||||
|
private CfgIndexInfo cfgIndexInfo;
|
||||||
|
private Integer isAudit;
|
||||||
|
private Map<Integer, FunctionServiceDict> serviceDictMap;
|
||||||
|
private Set<Integer> groupIdSet;
|
||||||
|
private List<MaatCfg.GroupCfg> groupRelationList;
|
||||||
|
private List<MaatCfg.IpCfg> ipRegionList;
|
||||||
|
private List<MaatCfg.StringCfg> strRegionList;
|
||||||
|
private List<MaatCfg.NumBoundaryCfg> numRegionList;
|
||||||
|
private Map<String,Object> maatTableMap;
|
||||||
|
private String groupName;
|
||||||
|
private Integer isValid;
|
||||||
|
private Date auditTime;
|
||||||
|
public ObjGroupCfgConvert(String groupName,CfgIndexInfo cfgIndexInfo,Integer isAudit,Map<Integer,FunctionServiceDict> serviceDictMap,Map<String,Object> maatTableMap,Set<Integer> groupIdSet){
|
||||||
|
this.cfgIndexInfo=cfgIndexInfo;
|
||||||
|
this.isAudit=isAudit;
|
||||||
|
this.serviceDictMap=serviceDictMap;
|
||||||
|
this.groupIdSet=groupIdSet;
|
||||||
|
this.groupName=groupName;
|
||||||
|
this.maatTableMap=maatTableMap;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//IP公共分组
|
||||||
|
if("ipGroup".equalsIgnoreCase(groupName)&& CollectionUtils.isNotEmpty(cfgIndexInfo.getIpCommGroupCfgList())){
|
||||||
|
IpPortCfg cfg = new IpPortCfg();
|
||||||
|
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
|
if(isValid!=null){
|
||||||
|
cfg.setIsValid(isValid);
|
||||||
|
}
|
||||||
|
cfg.setIsAudit(isAudit);
|
||||||
|
if(auditTime!=null){
|
||||||
|
cfg.setAuditTime(auditTime);
|
||||||
|
}
|
||||||
|
if(isAudit==1){
|
||||||
|
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfgIndexInfo.getIpCommGroupCfgList(),1,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
|
groupRelationList=map.get("groupList");
|
||||||
|
ipRegionList=map.get("dstList");
|
||||||
|
if(map.get("numRegionList")!=null){
|
||||||
|
numRegionList.addAll(map.get("numRegionList"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if("urlGroup".equalsIgnoreCase(groupName)&&CollectionUtils.isNotEmpty(cfgIndexInfo.getUrlCommGroupList())){
|
||||||
|
CommonStringCfg cfg = new CommonStringCfg();
|
||||||
|
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
|
if(isValid!=null){
|
||||||
|
cfg.setIsValid(isValid);
|
||||||
|
}
|
||||||
|
cfg.setIsAudit(isAudit);
|
||||||
|
if(auditTime!=null){
|
||||||
|
cfg.setAuditTime(auditTime);
|
||||||
|
}
|
||||||
|
if(isAudit==1){
|
||||||
|
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getUrlCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
|
groupRelationList=map.get("groupList");
|
||||||
|
strRegionList=map.get("dstList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//账号公共分组
|
||||||
|
if("subscribeIdGroup".equalsIgnoreCase(groupName)&&CollectionUtils.isNotEmpty(cfgIndexInfo.getScriberIdCommGroupList())){
|
||||||
|
CommonStringCfg cfg = new CommonStringCfg();
|
||||||
|
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
|
if(isValid!=null){
|
||||||
|
cfg.setIsValid(isValid);
|
||||||
|
}
|
||||||
|
cfg.setIsAudit(isAudit);
|
||||||
|
if(auditTime!=null){
|
||||||
|
cfg.setAuditTime(auditTime);
|
||||||
|
}
|
||||||
|
if(isAudit==1){
|
||||||
|
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getScriberIdCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
|
groupRelationList=map.get("groupList");
|
||||||
|
strRegionList=map.get("dstList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//域名公共分组
|
||||||
|
if("domainGroup".equalsIgnoreCase(groupName)&&CollectionUtils.isNotEmpty(cfgIndexInfo.getDomainCommGroupList())){
|
||||||
|
CommonStringCfg cfg = new CommonStringCfg();
|
||||||
|
BeanUtils.copyProperties(cfgIndexInfo, cfg, new String[]{"cfgId","menuNameCode"});
|
||||||
|
if(isValid!=null){
|
||||||
|
cfg.setIsValid(isValid);
|
||||||
|
}
|
||||||
|
cfg.setIsAudit(isAudit);
|
||||||
|
if(auditTime!=null){
|
||||||
|
cfg.setAuditTime(auditTime);
|
||||||
|
}
|
||||||
|
if(isAudit==1){
|
||||||
|
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfgIndexInfo.getDomainCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
|
groupRelationList=map.get("groupList");
|
||||||
|
strRegionList=map.get("dstList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MaatCfg.GroupCfg> getGroupRelationList() {
|
||||||
|
return groupRelationList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupRelationList(List<MaatCfg.GroupCfg> groupRelationList) {
|
||||||
|
this.groupRelationList = groupRelationList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MaatCfg.IpCfg> getIpRegionList() {
|
||||||
|
return ipRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIpRegionList(List<MaatCfg.IpCfg> ipRegionList) {
|
||||||
|
this.ipRegionList = ipRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MaatCfg.StringCfg> getStrRegionList() {
|
||||||
|
return strRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStrRegionList(List<MaatCfg.StringCfg> strRegionList) {
|
||||||
|
this.strRegionList = strRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MaatCfg.NumBoundaryCfg> getNumRegionList() {
|
||||||
|
return numRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumRegionList(List<MaatCfg.NumBoundaryCfg> numRegionList) {
|
||||||
|
this.numRegionList = numRegionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsValid() {
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsValid(Integer isValid) {
|
||||||
|
this.isValid = isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getAuditTime() {
|
||||||
|
return auditTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuditTime(Date auditTime) {
|
||||||
|
this.auditTime = auditTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,8 +16,6 @@ import com.nis.web.dao.configuration.CommonPolicyDao;
|
|||||||
import com.nis.web.dao.configuration.ObjectGroupDao;
|
import com.nis.web.dao.configuration.ObjectGroupDao;
|
||||||
import com.nis.web.security.UserUtils;
|
import com.nis.web.security.UserUtils;
|
||||||
import com.nis.web.service.BaseService;
|
import com.nis.web.service.BaseService;
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -339,8 +337,38 @@ public class ObjectGroupService extends BaseService {
|
|||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
public CfgIndexInfo getObjGroupPolicyMultyThread(Long cfgId){
|
||||||
|
CfgIndexInfo entity = commonPolicyDao.getPolicyById(cfgId);
|
||||||
|
entity.setUserRegion((Map<String,Object>)this.gsonFromJson(entity.getCommonGroupIds(),Map.class));
|
||||||
|
GetSubBeanThread GetSubBeanThread1=new GetSubBeanThread(entity,"ipGroup");
|
||||||
|
GetSubBeanThread GetSubBeanThread2=new GetSubBeanThread(entity,"subscribeIdGroup");
|
||||||
|
GetSubBeanThread GetSubBeanThread3=new GetSubBeanThread(entity,"domainGroup");
|
||||||
|
GetSubBeanThread GetSubBeanThread4=new GetSubBeanThread(entity,"urlGroup");
|
||||||
|
GetSubBeanThread1.setObjectGroupDao(objectGroupDao);
|
||||||
|
GetSubBeanThread2.setObjectGroupDao(objectGroupDao);
|
||||||
|
GetSubBeanThread3.setObjectGroupDao(objectGroupDao);
|
||||||
|
GetSubBeanThread4.setObjectGroupDao(objectGroupDao);
|
||||||
|
Thread t1= new Thread(GetSubBeanThread1);
|
||||||
|
t1.start();
|
||||||
|
Thread t2=new Thread(GetSubBeanThread2);
|
||||||
|
t2.start();
|
||||||
|
Thread t3=new Thread(GetSubBeanThread3);
|
||||||
|
t3.start();
|
||||||
|
Thread t4= new Thread(GetSubBeanThread4);
|
||||||
|
t4.start();
|
||||||
|
try {
|
||||||
|
t1.join();
|
||||||
|
t2.join();
|
||||||
|
t3.join();
|
||||||
|
t4.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("多线程join异常",e);
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
public void auditPolicy(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException {
|
public void auditPolicy(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException {
|
||||||
|
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
|
||||||
//修改数据库审核状态信息
|
//修改数据库审核状态信息
|
||||||
entity.setTableName(CfgIndexInfo.getTablename());
|
entity.setTableName(CfgIndexInfo.getTablename());
|
||||||
entity.setIsAudit(isAudit);
|
entity.setIsAudit(isAudit);
|
||||||
@@ -351,17 +379,23 @@ public class ObjectGroupService extends BaseService {
|
|||||||
|
|
||||||
ToMaatBean maatBean = new ToMaatBean();
|
ToMaatBean maatBean = new ToMaatBean();
|
||||||
MaatCfg maatCfg = new MaatCfg();
|
MaatCfg maatCfg = new MaatCfg();
|
||||||
Set<Integer> groupIdSet=new HashSet<>();
|
//确保线程安全
|
||||||
|
Set<Integer> groupIdSet=Collections.synchronizedSet(new HashSet<Integer>());
|
||||||
List<MaatCfg> configCompileList = new ArrayList();
|
List<MaatCfg> configCompileList = new ArrayList();
|
||||||
List<MaatCfg.GroupCfg> groupRelationList = new ArrayList();
|
//确保线程安全
|
||||||
List<MaatCfg.IpCfg> ipRegionList = new ArrayList();
|
List<MaatCfg.GroupCfg> groupRelationList = Collections.synchronizedList(new ArrayList<MaatCfg.GroupCfg>());
|
||||||
List<MaatCfg.StringCfg> strRegionList = new ArrayList();
|
List<MaatCfg.IpCfg> ipRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
List<MaatCfg.NumBoundaryCfg> numRegionList = new ArrayList();
|
List<MaatCfg.StringCfg> strRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
|
List<MaatCfg.NumBoundaryCfg> numRegionList = Collections.synchronizedList(new ArrayList());
|
||||||
List<MaatCfg.DigestCfg> digestRegionList = new ArrayList();
|
List<MaatCfg.DigestCfg> digestRegionList = new ArrayList();
|
||||||
List<MaatCfg.IpCfg> areaIpRegionList = new ArrayList();
|
List<MaatCfg.IpCfg> areaIpRegionList = new ArrayList();
|
||||||
|
|
||||||
//查询子配置并修改审核状态
|
//查询子配置
|
||||||
entity = this.getObjGroupPolicy(entity.getCfgId());
|
// entity = this.getObjGroupPolicy(entity.getCfgId());
|
||||||
|
//多线程查询
|
||||||
|
entity = this.getObjGroupPolicyMultyThread(entity.getCfgId());
|
||||||
|
end=System.currentTimeMillis();
|
||||||
|
logger.info("查询子配置完成,耗时"+(end-start)+"ms");
|
||||||
// if(StringUtils.isBlank(entity.getCommonGroupIds())){
|
// if(StringUtils.isBlank(entity.getCommonGroupIds())){
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
@@ -396,57 +430,98 @@ public class ObjectGroupService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//多线程转换配置
|
||||||
|
long start1=System.currentTimeMillis();
|
||||||
|
ObjGroupCfgConvert ipConvert=new ObjGroupCfgConvert("ipGroup",entity,isAudit,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
ipConvert.setGroupRelationList(groupRelationList);
|
||||||
|
ipConvert.setIpRegionList(ipRegionList);
|
||||||
|
ipConvert.setNumRegionList(numRegionList);
|
||||||
|
ipConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert subscribeIdConvert=new ObjGroupCfgConvert("subscribeIdGroup",entity,isAudit,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
subscribeIdConvert.setGroupRelationList(groupRelationList);
|
||||||
|
subscribeIdConvert.setIpRegionList(ipRegionList);
|
||||||
|
subscribeIdConvert.setNumRegionList(numRegionList);
|
||||||
|
subscribeIdConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert urlConvert=new ObjGroupCfgConvert("urlGroup",entity,isAudit,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
urlConvert.setGroupRelationList(groupRelationList);
|
||||||
|
urlConvert.setIpRegionList(ipRegionList);
|
||||||
|
urlConvert.setNumRegionList(numRegionList);
|
||||||
|
urlConvert.setStrRegionList(strRegionList);
|
||||||
|
ObjGroupCfgConvert domainConvert=new ObjGroupCfgConvert("domainGroup",entity,isAudit,serviceDictMap,maatTableMap,groupIdSet);
|
||||||
|
domainConvert.setGroupRelationList(groupRelationList);
|
||||||
|
domainConvert.setIpRegionList(ipRegionList);
|
||||||
|
domainConvert.setNumRegionList(numRegionList);
|
||||||
|
domainConvert.setStrRegionList(strRegionList);
|
||||||
|
Thread t1=new Thread(ipConvert);
|
||||||
|
Thread t2=new Thread(subscribeIdConvert);
|
||||||
|
Thread t3=new Thread(urlConvert);
|
||||||
|
Thread t4=new Thread(domainConvert);
|
||||||
|
t1.start();
|
||||||
|
t2.start();
|
||||||
|
t3.start();
|
||||||
|
t4.start();
|
||||||
|
try {
|
||||||
|
t1.join();
|
||||||
|
t2.join();
|
||||||
|
t3.join();
|
||||||
|
t4.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("多线程join异常",e);
|
||||||
|
}
|
||||||
|
|
||||||
//IP公共分组
|
//IP公共分组
|
||||||
if(CollectionUtils.isNotEmpty(entity.getIpCommGroupCfgList())){
|
// if(CollectionUtils.isNotEmpty(entity.getIpCommGroupCfgList())){
|
||||||
IpPortCfg cfg = new IpPortCfg();
|
// IpPortCfg cfg = new IpPortCfg();
|
||||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||||
//cfg.setTableName("ip_comm_cfg");
|
// //cfg.setTableName("ip_comm_cfg");
|
||||||
//commonPolicyDao.auditCfg(cfg);
|
// //commonPolicyDao.auditCfg(cfg);
|
||||||
if(isAudit==1){
|
// if(isAudit==1){
|
||||||
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,entity.getIpCommGroupCfgList(),1,cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,entity.getIpCommGroupCfgList(),1,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
ipRegionList=map.get("dstList");
|
// ipRegionList=map.get("dstList");
|
||||||
if(map.get("numRegionList")!=null){
|
// if(map.get("numRegionList")!=null){
|
||||||
numRegionList.addAll(map.get("numRegionList"));
|
// numRegionList.addAll(map.get("numRegionList"));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//URL公共分组
|
//URL公共分组
|
||||||
if(CollectionUtils.isNotEmpty(entity.getUrlCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(entity.getUrlCommGroupList())){
|
||||||
CommonStringCfg cfg = new CommonStringCfg();
|
// CommonStringCfg cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||||
//cfg.setTableName(CommonStringCfg.getTablename());
|
// //cfg.setTableName(CommonStringCfg.getTablename());
|
||||||
//commonPolicyDao.auditCfg(cfg);
|
// //commonPolicyDao.auditCfg(cfg);
|
||||||
if(isAudit==1){
|
// if(isAudit==1){
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,entity.getUrlCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,entity.getUrlCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//账号公共分组
|
//账号公共分组
|
||||||
if(CollectionUtils.isNotEmpty(entity.getScriberIdCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(entity.getScriberIdCommGroupList())){
|
||||||
CommonStringCfg cfg = new CommonStringCfg();
|
// CommonStringCfg cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||||
//cfg.setTableName(CommonStringCfg.getTablename());
|
// //cfg.setTableName(CommonStringCfg.getTablename());
|
||||||
//commonPolicyDao.auditCfg(cfg);
|
// //commonPolicyDao.auditCfg(cfg);
|
||||||
if(isAudit==1){
|
// if(isAudit==1){
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,entity.getScriberIdCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,entity.getScriberIdCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//域名公共分组
|
//域名公共分组
|
||||||
if(CollectionUtils.isNotEmpty(entity.getDomainCommGroupList())){
|
// if(CollectionUtils.isNotEmpty(entity.getDomainCommGroupList())){
|
||||||
CommonStringCfg cfg = new CommonStringCfg();
|
// CommonStringCfg cfg = new CommonStringCfg();
|
||||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
// BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||||
//cfg.setTableName(CommonStringCfg.getTablename());
|
// //cfg.setTableName(CommonStringCfg.getTablename());
|
||||||
//commonPolicyDao.auditCfg(cfg);
|
// //commonPolicyDao.auditCfg(cfg);
|
||||||
if(isAudit==1){
|
// if(isAudit==1){
|
||||||
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,entity.getDomainCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
// Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,entity.getDomainCommGroupList(),2,cfg,groupRelationList,maatTableMap,groupIdSet);
|
||||||
groupRelationList=map.get("groupList");
|
// groupRelationList=map.get("groupList");
|
||||||
strRegionList=map.get("dstList");
|
// strRegionList=map.get("dstList");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
end=System.currentTimeMillis();
|
||||||
|
logger.info("配置转换完成,耗时"+(end-start1)+"ms");
|
||||||
//保存区域IP信息
|
//保存区域IP信息
|
||||||
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||||
@@ -460,7 +535,6 @@ public class ObjectGroupService extends BaseService {
|
|||||||
areaIpRegionList=map.get("dstList");
|
areaIpRegionList=map.get("dstList");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
||||||
if(isAudit==1){
|
if(isAudit==1){
|
||||||
maatCfg.initDefaultValue();
|
maatCfg.initDefaultValue();
|
||||||
@@ -501,16 +575,22 @@ public class ObjectGroupService extends BaseService {
|
|||||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||||
maatBean.setOpAction(opAction);
|
maatBean.setOpAction(opAction);
|
||||||
|
start1=System.currentTimeMillis();
|
||||||
//调用服务接口下发配置数据
|
//调用服务接口下发配置数据
|
||||||
String json=gsonToJson(maatBean);
|
String json=gsonToJson(maatBean);
|
||||||
|
end=System.currentTimeMillis();
|
||||||
|
logger.info("json转换完成,耗时"+(end-start1)+"ms");
|
||||||
if(json.length()<Constants.JSON_PRINT_LENTH){
|
if(json.length()<Constants.JSON_PRINT_LENTH){
|
||||||
logger.info("策略对象组下发配置参数:"+json);
|
logger.info("策略对象组下发配置参数:"+json);
|
||||||
}else{
|
}else{
|
||||||
logger.info("策略对象组下发配置内容超过"+Constants.JSON_PRINT_LENTH+",不打印");
|
logger.info("策略对象组下发配置内容超过"+Constants.JSON_PRINT_LENTH+",不打印");
|
||||||
|
// FileUtils.writeToFile("D:\\send.json",json,false);
|
||||||
}
|
}
|
||||||
//调用服务接口下发配置
|
//调用服务接口下发配置
|
||||||
|
start1=System.currentTimeMillis();
|
||||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||||
logger.info("策略对象组下发响应信息:"+result.getMsg());
|
end=System.currentTimeMillis();
|
||||||
|
logger.info("策略对象组下发响应信息:"+result.getMsg()+",耗时"+(end-start1));
|
||||||
|
|
||||||
}else if(isAudit==3){
|
}else if(isAudit==3){
|
||||||
maatCfg.setCompileId(entity.getCompileId());
|
maatCfg.setCompileId(entity.getCompileId());
|
||||||
@@ -760,3 +840,56 @@ public class ObjectGroupService extends BaseService {
|
|||||||
public void saveAndSend(FunctionRegionDict regionDict, FunctionServiceDict serviceDict, List<BaseStringCfg<?>> stringCfgs) {
|
public void saveAndSend(FunctionRegionDict regionDict, FunctionServiceDict serviceDict, List<BaseStringCfg<?>> stringCfgs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class GetSubBeanThread implements Runnable{
|
||||||
|
private CfgIndexInfo cfgIndexInfo;
|
||||||
|
private ObjectGroupDao objectGroupDao;
|
||||||
|
private boolean isDone=false;
|
||||||
|
private boolean isCancelled=false;
|
||||||
|
private boolean mayInterruptIfRunning=false;
|
||||||
|
private String groupName;
|
||||||
|
public GetSubBeanThread(CfgIndexInfo cfgIndexInfo,String groupName){
|
||||||
|
this.cfgIndexInfo=cfgIndexInfo;
|
||||||
|
this.groupName=groupName;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
getObjGroupPolicy(groupName);
|
||||||
|
isDone=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getObjGroupPolicy(String groupName){
|
||||||
|
if(cfgIndexInfo.getUserRegion().containsKey(groupName)){
|
||||||
|
String ids=cfgIndexInfo.getUserRegion().get(groupName).toString().startsWith(",")?cfgIndexInfo.getUserRegion().get(groupName).toString().substring(1):cfgIndexInfo.getUserRegion().get(groupName).toString();
|
||||||
|
ids=ids.endsWith(",")?ids.substring(0,ids.length()-1):ids;
|
||||||
|
if("ipGroup".equalsIgnoreCase(groupName)){
|
||||||
|
List<IpCommCfg> ipList = objectGroupDao.getIpCommonList(ids,null);
|
||||||
|
// synchronized (cfgIndexInfo){
|
||||||
|
cfgIndexInfo.setIpCommGroupCfgList(ipList);
|
||||||
|
// }
|
||||||
|
}else if("subscribeIdGroup".equalsIgnoreCase(groupName)){
|
||||||
|
List<ScriberIdCommCfg> stringList=objectGroupDao.getScriberIdCommonList(ids,null);
|
||||||
|
//synchronized (cfgIndexInfo){
|
||||||
|
cfgIndexInfo.setScriberIdCommGroupList(stringList);
|
||||||
|
// }
|
||||||
|
}else if("domainGroup".equalsIgnoreCase(groupName)){
|
||||||
|
List<DomainCommCfg> stringList=objectGroupDao.getDomainCommonList(ids,null);
|
||||||
|
// synchronized (cfgIndexInfo){
|
||||||
|
cfgIndexInfo.setDomainCommGroupList(stringList);
|
||||||
|
//}
|
||||||
|
}else if("urlGroup".equalsIgnoreCase(groupName)){
|
||||||
|
List<UrlCommCfg> stringList = objectGroupDao.getUrlCommonList(ids,null);
|
||||||
|
// synchronized (cfgIndexInfo){
|
||||||
|
cfgIndexInfo.setUrlCommGroupList(stringList);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectGroupDao getObjectGroupDao() {
|
||||||
|
return objectGroupDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjectGroupDao(ObjectGroupDao objectGroupDao) {
|
||||||
|
this.objectGroupDao = objectGroupDao;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -428,7 +428,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<sys:message content="${message}" type="${messageType }"/>
|
<sys:message content="${message}" type="${messageType }"/>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap commonGroup">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
|
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
|
||||||
|
|||||||
Reference in New Issue
Block a user