Compare commits
4 Commits
develop_no
...
develop-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34ba8abbf4 | ||
|
|
4e2a5570fd | ||
|
|
94cf096be4 | ||
|
|
e37128e2c8 |
@@ -575,6 +575,25 @@ public class ConfigConvertUtil {
|
||||
dstIp.setDstPortMask("65535");
|
||||
}
|
||||
}
|
||||
private static <T> Map<Integer,Integer> getGroupIdList(List<T> srcList){
|
||||
Set<Integer> groupIdSet=new HashSet<>();
|
||||
Map<Integer,Integer> groupIdMap=new HashMap<>();
|
||||
for(T src:srcList){
|
||||
BaseCfg cfg=(BaseCfg)src;
|
||||
if(!groupIdSet.contains(cfg.getGroupId())){
|
||||
groupIdSet.add(cfg.getGroupId());
|
||||
}
|
||||
|
||||
}
|
||||
if(groupIdSet.size()>0){
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,groupIdSet.size());
|
||||
for(Integer id:groupIdSet){
|
||||
groupIdMap.put(id,groupIds.get(0));
|
||||
}
|
||||
groupIds.remove(0);
|
||||
}
|
||||
return groupIdMap;
|
||||
}
|
||||
/**
|
||||
*Obj 组maat配置转换
|
||||
* @param <T>
|
||||
@@ -591,6 +610,7 @@ public class ConfigConvertUtil {
|
||||
List groupRelationList, Map<String,Object> maatTableMap, Set<Integer> groupIdSet) {
|
||||
long start=System.currentTimeMillis(),end=0l;
|
||||
Map<String, List> map = new HashMap();
|
||||
Map<Integer,Integer> groupIdMap=getGroupIdList(srcList);
|
||||
if (cfgType == 1) {
|
||||
List numRegionList = new ArrayList();
|
||||
int pos=0;
|
||||
@@ -607,15 +627,17 @@ public class ConfigConvertUtil {
|
||||
|
||||
if (!groupIdSet.contains(baseIpCfg.getGroupId())) {
|
||||
GroupCfg group = new GroupCfg();
|
||||
//groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
||||
group.setGroupId(baseIpCfg.getGroupId());
|
||||
// group.setGroupId(baseIpCfg.getGroupId());
|
||||
Integer groupId =groupIdMap.get(baseIpCfg.getGroupId());
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
groupIdSet.add(baseIpCfg.getGroupId());
|
||||
}
|
||||
cfg.setGroupId(baseIpCfg.getGroupId());
|
||||
// cfg.setGroupId(baseIpCfg.getGroupId());
|
||||
cfg.setGroupId(groupIdMap.get(baseIpCfg.getGroupId()));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
if(maatTableMap.containsKey("ipMaatTable")){
|
||||
@@ -623,11 +645,11 @@ public class ConfigConvertUtil {
|
||||
cfg.setCfgType(ipMaatTable.get(baseIpCfg.getGroupId().toString()));
|
||||
}
|
||||
List<IpCfg> cfgs = ipConvert(cfg, baseIpCfg);
|
||||
if (cfgs.size() > 1) {
|
||||
if (cfgs.size() > 0) {
|
||||
List<Integer> ids =regionIdList.subList(pos,pos+cfgs.size());
|
||||
//支持range????
|
||||
for (int j = 1; j < cfgs.size(); j++) {
|
||||
cfgs.get(j).setRegionId(ids.get(j-1));
|
||||
for (int j = 0; j < cfgs.size(); j++) {
|
||||
cfgs.get(j).setRegionId(ids.get(j));
|
||||
}
|
||||
pos+=cfgs.size();
|
||||
}
|
||||
@@ -664,14 +686,16 @@ public class ConfigConvertUtil {
|
||||
}
|
||||
regionIdList.clear();
|
||||
} else if (cfgType == 2 || cfgType == 3) {
|
||||
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
|
||||
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
// List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
|
||||
List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
BaseStringCfg baserStringCfg=new BaseStringCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i),baserStringCfg);
|
||||
if(!groupIdSet.contains(baserStringCfg.getGroupId())){
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(baserStringCfg.getGroupId());
|
||||
// group.setGroupId(baserStringCfg.getGroupId());
|
||||
Integer groupId =groupIdMap.get(baserStringCfg.getGroupId());
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
@@ -680,8 +704,10 @@ public class ConfigConvertUtil {
|
||||
}
|
||||
StringCfg cfg = new StringCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
cfg.setGroupId(baserStringCfg.getGroupId());
|
||||
cfg.setRegionId(baserStringCfg.getRegionId());
|
||||
// cfg.setGroupId(baserStringCfg.getGroupId());
|
||||
// cfg.setRegionId(baserStringCfg.getRegionId());
|
||||
cfg.setGroupId(groupIdMap.get(baserStringCfg.getGroupId()));
|
||||
cfg.setRegionId(regionIdList.get(i));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
// 处理配置关键字转译
|
||||
@@ -696,44 +722,52 @@ public class ConfigConvertUtil {
|
||||
}
|
||||
} else if (cfgType == 4) {
|
||||
// List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
|
||||
// List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
// 一条业务配置创建一个分组
|
||||
NumBoundaryCfg cfg = new NumBoundaryCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
if(!groupIdSet.contains(cfg.getGroupId())){
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(cfg.getGroupId());
|
||||
// group.setGroupId(cfg.getGroupId());
|
||||
Integer groupId =groupIdMap.get(cfg.getGroupId());
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
groupIdSet.add(cfg.getGroupId());
|
||||
}
|
||||
cfg.setGroupId(cfg.getGroupId());
|
||||
cfg.setRegionId(cfg.getRegionId());
|
||||
// cfg.setGroupId(cfg.getGroupId());
|
||||
// cfg.setRegionId(cfg.getRegionId());
|
||||
cfg.setGroupId(groupIdMap.get(cfg.getGroupId()));
|
||||
cfg.setRegionId(regionIdList.get(i));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
dstList.add(cfg);
|
||||
}
|
||||
} else if (cfgType == 5) {
|
||||
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
|
||||
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
// 一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
if(!groupIdSet.contains(cfg.getGroupId())){
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(cfg.getGroupId());
|
||||
// group.setGroupId(cfg.getGroupId());
|
||||
Integer groupId =groupIdMap.get(cfg.getGroupId());
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
groupIdSet.add(cfg.getGroupId());
|
||||
}
|
||||
cfg.setGroupId(cfg.getGroupId());
|
||||
cfg.setRegionId(cfg.getRegionId());
|
||||
// cfg.setGroupId(cfg.getGroupId());
|
||||
// cfg.setRegionId(cfg.getRegionId());
|
||||
cfg.setGroupId(groupIdMap.get(cfg.getGroupId()));
|
||||
cfg.setRegionId(regionIdList.get(i));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
dstList.add(cfg);
|
||||
@@ -986,7 +1020,7 @@ public class ConfigConvertUtil {
|
||||
}
|
||||
}
|
||||
//拆分IP数量大于1获取ID
|
||||
if(total>1){
|
||||
if(total>0){
|
||||
regionIdsList=ConfigServiceUtil.getId(3,total);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class P2pLogController extends BaseController {
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_P2P_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
logger.error("查询结果:" + recv);
|
||||
// logger.error("查询结果:" + recv);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcP2pLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcP2pLog>>() {
|
||||
|
||||
@@ -3318,7 +3318,7 @@ public abstract class BaseService {
|
||||
ScriberIdCommGroupDao scriberIdCommGroupDao=SpringContextHolder.getBean(ScriberIdCommGroupDao.class);
|
||||
DomainCommGroupDao domainCommGroupDao=SpringContextHolder.getBean(DomainCommGroupDao.class);
|
||||
CommonPolicyDao commonPolicyDao=SpringContextHolder.getBean(CommonPolicyDao.class);
|
||||
SchedulerDao schedulerDao=SpringContextHolder.getBean(SchedulerDao.class);
|
||||
//SchedulerDao schedulerDao=SpringContextHolder.getBean(SchedulerDao.class);
|
||||
AreaIpCfgDao areaIpCfgDao=SpringContextHolder.getBean(AreaIpCfgDao.class);
|
||||
Set<String> ipDeletedGroups=new HashSet<>();
|
||||
Set<String> urlDeletedGroups=new HashSet<>();
|
||||
@@ -3356,6 +3356,7 @@ public abstract class BaseService {
|
||||
realGroupIds.deleteCharAt(realGroupIds.toString().length()-1);
|
||||
}
|
||||
List<CfgIndexInfo> toUpdateCfgIndexInfos=new ArrayList<>();
|
||||
List<CfgIndexInfo> toDelSchedualCfgIndexInfos=new ArrayList<>();
|
||||
List<CfgIndexInfo> toCancelCfgIndexInfos=new ArrayList<>();
|
||||
//没有
|
||||
if(StringUtils.isBlank(realGroupIds.toString())){
|
||||
@@ -3399,6 +3400,7 @@ public abstract class BaseService {
|
||||
cfgIndexInfo.setCommonGroupIds("");
|
||||
if(cfgIndexInfo.getIsValid()==Constants.VALID_NO){//未生效,直接更新配置,不用下发
|
||||
toUpdateCfgIndexInfos.add(cfgIndexInfo);
|
||||
toDelSchedualCfgIndexInfos.add(cfgIndexInfo);
|
||||
}else{//生效,需要取消配置
|
||||
cfgIndexInfo.setIsValid(Constants.VALID_NO);
|
||||
cfgIndexInfo.setIsAudit(Constants.AUDIT_NOT_YES);
|
||||
@@ -3597,22 +3599,30 @@ public abstract class BaseService {
|
||||
//查询定时任务,失效定时任务
|
||||
if(ids.toString().length()>0){
|
||||
ids.deleteCharAt(ids.toString().length()-1);
|
||||
schedulerDao.inValidByCompileIds(ids.toString());
|
||||
commonPolicyDao.cancelScheduCfg(ids.toString(),CfgIndexInfo.getTablename());
|
||||
}
|
||||
}
|
||||
if(toUpdateCfgIndexInfos.size()>0){
|
||||
StringBuffer ids=new StringBuffer();
|
||||
for(CfgIndexInfo info:toUpdateCfgIndexInfos){
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIds(info);
|
||||
// if(StringUtils.isBlank(info.getCommonGroupIds())){
|
||||
// ids.append(info.getCompileId()+",");
|
||||
// }
|
||||
}
|
||||
}
|
||||
if(toDelSchedualCfgIndexInfos.size()>0){
|
||||
StringBuffer ids=new StringBuffer();
|
||||
for(CfgIndexInfo info:toDelSchedualCfgIndexInfos){
|
||||
if(StringUtils.isBlank(info.getCommonGroupIds())){
|
||||
ids.append(info.getCompileId()+",");
|
||||
}
|
||||
}
|
||||
//查询定时任务,失效定时任务
|
||||
// if(ids.toString().length()>0){
|
||||
// ids.deleteCharAt(ids.toString().length()-1);
|
||||
// commonPolicyDao.cancelScheduCfg(ids.toString(),CfgIndexInfo.getTablename());
|
||||
// }
|
||||
if(ids.toString().length()>0){
|
||||
ids.deleteCharAt(ids.toString().length()-1);
|
||||
commonPolicyDao.cancelScheduCfg(ids.toString(),CfgIndexInfo.getTablename());
|
||||
}
|
||||
}
|
||||
//向maat发送配置
|
||||
if(CollectionUtils.isNotEmpty(cancelMaatBean.getConfigCompileList())){
|
||||
|
||||
Reference in New Issue
Block a user