各业务配置批量下发功能提交
This commit is contained in:
@@ -3095,171 +3095,152 @@ public class BaseController {
|
||||
}else{
|
||||
//400 ASN IP
|
||||
if(auditBatchCfg.getServiceId().equals(400)) {
|
||||
//所有已下发的ASN IP组
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
//已下发的ASN IP
|
||||
List<AsnIpCfg> list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList();
|
||||
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
if(auditBatchCfg.getIsValid() == 1) {
|
||||
boolean hasData = true;
|
||||
//批量生效[按每组每批次下发一次]
|
||||
AsnGroupInfo groupInfo=new AsnGroupInfo();
|
||||
if(!StringUtil.isEmpty(searchAsnIpCfg.getUserRegion1())) {
|
||||
groupInfo.setAsnId(Long.valueOf(searchAsnIpCfg.getUserRegion1()));
|
||||
}
|
||||
List<AsnGroupInfo> asnGroupInfos=asnGroupInfoService.findAsnGroupInfoList(groupInfo);
|
||||
if(StringUtil.isEmpty(asnGroupInfos)){
|
||||
hasData=false;
|
||||
}
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(true);
|
||||
page.setPageSize(-1);
|
||||
auditBatchCfg.setCompileIsIssued(asnGroupInfos.get(0).getIsValid());
|
||||
auditBatchCfg.setCompileId(asnGroupInfos.get(0).getCompileId());
|
||||
auditBatchCfg.setGroupId(asnGroupInfos.get(0).getGroupId());
|
||||
searchAsnIpCfg.setAsnIpGroup(asnGroupInfos.get(0).getGroupId());
|
||||
List list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
configSynchronizationService.auditAsnIpData(null, page, auditBatchCfg, list, hasData,true);
|
||||
}
|
||||
if(!StringUtil.isEmpty(asnGroupInfos)) {
|
||||
asnGroupInfos.remove(0);
|
||||
}
|
||||
if(asnGroupInfos.size() > 0) {
|
||||
hasData=true;
|
||||
}else {
|
||||
Map<Integer,List> asnIpMap=new HashMap();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (AsnIpCfg obj : list) {
|
||||
BaseCfg baseCfg=(BaseCfg)obj;
|
||||
if(!StringUtil.isEmpty(asnIpMap.get(obj.getAsnIpGroup()))) {
|
||||
asnIpMap.get(obj.getAsnIpGroup()).add(baseCfg);
|
||||
asnIpMap.put(obj.getAsnIpGroup(), asnIpMap.get(obj.getAsnIpGroup()));
|
||||
}else {
|
||||
List newList=new ArrayList<>();
|
||||
newList.add(baseCfg);
|
||||
asnIpMap.put(obj.getAsnIpGroup(),newList);
|
||||
hasData=false;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//所有已下发的ASN IP组
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
//已下发的ASN IP
|
||||
List<AsnIpCfg> list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList();
|
||||
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
}else {
|
||||
Map<Integer,List> asnIpMap=new HashMap();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (AsnIpCfg obj : list) {
|
||||
BaseCfg baseCfg=(BaseCfg)obj;
|
||||
if(!StringUtil.isEmpty(asnIpMap.get(obj.getAsnIpGroup()))) {
|
||||
asnIpMap.get(obj.getAsnIpGroup()).add(baseCfg);
|
||||
asnIpMap.put(obj.getAsnIpGroup(), asnIpMap.get(obj.getAsnIpGroup()));
|
||||
}else {
|
||||
List newList=new ArrayList<>();
|
||||
newList.add(baseCfg);
|
||||
asnIpMap.put(obj.getAsnIpGroup(),newList);
|
||||
}
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,asnIpMap,hasData);
|
||||
}
|
||||
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,asnIpMap,hasData);
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
}else if(auditBatchCfg.getServiceId().equals(1028)) {
|
||||
//所有已下发的app IP组
|
||||
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
|
||||
groupInfo.setIsIssued(1);
|
||||
groupInfo.setGroupType(1);//1:app ip
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);
|
||||
Map<Integer,Integer> groupMap=new HashMap<>();
|
||||
for (ConfigGroupInfo configGroupInfo : groupInfos) {
|
||||
groupMap.put(configGroupInfo.getCompileId(), configGroupInfo.getGroupId());
|
||||
}
|
||||
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
|
||||
//已下发的APP IP
|
||||
List<AppIpCfg> list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
|
||||
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
//TODO 批量审核通过APP IP需要处理的问题:一批中存在一个APP 所有IP均未下发过的问题?待解决
|
||||
//批量下发时,未下发过的app需要下发正常配置;已下发过的app需要下发ip复用配置(为保证事物,分两种方式下发)
|
||||
/*hasData=configSynchronizationService.auditDdosMaatData(cfgList,userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);*/
|
||||
if(auditBatchCfg.getIsValid() == 1) {
|
||||
boolean hasData = true;
|
||||
//批量生效[按每组每批次下发一次]
|
||||
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
|
||||
groupInfo.setGroupType(1);//1:app ip
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);
|
||||
if(StringUtil.isEmpty(groupInfos)){
|
||||
hasData=false;
|
||||
}
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(true);
|
||||
page.setPageSize(-1);
|
||||
auditBatchCfg.setCompileIsIssued(groupInfos.get(0).getIsIssued());
|
||||
auditBatchCfg.setCompileId(groupInfos.get(0).getCompileId());
|
||||
auditBatchCfg.setGroupId(groupInfos.get(0).getGroupId());
|
||||
searchAppIpCfg.setCompileId(groupInfos.get(0).getCompileId());;
|
||||
List list=appCfgService.findAppIpList(searchAppIpCfg);
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
configSynchronizationService.auditAppIpData(null, page, auditBatchCfg, list, hasData,true);
|
||||
}
|
||||
if(!StringUtil.isEmpty(groupInfos)) {
|
||||
groupInfos.remove(0);
|
||||
}
|
||||
if(groupInfos.size() > 0) {
|
||||
hasData=true;
|
||||
}else {
|
||||
Map<Integer,List> appIpMap=new HashMap();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (AppIpCfg obj : list) {
|
||||
BaseCfg baseCfg=(BaseCfg)obj;
|
||||
if(!StringUtil.isEmpty(appIpMap.get((groupMap.get(obj.getCompileId()))))) {
|
||||
appIpMap.get(groupMap.get(obj.getCompileId())).add(baseCfg);
|
||||
appIpMap.put(groupMap.get(obj.getCompileId()), appIpMap.get(groupMap.get(obj.getCompileId())));
|
||||
}else {
|
||||
List newList=new ArrayList<>();
|
||||
newList.add(baseCfg);
|
||||
appIpMap.put(groupMap.get(obj.getCompileId()),newList);
|
||||
hasData=false;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//所有已下发的app IP组
|
||||
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
|
||||
groupInfo.setIsIssued(1);
|
||||
groupInfo.setGroupType(1);//1:app ip
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);
|
||||
Map<Integer,Integer> groupMap=new HashMap<>();
|
||||
for (ConfigGroupInfo configGroupInfo : groupInfos) {
|
||||
groupMap.put(configGroupInfo.getCompileId(), configGroupInfo.getGroupId());
|
||||
}
|
||||
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
|
||||
//已下发的APP IP
|
||||
List<AppIpCfg> list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
|
||||
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
//TODO 批量审核通过APP IP需要处理的问题:一批中存在一个APP 所有IP均未下发过的问题?待解决
|
||||
//先查询所有的asn group,在根据asn group 查询所有未下发的asn ip
|
||||
|
||||
//批量下发时,未下发过的app需要下发正常配置;已下发过的app需要下发ip复用配置(为保证事物,分两种方式下发)
|
||||
/*hasData=configSynchronizationService.auditDdosMaatData(cfgList,userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);*/
|
||||
|
||||
}else {
|
||||
Map<Integer,List> appIpMap=new HashMap();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (AppIpCfg obj : list) {
|
||||
BaseCfg baseCfg=(BaseCfg)obj;
|
||||
if(!StringUtil.isEmpty(appIpMap.get((groupMap.get(obj.getCompileId()))))) {
|
||||
appIpMap.get(groupMap.get(obj.getCompileId())).add(baseCfg);
|
||||
appIpMap.put(groupMap.get(obj.getCompileId()), appIpMap.get(groupMap.get(obj.getCompileId())));
|
||||
}else {
|
||||
List newList=new ArrayList<>();
|
||||
newList.add(baseCfg);
|
||||
appIpMap.put(groupMap.get(obj.getCompileId()),newList);
|
||||
}
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,appIpMap,hasData);
|
||||
}
|
||||
hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,appIpMap,hasData);
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*if(true) {
|
||||
page.setOrderBy("");
|
||||
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
*//************预先获取已下发的groupid和compileid,且每批次重新获取,避免上一批次有新的compileId下发*************//*
|
||||
Map<Integer, Integer> isIssuedCompileIds=new HashMap<>();
|
||||
//分组复用组信息1:app ip,2:内容,3:区域 ,4 asn
|
||||
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
|
||||
groupInfo.setIsIssued(1);
|
||||
groupInfo.setGroupType(1);
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);//每一批次下发都取一次最新的group_info信息
|
||||
Map<Integer, Integer> compileGroups=new HashMap<>();
|
||||
if(!StringUtil.isEmpty(groupInfos)) {
|
||||
for (ConfigGroupInfo configGroupInfo : groupInfos) {
|
||||
isIssuedCompileIds.put(configGroupInfo.getCompileId(), configGroupInfo.getGroupId());
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(isIssuedCompileIds)) {
|
||||
auditBatchCfg.setCompileGroupMap(isIssuedCompileIds);
|
||||
auditBatchCfg.setCompileIsIssued(1);
|
||||
List list = Lists.newArrayList();
|
||||
searchAppIpCfg.setCompileGroupMap(isIssuedCompileIds);
|
||||
list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//APP IP配置生效/失效
|
||||
hasData=configSynchronizationService.auditAppIpData(userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
if(hasData) {
|
||||
page.setPageNo(page.getNext());
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}else {
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
page.setOrderBy("");
|
||||
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
*//************预先获取未下发的groupid和compileid,********************//*
|
||||
//获取已下发的appcompileid
|
||||
Map<Integer, Integer> notIssuedCompileIds=new HashMap<>();
|
||||
//分组复用组信息1:app ip,2:内容,3:区域 ,4 asn
|
||||
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
|
||||
groupInfo.setIsIssued(0);
|
||||
groupInfo.setGroupType(1);
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);//每一批次下发都取一次最新的group_info信息
|
||||
Map<Integer, Integer> compileGroups=new HashMap<>();
|
||||
if(!StringUtil.isEmpty(groupInfos)) {
|
||||
for (ConfigGroupInfo configGroupInfo : groupInfos) {
|
||||
notIssuedCompileIds.put(configGroupInfo.getCompileId(), configGroupInfo.getGroupId());
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(notIssuedCompileIds)) {
|
||||
auditBatchCfg.setCompileGroupMap(notIssuedCompileIds);
|
||||
searchAppIpCfg.setCompileGroupMap(notIssuedCompileIds);
|
||||
auditBatchCfg.setCompileIsIssued(0);
|
||||
List list = Lists.newArrayList();
|
||||
list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//APP IP配置生效/失效
|
||||
hasData=configSynchronizationService.auditAppIpData(userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
if(hasData) {
|
||||
page.setPageNo(page.getNext());
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}else {
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}else {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
|
||||
@@ -777,55 +777,66 @@
|
||||
|
||||
</update>
|
||||
<update id="auditCfgBatch">
|
||||
<if test="tableName != 'config_group_info'" >
|
||||
update ${tableName} set is_audit = #{entity.isAudit,jdbcType=INTEGER},
|
||||
auditor_id = #{entity.auditorId,jdbcType=INTEGER},
|
||||
audit_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="entity.isValid != null" >
|
||||
,is_valid = #{entity.isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
,cancel_request_id = #{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<where>
|
||||
<choose>
|
||||
<when test="tableName == 'app_ip_cfg'">
|
||||
and user_region1 in
|
||||
<choose>
|
||||
<when test="tableName == 'config_group_info'" >
|
||||
update ${tableName} set is_issued = #{entity.isValid,jdbcType=INTEGER},
|
||||
update_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<where>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'asn_ip_cfg'">
|
||||
and region_id in
|
||||
</where>
|
||||
</when>
|
||||
<when test="tableName == 'asn_group_info'" >
|
||||
update ${tableName} set is_valid = #{entity.isValid,jdbcType=INTEGER}
|
||||
<where>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'pxy_obj_trusted_ca_crl'">
|
||||
and cert_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<otherwise>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</if>
|
||||
<if test="tableName == 'config_group_info'" >
|
||||
update ${tableName} set is_issued = #{entity.isAudit,jdbcType=INTEGER},
|
||||
update_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<where>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
</where>
|
||||
</when>
|
||||
<otherwise>
|
||||
update ${tableName} set is_audit = #{entity.isAudit,jdbcType=INTEGER},
|
||||
auditor_id = #{entity.auditorId,jdbcType=INTEGER},
|
||||
audit_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="entity.isValid != null" >
|
||||
,is_valid = #{entity.isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
,cancel_request_id = #{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<where>
|
||||
<choose>
|
||||
<when test="tableName == 'app_ip_cfg'">
|
||||
and user_region1 in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'asn_ip_cfg'">
|
||||
and region_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'pxy_obj_trusted_ca_crl'">
|
||||
and cert_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<otherwise>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</update>
|
||||
<update id="deleteHttpUrlCfg">
|
||||
update ${tableName} set is_valid =-1,is_audit = 0,
|
||||
|
||||
@@ -234,4 +234,8 @@ public class AsnGroupInfoService extends BaseService{
|
||||
}
|
||||
return map;
|
||||
}
|
||||
public List<AsnGroupInfo> findAsnGroupInfoList(AsnGroupInfo entity) {
|
||||
List<AsnGroupInfo> list=asnGroupInfoDao.findAsnGroupInfoList(entity);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,10 @@ public class AppCfgService extends BaseService {
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public List<AppIpCfg> findAppIpList(AppIpCfg entity) {
|
||||
List<AppIpCfg> list = appCfgDao.findAppIpList(entity);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<AppIpCfg> findAppByIpList(String ids) {
|
||||
List<AppIpCfg> list = appCfgDao.findAppByIpList(ids);
|
||||
|
||||
@@ -1499,7 +1499,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
/**
|
||||
* 处理app ip特征(分组复用)配置
|
||||
* 全量下发(全量下发接口只支持maat和回调类的json字符串格式)
|
||||
* TODO 批量下发:【第一次下发为正常配置下发,非第一次下发为分组复用接口下发】
|
||||
* 批量下发:【按照config group,每组每批次下发,一次之下发一种格式的配置maat/reuse,CompileIsIssued标识】
|
||||
* @param serviceId
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -1533,6 +1533,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
Map<Integer,List<AppIpCfg>> dataMap=new HashMap<>();
|
||||
Integer compileId=entity.getCompileId();
|
||||
Integer groupId=entity.getGroupId();
|
||||
compileIds.add(compileId);
|
||||
List<AppIpCfg> ipList=new ArrayList<>();
|
||||
for(int i=0;i<list.size();i++){
|
||||
AppIpCfg cfg = new AppIpCfg();
|
||||
@@ -1541,14 +1542,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
cfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
cfg.setGroupId(groupId);
|
||||
ipList.add(cfg);
|
||||
/*if(isUpdateCfg) {
|
||||
if(!compileIds.contains(cfg.getCompileId())) {
|
||||
compileIds.add(cfg.getCompileId());
|
||||
}
|
||||
if(!StringUtil.isEmpty(cfg.getUserRegion1())) {
|
||||
regionIds.add(Integer.parseInt(cfg.getUserRegion1()));
|
||||
}
|
||||
}*/
|
||||
regionIds.add(Integer.parseInt(cfg.getUserRegion1()));
|
||||
}
|
||||
dataMap.put(compileId, ipList);
|
||||
for(List<AppIpCfg> entitys:dataMap.values()) {
|
||||
@@ -1561,23 +1555,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
numRegionList = new ArrayList();
|
||||
digestRegionList = new ArrayList();
|
||||
areaIpRegionList = new ArrayList();
|
||||
|
||||
/*if(configGroupInfo==null) {
|
||||
Integer groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
||||
specificServiceCfg.setGroupId(groupId);
|
||||
configGroupInfo = new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupId(specificServiceCfg.getGroupId());
|
||||
configGroupInfo.setGroupName(specificServiceCfg.getSpecServiceName());
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setCompileId(entitys.get(0).getCompileId());
|
||||
configGroupInfo.setGroupType(1);
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
||||
//更新group_id
|
||||
specificServiceCfg.setOpTime(new Date());
|
||||
specificServiceCfgDao.update(specificServiceCfg);
|
||||
}*/
|
||||
|
||||
if(isUpdateCfg && (isIssued.equals(1) || entity.getIsValid().equals(0))) {
|
||||
if(isUpdateCfg && isIssued.equals(1)) {
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
/*groupReuseCfg.setUserRegion(userRegion);*/
|
||||
@@ -1591,11 +1570,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
reuseMaatBean.setAuditTime(StringUtil.isEmpty(entity.getAuditTime())?entitys.get(0).getAuditTime():entity.getAuditTime());
|
||||
reuseMaatBean.setCreatorName(entitys.get(0).getCurrentUser().getName());
|
||||
reuseMaatBean.setVersion(Constants.MAAT_VERSION);
|
||||
if(entity.getIsValid().equals(0)) {
|
||||
reuseMaatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
}else {
|
||||
reuseMaatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
}
|
||||
reuseMaatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
}else {
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entitys.get(0).getCompileId());
|
||||
@@ -1632,7 +1607,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
if(!StringUtil.isEmpty(regionIds)) {
|
||||
commonPolicyDao.auditCfgBatch(entity.getTableName(), entity, regionIds, null);
|
||||
}
|
||||
if(isIssued.equals(0) && entity.getIsValid().equals(1)) {//group第一次下发需要修改状态为已下发
|
||||
if(isIssued.equals(0)) {//group第一次下发需要修改状态为已下发
|
||||
if(!StringUtil.isEmpty(compileIds)) {
|
||||
commonPolicyDao.auditCfgBatch("config_group_info", entity, compileIds, null);
|
||||
}
|
||||
@@ -1650,24 +1625,15 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
|
||||
if(isIssued.equals(1)) {//已下发过的compile或配置取消直接走ip复用接口
|
||||
json=gsonToJson(reuseMaatBean);
|
||||
if(entity.getIsValid().equals(0)) {
|
||||
logger.info("app ip批量失效:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 3);
|
||||
if(result!=null){
|
||||
logger.info("app ip批量失效响应信息:"+result.getMsg());
|
||||
}
|
||||
}else {
|
||||
logger.info("app ip批量生效:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
if(result!=null){
|
||||
logger.info("app ip批量生效响应信息:"+result.getMsg());
|
||||
}
|
||||
//logger.info("app ip批量生效:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
if(result!=null){
|
||||
logger.info("app ip批量生效响应信息:"+result.getMsg());
|
||||
}
|
||||
|
||||
}else {//未下发过的compile直接走正常maat配置接口
|
||||
// logger.info("配置批量下发:"+json);
|
||||
//logger.info("配置批量下发:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
@@ -1687,7 +1653,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
/**
|
||||
* 处理ASN ip配置
|
||||
* 全量下发(全量下发接口只支持maat和回调类的json字符串格式)
|
||||
* TODO 批量下发:【第一次下发为正常配置下发,非第一次下发为分组复用接口下发】
|
||||
* 批量下发:【按照asn group,每组每批次下发,一次之下发一种格式的配置maat/reuse,CompileIsIssued标识】
|
||||
* @param serviceId
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -1714,13 +1680,14 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
reuseMaatBean = new GroupReuseAddBean();
|
||||
configCompileList = new ArrayList();
|
||||
List<Integer> regionIds= new ArrayList();//存储app ip域id
|
||||
List<Integer> compileIds= new ArrayList();//存储app compileId
|
||||
List<Integer> compileIds= new ArrayList();//存储app ip域id
|
||||
Integer isIssued=entity.getCompileIsIssued();//批量下发时使用,需要用来判断是否走分组复用接口
|
||||
|
||||
//同一编译IP的分组
|
||||
Map<Integer,List<AsnIpCfg>> dataMap=new HashMap<>();
|
||||
Integer compileId=entity.getCompileId();
|
||||
Integer groupId=entity.getGroupId();
|
||||
compileIds.add(compileId);
|
||||
List<AsnIpCfg> ipList=new ArrayList<>();
|
||||
for(int i=0;i<list.size();i++){
|
||||
AsnIpCfg cfg = new AsnIpCfg();
|
||||
@@ -1728,15 +1695,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
|
||||
cfg.setGroupId(groupId);
|
||||
regionIds.add(cfg.getRegionId());
|
||||
ipList.add(cfg);
|
||||
/*if(isUpdateCfg) {
|
||||
if(!compileIds.contains(cfg.getCompileId())) {
|
||||
compileIds.add(cfg.getCompileId());
|
||||
}
|
||||
if(!StringUtil.isEmpty(cfg.getUserRegion1())) {
|
||||
regionIds.add(Integer.parseInt(cfg.getUserRegion1()));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
dataMap.put(compileId, ipList);
|
||||
for(List<AsnIpCfg> entitys:dataMap.values()) {
|
||||
@@ -1750,22 +1710,8 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
digestRegionList = new ArrayList();
|
||||
areaIpRegionList = new ArrayList();
|
||||
|
||||
/*if(configGroupInfo==null) {
|
||||
Integer groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
||||
specificServiceCfg.setGroupId(groupId);
|
||||
configGroupInfo = new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupId(specificServiceCfg.getGroupId());
|
||||
configGroupInfo.setGroupName(specificServiceCfg.getSpecServiceName());
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setCompileId(entitys.get(0).getCompileId());
|
||||
configGroupInfo.setGroupType(1);
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
||||
//更新group_id
|
||||
specificServiceCfg.setOpTime(new Date());
|
||||
specificServiceCfgDao.update(specificServiceCfg);
|
||||
}*/
|
||||
|
||||
if(isUpdateCfg && (isIssued.equals(1) || entity.getIsValid().equals(0))) {
|
||||
//批量配置生效,当前组已下发过
|
||||
if(isUpdateCfg && isIssued.equals(1)) {
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
/*groupReuseCfg.setUserRegion(userRegion);*/
|
||||
@@ -1779,11 +1725,7 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
reuseMaatBean.setAuditTime(StringUtil.isEmpty(entity.getAuditTime())?entitys.get(0).getAuditTime():entity.getAuditTime());
|
||||
reuseMaatBean.setCreatorName(entitys.get(0).getCurrentUser().getName());
|
||||
reuseMaatBean.setVersion(Constants.MAAT_VERSION);
|
||||
if(entity.getIsValid().equals(0)) {
|
||||
reuseMaatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
}else {
|
||||
reuseMaatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
}
|
||||
reuseMaatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
}else {
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entitys.get(0).getCompileId());
|
||||
@@ -1820,9 +1762,9 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
if(!StringUtil.isEmpty(regionIds)) {
|
||||
commonPolicyDao.auditCfgBatch(entity.getTableName(), entity, regionIds, null);
|
||||
}
|
||||
if(isIssued.equals(0) && entity.getIsValid().equals(1)) {//group第一次下发需要修改状态为已下发
|
||||
if(isIssued.equals(0)) {//group第一次下发需要修改状态为已下发
|
||||
if(!StringUtil.isEmpty(compileIds)) {
|
||||
commonPolicyDao.auditCfgBatch("config_group_info", entity, compileIds, null);
|
||||
commonPolicyDao.auditCfgBatch("asn_group_info", entity, compileIds, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1838,24 +1780,15 @@ public class ConfigSynchronizationService extends BaseService{
|
||||
|
||||
if(isIssued.equals(1)) {//已下发过的compile或配置取消直接走ip复用接口
|
||||
json=gsonToJson(reuseMaatBean);
|
||||
if(entity.getIsValid().equals(0)) {
|
||||
logger.info("app ip批量失效:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 3);
|
||||
if(result!=null){
|
||||
logger.info("app ip批量失效响应信息:"+result.getMsg());
|
||||
}
|
||||
}else {
|
||||
logger.info("app ip批量生效:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
if(result!=null){
|
||||
logger.info("app ip批量生效响应信息:"+result.getMsg());
|
||||
}
|
||||
//logger.info("app ip批量生效:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
if(result!=null){
|
||||
logger.info("app ip批量生效响应信息:"+result.getMsg());
|
||||
}
|
||||
|
||||
}else {//未下发过的compile直接走正常maat配置接口
|
||||
// logger.info("配置批量下发:"+json);
|
||||
//logger.info("配置批量下发:"+json);
|
||||
//调用服务接口同步回调类配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
|
||||
@@ -1500,4 +1500,5 @@ v6_num=IPv6 Number
|
||||
always=Permanent
|
||||
schedule=Scheduler
|
||||
cancel_all=Cancel all configurations!
|
||||
pre_version=Previous Version
|
||||
pre_version=Previous Version
|
||||
approved_all=Approve all configurations!
|
||||
@@ -1505,4 +1505,5 @@ v6_num=IPv6 Number
|
||||
always=\u041F\u043E\u0441\u0442\u043E\u044F\u043D\u043D\u043E
|
||||
schedule=Scheduler
|
||||
cancel_all=Cancel all configurations!
|
||||
pre_version=Previous Version
|
||||
pre_version=Previous Version
|
||||
approved_all=Approve all configurations!
|
||||
@@ -1496,6 +1496,7 @@ v4_num=IPv4 Number
|
||||
v6_num=IPv6 Number
|
||||
always=\u957F\u671F
|
||||
schedule=Scheduler
|
||||
cancel_all=Cancel all configurations!
|
||||
cancel_all=\u53D6\u6D88\u6240\u6709\u914D\u7F6E!
|
||||
pre_version=\u4e0a\u4e00\u7248
|
||||
is_schduler=\u5b9a\u65f6\u5668
|
||||
is_schduler=\u5b9a\u65f6\u5668
|
||||
approved_all=\u5BA1\u6838\u901A\u8FC7\u6240\u6709\u914D\u7F6E!
|
||||
@@ -154,18 +154,72 @@ var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
|
||||
doAll(checkboxes,url);
|
||||
}
|
||||
}else{
|
||||
/* 批量下发待测试
|
||||
if(url.indexOf("functionId") > -1){
|
||||
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='approved_all'/>",function(v,h,f){
|
||||
if(v=="ok"){
|
||||
$("#searchForm").attr("action",url);
|
||||
page();
|
||||
}
|
||||
});
|
||||
}else{ */
|
||||
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
/* } */
|
||||
url=url+"&"
|
||||
//配置批量下发
|
||||
if( url.indexOf("functionId=3&") > -1 //ip whitelist
|
||||
|| url.indexOf("functionId=5&") > -1 //ip
|
||||
|| url.indexOf("functionId=212&") > -1 //ip
|
||||
|| url.indexOf("functionId=214&") > -1 //ip
|
||||
|| url.indexOf("functionId=6&") > -1 //http url
|
||||
|| url.indexOf("functionId=7&") > -1 //dns
|
||||
|| url.indexOf("functionId=37&") > -1 //mail address
|
||||
|| url.indexOf("functionId=35&") > -1 //mail advanced
|
||||
|| url.indexOf("functionId=210&") > -1 //https monitor
|
||||
|| url.indexOf("functionId=207&") > -1 //https block
|
||||
|| url.indexOf("functionId=208&") > -1 //https redirect
|
||||
|| url.indexOf("functionId=209&") > -1 //https replace
|
||||
|| url.indexOf("functionId=211&") > -1 //https whitelist
|
||||
|| url.indexOf("functionId=407&") > -1 //Protocol Identify
|
||||
|| url.indexOf("functionId=63&") > -1 //App Identify
|
||||
|| url.indexOf("functionId=408&") > -1 //Behavior Identify
|
||||
|| url.indexOf("functionId=61&") > -1 //BGP
|
||||
|| url.indexOf("functionId=34&") > -1 //SSL
|
||||
|| url.indexOf("functionId=635&") > -1 //Website Keyword
|
||||
|| url.indexOf("functionId=8&") > -1 //HTTP Advanced
|
||||
|| url.indexOf("functionId=51&") > -1 //FTP
|
||||
|| url.indexOf("functionId=510&") > -1 //P2P
|
||||
|| url.indexOf("functionId=22&") > -1 //Streaming media
|
||||
|| url.indexOf("functionId=24&") > -1 //VoIP
|
||||
|| url.indexOf("functionId=52&") > -1 //File Digest
|
||||
|| url.indexOf("functionId=28&") > -1 //Audio Sample
|
||||
|| url.indexOf("functionId=29&") > -1 //Video Sample
|
||||
|| url.indexOf("functionId=30&") > -1 //Picture Sample
|
||||
|| url.indexOf("functionId=31&") > -1 //VoIP Voice Sample
|
||||
|| url.indexOf("functionId=630&") > -1 //Speaker Recognization
|
||||
|| url.indexOf("functionId=631&") > -1 //Logo Detection
|
||||
|| url.indexOf("functionId=632&") > -1 //Face Recognization
|
||||
|| url.indexOf("functionId=301&") > -1 //DDOS
|
||||
|| url.indexOf("functionId=200&") > -1 //Intercept Policy
|
||||
|| url.indexOf("functionId=210&") > -1 //HTTPS monitor
|
||||
|| url.indexOf("functionId=207&") > -1 //HTTPS block
|
||||
|| url.indexOf("functionId=208&") > -1 //HTTPS Redirect
|
||||
|| url.indexOf("functionId=209&") > -1 //HTTPS Replace
|
||||
|| url.indexOf("functionId=211&") > -1 //whitelist
|
||||
|| url.indexOf("functionId=213&") > -1 //Cache
|
||||
|| url.indexOf("functionId=560&") > -1 //Focused Website
|
||||
|| url.indexOf("functionId=405&") > -1 //APP IP
|
||||
|| url.indexOf("functionId=403&") > -1 //APP DOMAIN
|
||||
//|| url.indexOf("functionId=520&") > -1 //APP SSL CERT
|
||||
|| url.indexOf("functionId=563&") > -1 //APP Payload
|
||||
|| url.indexOf("functionId=565&") > -1 //APP HTTP
|
||||
|| url.indexOf("functionId=566&") > -1 //APP SSL
|
||||
|| url.indexOf("functionId=564&") > -1 //APP DNS
|
||||
|| url.indexOf("functionId=400&") > -1 //DNS Response Profiles
|
||||
|| url.indexOf("functionId=401&") > -1 //Spoofing IP
|
||||
|| url.indexOf("functionId=570&") > -1 //Key Ring
|
||||
|| url.indexOf("functionId=571&") > -1 //Trusted Certificate
|
||||
|| url.indexOf("functionId=600&") > -1 //Trusted Certificate
|
||||
){
|
||||
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='approved_all'/>",function(v,h,f){
|
||||
if(v=="ok"){
|
||||
$("#searchForm").attr("action",url);
|
||||
page();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
//未通过
|
||||
@@ -248,7 +302,7 @@ function cancelPassOpt(url){
|
||||
|
||||
}else{
|
||||
url=url+"&"
|
||||
//批量下发待测试
|
||||
//配置批量取消
|
||||
if( url.indexOf("functionId=3&") > -1 //ip whitelist
|
||||
|| url.indexOf("functionId=5&") > -1 //ip
|
||||
|| url.indexOf("functionId=212&") > -1 //ip
|
||||
|
||||
Reference in New Issue
Block a user