Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git
into develop Conflicts: src/main/java/com/nis/domain/configuration/CfgIndexInfo.java src/main/resources/nis.properties src/main/webapp/WEB-INF/tags/sys/delRow.tag asn相关功能更改: IP ADDR:增加asn域 1、新增IP ADDR可选asn,如果asn未下发过(is_used=0),下发时asn的group需要标记为commonGroup(groupId为asn组织的groupId,regionId为asn的regionId)。 2、如果所选的asn组(asn组织的groupId)已经下发过(is_used=1),则下发maat时,asn域不需要下发。 3、策略取消时,如果有需要保留的公共组(commongRroupIds),需要将公共组的组号下发。 ASN GROUP: 1、新增asn,如果此asn的组织groupId已下发过(is_used=1),且此组织的groupId已被策略标记过全选(is_audit_all=1),则需要调用公共组域新增的接口,将新增的asn关键字下发。 2、修改asn,如果此asn的组织groupId已下发过(is_used=1),则需要调用公共组域修改的接口,修改已经下发的asn关键字域。 3、删除asn,如果此asn的组织groupId已下发过(is_used=1),则需要调用公共组域删除的接口,删除已经下发的asn关键字域。 ASN IP CFG: 1、新增asn ip,所选asn no的组首次下发(is_valid=0),需要将asn no的groupId标记为公共组;如果asn no非首次下发(is_valid=1),直接调用公共组新增域的接口。 2、修改 生效状态asn ip修改,调用公共组修改域接口直接修改 3、失效 直接调用公共组删除域接口,失效asn ip域
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -13,6 +14,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.configuration.AsnKeywordCfg;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
@@ -85,6 +89,8 @@ public class AsnGroupInfoService extends BaseService{
|
||||
configGroupInfo.setGroupName(org.toUpperCase());
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setIsAuditAll(0);
|
||||
configGroupInfo.setIsUsed(0);
|
||||
configGroupInfo.setGroupId(groupIds.get(1));
|
||||
configGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
||||
@@ -104,13 +110,33 @@ public class AsnGroupInfoService extends BaseService{
|
||||
entity.setCreateTime(createTime);
|
||||
entity.setGroupId(groupId);
|
||||
entity.setIsValid(0);
|
||||
//分组已被策略设定为下发全部域,则需要自动下发新增的asno
|
||||
if(configGroupInfo.getIsAuditAll() != null && configGroupInfo.getIsAuditAll().equals(1)){
|
||||
entity.setIsUsed(1);
|
||||
}else{
|
||||
entity.setIsUsed(0);
|
||||
}
|
||||
|
||||
List<Integer> compileIds= ConfigServiceUtil.getId(1,1);
|
||||
if(compileIds.size()>0) {
|
||||
entity.setCompileId(compileIds.get(0));
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
throw new MaatConvertException("Get asn reigon id failed");
|
||||
}
|
||||
List<Integer> regionIds= ConfigServiceUtil.getId(3,1);
|
||||
if(regionIds.size()>0) {
|
||||
entity.setRegionId(regionIds.get(0));
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn reigon id failed");
|
||||
}
|
||||
asnGroupInfoDao.insert(entity);
|
||||
//新增,需要判断组是否被标记为全量下发,如果标记则下发新增的,没有不下发
|
||||
if(configGroupInfo.getIsAuditAll() != null
|
||||
&& configGroupInfo.getIsAuditAll().equals(1)
|
||||
&& configGroupInfo.getIsUsed()!= null
|
||||
&& configGroupInfo.getIsUsed().equals(1)){
|
||||
auditAsn(entity,configGroupInfo,Constants.OPACTION_POST);
|
||||
}
|
||||
//修改
|
||||
}else{
|
||||
long id=entity.getId();
|
||||
@@ -131,6 +157,8 @@ public class AsnGroupInfoService extends BaseService{
|
||||
configGroupInfo1.setGroupName(entity.getOrganization().toUpperCase());
|
||||
configGroupInfo1.setIsIssued(0);
|
||||
configGroupInfo1.setGroupType(4);
|
||||
configGroupInfo1.setIsUsed(0);
|
||||
configGroupInfo1.setIsAuditAll(0);
|
||||
configGroupInfo1.setGroupId(groupIds.get(1));
|
||||
configGroupInfo1.setInsertTime(new Date());
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo1);
|
||||
@@ -141,52 +169,148 @@ public class AsnGroupInfoService extends BaseService{
|
||||
entity.setGroupId(groupId);
|
||||
asnGroupInfoDao.update(entity);
|
||||
asnIpCfgDao.updateAsn(String.valueOf(entity.getAsnId()),entity.getOrganization(),entity.getCountry(),entity.getDetail());
|
||||
if(configGroupInfo1.getIsUsed()!= null
|
||||
&& configGroupInfo1.getIsUsed().equals(1)){
|
||||
group.setGroupId(groupId);
|
||||
group.setAsnId(entity.getAsnId());
|
||||
auditAsn(group,configGroupInfo1,Constants.OPACTION_PUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public void auditAsn(AsnGroupInfo entity,ConfigGroupInfo group,Integer action){
|
||||
Map<Integer, List<AsnKeywordCfg>> srcMap=new HashMap<>();
|
||||
List srcList=new ArrayList<>();
|
||||
AsnKeywordCfg cfg=new AsnKeywordCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setGroupId(group.getGroupId());
|
||||
cfg.setCfgKeywords(entity.getAsnId().toString());
|
||||
cfg.setRegionId(entity.getRegionId());
|
||||
cfg.setCfgType(Constants.NTC_ASN_NUMBER);
|
||||
cfg.setAuditTime(new Date());
|
||||
srcList.add(cfg);
|
||||
srcMap.put(group.getGroupId(), srcList);
|
||||
GroupReuseAddBean commonGroupBean=new GroupReuseAddBean();
|
||||
List<GroupReuseCfg> commonGroupList=new ArrayList<>();
|
||||
commonGroupList=convertCommonRegion(srcMap,commonGroupList,1,2);
|
||||
commonGroupBean.setGroupReuseCfgList(commonGroupList);
|
||||
//如果已经被引用,则修改
|
||||
commonGroupBean.setAuditTime(new Date());
|
||||
commonGroupBean.setCreatorName(UserUtils.getUser().getName());
|
||||
commonGroupBean.setVersion(Constants.MAAT_VERSION);
|
||||
if(entity.getIsUsed() != null && entity.getIsUsed().equals(1)){ //已经被引用过的asn可调用修改region
|
||||
commonGroupBean.setOpAction(action);
|
||||
String json = gsonToJson(commonGroupBean);
|
||||
logger.info("ASN配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json, action);
|
||||
}else{//已经被引用过的asn可调用新增region
|
||||
commonGroupBean.setOpAction(action);
|
||||
String json = gsonToJson(commonGroupBean);
|
||||
logger.info("ASN配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json, action);
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids,String asnIds){
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
List<FunctionServiceDict> dicts=DictUtils.getFunctionServiceDictList(600);
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
}while(result>0);
|
||||
for (String id : ids.split(",")) {
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
AsnGroupInfo entity=asnGroupInfoDao.getById(Integer.parseInt(id));
|
||||
int valid=entity.getIsValid();
|
||||
entity.setIsValid(-1);
|
||||
entity.setId(Long.parseLong(id));
|
||||
asnGroupInfoDao.updateValid(entity);
|
||||
if(asnGroupInfoDao.getCountGroupInfoByName(entity.getOrganization())==0) {
|
||||
configGroupInfoDao.delAsnGroup(entity.getOrganization());
|
||||
}
|
||||
//取消下发过的编译
|
||||
if(valid==1) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(dicts.get(0).getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("asn ip配置取消配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult _result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("asn ip配置取消配置响应信息:"+_result.getMsg());
|
||||
List<GroupReuseCfg> commonGroupList=new ArrayList<>();
|
||||
//查询已经被策略引用的asn
|
||||
List<AsnGroupInfo> asnList=asnGroupInfoDao.findAsnGroupInfoByAsnNos(Arrays.asList(asnIds.split(",")), 1);
|
||||
//修改asn为无效,且解除引用
|
||||
asnGroupInfoDao.updateIsUsedAndIsValid(Arrays.asList(asnIds.split(",")), 0, -1);
|
||||
|
||||
//查询已经被策略引用的asn,需要走取消接口
|
||||
if(!StringUtil.isEmpty(asnList)){
|
||||
Map<Integer, List<AsnKeywordCfg>> srcMap=new HashMap<>();
|
||||
Map<String, Integer> groupIdMap=new HashMap<>();
|
||||
for (AsnGroupInfo asnGroupInfo : asnList) {
|
||||
//查询groupId
|
||||
if(StringUtil.isEmpty(groupIdMap.get(asnGroupInfo.getOrganization()))){
|
||||
ConfigGroupInfo group=configGroupInfoDao.getAsnGroupByName(asnGroupInfo.getOrganization());
|
||||
groupIdMap.put(asnGroupInfo.getOrganization(), group.getGroupId());
|
||||
List<AsnKeywordCfg> list1=new ArrayList<>();
|
||||
AsnKeywordCfg asnCfg=new AsnKeywordCfg();
|
||||
asnCfg.initDefaultValue();
|
||||
asnCfg.setCfgType(Constants.NTC_ASN_NUMBER);
|
||||
asnCfg.setRegionId(asnGroupInfo.getRegionId());
|
||||
asnCfg.setGroupId(group.getGroupId());
|
||||
asnCfg.setIsValid(0);
|
||||
list1.add(asnCfg);
|
||||
srcMap.put(group.getGroupId(), list1);
|
||||
}else{
|
||||
Integer groupId=groupIdMap.get(asnGroupInfo.getOrganization());
|
||||
List list2=srcMap.get(groupId);
|
||||
AsnKeywordCfg asnCfg=new AsnKeywordCfg();
|
||||
asnCfg.initDefaultValue();
|
||||
asnCfg.setCfgType(Constants.NTC_ASN_NUMBER);
|
||||
asnCfg.setRegionId(asnGroupInfo.getRegionId());
|
||||
asnCfg.setGroupId(groupId);
|
||||
asnCfg.setIsValid(0);
|
||||
list2.add(asnCfg);
|
||||
srcMap.put(groupId, list2);
|
||||
}
|
||||
}
|
||||
commonGroupList=convertCommonRegion(srcMap, commonGroupList, 0, 2);
|
||||
GroupReuseAddBean commonGroupBean=new GroupReuseAddBean();
|
||||
commonGroupBean.setGroupReuseCfgList(commonGroupList);
|
||||
commonGroupBean.setAuditTime(new Date());
|
||||
commonGroupBean.setCreatorName(UserUtils.getUser().getName());
|
||||
commonGroupBean.setVersion(Constants.MAAT_VERSION);
|
||||
commonGroupBean.setOpAction(2);
|
||||
String json = gsonToJson(commonGroupBean);
|
||||
logger.info("ASN配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json, 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*List<FunctionServiceDict> dicts=DictUtils.getFunctionServiceDictList(600);
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
}while(result>0);
|
||||
for (String id : ids.split(",")) {
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
AsnGroupInfo entity=asnGroupInfoDao.getById(Integer.parseInt(id));
|
||||
int valid=entity.getIsValid();
|
||||
entity.setIsValid(-1);
|
||||
entity.setId(Long.parseLong(id));
|
||||
asnGroupInfoDao.updateValid(entity);
|
||||
if(asnGroupInfoDao.getCountGroupInfoByName(entity.getOrganization())==0) {
|
||||
configGroupInfoDao.delAsnGroup(entity.getOrganization());
|
||||
}
|
||||
//取消下发过的编译
|
||||
if(valid==1) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(dicts.get(0).getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("asn ip配置取消配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult _result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("asn ip配置取消配置响应信息:"+_result.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
public boolean checkIps(String groupIds) {
|
||||
@@ -234,4 +358,13 @@ public class AsnGroupInfoService extends BaseService{
|
||||
}
|
||||
return map;
|
||||
}
|
||||
public List<AsnGroupInfo> findAsnGroupList(AsnGroupInfo asnGroupInfo){
|
||||
List<AsnGroupInfo> list=asnGroupInfoDao.findAsnGroupInfoByAsnGroup(asnGroupInfo);
|
||||
return list;
|
||||
}
|
||||
public List<AsnGroupInfo> findAsnGroupList(List<String> asnNos,Integer isUsed){
|
||||
List<AsnGroupInfo> list=asnGroupInfoDao.findAsnGroupInfoByAsnNos(asnNos,null );
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
@@ -34,6 +36,7 @@ import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
@@ -100,6 +103,8 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void update(AsnIpCfg entity){
|
||||
List<AsnIpCfg> auditAsnIpList=new ArrayList<>();
|
||||
List<AsnGroupInfo> auditAsnGroupList=new ArrayList<>();
|
||||
Date editTime=new Date();
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
@@ -114,7 +119,53 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
entity.setCountry(country);
|
||||
entity.setDetail(detail);
|
||||
entity.setCompileId(groupInfo.getCompileId());
|
||||
/**
|
||||
* isvalid=0 and asnNo=false 直接修改
|
||||
* isvalid=0 and asnNo=true 需要下发
|
||||
* isvalid=1 需要下发asnNo下所有的域配置
|
||||
*/
|
||||
/*if(groupInfo.getIsUsed().equals(1) && entity.getIsValid().equals(Constants.VALID_NO)){
|
||||
entity.setAuditTime(editTime);
|
||||
entity.setAuditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_YES);
|
||||
entity.setIsAudit(Constants.AUDIT_YES);
|
||||
auditAsnIpList.add(entity);
|
||||
}
|
||||
if(groupInfo.getIsUsed().equals(1) && entity.getIsValid().equals(Constants.VALID_YES)){
|
||||
entity.setAuditTime(editTime);
|
||||
entity.setAuditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_YES);
|
||||
entity.setIsAudit(Constants.AUDIT_YES);
|
||||
auditAsnGroupList.add(groupInfo);
|
||||
}*/
|
||||
if(entity.getIsValid() ==1){
|
||||
entity.setAuditTime(editTime);
|
||||
entity.setAuditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_YES);
|
||||
entity.setIsAudit(Constants.AUDIT_YES);
|
||||
}else{
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_NO);
|
||||
entity.setIsAudit(Constants.VALID_NO);
|
||||
}
|
||||
asnIpCfgDao.update(entity);
|
||||
//ASN下发状态时可以更改,更改之后直接下发
|
||||
if(entity.getIsValid() ==1){
|
||||
auditAsnIpList.add(entity);
|
||||
asnIPRegionSendToMaat(auditAsnIpList,Constants.VALID_YES,Constants.OPACTION_PUT);
|
||||
}
|
||||
//common group 新增下发 ASN IP配置
|
||||
/*if(!StringUtil.isEmpty(auditAsnIpList)){
|
||||
asnIPRegionSendToMaat(auditAsnIpList,Constants.VALID_YES,Constants.OPACTION_POST);
|
||||
}*/
|
||||
|
||||
//common group 修改已下发过的配置,全量下发 ASN NO下的所有有效配置
|
||||
/*if(entity.getIsAudit().equals(Constants.VALID_YES)){
|
||||
auditAllAsnRegionCfg(entity,auditAsnGroupList,null);
|
||||
}*/
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void processGroup(Map<Long,AsnGroupInfo> asnNoMap){
|
||||
@@ -256,11 +307,12 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
sb.deleteCharAt(sb.toString().lastIndexOf(","));
|
||||
asnIpCfgDao.delete(sb.toString());
|
||||
asnIPRegionSendToMaat(entities,Constants.VALID_NO);
|
||||
asnIPRegionSendToMaat(entities,Constants.VALID_NO,Constants.OPACTION_PUT);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAsnIpCfg(CfgIndexInfo entity) {
|
||||
List<AsnIpCfg> auditAsnIpList=new ArrayList<>();
|
||||
Date createTime=new Date();
|
||||
//asn号
|
||||
String userRegion1=entity.getUserRegion1();
|
||||
@@ -301,13 +353,27 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setAsnIpGroup(entity.getAsnIpGroup().intValue());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setRegionId(idList.get(index));
|
||||
//TODO 注意:被策略引用并下发过的ASN NO,配置新增后直接下发【此功能暂时不做自动,asnip拥有审核功能】
|
||||
/*if(asnGroupInfo.getIsUsed().equals(1)){
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(createTime);
|
||||
auditAsnIpList.add(cfg);
|
||||
}else{*/
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
/*}*/
|
||||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
this.save(entity.getAsnIpCfgs());
|
||||
//TODO 注意:被策略引用并下发过的ASN NO,配置新增后直接下发【此功能暂时不做自动,asnip拥有审核功能】
|
||||
/*if(!StringUtil.isEmpty(auditAsnIpList)){
|
||||
asnIPRegionSendToMaat(auditAsnIpList,Constants.VALID_YES,Constants.OPACTION_POST);
|
||||
}*/
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids) {
|
||||
@@ -332,7 +398,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
//已经下发过的,调用分组复用配置删除接口
|
||||
// splitAndSend(issuedList,Constants.VALID_NO);
|
||||
if(issuedList.size() > 0){
|
||||
asnIPRegionSendToMaat(issuedList,Constants.VALID_NO);
|
||||
asnIPRegionSendToMaat(issuedList,Constants.VALID_NO,Constants.OPACTION_PUT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -440,14 +506,11 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditIpBatch(Map<Long,List<AsnIpCfg>> data,Integer isValid) {
|
||||
public void auditIpBatch(List<AsnIpCfg> asnIpCfgs,Long asn,Integer isValid) {
|
||||
List<AsnGroupInfo> auditAsnGroupList=new ArrayList<>();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
final SqlSession batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
try{
|
||||
for(Entry<Long,List<AsnIpCfg>> enrty:data.entrySet()) {
|
||||
//data.entrySet().stream().forEach( enrty->{
|
||||
Long asn=enrty.getKey();//ans group 的group id
|
||||
List<AsnIpCfg> asnIpCfgs=enrty.getValue();
|
||||
int issuedNum=asnIpCfgs.size();
|
||||
for(int index = 0; index < asnIpCfgs.size();index++){
|
||||
AsnIpCfg t = asnIpCfgs.get(index);
|
||||
@@ -461,6 +524,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
asnGroupInfo.setAsnId(asn);
|
||||
asnGroupInfo=asnGroupInfoDao.getInfoByAsnNo(asnGroupInfo);
|
||||
Integer groupId=asnGroupInfo.getGroupId();
|
||||
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
@@ -484,6 +548,8 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
groupCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
groupCfg.setGroupId(groupId);
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
//asnGroupId标记为公共组
|
||||
groupCfg.setIsCommonGroup(1);
|
||||
groupCfg.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
BeanUtils.copyProperties(asnIpCfgs.get(0), maatCfg);
|
||||
@@ -517,7 +583,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}else if(asnGroupInfo.getIsValid()==1){//已经下发过,走分组复用
|
||||
asnGroupInfo.setIssuedIPs(issuedNum+0l);
|
||||
asnGroupInfoDao.update(asnGroupInfo);
|
||||
asnIPRegionSendToMaat(asnIpCfgs,isValid);
|
||||
asnIPRegionSendToMaat(asnIpCfgs,isValid,Constants.OPACTION_POST);
|
||||
}else {
|
||||
throw new RuntimeException("asnGroupInfo isValid value is "+asnGroupInfo.getIsValid());
|
||||
}
|
||||
@@ -525,39 +591,34 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
asnGroupInfo.setIssuedIPs(0L-issuedNum);
|
||||
asnGroupInfoDao.update(asnGroupInfo);
|
||||
//已经下发过的,调用分组复用配置删除接口
|
||||
// GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
// List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
// GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
// ipRegionList.addAll(groupReuseCfgAddRemoveConvert(asnIpCfgs,Constants.VALID_NO,groupId));
|
||||
// groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
// groupReuseCfg.setStrRegionList(strRegionList);
|
||||
// groupReuseCfg.setNumRegionList(numRegionList);
|
||||
// groupReuseList.add(groupReuseCfg);
|
||||
// maatBean.setGroupReuseCfgList(groupReuseList);
|
||||
// maatBean.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
// maatBean.setCreatorName(asnIpCfgs.get(0).getCurrentUser().getName());
|
||||
// maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
// maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
// //调用服务接口下发配置数据
|
||||
// String json=gsonToJson(maatBean);
|
||||
// logger.info("ASN IP域删除配置下发配置参数:"+json);
|
||||
// //调用服务接口下发配置
|
||||
// ToMaatResult result = ConfigServiceUtil.put(json,3);
|
||||
// logger.info("ASN IP域删除配置响应信息:"+result.getMsg());
|
||||
asnIPRegionSendToMaat(asnIpCfgs,isValid);
|
||||
GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(asnIpCfgs,Constants.VALID_NO,groupId));
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
groupReuseCfg.setNumRegionList(numRegionList);
|
||||
groupReuseList.add(groupReuseCfg);
|
||||
maatBean.setGroupReuseCfgList(groupReuseList);
|
||||
maatBean.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatBean.setCreatorName(asnIpCfgs.get(0).getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ASN IP域删除配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,3);
|
||||
logger.info("ASN IP域删除配置响应信息:"+result.getMsg());
|
||||
//如果一个asn组下没有IP了,修改有效状态
|
||||
//if(hasValidAsnIp(asn)) {
|
||||
// asnGroupInfo.setIsValid(0);
|
||||
// asnGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
// asnGroupInfo.setEditTime(new Date());
|
||||
// asnGroupInfoDao.updateValid(asnGroupInfo);
|
||||
//}
|
||||
if(hasValidAsnIp(asn)) {
|
||||
asnGroupInfo.setIsValid(0);
|
||||
asnGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
asnGroupInfo.setEditTime(new Date());
|
||||
asnGroupInfoDao.updateValid(asnGroupInfo);
|
||||
}
|
||||
|
||||
}else {
|
||||
throw new RuntimeException("isValid value is "+isValid);
|
||||
}
|
||||
//});
|
||||
}
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
|
||||
@@ -1212,6 +1212,7 @@ public class AppCfgService extends BaseService {
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entitys.get(0).getCompileId());
|
||||
groupCfg.setGroupId(groupId);
|
||||
groupCfg.setIsCommonGroup(1);
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(entitys.get(0).getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
@@ -1250,7 +1251,7 @@ public class AppCfgService extends BaseService {
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
/*groupReuseCfg.setUserRegion(userRegion);*/
|
||||
groupReuseCfg.setServiceId(entitys.get(0).getServiceId());
|
||||
/*groupReuseCfg.setServiceId(entitys.get(0).getServiceId());*/
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(entitys,Constants.VALID_YES,groupId));
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
@@ -1265,7 +1266,7 @@ public class AppCfgService extends BaseService {
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("app协议IP域新增配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,1);
|
||||
logger.info("app协议IP域新增配置响应信息:"+result.getMsg());
|
||||
}else {
|
||||
throw new RuntimeException("Unknown configGroupInfo isIssued value");
|
||||
@@ -1289,7 +1290,7 @@ public class AppCfgService extends BaseService {
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("app协议IP域删除配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,3);
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,3);
|
||||
logger.info("app协议IP域删除配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,14 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
if(entity.getStrList()!=null){
|
||||
for(AppStringFeatureCfg cfg:entity.getStrList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
if(cfg.getExprType()==null){
|
||||
if(cfg.getCfgKeywords().contains(Constants.KEYWORD_EXPR)){
|
||||
cfg.setExprType(1);//与表达式
|
||||
}else{
|
||||
cfg.setExprType(0);//无表达式
|
||||
}
|
||||
}
|
||||
appMultiFeatureCfgDao.insertAppStringFeatureCfg(cfg);
|
||||
}
|
||||
|
||||
@@ -108,8 +115,8 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
}
|
||||
if(entity.getComplexList()!=null){
|
||||
for(AppComplexFeatureCfg cfg:entity.getComplexList()){
|
||||
if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("L3_header")){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
if(StringUtils.isNotBlank(cfg.getDistrict()) && (cfg.getDistrict().equals("L3_header_IP")||cfg.getDistrict().equals("L3_header_ICMP"))){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
cfg.setIsHexbin(1);
|
||||
cfg.setIsCaseInsenstive(0);
|
||||
cfg.setExprType(3);
|
||||
@@ -117,9 +124,28 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
this.setL3HeaderKeyword(cfg);
|
||||
appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg);
|
||||
|
||||
}else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
}else if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("Payload") && cfg.getExprType()==3){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
cfg.setIsHexbin(1);
|
||||
cfg.setIsCaseInsenstive(0);
|
||||
cfg.setExprType(3);
|
||||
cfg.setMatchMethod(0);
|
||||
cfg.setHeaderType(null);
|
||||
//设置payload特征的偏移量表达之关键字字符串
|
||||
cfg.setCfgKeywords(cfg.getPayloadOffset()+"-"+((cfg.getCfgKeywords().length()/2)+cfg.getPayloadOffset())+":"+cfg.getCfgKeywords());
|
||||
appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg);
|
||||
|
||||
}else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
cfg.setHeaderType(null);
|
||||
if(cfg.getExprType()==null){
|
||||
if(cfg.getCfgKeywords().contains(Constants.KEYWORD_EXPR)){
|
||||
cfg.setExprType(1);//与表达式
|
||||
}else{
|
||||
cfg.setExprType(0);//无表达式
|
||||
}
|
||||
}
|
||||
|
||||
appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg);
|
||||
}
|
||||
|
||||
@@ -161,15 +187,22 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
if(entity.getStrList()!=null){
|
||||
for(AppStringFeatureCfg cfg:entity.getStrList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
if(cfg.getExprType()==null){
|
||||
if(cfg.getCfgKeywords().contains(Constants.KEYWORD_EXPR)){
|
||||
cfg.setExprType(1);//与表达式
|
||||
}else{
|
||||
cfg.setExprType(0);//无表达式
|
||||
}
|
||||
}
|
||||
appMultiFeatureCfgDao.insertAppStringFeatureCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entity.getComplexList()!=null){
|
||||
for(AppComplexFeatureCfg cfg:entity.getComplexList()){
|
||||
if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("L3_header")){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
if(StringUtils.isNotBlank(cfg.getDistrict()) && (cfg.getDistrict().equals("L3_header_IP")||cfg.getDistrict().equals("L3_header_ICMP"))){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
cfg.setIsHexbin(1);
|
||||
cfg.setIsCaseInsenstive(0);
|
||||
cfg.setExprType(3);
|
||||
@@ -177,9 +210,27 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
this.setL3HeaderKeyword(cfg);
|
||||
appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg);
|
||||
|
||||
}else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
}else if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("Payload") && cfg.getExprType()==3){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
cfg.setIsHexbin(1);
|
||||
cfg.setIsCaseInsenstive(0);
|
||||
cfg.setExprType(3);
|
||||
cfg.setMatchMethod(0);
|
||||
cfg.setHeaderType(null);
|
||||
//设置payload特征的偏移量表达之关键字字符串
|
||||
cfg.setCfgKeywords(cfg.getPayloadOffset()+"-"+((cfg.getCfgKeywords().length()/2)+cfg.getPayloadOffset())+":"+cfg.getCfgKeywords());
|
||||
appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg);
|
||||
|
||||
}else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin"});
|
||||
cfg.setHeaderType(null);
|
||||
if(cfg.getExprType()==null){
|
||||
if(cfg.getCfgKeywords().contains(Constants.KEYWORD_EXPR)){
|
||||
cfg.setExprType(1);//与表达式
|
||||
}else{
|
||||
cfg.setExprType(0);//无表达式
|
||||
}
|
||||
}
|
||||
appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg);
|
||||
}
|
||||
}
|
||||
@@ -197,37 +248,38 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
|
||||
public void setL3HeaderKeyword(AppComplexFeatureCfg cfg) {
|
||||
String keyword = "";
|
||||
if(cfg.getHeaderType().equals("IP_header")){
|
||||
if(StringUtils.isNoneBlank(cfg.getVer())){
|
||||
if(cfg.getHeaderType().equals("L3_header_IP")){
|
||||
/*if(StringUtils.isNoneBlank(cfg.getVer())){
|
||||
keyword += "0-3:"+cfg.getVer()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getIhl())){
|
||||
keyword += "4-7:"+cfg.getIhl()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
}*/
|
||||
if(StringUtils.isNotBlank(cfg.getTos())){
|
||||
keyword += "8-15:"+cfg.getTos()+Constants.KEYWORD_EXPR;
|
||||
keyword += "1-2:"+cfg.getTos()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getTotalLength())){
|
||||
keyword += "16-31:"+cfg.getTotalLength()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getFlags())){
|
||||
keyword += "48-50:"+cfg.getFlags()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getFragmentOffset())){
|
||||
keyword += "56-63:"+cfg.getFragmentOffset()+Constants.KEYWORD_EXPR;
|
||||
keyword += "2-4:"+cfg.getTotalLength()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getProtocol())){
|
||||
keyword += "72-79:"+cfg.getProtocol()+Constants.KEYWORD_EXPR;
|
||||
keyword += "9-10:"+cfg.getProtocol()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getFragmentOffset())){//记录IP头的客户端IP
|
||||
keyword += "12-16:"+cfg.getFragmentOffset()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getFlags())){//记录IP头的服务端IP
|
||||
keyword += "16-20:"+cfg.getFlags()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
|
||||
}else{
|
||||
if(StringUtils.isNoneBlank(cfg.getIcmpType())){
|
||||
keyword += "0-7:"+cfg.getIcmpType()+Constants.KEYWORD_EXPR;
|
||||
keyword += "0-1:"+cfg.getIcmpType()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getIcmpCode())){
|
||||
keyword += "8-15:"+cfg.getIcmpCode()+Constants.KEYWORD_EXPR;
|
||||
keyword += "1-2:"+cfg.getIcmpCode()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getIcmpIdentifier())){
|
||||
keyword += "32-47:"+cfg.getIcmpIdentifier()+Constants.KEYWORD_EXPR;
|
||||
keyword += "4-6:"+cfg.getIcmpIdentifier()+Constants.KEYWORD_EXPR;
|
||||
}
|
||||
}
|
||||
keyword=keyword.substring(0,keyword.lastIndexOf(Constants.KEYWORD_EXPR));
|
||||
@@ -289,9 +341,44 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
cfg.setTableName(AppComplexFeatureCfg.getTablename());
|
||||
appMultiFeatureCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
//如果是payload特征,需要判断匹配区域是否为Payload,并且判断包大小或者本包方向,如果不为空,需要创建域配置
|
||||
if(entity.getServiceId().equals(1025)){//app payload特征
|
||||
for(AppComplexFeatureCfg c:complexList){
|
||||
if(c.getDistrict().equals("Payload")){
|
||||
//payload特征的payloadSize,payloadPacketDirection两个参数各自为单独的域配置下发
|
||||
if(c.getPayloadSize()!=null){
|
||||
AppComplexFeatureCfg payloadSizeCfg = new AppComplexFeatureCfg();
|
||||
BeanUtils.copyProperties(c, payloadSizeCfg, new String[]{"cfgId"});
|
||||
payloadSizeCfg.setCfgKeywords(c.getPayloadSize().toString());
|
||||
payloadSizeCfg.setCfgType("APP_PAYLOAD_SIZE");//综合服务前端redis表名
|
||||
payloadSizeCfg.setDistrict(null);
|
||||
payloadSizeCfg.setExprType(0);;
|
||||
payloadSizeCfg.setMatchMethod(3);
|
||||
payloadSizeCfg.setIsHexbin(0);
|
||||
complexList.add(payloadSizeCfg);
|
||||
}
|
||||
if(c.getPayloadPacketDirection()!=null){
|
||||
AppComplexFeatureCfg packetDirectionCfg = new AppComplexFeatureCfg();
|
||||
BeanUtils.copyProperties(c, packetDirectionCfg, new String[]{"cfgId"});
|
||||
packetDirectionCfg.setCfgKeywords(c.getPayloadPacketDirection().toString());
|
||||
packetDirectionCfg.setCfgType("APP_PKT_SEQ");//综合服务前端redis表名
|
||||
packetDirectionCfg.setDistrict(null);
|
||||
packetDirectionCfg.setExprType(0);;
|
||||
packetDirectionCfg.setMatchMethod(3);
|
||||
packetDirectionCfg.setIsHexbin(0);
|
||||
complexList.add(packetDirectionCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,List> map = cfgConvert(strRegionList,complexList,2,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
List<AppTcpCfg> numCfgList = appMultiFeatureCfgDao.getAppTcpCfg(entity.getCompileId(),entity.getFunctionId(),null);
|
||||
|
||||
@@ -1513,7 +1513,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
/*groupReuseCfg.setUserRegion(userRegion);*/
|
||||
groupReuseCfg.setServiceId(entitys.get(0).getServiceId());
|
||||
/*groupReuseCfg.setServiceId(entitys.get(0).getServiceId());*/
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(entitys,entity.getIsValid(),entitys.get(0).getGroupId()));
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
@@ -1592,7 +1592,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
}else {
|
||||
logger.info("app ip批量生效:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,1);
|
||||
if(result!=null){
|
||||
logger.info("app ip批量生效响应信息:"+result.getMsg());
|
||||
}
|
||||
|
||||
@@ -149,6 +149,8 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
spoofingPool.setCreatorId(UserUtils.getUser().getId());
|
||||
spoofingPool.setCompileId(spoofingPoolId);
|
||||
spoofingPool.setAction(1);
|
||||
spoofingPool.setIsValid(0);
|
||||
spoofingPool.setIsAudit(0);
|
||||
spoofingPool.setFunctionId(666);
|
||||
spoofingPool.setRequestId(0);
|
||||
pxyObjSpoofingIpPoolDao.insert(spoofingPool);//保存仿冒IP池配置
|
||||
|
||||
@@ -132,6 +132,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
//保存asn组织信息 字符串域信息
|
||||
handleAsn(entity.getAsnKeywords(), entity);
|
||||
ipCfgDao.saveCfgIndex(entity);
|
||||
if(entity.getIpPortList()!=null){
|
||||
for(IpPortCfg cfg:entity.getIpPortList()){
|
||||
@@ -155,42 +157,15 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
//保存asn组织信息 字符串域信息
|
||||
if(StringUtils.isNotBlank(entity.getUserRegion4())){
|
||||
List<FunctionRegionDict> functionRegionDicts=DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
FunctionRegionDict regionDict=null;
|
||||
for(FunctionRegionDict dict:functionRegionDicts) {
|
||||
if("asn".equals(dict.getConfigServiceType())) {
|
||||
regionDict=dict;
|
||||
}
|
||||
}
|
||||
if(regionDict!=null) {
|
||||
String org=entity.getUserRegion4();
|
||||
List<AsnGroupInfo> asnGroupInfos=asnGroupInfoDao.getValidConfigGroupInfoByName(org);
|
||||
for(AsnGroupInfo info:asnGroupInfos) {
|
||||
BaseStringCfg<AsnKeywordCfg> asnKeywordCfg=new AsnKeywordCfg();
|
||||
BeanUtils.copyProperties(entity, asnKeywordCfg,new String[]{"cfgId","cfgDesc","cfgRegionCode","cfgType","userRegion1","userRegion2","userRegion3"});
|
||||
asnKeywordCfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
asnKeywordCfg.setCfgKeywords("AS"+info.getAsnId());
|
||||
asnKeywordCfg.setExprType(0);
|
||||
asnKeywordCfg.setMatchMethod(3);
|
||||
asnKeywordCfg.setExType("0");
|
||||
asnKeywordCfg.setIsHexbin(0);
|
||||
asnKeywordCfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
asnKeywordCfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
asnKeywordCfg.setCreateTime(entity.getCreateTime());
|
||||
asnKeywordCfg.setCreatorId(UserUtils.getUser().getId());
|
||||
asnKeywordCfg.setFunctionId(regionDict.getFunctionId());
|
||||
asnKeywordCfg.setCompileId(compileId);
|
||||
stringCfgDao.saveStringCfgBatch(asnKeywordCfg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
entity.setEditTime(new Date());
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
//保存asn组织信息 字符串域信息
|
||||
handleAsn(entity.getAsnKeywords(), entity);
|
||||
ipCfgDao.updateCfgIndex(entity);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
//无效子配置后,再新增子配置
|
||||
ipCfgDao.deleteIpCfg(entity);
|
||||
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
|
||||
@@ -198,8 +173,6 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
area.setCompileId(entity.getCompileId());
|
||||
area.setFunctionId(entity.getFunctionId());
|
||||
areaIpCfgDao.deleteAreaIpCfg(area);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
if(entity.getIpPortList()!=null){
|
||||
for(IpPortCfg cfg:entity.getIpPortList()){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
@@ -222,8 +195,9 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
handleAsn(entity.getAsnKeywords(), entity);
|
||||
//保存asn组织信息 字符串域信息
|
||||
if(StringUtils.isNotBlank(entity.getUserRegion4())){
|
||||
/*if(StringUtils.isNotBlank(entity.getUserRegion4())){
|
||||
List<FunctionRegionDict> functionRegionDicts=DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
FunctionRegionDict regionDict=null;
|
||||
for(FunctionRegionDict dict:functionRegionDicts) {
|
||||
@@ -257,7 +231,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
public void updateIpCfgValid(Integer isValid,String ids,Integer functionId){
|
||||
@@ -571,6 +545,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
numRegionList.addAll(map.get("numRegionList"));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
maatType=1;
|
||||
}
|
||||
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){
|
||||
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
|
||||
@@ -583,26 +559,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
if(entity.getAsnKeywords()!=null && entity.getAsnKeywords().size()>0){
|
||||
String regionValue=entity.getAsnKeywords().get(0).getCfgType();
|
||||
if(regionValue!=null) {
|
||||
for(FunctionRegionDict region:dictList) {
|
||||
if(regionValue.equals(region.getConfigRegionValue())) {
|
||||
maatType=region.getIsMaat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
ipCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1&&maatType==Constants.MAAT_TYPE){
|
||||
Map<String,List> map = cfgConvert(strRegionList,entity.getAsnKeywords(),2,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
//asn配置下发
|
||||
auditAsnCfg(groupRelationList,strRegionList,entity,entity.getAsnKeywords());
|
||||
//保存区域IP信息
|
||||
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
@@ -710,7 +668,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
configCompileList.add(addKeepGroupList(maatCfg,entity));
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
@@ -905,7 +863,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
|
||||
entity.setIpPortList(ipPortList);
|
||||
entity.setNtcSubscribeIdCfgList(subscribeIdList);
|
||||
if(StringUtils.isNotBlank(entity.getUserRegion4())) {
|
||||
if(StringUtils.isNotBlank(entity.getCommonGroupIds())) {
|
||||
List<AsnKeywordCfg> asnKeywordCfgs=stringCfgDao.findAsnKeywordCfgList(entity);
|
||||
entity.setAsnKeywords(asnKeywordCfgs);
|
||||
}
|
||||
|
||||
@@ -269,6 +269,31 @@ public class PxyObjSpoofingIpPoolService extends BaseService{
|
||||
return gsonToJson(rangeCfg);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* IP Spoofing配置导入时 下发仿冒IP池配置
|
||||
* @param spoofingPools
|
||||
*/
|
||||
public void auditSpoofingPool(List<PxyObjSpoofingIpPool> spoofingPools) {
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(spoofingPools);
|
||||
if(spoofingPools.size()>10) {
|
||||
logger.info("欺骗IP池配置下发配置条数:" + spoofingPools.size());
|
||||
}else {
|
||||
logger.info("欺骗IP池配置下发配置参数:" + json);
|
||||
}
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("欺骗IP池配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("欺骗IP池配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user