asn 相关修改提交
(1)asn_ip_cfg增加四列 (2)新增asn_group_info表 (3)asn ip菜单移动到policy object下,新增审核审计菜单 (4)asn ip导入修改,适应新的需求放弃了使用AsnCache,直接从数据库查 (5)asn ip加入审核流程 (6)Packet IP选择asn时,改为选中一个组织,审核下发的配置为as号字符串域 (7)asn ip 新增业务新增function_service_dict字典,serviceId为400
This commit is contained in:
135
src/main/java/com/nis/domain/basics/AsnGroupInfo.java
Normal file
135
src/main/java/com/nis/domain/basics/AsnGroupInfo.java
Normal file
@@ -0,0 +1,135 @@
|
||||
package com.nis.domain.basics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @ClassName: AsnGroupInfo.java
|
||||
* @Description: ASN分组
|
||||
* @version V1.0
|
||||
*/
|
||||
public class AsnGroupInfo extends BaseCfg<AsnGroupInfo> implements Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7931466570918016654L;
|
||||
private Integer groupId;
|
||||
private Integer orgGroupId;
|
||||
@ExcelField(title="cfg_id",sort=301)
|
||||
private Integer compileId;
|
||||
@ExcelField(title="organization",sort=302)
|
||||
private String organization;
|
||||
@ExcelField(title="organization",sort=303)
|
||||
private String country;
|
||||
@ExcelField(title="organization",sort=304)
|
||||
private String detail;
|
||||
private Integer isValid;
|
||||
@ExcelField(title="ASN",sort=305)
|
||||
private Long asnId;
|
||||
|
||||
public Integer getOrgGroupId() {
|
||||
return orgGroupId;
|
||||
}
|
||||
|
||||
public void setOrgGroupId(Integer orgGroupId) {
|
||||
this.orgGroupId = orgGroupId;
|
||||
}
|
||||
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
|
||||
public void setOrganization(String organization) {
|
||||
this.organization = organization;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Long getCreatorId() {
|
||||
return creatorId;
|
||||
}
|
||||
|
||||
public void setCreatorId(Long creatorId) {
|
||||
this.creatorId = creatorId;
|
||||
}
|
||||
|
||||
public Date getEditTime() {
|
||||
return editTime;
|
||||
}
|
||||
|
||||
public void setEditTime(Date editTime) {
|
||||
this.editTime = editTime;
|
||||
}
|
||||
|
||||
public Long getEditorId() {
|
||||
return editorId;
|
||||
}
|
||||
|
||||
public void setEditorId(Long editorId) {
|
||||
this.editorId = editorId;
|
||||
}
|
||||
|
||||
public Long getAsnId() {
|
||||
return asnId;
|
||||
}
|
||||
|
||||
public void setAsnId(Long asnId) {
|
||||
this.asnId = asnId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
|
||||
private Integer portPattern;
|
||||
private String srcPort;
|
||||
private String destPort;
|
||||
@ExcelField(title="group",sort=2)
|
||||
//@ExcelField(title="group",sort=2)
|
||||
private String asnIpGroupName;//asn组名
|
||||
private Integer asnIpGroup;//asn组号
|
||||
/**
|
||||
@@ -48,9 +48,39 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
|
||||
|
||||
@ExcelField(title="is_issued",dictType="VALID_IDENTIFIER",sort=90)
|
||||
private String isIssued;
|
||||
@ExcelField(title="organization",sort=91)
|
||||
private String organization;
|
||||
@ExcelField(title="country",sort=92)
|
||||
private String country;
|
||||
@ExcelField(title="detail",sort=93)
|
||||
private String detail;
|
||||
private String userregion1;
|
||||
|
||||
|
||||
|
||||
public String getUserregion1() {
|
||||
return userregion1;
|
||||
}
|
||||
public void setUserregion1(String userregion1) {
|
||||
this.userregion1 = userregion1;
|
||||
}
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
public void setOrganization(String organization) {
|
||||
this.organization = organization;
|
||||
}
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
public String getIsIssued() {
|
||||
return isIssued;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,28 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
protected String antiddosProtocol;//仅用于copy属性使用
|
||||
protected Long bpsThreadshold;//仅用于copy属性使用
|
||||
protected Long ppsThreadshold;//仅用于copy属性使用
|
||||
protected String organization; //仅用于copy属性使用
|
||||
protected String country; //仅用于copy属性使用
|
||||
protected String detail; //仅用于copy属性使用
|
||||
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
public void setOrganization(String organization) {
|
||||
this.organization = organization;
|
||||
}
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
public String getAntiddosProtocol() {
|
||||
return antiddosProtocol;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ package com.nis.domain.configuration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.cache.CacheKey;
|
||||
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
@@ -81,6 +80,10 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
private String searchKeywords;// 列表关键字查询字段
|
||||
|
||||
private Map<String,Object> userRegion;
|
||||
private String organization;
|
||||
private String country;
|
||||
private String detail;
|
||||
private List<AsnGroupInfo> asnGroups;
|
||||
|
||||
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
|
||||
|
||||
@@ -92,6 +95,30 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
}*/
|
||||
|
||||
|
||||
public List<AsnGroupInfo> getAsnGroups() {
|
||||
return asnGroups;
|
||||
}
|
||||
public void setAsnGroups(List<AsnGroupInfo> asnGroups) {
|
||||
this.asnGroups = asnGroups;
|
||||
}
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
public void setOrganization(String organization) {
|
||||
this.organization = organization;
|
||||
}
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
public Integer getSourceCompileId() {
|
||||
return sourceCompileId;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,11 @@ public class AsnIpTemplate extends BasicTemplate{
|
||||
private String cfgDesc;
|
||||
private String userRegion1;
|
||||
private String destIpAddress;
|
||||
private String organization;
|
||||
private String country;
|
||||
private String detail;
|
||||
|
||||
@ExcelField(title="config_describe",align=2,sort=1)
|
||||
// @ExcelField(title="config_describe",align=2,sort=1)
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
@@ -39,4 +42,26 @@ public class AsnIpTemplate extends BasicTemplate{
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
@ExcelField(title="organization",align=2,sort=1)
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
public void setOrganization(String organization) {
|
||||
this.organization = organization;
|
||||
}
|
||||
@ExcelField(title="country",align=2,sort=14)
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
@ExcelField(title="detail",align=2,sort=13)
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.apache.log4j.Logger;
|
||||
import org.apache.shiro.cache.Cache;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Maps;
|
||||
@@ -26,40 +26,40 @@ public class AsnCacheUtils{
|
||||
*/
|
||||
private static final String ASN_NO_CACHE = "asnNoCache";
|
||||
private static final int cache_rage = 1000;
|
||||
private final static ConfigGroupInfoDao configGroupInfoDao = SpringContextHolder.getBean(ConfigGroupInfoDao.class);
|
||||
private final static AsnGroupInfoDao configGroupInfoDao = SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
/**
|
||||
* 获取缓存
|
||||
* @param cacheName
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static ConfigGroupInfo get(Long key) {
|
||||
public static AsnGroupInfo get(Long key) {
|
||||
Cache cache = getCache(ASN_NO_CACHE);
|
||||
Object element = cache.get(key/cache_rage);
|
||||
|
||||
// Element element = getCache(ASN_NO_CACHE).get(key/cache_rage);
|
||||
if(element!=null) {
|
||||
Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element;
|
||||
Map<Long,AsnGroupInfo> map=(Map<Long,AsnGroupInfo>)element;
|
||||
if(map.containsKey(key)) {
|
||||
return map.get(key);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static Map<Long,ConfigGroupInfo> getMap(Object key) {
|
||||
public static Map<Long,AsnGroupInfo> getMap(Object key) {
|
||||
Object element = getCache(ASN_NO_CACHE).get(key);
|
||||
return (Map<Long,ConfigGroupInfo>)element;
|
||||
return (Map<Long,AsnGroupInfo>)element;
|
||||
}
|
||||
public static void clearCache() {
|
||||
logger.warn("clear cache!");
|
||||
getCache(ASN_NO_CACHE).clear();
|
||||
}
|
||||
public static List<ConfigGroupInfo> getAllAsnGroup(){
|
||||
List<ConfigGroupInfo> configGroupInfos=Lists.newArrayList();
|
||||
public static List<AsnGroupInfo> getAllAsnGroup(){
|
||||
List<AsnGroupInfo> configGroupInfos=Lists.newArrayList();
|
||||
Cache cache=getCache(ASN_NO_CACHE);
|
||||
for(Object val : cache.values()) {
|
||||
if(val!=null) {
|
||||
Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)val;
|
||||
Map<Long,AsnGroupInfo> map=(Map<Long,AsnGroupInfo>)val;
|
||||
configGroupInfos.addAll(map.values());
|
||||
}
|
||||
}
|
||||
@@ -77,31 +77,32 @@ public class AsnCacheUtils{
|
||||
logger.warn("AsnCacheUtils init start...");
|
||||
Cache cache=getCache(ASN_NO_CACHE);
|
||||
if(force) {
|
||||
List<ConfigGroupInfo> list=configGroupInfoDao.findAllList(4);
|
||||
Map<Long,Map<Long,ConfigGroupInfo>> groupMap=Maps.newHashMap();
|
||||
for(ConfigGroupInfo configGroupInfo:list) {
|
||||
cache.clear();
|
||||
List<AsnGroupInfo> list=configGroupInfoDao.findAsnGroupInfos();
|
||||
Map<Long,Map<Long,AsnGroupInfo>> groupMap=Maps.newHashMap();
|
||||
for(AsnGroupInfo configGroupInfo:list) {
|
||||
if(groupMap.containsKey(configGroupInfo.getAsnId()/cache_rage)) {
|
||||
groupMap.get(configGroupInfo.getAsnId()/cache_rage)
|
||||
.put(configGroupInfo.getAsnId(), configGroupInfo);
|
||||
}else {
|
||||
Map<Long,ConfigGroupInfo> m=Maps.newHashMap();
|
||||
Map<Long,AsnGroupInfo> m=Maps.newHashMap();
|
||||
m.put(configGroupInfo.getAsnId(), configGroupInfo);
|
||||
groupMap.put(configGroupInfo.getAsnId()/cache_rage, m);
|
||||
}
|
||||
}
|
||||
for(Entry<Long, Map<Long, ConfigGroupInfo>> e:groupMap.entrySet()) {
|
||||
for(Entry<Long, Map<Long, AsnGroupInfo>> e:groupMap.entrySet()) {
|
||||
cache.put(e.getKey(),e.getValue());
|
||||
}
|
||||
}else {
|
||||
//查询总量
|
||||
Long count=configGroupInfoDao.getCountByType(4);
|
||||
Long count=configGroupInfoDao.getCount();
|
||||
boolean loadDatabase=false;
|
||||
if(cache.keys().size()==0) {
|
||||
loadDatabase=true;
|
||||
}else {
|
||||
long c=0l;
|
||||
for(Object key:cache.keys()) {
|
||||
Map<Long, ConfigGroupInfo> map = getMap(key);
|
||||
Map<Long, AsnGroupInfo> map = getMap(key);
|
||||
if(map != null) {
|
||||
c+=getMap(key).size();
|
||||
}
|
||||
@@ -111,19 +112,19 @@ public class AsnCacheUtils{
|
||||
}
|
||||
}
|
||||
if(loadDatabase) {
|
||||
List<ConfigGroupInfo> list=configGroupInfoDao.findAllList(4);
|
||||
Map<Long,Map<Long,ConfigGroupInfo>> groupMap=Maps.newHashMap();
|
||||
for(ConfigGroupInfo configGroupInfo:list) {
|
||||
List<AsnGroupInfo> list=configGroupInfoDao.findAsnGroupInfos();
|
||||
Map<Long,Map<Long,AsnGroupInfo>> groupMap=Maps.newHashMap();
|
||||
for(AsnGroupInfo configGroupInfo:list) {
|
||||
if(groupMap.containsKey(configGroupInfo.getAsnId()/cache_rage)) {
|
||||
groupMap.get(configGroupInfo.getAsnId()/cache_rage)
|
||||
.put(configGroupInfo.getAsnId(), configGroupInfo);
|
||||
}else {
|
||||
Map<Long,ConfigGroupInfo> m=Maps.newHashMap();
|
||||
Map<Long,AsnGroupInfo> m=Maps.newHashMap();
|
||||
m.put(configGroupInfo.getAsnId(), configGroupInfo);
|
||||
groupMap.put(configGroupInfo.getAsnId()/cache_rage, m);
|
||||
}
|
||||
}
|
||||
for(Entry<Long, Map<Long, ConfigGroupInfo>> e:groupMap.entrySet()) {
|
||||
for(Entry<Long, Map<Long, AsnGroupInfo>> e:groupMap.entrySet()) {
|
||||
cache.put(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
@@ -137,15 +138,15 @@ public class AsnCacheUtils{
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static void put(Long key, ConfigGroupInfo value) {
|
||||
public static void put(Long key, AsnGroupInfo value) {
|
||||
Long _key=key/cache_rage;
|
||||
Object element = getCache(ASN_NO_CACHE).get(_key);
|
||||
if(element==null) {
|
||||
Map<Long,ConfigGroupInfo> map=Maps.newHashMap();
|
||||
Map<Long,AsnGroupInfo> map=Maps.newHashMap();
|
||||
map.put(key, value);
|
||||
getCache(ASN_NO_CACHE).put(_key,map);
|
||||
}else {
|
||||
Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element;
|
||||
Map<Long,AsnGroupInfo> map=(Map<Long,AsnGroupInfo>)element;
|
||||
map.put(key, value);
|
||||
getCache(ASN_NO_CACHE).put(_key,map);
|
||||
}
|
||||
@@ -162,7 +163,7 @@ public class AsnCacheUtils{
|
||||
Long _key=key/cache_rage;
|
||||
Object element = getCache(ASN_NO_CACHE).get(_key);
|
||||
if(element!=null) {
|
||||
Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element;
|
||||
Map<Long,AsnGroupInfo> map=(Map<Long,AsnGroupInfo>)element;
|
||||
if(map.containsKey(key)) {
|
||||
map.remove(key);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public final class Constants {
|
||||
* 导入条数限制
|
||||
*/
|
||||
public static final int IMPORT_LIMIT=Configurations.getIntProperty("import_limit",10000);
|
||||
public static final Object IMPORT_LOCK=new Object();
|
||||
public static final String GROUP_REUSE_SOURCES=Configurations.getStringProperty("groupReuseSources","groupReuseSources");
|
||||
public static Integer APP_SPEC_SERVICE_CODE_MIN_VAL=Configurations.getIntProperty("app_spec_service_code_min_val", 300001);
|
||||
public static Integer APP_SPEC_SERVICE_CODE_MAX_VAL=Configurations.getIntProperty("app_spec_service_code_max_val", 268435455);
|
||||
|
||||
@@ -18,13 +18,13 @@ import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
//import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
|
||||
@@ -36,7 +36,8 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// private DnsResStrategyService dnsResStrategyService;
|
||||
private FunctionServiceDict serviceDict;
|
||||
private FunctionRegionDict regionDict;
|
||||
private List<Map<Long,Integer>> asnNoMaps;
|
||||
private List<Map<Long,AsnGroupInfo>> asnNoMaps;
|
||||
private Map<Long,AsnGroupInfo> asnGroupInfos;
|
||||
// private DnsResStrategyDao dnsResStrategyDao;
|
||||
public CheckIpFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseIpCfg> destQueue) {
|
||||
this.serviceDict=serviceDict;
|
||||
@@ -68,7 +69,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
return msg.toString();
|
||||
}
|
||||
public List<BaseIpCfg> checkIpCfg(StringBuffer msg,List<Map<Long,Integer>> asnNos, List<Object> list)
|
||||
public List<BaseIpCfg> checkIpCfg(StringBuffer msg,List<Map<Long,AsnGroupInfo>> asnNos, List<Object> list)
|
||||
throws ServiceException {
|
||||
logger.warn("start to validate ip...");
|
||||
long start=System.currentTimeMillis();
|
||||
@@ -104,7 +105,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
IpPortCfg baseIpCfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(list.get(i), baseIpCfg);
|
||||
// 配置描述长度限制
|
||||
if(baseIpCfg.getCfgDesc().length() > 128) {
|
||||
if(baseIpCfg.getCfgDesc()!=null&&baseIpCfg.getCfgDesc().length() > 128) {
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
|
||||
@@ -231,6 +232,18 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("asn_no"))
|
||||
+ ";");
|
||||
}else if(StringUtils.isBlank(baseIpCfg.getOrganization())){
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("organization","Organization"))
|
||||
+ ";");
|
||||
}else if(StringUtils.isBlank(baseIpCfg.getCountry())){
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("country","Country"))
|
||||
+ ";");
|
||||
}else if(StringUtils.isBlank(baseIpCfg.getDetail())){
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("detail","Detail"))
|
||||
+ ";");
|
||||
}else {
|
||||
try {
|
||||
Long asnNo=Long.parseLong(userRegion1);
|
||||
@@ -240,13 +253,32 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
+ ";");
|
||||
}else {
|
||||
// ConfigGroupInfo configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
|
||||
ConfigGroupInfo configGroupInfo=AsnCacheUtils.get(asnNo);
|
||||
if(asnNos!=null) {
|
||||
AsnGroupInfo configGroupInfo=asnGroupInfos==null?null:asnGroupInfos.get(asnNo);//从缓存中取
|
||||
//缓存中没有
|
||||
if(configGroupInfo==null) {
|
||||
asnNos.get(0).put(asnNo,-1);
|
||||
synchronized (Constants.IMPORT_LOCK) {
|
||||
AsnGroupInfo groupInfo=new AsnGroupInfo();
|
||||
groupInfo.setOrganization(baseIpCfg.getOrganization().trim());
|
||||
groupInfo.setCountry(baseIpCfg.getCountry().trim());
|
||||
groupInfo.setDetail(baseIpCfg.getDetail().trim());
|
||||
groupInfo.setIsValid(0);
|
||||
groupInfo.setAsnId(asnNo);
|
||||
asnNos.get(0).put(asnNo,groupInfo);
|
||||
}
|
||||
}else {
|
||||
asnNos.get(1).put(asnNo,configGroupInfo.getGroupId());
|
||||
if(!configGroupInfo.getOrganization().equals(baseIpCfg.getOrganization().trim())) {
|
||||
errInfo.append(prop.getProperty("organization","Organization")+" "+prop.getProperty("mismatch","Mismatch"));
|
||||
}
|
||||
if(!configGroupInfo.getCountry().equals(baseIpCfg.getCountry().trim())) {
|
||||
errInfo.append(prop.getProperty("country","Country")+" "+prop.getProperty("mismatch","Mismatch"));
|
||||
}
|
||||
if(!configGroupInfo.getDetail().equals(baseIpCfg.getDetail().trim())) {
|
||||
errInfo.append(prop.getProperty("detail","Detail")+" "+prop.getProperty("mismatch","Mismatch"));
|
||||
}
|
||||
if(StringUtils.isBlank(errInfo.toString())) {
|
||||
asnNos.get(1).put(asnNo,configGroupInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,6 +291,28 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
String organization=baseIpCfg.getOrganization();
|
||||
if(StringUtils.isBlank(organization)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("organization","Organization"))
|
||||
+ ";");
|
||||
}else {
|
||||
baseIpCfg.setCfgDesc(organization);
|
||||
|
||||
}
|
||||
String country=baseIpCfg.getCountry();
|
||||
if(StringUtils.isBlank(country)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("country"))
|
||||
+ ";");
|
||||
}
|
||||
String detail=baseIpCfg.getDetail();
|
||||
if(StringUtils.isBlank(detail)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("detail"))
|
||||
+ ";");
|
||||
}
|
||||
|
||||
}
|
||||
if (regionDict.getFunctionId().equals(301)) {
|
||||
String antiddosProtocol=baseIpCfg.getAntiddosProtocol();
|
||||
@@ -1138,11 +1192,17 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
return matchType;
|
||||
}
|
||||
|
||||
public List<Map<Long, Integer>> getAsnNoMaps() {
|
||||
public List<Map<Long, AsnGroupInfo>> getAsnNoMaps() {
|
||||
return asnNoMaps;
|
||||
}
|
||||
public void setAsnNoMaps(List<Map<Long, Integer>> asnNoMaps) {
|
||||
public void setAsnNoMaps(List<Map<Long, AsnGroupInfo>> asnNoMaps) {
|
||||
this.asnNoMaps = asnNoMaps;
|
||||
}
|
||||
public Map<Long, AsnGroupInfo> getAsnGroupInfos() {
|
||||
return asnGroupInfos;
|
||||
}
|
||||
public void setAsnGroupInfos(Map<Long, AsnGroupInfo> asnGroupInfos) {
|
||||
this.asnGroupInfos = asnGroupInfos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.nis.util.excel.thread;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@@ -12,10 +11,12 @@ import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
@@ -23,10 +24,12 @@ import com.nis.web.service.basics.AsnIpCfgService;
|
||||
|
||||
public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
private BlockingQueue<Long> asnNos;
|
||||
private AsnGroupInfoDao asnGroupInfoDao;
|
||||
private ConfigGroupInfoDao configGroupInfoDao;
|
||||
private AsnIpCfgDao asnIpCfgDao;
|
||||
public DeleteAsnIpTread(BlockingQueue<Long> asnNos) {
|
||||
this.asnNos=asnNos;
|
||||
this.asnGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
this.configGroupInfoDao=SpringContextHolder.getBean(ConfigGroupInfoDao.class);
|
||||
this.asnIpCfgDao=SpringContextHolder.getBean(AsnIpCfgDao.class);
|
||||
}
|
||||
@@ -37,20 +40,29 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
List<Long> asnIds=Lists.newArrayList();
|
||||
DataSourceTransactionManager transactionManager=(DataSourceTransactionManager)SpringContextHolder.getBean("transactionManager");
|
||||
LinkedBlockingQueue<AsnIpCfg> toDelAndSendAsnIpCfgs=new LinkedBlockingQueue<AsnIpCfg>();
|
||||
List<ConfigGroupInfo> configGroupInfos=configGroupInfoDao.findAllList(4);
|
||||
while(!asnNos.isEmpty()) {
|
||||
asnNos.drainTo(asnNoList,5);
|
||||
for(Long asnNo:asnNoList) {
|
||||
ConfigGroupInfo configGroupInfo=AsnCacheUtils.get(asnNo);
|
||||
AsnGroupInfo configGroupInfo=AsnCacheUtils.get(asnNo);
|
||||
if(configGroupInfo==null) {
|
||||
configGroupInfo=configGroupInfoDao.getInfoByAsnNo(asnNo);
|
||||
configGroupInfo=new AsnGroupInfo();
|
||||
configGroupInfo.setAsnId(asnNo);
|
||||
configGroupInfo=asnGroupInfoDao.getInfoByAsnNo(configGroupInfo);
|
||||
}
|
||||
if(configGroupInfo.getIsIssued()==1) {//已下发
|
||||
List<AsnIpCfg> _toDelAsnIpCfgs=asnIpCfgDao.getByAsnNo(configGroupInfo.getAsnId());
|
||||
toDelAndSendAsnIpCfgs.addAll(_toDelAsnIpCfgs);
|
||||
}else {
|
||||
asnIds.add(asnNo);
|
||||
for(ConfigGroupInfo cinfo:configGroupInfos) {
|
||||
if(cinfo.getGroupId().intValue()==configGroupInfo.getGroupId().intValue()) {
|
||||
if(cinfo.getIsIssued()==1) {//已下发
|
||||
List<AsnIpCfg> _toDelAsnIpCfgs=asnIpCfgDao.getByAsnNo(configGroupInfo.getAsnId());
|
||||
toDelAndSendAsnIpCfgs.addAll(_toDelAsnIpCfgs);
|
||||
}else {
|
||||
asnIds.add(asnNo);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(asnIds.size()>0) {
|
||||
this.deleteByAsnNo(asnIds);
|
||||
@@ -102,7 +114,7 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnGroup(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
}while(result>0);
|
||||
//剔除
|
||||
asnNoList.subList(0, pointsDataLimit).clear();
|
||||
@@ -115,7 +127,7 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnGroup(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
@@ -127,7 +139,7 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnGroup(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
|
||||
@@ -18,17 +18,16 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.Varibles;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.nis.web.service.basics.AsnIpCfgService;
|
||||
@@ -42,7 +41,7 @@ public class SaveAsnIpThread implements Callable<Throwable>{
|
||||
private List<Map<Long,Integer>> asnNoMaps;
|
||||
private Integer requestId;
|
||||
private AsnIpCfgDao asnIpCfgDao;
|
||||
private ConfigGroupInfoDao configGroupInfoDao;
|
||||
private AsnGroupInfoDao configGroupInfoDao;
|
||||
// private AsnIpCfgService asnIpCfgService;
|
||||
public SaveAsnIpThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Integer requestId,BlockingQueue<BaseIpCfg> ipPortCfgs) {
|
||||
this.serviceDict=serviceDict;
|
||||
@@ -50,7 +49,7 @@ public class SaveAsnIpThread implements Callable<Throwable>{
|
||||
this.ipPortCfgs=ipPortCfgs;
|
||||
this.requestId=requestId;
|
||||
this.asnIpCfgDao=SpringContextHolder.getBean(AsnIpCfgDao.class);
|
||||
this.configGroupInfoDao=SpringContextHolder.getBean(ConfigGroupInfoDao.class);
|
||||
this.configGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
}
|
||||
@Override
|
||||
public Throwable call() {
|
||||
@@ -113,9 +112,11 @@ public class SaveAsnIpThread implements Callable<Throwable>{
|
||||
_cfg.setAsnIpGroup(asnNoMaps.get(1).get(Long.parseLong(_cfg.getUserRegion1())));
|
||||
}else {
|
||||
// ConfigGroupInfo info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(_cfg.getUserRegion1()));
|
||||
ConfigGroupInfo info=AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
AsnGroupInfo info=AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
if(info==null) {
|
||||
info=configGroupInfoDao.getInfoByAsnNo(Long.parseLong(_cfg.getUserRegion1()));
|
||||
info=new AsnGroupInfo();
|
||||
info.setAsnId(Long.parseLong(_cfg.getUserRegion1()));
|
||||
info=configGroupInfoDao.getInfoByAsnNo(info);
|
||||
}
|
||||
_cfg.setAsnIpGroup(info.getGroupId());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
@@ -44,6 +45,7 @@ import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
@@ -115,14 +117,13 @@ import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
//import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Configurations;
|
||||
//import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.ServiceConfigTemplateUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
@@ -145,6 +146,7 @@ import com.nis.web.service.OfficeService;
|
||||
import com.nis.web.service.RoleService;
|
||||
import com.nis.web.service.SystemService;
|
||||
import com.nis.web.service.UserService;
|
||||
import com.nis.web.service.basics.AsnGroupInfoService;
|
||||
import com.nis.web.service.basics.AsnIpCfgService;
|
||||
import com.nis.web.service.basics.IpReuseIpCfgService;
|
||||
import com.nis.web.service.basics.PolicyGroupInfoService;
|
||||
@@ -317,6 +319,8 @@ public class BaseController {
|
||||
|
||||
@Autowired
|
||||
protected PxyObjSpoofingIpPoolService pxyObjSpoofingIpPoolService;// 欺骗IP池
|
||||
@Autowired
|
||||
protected AsnGroupInfoService asnGroupInfoService;// asn组
|
||||
/**
|
||||
* 管理基础路径
|
||||
*/
|
||||
@@ -944,7 +948,7 @@ public class BaseController {
|
||||
* @throws InterruptedException
|
||||
* @throws ExecutionException
|
||||
*/
|
||||
public BlockingQueue<BaseIpCfg> checkIpCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,List<Map<Long,Integer>> asnNos, BlockingQueue<? extends Object> list) throws ServiceException, InterruptedException, ExecutionException{
|
||||
public BlockingQueue<BaseIpCfg> checkIpCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,List<Map<Long,AsnGroupInfo>> asnNos,Map<Long,AsnGroupInfo> asnGroupInfos, BlockingQueue<? extends Object> list) throws ServiceException, InterruptedException, ExecutionException{
|
||||
logger.warn("start checkIpCfgMulity ,size "+list.size());
|
||||
long start=System.currentTimeMillis();
|
||||
BlockingQueue<BaseIpCfg> queue=new ArrayBlockingQueue<>(list.size());
|
||||
@@ -953,6 +957,7 @@ public class BaseController {
|
||||
for(int i=0;i<Constants.MULITY_THREAD_SIZE;i++) {
|
||||
CheckIpFormatThread t=new CheckIpFormatThread(serviceDict,regionDict, this.getMsgProp(), list, queue);
|
||||
t.setAsnNoMaps(asnNos);
|
||||
t.setAsnGroupInfos(asnGroupInfos);
|
||||
futures.add(service.submit(t));
|
||||
}
|
||||
service.shutdown();
|
||||
@@ -1278,9 +1283,10 @@ public class BaseController {
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
List<AppPolicyCfg> appPolicyCfgs = new ArrayList<AppPolicyCfg>();
|
||||
List<AppFeatureIndex> appFeatureIndexs= new ArrayList<AppFeatureIndex>();
|
||||
List<Map<Long,Integer>> asnNoMaps=Lists.newArrayList();
|
||||
Map<Long,Integer> newAsnNoMap=Maps.newConcurrentMap();
|
||||
Map<Long,Integer> OldAsnNoMap=Maps.newConcurrentMap();
|
||||
List<Map<Long,AsnGroupInfo>> asnNoMaps=Lists.newArrayList();
|
||||
Map<Long,AsnGroupInfo> newAsnNoMap=Maps.newConcurrentMap();
|
||||
Map<Long,AsnGroupInfo> OldAsnNoMap=Maps.newConcurrentMap();
|
||||
Map<Long,AsnGroupInfo> asnGroupInfos=null;
|
||||
asnNoMaps.add(newAsnNoMap);
|
||||
asnNoMaps.add(OldAsnNoMap);
|
||||
FunctionRegionDict appRegion = null;
|
||||
@@ -1319,44 +1325,48 @@ public class BaseController {
|
||||
if (serviceDict!=null&&serviceDict.getAction().equals(64)) {
|
||||
BlockingQueue<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class
|
||||
);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,asnGroupInfos, list);
|
||||
} else {
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
}
|
||||
} else if (regionDict.getFunctionId().equals(7)&&serviceDict!=null&&serviceDict.getAction().intValue()==16) {
|
||||
BlockingQueue<DnsIpTemplate> list = ei.getDataList(DnsIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
}else if(regionDict.getFunctionId().equals(401)) {
|
||||
BlockingQueue<DnsFakeIpTemplate> list = ei.getDataList(DnsFakeIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
}else if (regionDict.getFunctionId().equals(212)) {
|
||||
BlockingQueue<IpPayloadTemplate> list = ei.getDataList(IpPayloadTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
} else if (regionDict.getFunctionId().equals(510)
|
||||
&& "p2p_ip".equals(regionDict.getConfigServiceType())) { // P2p IP
|
||||
BlockingQueue<P2pIpTemplate> list = ei.getDataList(P2pIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
} else if (regionDict.getFunctionId().equals(600)) {// ASN IP
|
||||
//加载asn缓存
|
||||
AsnCacheUtils.init(true);
|
||||
//AsnCacheUtils.init(true);
|
||||
//从数据库中读取
|
||||
asnGroupInfos=asnGroupInfoService.getGroupList();
|
||||
//OldAsnNoMap.putAll(asnGroupInfoService.getGroupList());
|
||||
BlockingQueue<AsnIpTemplate> list = ei.getDataList(AsnIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, asnNoMaps, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, asnNoMaps,asnGroupInfos, list);
|
||||
|
||||
}else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
BlockingQueue<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
BlockingQueue<HttpsRejectIpTemplate> list = ei.getDataList(HttpsRejectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
BlockingQueue<HttpsRedirectIpTemplate> list = ei.getDataList(HttpsRedirectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceIpTemplate> list = ei.getDataList(HttpsReplaceIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
} else {
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(2)) {// 字符串类
|
||||
if (regionDict.getFunctionId().equals(510)
|
||||
@@ -1454,88 +1464,20 @@ public class BaseController {
|
||||
}
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(regionDict.getFunctionId().intValue()==600) {//ans ip
|
||||
if(asnNoMaps.get(0).size()>0) {
|
||||
try {
|
||||
//将未在缓存中找到对应config的asn no分配group ID
|
||||
List<Integer> groupIds = ConfigServiceUtil.getId(2,asnNoMaps.get(0).size());
|
||||
int ind=0;
|
||||
for(Long key:asnNoMaps.get(0).keySet()) {
|
||||
asnNoMaps.get(0).put(key, groupIds.get(ind));
|
||||
ind++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
List<SysDataDictionaryItem> isImportAll=DictUtils.getDictList("IS_ASN_IP_IMPORT_ALL");
|
||||
//处理组,新的组会在这里保存
|
||||
asnIpCfgService.processGroup(asnNoMaps.get(0));
|
||||
if(!asnNoMaps.get(0).isEmpty()) {
|
||||
asnIpCfgService.processGroup(asnNoMaps.get(0));
|
||||
}
|
||||
//全量下发,删除asnNo对应的已有的IP
|
||||
if(isImportAll.get(0).getItemCode().equals("1")) {
|
||||
logger.warn("Delete and send ip reuse regions start");
|
||||
long _start=System.currentTimeMillis();
|
||||
asnIpCfgService.deleteIps(asnNoMaps.get(1));
|
||||
// List<Future<Throwable>> list=Lists.newArrayList();
|
||||
// ExecutorService service=Executors.newFixedThreadPool(Constants.SAVE_AND_DEL_THREAD_SIZE);
|
||||
// BlockingQueue<Long> queue=new ArrayBlockingQueue<>(asnNoMaps.get(1).size());
|
||||
// queue.addAll(asnNoMaps.get(1).keySet());
|
||||
// for(int j=0;j<Constants.SAVE_AND_DEL_THREAD_SIZE;j++) {
|
||||
// DeleteAsnIpTread t=new DeleteAsnIpTread(queue);
|
||||
// list.add(service.submit(t));
|
||||
// }
|
||||
// service.shutdown();
|
||||
// while(!service.isTerminated()) {
|
||||
// Thread.sleep(10);
|
||||
// }
|
||||
// for(Future<Throwable> e:list) {
|
||||
// if(e.get()!=null) {
|
||||
// try {
|
||||
// throw e.get();
|
||||
// } catch (Throwable e1) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e1.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
deleteIps(asnNoMaps.get(1));
|
||||
long _end=System.currentTimeMillis();
|
||||
logger.warn("Delete and send ip reuse regions end,cost:"+(_end-_start));
|
||||
}
|
||||
Map<Long,Boolean> fullMap=Maps.newConcurrentMap();
|
||||
for(Long asnNo:asnNoMaps.get(0).keySet()) {
|
||||
fullMap.put(asnNo, false);
|
||||
}
|
||||
for(Long asnNo:asnNoMaps.get(1).keySet()) {
|
||||
ConfigGroupInfo info=AsnCacheUtils.get(asnNo);
|
||||
if(info==null) {
|
||||
info=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
|
||||
}
|
||||
fullMap.put(asnNo, info.getIsIssued().intValue()==1);
|
||||
}
|
||||
// List<Future<Throwable>> list=Lists.newArrayList();
|
||||
// ExecutorService service=Executors.newFixedThreadPool(Constants.SAVE_AND_DEL_THREAD_SIZE);
|
||||
// for(int j=0;j<Constants.SAVE_AND_DEL_THREAD_SIZE;j++) {
|
||||
// SaveAsnIpThread t=new SaveAsnIpThread(serviceDict, regionDict, requestId, ipPortCfgs);
|
||||
// t.setAsnNoMaps(asnNoMaps);
|
||||
// t.setFullMap(fullMap);
|
||||
// list.add(service.submit(t));
|
||||
// }
|
||||
// service.shutdown();
|
||||
// while(!service.isTerminated()) {
|
||||
// Thread.sleep(10);
|
||||
// }
|
||||
// for(Future<Throwable> e:list) {
|
||||
// if(e.get()!=null) {
|
||||
// try {
|
||||
// throw e.get();
|
||||
// } catch (Throwable e1) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e1.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
List<AsnIpCfg> asnIpCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
@@ -1553,17 +1495,21 @@ public class BaseController {
|
||||
AsnIpCfg _cfg=new AsnIpCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg,new String[] {"cfgId"});
|
||||
_cfg.setTableName(AsnIpCfg.getTablename());
|
||||
_cfg.setAction(0);
|
||||
_cfg.setAction(serviceDict==null?0:serviceDict.getAction());
|
||||
_cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
_cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
_cfg.setCreateTime(date);
|
||||
_cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
_cfg.setDoLog(2);
|
||||
_cfg.setFunctionId(regionDict.getFunctionId());
|
||||
_cfg.setIsAudit(0);
|
||||
if(fullMap.get(Long.parseLong(_cfg.getUserRegion1()))) {
|
||||
if(isSend.equals("1")) {
|
||||
_cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
_cfg.setIsValid(Constants.VALID_YES);
|
||||
_cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
_cfg.setAuditTime(date);
|
||||
|
||||
}else {
|
||||
_cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
_cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
_cfg.setIsAreaEffective(0);
|
||||
@@ -1571,27 +1517,31 @@ public class BaseController {
|
||||
_cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
_cfg.setAttribute(attribute);
|
||||
_cfg.setClassify(classify);
|
||||
_cfg.setServiceId(0);
|
||||
// _cfg.setServiceId(0);
|
||||
_cfg.setServiceId(serviceDict==null?0:serviceDict.getServiceId());
|
||||
//设置region id
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
_cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
//设置group id
|
||||
//设置group id,compileId
|
||||
if(asnNoMaps.get(0).containsKey(Long.parseLong(_cfg.getUserRegion1()))) {
|
||||
_cfg.setAsnIpGroup(asnNoMaps.get(0).get(Long.parseLong(_cfg.getUserRegion1())));
|
||||
_cfg.setAsnIpGroup(asnNoMaps.get(0).get(Long.parseLong(_cfg.getUserRegion1())).getGroupId());
|
||||
_cfg.setCompileId(asnNoMaps.get(0).get(Long.parseLong(_cfg.getUserRegion1())).getCompileId());
|
||||
}else if(asnNoMaps.get(1).containsKey(Long.parseLong(_cfg.getUserRegion1()))) {
|
||||
_cfg.setAsnIpGroup(asnNoMaps.get(1).get(Long.parseLong(_cfg.getUserRegion1())));
|
||||
_cfg.setAsnIpGroup(asnNoMaps.get(1).get(Long.parseLong(_cfg.getUserRegion1())).getGroupId());
|
||||
_cfg.setCompileId(asnNoMaps.get(1).get(Long.parseLong(_cfg.getUserRegion1())).getCompileId());
|
||||
}else {
|
||||
ConfigGroupInfo info=AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
if(info==null) {
|
||||
info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(_cfg.getUserRegion1()));
|
||||
//AsnGroupInfo info=AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
AsnGroupInfo info=asnGroupInfos.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
if(info!=null) {
|
||||
_cfg.setAsnIpGroup(info.getGroupId());
|
||||
_cfg.setCompileId(info.getCompileId());
|
||||
}
|
||||
_cfg.setAsnIpGroup(info.getGroupId());
|
||||
}
|
||||
asnIpCfgs.add(_cfg);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1734,7 +1684,7 @@ public class BaseController {
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1859,7 +1809,7 @@ public class BaseController {
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_stringCfgs.clear();
|
||||
@@ -1970,7 +1920,7 @@ public class BaseController {
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
@@ -2050,7 +2000,7 @@ public class BaseController {
|
||||
appFeatureIndexs.add(appfeature);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
@@ -2092,7 +2042,7 @@ public class BaseController {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
_dnsResStrategies.clear();
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
@@ -2123,6 +2073,48 @@ public class BaseController {
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
}
|
||||
|
||||
public void deleteIps(Map<Long,AsnGroupInfo> asnNoMap){
|
||||
List<AsnIpCfg> toDelAndSendAsnIpCfgs=Lists.newArrayList();
|
||||
List<Long> asnIds=Lists.newArrayList(asnNoMap.size());
|
||||
for(Entry<Long, AsnGroupInfo> e:asnNoMap.entrySet()) {
|
||||
AsnGroupInfo asnGroupInfo=e.getValue();
|
||||
if(asnGroupInfo==null) {
|
||||
asnGroupInfo=asnIpCfgService.getAsnGroupInfoByAsnNo(e.getKey());
|
||||
}
|
||||
if(asnGroupInfo.getIsValid()==1) {//已下发
|
||||
List<AsnIpCfg> _toDelAsnIpCfgs=asnIpCfgService.getByAsnNo(asnGroupInfo.getAsnId());
|
||||
toDelAndSendAsnIpCfgs.addAll(_toDelAsnIpCfgs);
|
||||
}else {
|
||||
asnIds.add(e.getKey());
|
||||
}
|
||||
}
|
||||
if(asnIds.size()>0) {
|
||||
asnIpCfgService.deleteByAsnNo(asnIds);
|
||||
}
|
||||
if(toDelAndSendAsnIpCfgs.size()>0) {
|
||||
int pointsDataLimit = Constants.MAAT_JSON_SEND_SIZE;//限制条数
|
||||
Integer size = toDelAndSendAsnIpCfgs.size();
|
||||
//判断是否有必要分批
|
||||
if(pointsDataLimit<size){
|
||||
int part = size/pointsDataLimit;//分批数
|
||||
for (int i = 0; i < part; i++) {
|
||||
//pointsDataLimit条
|
||||
List<AsnIpCfg> listPage = toDelAndSendAsnIpCfgs.subList(0, pointsDataLimit);
|
||||
asnIpCfgService.delAndSend(listPage);
|
||||
//剔除
|
||||
toDelAndSendAsnIpCfgs.subList(0, pointsDataLimit).clear();
|
||||
}
|
||||
//最后剩下的
|
||||
if(!toDelAndSendAsnIpCfgs.isEmpty()){
|
||||
asnIpCfgService.delAndSend(toDelAndSendAsnIpCfgs);
|
||||
|
||||
}
|
||||
}else {
|
||||
asnIpCfgService.delAndSend(toDelAndSendAsnIpCfgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 加载模板
|
||||
* @param ei
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
* 协议分组
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/asnGroup")
|
||||
public class AsnGroupController extends BaseController {
|
||||
|
||||
//@RequiresPermissions(value={"basics:asnGroup:view"},logical=Logical.OR)
|
||||
@RequestMapping(value = {"/asnGroupList", ""})
|
||||
public String asnGroupList(AsnGroupInfo cfg,HttpServletRequest request
|
||||
, HttpServletResponse response, Model model
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
if(cfg == null)cfg=new AsnGroupInfo();
|
||||
Page<AsnGroupInfo> pageCondition = new Page<AsnGroupInfo>(request, response,"r");
|
||||
|
||||
Page page = asnGroupInfoService.findAsnGroupInfoList(pageCondition,cfg);
|
||||
model.addAttribute("cfg", cfg);
|
||||
model.addAttribute("page", page);
|
||||
return "/basics/asnGroupList";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入添加或修改页面
|
||||
* @param serviceDictInfo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit","basics:classification:view","basics:attribute:view","basics:label:view"},logical=Logical.OR)
|
||||
@RequestMapping(value={"/asnGroupForm"})
|
||||
public String form(String ids,Model model,String doAction,RedirectAttributes redirectAttributes) {
|
||||
AsnGroupInfo asnGroup=new AsnGroupInfo();
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
asnGroup=asnGroupInfoService.getById(Integer.parseInt(ids));
|
||||
}
|
||||
model.addAttribute("_cfg", asnGroup);
|
||||
return "/basics/asnGroupForm";
|
||||
}
|
||||
/**
|
||||
* 新增或修改
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(AsnGroupInfo cfg,Model model,
|
||||
RedirectAttributes redirectAttributes,String itType) {
|
||||
|
||||
try {
|
||||
AsnGroupInfo asnGroup=asnGroupInfoService.getGroupIdByNameAndASNId(cfg.getOrganization().trim(), cfg.getCountry().trim(), cfg.getAsnId());
|
||||
if(asnGroup!=null) {
|
||||
Properties props=this.getMsgProp();
|
||||
addMessage(redirectAttributes,"error","ASN "+props.getProperty("repeat", "Repeat"));
|
||||
}
|
||||
asnGroupInfoService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("新增失败",e);
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del"},logical=Logical.OR)
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(RedirectAttributes redirectAttributes,String ids,String asnIds) {
|
||||
try {
|
||||
asnGroupInfoService.delete(ids,asnIds);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
}
|
||||
@RequestMapping(value="ajaxGetAuditedIP",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public boolean ajaxGetAuditedIP(Model model,@RequestParam(required=true,value="asnIds")String asnIds){
|
||||
if(StringUtils.isNotBlank(asnIds)) {
|
||||
return asnGroupInfoService.checkIps(asnIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@RequestMapping(value="asnGroupName",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Integer asnGroupName(Model model,@RequestParam(required=true,value="id")Long id,@RequestParam(required=true,value="organization")String organization,@RequestParam(required=true,value="country")String country,
|
||||
@RequestParam(required=true,value="detail")String detail,@RequestParam(required=true,value="asnId")Long asnId){
|
||||
if(StringUtils.isNotBlank(organization)) {
|
||||
AsnGroupInfo info= asnGroupInfoService.getGroupIdByNameAndASNId(organization,country,asnId);
|
||||
if(info==null) {
|
||||
return 0;
|
||||
}else if(id!=null&&info.getId().longValue()==id.longValue()){
|
||||
return 0;
|
||||
}else if(id!=null&&info.getId().longValue()!=id.longValue()){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// @RequestMapping(value="asnGroupName1",method=RequestMethod.POST)
|
||||
// @ResponseBody
|
||||
// public String asnGroupName1(Model model,@RequestParam(required=true,value="id")Long id,@RequestParam(required=true,value="organization")String organization,@RequestParam(required=true,value="country")String country,
|
||||
// @RequestParam(required=true,value="detail")String detail,@RequestParam(required=true,value="asnId")Long asnId){
|
||||
// if(StringUtils.isNotBlank(organization)) {
|
||||
// AsnGroupInfo info= asnGroupInfoService.getGroupIdByNameAndASNId(organization,country,asnId);
|
||||
// if(info==null) {
|
||||
// return "";
|
||||
// }else if(info.get) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
/**
|
||||
* 校验asn号是否已存在
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/checkAsnNo"})
|
||||
public boolean checkIp(AsnGroupInfo cfg, HttpServletRequest request, HttpServletResponse response){
|
||||
|
||||
AsnGroupInfo policyGroup = asnGroupInfoService.getInfoByAsnNo(cfg);
|
||||
if(policyGroup == null){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.nis.web.controller.basics;
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@@ -17,26 +20,33 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
//import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Lists;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/asn")
|
||||
public class AsnIpController extends BaseController{
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")AsnIpCfg entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
){
|
||||
Page<AsnIpCfg> page = asnIpCfgService.findPage(new Page<AsnIpCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
// initPageCondition(model);
|
||||
@@ -44,12 +54,6 @@ public class AsnIpController extends BaseController{
|
||||
model.addAttribute("regionList", regionList);
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
// List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4);
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
// AsnCacheUtils.init(false);
|
||||
// List<ConfigGroupInfo> policyGroups=AsnCacheUtils.getAllAsnGroup();
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
return "/basics/asnIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/addForm"})
|
||||
@@ -57,8 +61,8 @@ public class AsnIpController extends BaseController{
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
initFormCondition(model,cfg);
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(4);
|
||||
model.addAttribute("policyGroups", groupInfos);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/asnIpCfgFormAdd";
|
||||
}
|
||||
@@ -68,8 +72,8 @@ public class AsnIpController extends BaseController{
|
||||
,RedirectAttributes redirectAttributes){
|
||||
cfg = asnIpCfgService.get(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model, cfg);
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(4);
|
||||
model.addAttribute("policyGroups", groupInfos);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/asnIpCfgFormUpdate";
|
||||
}
|
||||
@@ -106,13 +110,64 @@ public class AsnIpController extends BaseController{
|
||||
|
||||
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"asn:ip:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")AsnIpCfg cfg
|
||||
,Integer isAudit
|
||||
,Integer isValid
|
||||
,String ids
|
||||
,Integer functionId
|
||||
, HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
//选中配置审核
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
List<AsnIpCfg> asnIps=asnIpCfgService.getByIds(ids);
|
||||
Map<Long,List<AsnIpCfg>> asnIpMap=Maps.newHashMap();
|
||||
for(AsnIpCfg asnIpCfg:asnIps) {
|
||||
asnIpCfg.setIsAudit(isAudit);
|
||||
asnIpCfg.setIsValid(isValid);
|
||||
asnIpCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
asnIpCfg.setAuditTime(new Date());
|
||||
asnIpCfg.setFunctionId(functionId);
|
||||
if(asnIpMap.containsKey(Long.parseLong(asnIpCfg.getUserRegion1()))) {
|
||||
asnIpMap.get(Long.parseLong(asnIpCfg.getUserRegion1())).add(asnIpCfg);
|
||||
}else {
|
||||
List<AsnIpCfg> _asnIps=Lists.newArrayList();
|
||||
_asnIps.add(asnIpCfg);
|
||||
asnIpMap.put(Long.parseLong(asnIpCfg.getUserRegion1()), _asnIps);
|
||||
}
|
||||
}
|
||||
asnIpCfgService.auditIpBatch(asnIpMap,isValid);
|
||||
}/*else {
|
||||
//条件下所有配置审核
|
||||
Page<AsnIpCfg> searchPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
Page<AsnIpCfg> auditPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}*/
|
||||
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"asn:ip:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
asnIpCfgService.delete(isValid,ids);
|
||||
asnIpCfgService.delete(ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
@@ -134,35 +189,13 @@ public class AsnIpController extends BaseController{
|
||||
logger.error("Delete failed",e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ajax设置Name
|
||||
* @param model
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="ajaxGroupName",method=RequestMethod.POST)
|
||||
@RequestMapping(value="ajaxGetGroups",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, String> ajaxGroupName(Model model,String ids){
|
||||
AsnCacheUtils.init(false);
|
||||
Map<String, String> groupMap=new HashMap<>();
|
||||
for(String id:ids.split(",")) {
|
||||
ConfigGroupInfo info=AsnCacheUtils.get(Long.parseLong(id));
|
||||
if(info!=null) {
|
||||
groupMap.put(id, info.getGroupName());
|
||||
}else {
|
||||
info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(id));
|
||||
groupMap.put(id, info.getGroupName());
|
||||
}
|
||||
public List<AsnGroupInfo> ajaxGetGroups(Model model,@RequestParam(required=true,value="org")String org){
|
||||
if(StringUtils.isNotBlank(org)) {
|
||||
return asnGroupInfoService.getByOrg(org);
|
||||
}
|
||||
return groupMap;
|
||||
}
|
||||
@RequestMapping(value="ajaxServiceIdState",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public boolean ajaxServiceIdState(Model model,@RequestParam(required=true,value="serviceGroupIds")String serviceGroupIds){
|
||||
if(StringUtils.isNotBlank(serviceGroupIds)) {
|
||||
return policyGroupInfoService.checkIsIssued(serviceGroupIds);
|
||||
}
|
||||
return false;
|
||||
return new ArrayList<AsnGroupInfo>();
|
||||
}
|
||||
@RequestMapping(value="ajaxIsLast",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
|
||||
@@ -11,7 +11,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.cxf.common.util.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -22,22 +21,11 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.CacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.configuration.DnsIpCfgService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/dnsIp")
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
@@ -38,7 +38,6 @@ import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsFakeIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsResStrategyTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptTemplate;
|
||||
@@ -51,6 +50,7 @@ import com.nis.domain.configuration.template.HttpsRejectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.IpWhitelistTemplate;
|
||||
@@ -60,7 +60,6 @@ import com.nis.domain.configuration.template.SnatTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.index.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
@@ -525,13 +524,13 @@ public class IpController extends BaseController{
|
||||
titleList.add("asn_policy");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("asn_policy", ConfigGroupInfo.class);
|
||||
classMap.put("asn_policy", AsnGroupInfo.class);
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion3,userregion4,userregion5,&userregion2:ratelimit-";
|
||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String asnGroupInfoNoExport="";
|
||||
String asnGroupInfoNoExport=ipPortInfoNoExport+"block_type,";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
@@ -549,15 +548,12 @@ public class IpController extends BaseController{
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("asn_policy", asnGroupInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<ConfigGroupInfo> groupInfoList=new ArrayList<ConfigGroupInfo>();
|
||||
List<AsnGroupInfo> groupInfoList=new ArrayList<AsnGroupInfo>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
if(!StringUtil.isEmpty(cfgIndexInfo.getAsnIpGroupName())){
|
||||
ConfigGroupInfo group=new ConfigGroupInfo();
|
||||
group.setCompileId(cfgIndexInfo.getCompileId());
|
||||
group.setGroupName(cfgIndexInfo.getAsnIpGroupName());
|
||||
groupInfoList.add(group);
|
||||
if(!StringUtil.isEmpty(cfgIndexInfo.getUserRegion4())){
|
||||
groupInfoList.addAll(cfgIndexInfo.getAsnGroups());
|
||||
}
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
@@ -6,7 +6,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -14,7 +13,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryName;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.CacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
@@ -105,12 +103,12 @@ public class DictController extends BaseController {
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"refreshCache"})
|
||||
public String refreshCache(String cacheName){
|
||||
if(cacheName.equals(AsnCacheUtils.getCacheName())) {
|
||||
AsnCacheUtils.clearCache();
|
||||
}else {
|
||||
// if(cacheName.equals(AsnCacheUtils.getCacheName())) {
|
||||
// AsnCacheUtils.clearCache();
|
||||
// }else {
|
||||
//删除字典缓存
|
||||
CacheUtils.remove(cacheName);
|
||||
}
|
||||
/*}*/
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
||||
32
src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.java
Normal file
32
src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.nis.web.dao.basics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface AsnGroupInfoDao extends CrudDao<AsnGroupInfo> {
|
||||
List<AsnGroupInfo> findAsnGroupInfoList(AsnGroupInfo policyGroupInfo);
|
||||
AsnGroupInfo getById(int id);
|
||||
AsnGroupInfo getByGroupId(int groupId);
|
||||
AsnGroupInfo getInfoByAsnNo(AsnGroupInfo policyGroupInfo);
|
||||
Integer getGroupIdByOrganization(String organization);
|
||||
AsnGroupInfo getGroupInfo(AsnGroupInfo policyGroupInfo);
|
||||
AsnGroupInfo getGroupInfoByName(AsnGroupInfo policyGroupInfo);
|
||||
int updateValid(AsnGroupInfo policyGroupInfo);
|
||||
Integer getGroupIdByName(@Param("organization")String organization,@Param("country")String country);
|
||||
AsnGroupInfo getGroupIdByNameAndASNId(@Param("organization")String organization,@Param("country")String country,@Param("asnId")Long asnId);
|
||||
List<AsnGroupInfo> getConfigGroupInfoByGroupId(Integer groupId);
|
||||
List<AsnGroupInfo> getConfigGroupInfoByName(@Param("organization")String organization);
|
||||
List<AsnGroupInfo> getValidConfigGroupInfoByName(@Param("organization")String organization);
|
||||
int getCountGroupInfoByName(@Param("organization")String organization);
|
||||
void insertBatch(List<AsnGroupInfo> policyGroupInfos);
|
||||
List<AsnGroupInfo> findAsnGroupInfos();
|
||||
Long getCount();
|
||||
void audit(AsnIpCfg t);
|
||||
}
|
||||
258
src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.xml
Normal file
258
src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.xml
Normal file
@@ -0,0 +1,258 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.basics.AsnGroupInfoDao" >
|
||||
<resultMap id="AsnGroupInfoMap" type="com.nis.domain.basics.AsnGroupInfo" >
|
||||
<id column="id" property="id" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="organization" property="organization" jdbcType="VARCHAR" />
|
||||
<result column="country" property="country" jdbcType="VARCHAR" />
|
||||
<result column="detail" property="detail" jdbcType="VARCHAR" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="asn_id" property="asnId" jdbcType="BIGINT" />
|
||||
<result column="org_group_id" property="orgGroupId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="AsnGroupInfoColumns">
|
||||
r.id,r.group_id,r.compile_id,r.organization,r.country,r.detail,r.is_valid,r.create_time,r.edit_time,
|
||||
r.creator_id,r.editor_id,r.asn_id,r.org_group_id
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findAsnGroupInfoList" resultMap="AsnGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name
|
||||
,e.name as editor_name
|
||||
</trim>
|
||||
FROM asn_group_info r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="organization != null and organization != ''">
|
||||
AND r.organization like concat(concat('%',#{organization,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="country != null and country != ''">
|
||||
AND r.country like concat(concat('%',#{country,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="detail != null and detail != ''">
|
||||
AND r.detail like concat(concat('%',#{detail,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="asnId != null and asnId != ''">
|
||||
AND r.asn_id =#{asnId }
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="orgGroupId != null and orgGroupId != ''">
|
||||
AND r.org_group_id =#{orgGroupId }
|
||||
</if>
|
||||
<if test="isValid != null and isValid != ''">
|
||||
AND r.is_valid =#{isValid }
|
||||
</if>
|
||||
AND r.is_valid !=-1
|
||||
<!-- 数据范围过滤 -->
|
||||
<!-- ${sqlMap.dsf} -->
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.group_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findAsnGroupInfos" resultMap="AsnGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM asn_group_info r where is_valid !=-1
|
||||
</select>
|
||||
<select id="getCount" resultType="java.lang.Long">
|
||||
SELECT count(1)
|
||||
FROM asn_group_info r where is_valid !=-1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
insert into asn_group_info(group_id,compile_id,organization,country,detail,is_valid,creator_id,create_time,editor_id,edit_time,asn_id,org_group_id
|
||||
)values (
|
||||
#{groupId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{organization,jdbcType=VARCHAR},
|
||||
#{country,jdbcType=VARCHAR},
|
||||
#{detail,jdbcType=VARCHAR},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{asnId,jdbcType=INTEGER},
|
||||
#{orgGroupId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
update asn_group_info
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="organization != null and organization !=''" >
|
||||
organization = #{organization,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="country != null and country !=''" >
|
||||
country = #{country,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="detail != null and detail !=''" >
|
||||
detail = #{detail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="asnId != null and asnId !=''" >
|
||||
asn_id = #{asnId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null and isValid !=''" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="groupId != null and groupId !=''" >
|
||||
group_id = #{groupId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orgGroupId != null and orgGroupId !=''" >
|
||||
org_group_id = #{orgGroupId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="compileId != null and compileId !=''" >
|
||||
compile_id = #{compileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
<trim suffixOverrides="and">
|
||||
<if test="id != null" >
|
||||
and id = #{id,jdbcType=INTEGER}
|
||||
</if>
|
||||
</trim>
|
||||
</where>
|
||||
</update>
|
||||
<update id="updateValid" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
update asn_group_info
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
<trim prefixOverrides="and">
|
||||
<if test="groupId != null" >
|
||||
and group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="id != null and id != ''" >
|
||||
and id = #{id,jdbcType=INTEGER}
|
||||
</if>
|
||||
</trim>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="getById" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
select <include refid="AsnGroupInfoColumns"/>
|
||||
from asn_group_info r
|
||||
where r.id =#{id}
|
||||
</select>
|
||||
<select id="getByGroupId" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
select <include refid="AsnGroupInfoColumns"/>
|
||||
from asn_group_info r
|
||||
where r.group_id =#{groupId} and is_valid !=-1
|
||||
</select>
|
||||
<select id="getGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
select <include refid="AsnGroupInfoColumns"/>
|
||||
from asn_group_info r
|
||||
where r.organization =#{organization}
|
||||
<!-- and r.country =#{country} -->
|
||||
and r.is_valid != -1 limit 1
|
||||
</select>
|
||||
<select id="getGroupIdByNameAndASNId" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
select <include refid="AsnGroupInfoColumns"/>
|
||||
from asn_group_info r
|
||||
where r.organization =#{organization}
|
||||
<!-- and r.country =#{country} -->
|
||||
and r.asn_id=#{asnId} and r.is_valid != -1 limit 1
|
||||
</select>
|
||||
<select id="getInfoByAsnNo" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="id != null" >
|
||||
AND id != #{id,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="groupId != null" >
|
||||
AND group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="asnId != null" >
|
||||
AND asn_id = #{asnId,jdbcType=BIGINT}
|
||||
</if>
|
||||
AND is_valid !=-1
|
||||
</trim>
|
||||
</select>
|
||||
<select id="getConfigGroupInfoByGroupId" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r WHERE group_id = #{groupId,jdbcType=INTEGER} AND is_valid !=-1
|
||||
</select>
|
||||
<select id="getConfigGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r WHERE organization = #{organization,jdbcType=VARCHAR} AND is_valid !=-1
|
||||
</select>
|
||||
<select id="getValidConfigGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r WHERE organization = #{organization,jdbcType=VARCHAR} AND is_valid =1
|
||||
</select>
|
||||
<select id="getCountGroupInfoByName" resultType="java.lang.Integer">
|
||||
SELECT count(1) FROM asn_group_info r WHERE organization = #{organization,jdbcType=VARCHAR} AND is_valid !=-1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getGroupIdByOrganization" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
r.group_id
|
||||
FROM
|
||||
asn_group_info r
|
||||
WHERE
|
||||
r.organization = #{organization}
|
||||
</select>
|
||||
|
||||
<select id="getGroupInfo" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="organization != null and organization != ''" >
|
||||
AND organization = #{organization,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="asnId != null" >
|
||||
AND asn_id = #{asnId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -17,14 +17,16 @@ public interface AsnIpCfgDao extends CrudDao<AsnIpCfg>{
|
||||
public void updateIssued(AsnIpCfg cfg);
|
||||
public List<AsnIpCfg> getByIds(@Param("ids")String ids);
|
||||
public List<Integer> hasGroupIds(@Param("ids")String ids);
|
||||
public List<Integer> hasASNIds(@Param("ids")String ids);
|
||||
public List<AsnIpCfg> findAllList(AsnIpCfg cfg);
|
||||
// public List<ConfigGroupInfo> findPolicyGroupInfosByType(@Param("groupId")Integer groupId);
|
||||
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
|
||||
public List<Integer> countValidIPs(@Param("groups")String groups,@Param("ids")String ids);
|
||||
|
||||
public List<AsnIpCfg> getByAsnNo(@Param("asnId")long asnNo);
|
||||
public int deleteByAsnGroup(@Param("asnId")String asnNo);
|
||||
public int deleteByAsnId(@Param("asnId")String asnNo);
|
||||
public int insertBatch(List<AsnIpCfg> list);
|
||||
public Varibles getVaribles(@Param("name")String name);
|
||||
public void ajaxDeleteAsnIp(@Param("ids")String ids);
|
||||
public int hasValidAsnIp(@Param("asnId")Long asnNo);
|
||||
}
|
||||
|
||||
@@ -41,11 +41,12 @@
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
<result column="organization" property="organization" jdbcType="VARCHAR" />
|
||||
<result column="country" property="country" jdbcType="VARCHAR" />
|
||||
<result column="detail" property="detail" jdbcType="VARCHAR" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<resultMap id="varibleMap" type="com.nis.domain.basics.Varibles">
|
||||
<result column="variable_name" property="variableName" jdbcType="VARCHAR" />
|
||||
<result column="value" property="value" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="columns">
|
||||
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port
|
||||
,r.protocol,r.protocol_id,r.direction,r.cfg_type,r.action,r.dest_port,r.dest_ip_address
|
||||
@@ -53,14 +54,14 @@
|
||||
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
|
||||
r.region_id,r.is_area_effective,r.classify,r.attribute,r.lable
|
||||
,r.area_effective_ids,r.function_id,r.cfg_region_code,r.asn_ip_group,r.user_region1
|
||||
,r.user_region2,r.user_region3,r.user_region4,r.user_region5
|
||||
,r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.organization,r.country,r.detail,r.compile_id
|
||||
</sql>
|
||||
|
||||
<select id="findPage" resultMap="asnIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name,d.group_name as asnIpGroupName
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name<!-- ,d.group_name as asnIpGroupName -->
|
||||
<!-- ,asn.group_name as asn_ip_group_name -->
|
||||
</trim>
|
||||
from asn_ip_cfg r
|
||||
@@ -68,7 +69,6 @@
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
left join sys_user u on r.auditor_id=u.id
|
||||
left join policy_group_info d on r.asn_ip_group = d.service_group_id
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
@@ -175,6 +175,15 @@
|
||||
<if test="functionId != null">
|
||||
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="organization != null">
|
||||
AND r.organization like concat(concat('%',#{organization,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="country != null">
|
||||
AND r.country like concat(concat('%',#{country,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
AND r.detail like concat(concat('%',#{detail,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
@@ -230,6 +239,7 @@
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
region_id,
|
||||
compile_id,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
@@ -253,12 +263,15 @@
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
user_region5,
|
||||
organization,
|
||||
country,
|
||||
detail
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
0,
|
||||
#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
@@ -268,6 +281,7 @@
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
@@ -291,7 +305,10 @@
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
#{userRegion5,jdbcType=VARCHAR},
|
||||
#{organization,jdbcType=VARCHAR},
|
||||
#{country,jdbcType=VARCHAR},
|
||||
#{detail,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<update id="updateIssued" parameterType="com.nis.domain.basics.AsnIpCfg" >
|
||||
@@ -387,6 +404,15 @@
|
||||
</if>
|
||||
<if test="cfgRegionCode != null " >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="organization != null " >
|
||||
organization = #{organization,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="country != null " >
|
||||
country = #{country,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="detail != null " >
|
||||
detail = #{detail,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="asnIpGroup != null " >
|
||||
asn_ip_group = #{asnIpGroup,jdbcType=INTEGER},
|
||||
@@ -403,12 +429,12 @@
|
||||
<!-- <update id="deleteByAsnGroup" parameterType="java.lang.Integer" >
|
||||
update asn_ip_cfg set is_valid=-1 where asn_ip_group=#{groupId} and user_region1=#{asnId}
|
||||
</update> -->
|
||||
<delete id="deleteByAsnGroup" parameterType="java.lang.String" >
|
||||
<delete id="deleteByAsnId" parameterType="java.lang.String" >
|
||||
delete from asn_ip_cfg where user_region1 in(${asnId}) limit 10000
|
||||
</delete>
|
||||
<update id="delete" parameterType="java.lang.String" >
|
||||
<delete id="delete" parameterType="java.lang.String" >
|
||||
delete from asn_ip_cfg where cfg_id in (${ids})
|
||||
</update>
|
||||
</delete>
|
||||
<update id="ajaxDeleteAsnIp" parameterType="java.lang.String" >
|
||||
delete from asn_ip_cfg where asn_ip_group in (${ids})
|
||||
</update>
|
||||
@@ -418,25 +444,25 @@
|
||||
<select id="hasGroupIds" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
||||
select 1 from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${ids}) limit 1
|
||||
</select>
|
||||
<select id="hasASNIds" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
||||
select 1 from asn_ip_cfg where is_valid !=-1 and is_audit=1 and user_region1 in(${ids}) limit 1
|
||||
</select>
|
||||
<select id="countValidIPs" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
select count(1) from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${groups}) and cfg_id not in(${ids}) GROUP BY asn_ip_group;
|
||||
</select>
|
||||
<select id="getVaribles" resultMap="varibleMap" parameterType="java.lang.String">
|
||||
show VARIABLES like #{name}
|
||||
</select>
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO asn_ip_cfg
|
||||
(CFG_DESC,ACTION,IS_VALID,IS_AUDIT,CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,
|
||||
AUDIT_TIME,SERVICE_ID,REQUEST_ID,region_id,IS_AREA_EFFECTIVE,CLASSIFY,ATTRIBUTE,LABLE,
|
||||
AUDIT_TIME,SERVICE_ID,REQUEST_ID,region_id,compile_id,IS_AREA_EFFECTIVE,CLASSIFY,ATTRIBUTE,LABLE,
|
||||
AREA_EFFECTIVE_IDS,function_id,ip_type,src_ip_address,ip_pattern,port_pattern,src_port,
|
||||
protocol,protocol_id,direction,dest_port,dest_ip_address,cfg_type,cfg_region_code,
|
||||
asn_ip_group,user_region1,user_region2,user_region3,user_region4,user_region5)
|
||||
asn_ip_group,user_region1,user_region2,user_region3,user_region4,user_region5,organization,country,detail)
|
||||
VALUES
|
||||
<foreach collection ="list" item="asnIp" separator =",">
|
||||
(#{asnIp.cfgDesc,jdbcType=VARCHAR},
|
||||
#{asnIp.action,jdbcType=INTEGER},
|
||||
#{asnIp.isValid,jdbcType=INTEGER},
|
||||
0,
|
||||
#{asnIp.isAudit,jdbcType=INTEGER},
|
||||
#{asnIp.creatorId,jdbcType=INTEGER},
|
||||
#{asnIp.createTime,jdbcType=TIMESTAMP},
|
||||
#{asnIp.editorId,jdbcType=INTEGER},
|
||||
@@ -446,6 +472,7 @@
|
||||
#{asnIp.serviceId,jdbcType=INTEGER},
|
||||
#{asnIp.requestId,jdbcType=INTEGER},
|
||||
#{asnIp.regionId,jdbcType=INTEGER},
|
||||
#{asnIp.compileId,jdbcType=INTEGER},
|
||||
#{asnIp.isAreaEffective,jdbcType=INTEGER},
|
||||
#{asnIp.classify,jdbcType=VARCHAR},
|
||||
#{asnIp.attribute,jdbcType=VARCHAR},
|
||||
@@ -469,17 +496,20 @@
|
||||
#{asnIp.userRegion2,jdbcType=VARCHAR},
|
||||
#{asnIp.userRegion3,jdbcType=VARCHAR},
|
||||
#{asnIp.userRegion4,jdbcType=VARCHAR},
|
||||
#{asnIp.userRegion5,jdbcType=VARCHAR})
|
||||
#{asnIp.userRegion5,jdbcType=VARCHAR}),
|
||||
#{asnIp.organization,jdbcType=VARCHAR}),
|
||||
#{asnIp.country,jdbcType=VARCHAR}),
|
||||
#{asnIp.detail,jdbcType=VARCHAR})
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<select id="hasValidAsnIp" resultType="java.lang.Integer">
|
||||
select count(1) from asn_ip_cfg where is_valid=1 and user_region1=#{asnId}
|
||||
</select>
|
||||
<select id="findByPage" resultMap="asnIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name,d.group_name as asnIpGroupName
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name<!-- ,d.group_name as asnIpGroupName -->
|
||||
<!-- ,asn.group_name as asn_ip_group_name -->
|
||||
</trim>
|
||||
from asn_ip_cfg r
|
||||
@@ -487,7 +517,7 @@
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
left join sys_user u on r.auditor_id=u.id
|
||||
left join policy_group_info d on r.asn_ip_group = d.service_group_id
|
||||
<!-- left join policy_group_info d on r.asn_ip_group = d.service_group_id -->
|
||||
where r.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
|
||||
@@ -275,8 +275,7 @@
|
||||
update cfg_index_info set is_valid=#{isValid} where cfg_id in (${ids})
|
||||
</update>
|
||||
<select id="getConfigGroupInfoList" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Integer">
|
||||
SELECT c.id,c.group_id,c.group_name,c.is_issued,c.insert_time,c.update_time,c.group_type,c.asn_id FROM (
|
||||
SELECT DISTINCT asn_ip_group FROM asn_ip_cfg WHERE is_valid !=-1) a
|
||||
LEFT JOIN config_group_info c ON a.asn_ip_group=c.group_id where c.group_type=#{groupType}
|
||||
SELECT c.id,c.group_id,c.group_name,c.is_issued,c.insert_time,c.update_time,c.group_type,c.asn_id FROM
|
||||
config_group_info c where c.group_name in (select DISTINCT organization from asn_group_info where is_valid=1)
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -20,4 +20,7 @@ public interface ConfigGroupInfoDao extends CrudDao<ConfigGroupInfo>{
|
||||
ConfigGroupInfo getInfoByAsnNo(@Param("asnId")Long asnNo);
|
||||
Integer getIssuedConfigGroupInfoByGroupIds(@Param("groupIds")String groupIds);
|
||||
Long getCountByType(@Param("groupType")Integer groupType);
|
||||
//获取asn组织的groupId
|
||||
ConfigGroupInfo getAsnGroupByName(@Param("groupName")String groupName);
|
||||
int delAsnGroup(@Param("groupName")String groupName);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||
from config_group_info where group_id= #{groupId}
|
||||
</select>
|
||||
<select id="getAsnGroupByName" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.String">
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||
from config_group_info where group_type=4 and group_name= #{groupName}
|
||||
</select>
|
||||
<!-- <select id="findPolicyGroupInfosByType" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Integer">
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||
from config_group_info c where c.group_type= #{groupType}
|
||||
@@ -80,4 +84,7 @@
|
||||
<select id="getCountByType" resultType="java.lang.Long" parameterType="java.lang.Integer">
|
||||
select count(1) from config_group_info c where c.group_type=${groupType}
|
||||
</select>
|
||||
<delete id="delAsnGroup" parameterType="java.lang.String">
|
||||
delete from config_group_info where group_name=#{groupName} and group_type=4
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -11,6 +11,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
@@ -41,6 +42,7 @@ import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysRole;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.callback.NtcDnsResStrategy;
|
||||
@@ -79,6 +81,7 @@ import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
//import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
@@ -87,6 +90,7 @@ import com.nis.util.IpUtil;
|
||||
import com.nis.util.Reflections;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.configuration.AppCfgDao;
|
||||
import com.nis.web.dao.configuration.AppMultiFeatureCfgDao;
|
||||
@@ -1600,6 +1604,7 @@ public abstract class BaseService {
|
||||
List<? extends BaseCfg> list,List<CfgIndexInfo> cfgIndexInfos,
|
||||
List<AppPolicyCfg> appPolicyCfgs,
|
||||
List<AppFeatureIndex> appFeatureCfgs,
|
||||
List<Map<Long,AsnGroupInfo>> asnNoMaps,
|
||||
boolean send){
|
||||
if(list!=null&&list.size()>0) {
|
||||
String type=null;
|
||||
@@ -1635,7 +1640,7 @@ public abstract class BaseService {
|
||||
}
|
||||
}else if("AsnIpCfg".equals(type)) {
|
||||
List<AsnIpCfg> listPage = (List<AsnIpCfg>) list;
|
||||
this.saveAsnIpBatch(listPage);
|
||||
this.saveAsnIpBatch(listPage,asnNoMaps,send);
|
||||
}else if("AppComplexFeature".equals(type)) {// APP Payload
|
||||
List<AppComplexFeatureCfg> listPage = (List<AppComplexFeatureCfg>) list;
|
||||
this.saveAppComplexFeatureBatch(regionDict,serviceDict,listPage,send);
|
||||
@@ -1767,19 +1772,107 @@ public abstract class BaseService {
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAsnIpBatch(List<AsnIpCfg> cfgs){
|
||||
public void saveAsnIpBatch(List<AsnIpCfg> cfgs,List<Map<Long,AsnGroupInfo>> asnNoMaps,boolean send){
|
||||
logger.warn("Start to save IP,size:"+cfgs.size());
|
||||
long start=System.currentTimeMillis();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
//需要通过新增域接口新增的ip集合
|
||||
List<AsnIpCfg> toAddRegionAsnIpCfgs=Lists.newArrayList();
|
||||
Map<Long,List<AsnIpCfg>> toSendFirstAsnIpCfgs=Maps.newHashMap();
|
||||
|
||||
// AsnCacheUtils.init(true);
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(AsnIpCfg cfg:cfgs) {
|
||||
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(cfg);
|
||||
if(Constants.VALID_YES==cfg.getIsValid().intValue()) {
|
||||
toAddRegionAsnIpCfgs.add(cfg);
|
||||
if(send) {
|
||||
AsnGroupInfo group=asnNoMaps.get(0).get(Long.parseLong(cfg.getUserRegion1()));
|
||||
if(group==null) {
|
||||
group=asnNoMaps.get(1).get(Long.parseLong(cfg.getUserRegion1()));
|
||||
}
|
||||
//AsnGroupInfo group=AsnCacheUtils.get(Long.parseLong(cfg.getUserRegion1()));
|
||||
if(group!=null&&group.getIsValid().intValue()==1) {
|
||||
toAddRegionAsnIpCfgs.add(cfg);
|
||||
}else if(group!=null) {
|
||||
if(toSendFirstAsnIpCfgs.containsKey(group.getAsnId())) {
|
||||
toSendFirstAsnIpCfgs.get(group.getAsnId()).add(cfg);
|
||||
}else {
|
||||
toSendFirstAsnIpCfgs.put(group.getAsnId(), Lists.newArrayList());
|
||||
toSendFirstAsnIpCfgs.get(group.getAsnId()).add(cfg);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(send) {
|
||||
if(toAddRegionAsnIpCfgs.size()>0) {
|
||||
asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES);
|
||||
}
|
||||
if(toSendFirstAsnIpCfgs.size()>0) {
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
|
||||
for(Entry<Long, List<AsnIpCfg>> info:toSendFirstAsnIpCfgs.entrySet()) {
|
||||
AsnGroupInfo group=asnNoMaps.get(0).get(info.getKey());
|
||||
if(group==null) {
|
||||
group=asnNoMaps.get(1).get(info.getKey());
|
||||
}
|
||||
//AsnGroupInfo group=AsnCacheUtils.get(info.getKey());
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
maatCfg.initDefaultValue();
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(group.getCompileId());
|
||||
groupCfg.setGroupId(group.getGroupId());
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(info.getValue().get(0).getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
BeanUtils.copyProperties(info.getValue().get(0), maatCfg);
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(info.getValue(),Constants.VALID_YES,group.getGroupId()));
|
||||
maatCfg.setCompileId(group.getCompileId());
|
||||
maatCfg.setAction(info.getValue().get(0).getAction());
|
||||
maatCfg.setAuditTime(info.getValue().get(0).getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(info.getValue().get(0).getIsValid());
|
||||
// 设置自定义域
|
||||
String userRegion = "ASN_ID=" + info.getKey();
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
|
||||
group.setIsValid(1);
|
||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).updateValid(group);
|
||||
}
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(cfgs.get(0).getAuditTime());
|
||||
maatBean.setCreatorName(cfgs.get(0).getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
// 调用服务接口下发配置数据
|
||||
String json = gsonToJson(maatBean);
|
||||
if(configCompileList.size()<=100) {
|
||||
logger.info("asn IP配置下发配置参数:" + json);
|
||||
}else {
|
||||
logger.info("asn IP配置下发配置数量:" + configCompileList.size());
|
||||
}
|
||||
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("asn IP配置下发响应信息:" + result.getMsg());
|
||||
}
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
@@ -1790,9 +1883,6 @@ public abstract class BaseService {
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("Save IP finish,cost:"+(end-start));
|
||||
if(toAddRegionAsnIpCfgs.size()>0) {
|
||||
asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES);
|
||||
}
|
||||
cfgs.clear();
|
||||
toAddRegionAsnIpCfgs.clear();
|
||||
cfgs=null;
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Maps;
|
||||
|
||||
@Service
|
||||
public class AsnGroupInfoService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private AsnGroupInfoDao asnGroupInfoDao;
|
||||
@Autowired
|
||||
private ConfigGroupInfoDao configGroupInfoDao;
|
||||
@Autowired
|
||||
private AsnIpCfgDao asnIpCfgDao;
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<AsnGroupInfo> findAsnGroupInfoList(Page<AsnGroupInfo> page, AsnGroupInfo entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<AsnGroupInfo> list=asnGroupInfoDao.findAsnGroupInfoList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public AsnGroupInfo getById(int id) {
|
||||
AsnGroupInfo AsnGroupInfo=asnGroupInfoDao.getById(id);
|
||||
return AsnGroupInfo;
|
||||
}
|
||||
public List<AsnGroupInfo> getByOrg(String org) {
|
||||
List<AsnGroupInfo> AsnGroupInfos=asnGroupInfoDao.getConfigGroupInfoByName(org);
|
||||
return AsnGroupInfos;
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(AsnGroupInfo entity) throws MaatConvertException{
|
||||
//asn类型从综合服务获取groupId
|
||||
String org=entity.getOrganization().trim();
|
||||
String country=entity.getCountry().trim();
|
||||
int groupId=0;
|
||||
//获取组织
|
||||
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getAsnGroupByName(org);
|
||||
|
||||
if(configGroupInfo==null) {
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,2);
|
||||
if(groupIds.size()>0) {
|
||||
groupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(org);
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setGroupId(groupIds.get(1));
|
||||
configGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
||||
}else {
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
groupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
|
||||
}
|
||||
//新增
|
||||
if(entity.getGroupId()==null){
|
||||
Date createTime=new Date();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
entity.setGroupId(groupId);
|
||||
entity.setIsValid(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");
|
||||
}
|
||||
asnGroupInfoDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
entity.setGroupId(groupId);
|
||||
asnGroupInfoDao.update(entity);
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids,String asnIds){
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for (String id : ids.split(",")) {
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
AsnGroupInfo entity=asnGroupInfoDao.getById(Integer.parseInt(id));
|
||||
entity.setIsValid(-1);
|
||||
entity.setId(Long.parseLong(id));
|
||||
asnGroupInfoDao.updateValid(entity);
|
||||
if(asnGroupInfoDao.getCountGroupInfoByName(entity.getOrganization())==0) {
|
||||
configGroupInfoDao.delAsnGroup(entity.getOrganization());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
}while(result>0);
|
||||
}
|
||||
|
||||
}
|
||||
public boolean checkIps(String groupIds) {
|
||||
for(String groupId:groupIds.split(",")) {
|
||||
Integer.parseInt(groupId);
|
||||
}
|
||||
List<Integer> hasIpList=asnIpCfgDao.hasASNIds(groupIds);
|
||||
if(hasIpList!=null&&hasIpList.size()>0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public AsnGroupInfo getInfoByAsnNo(AsnGroupInfo AsnGroupInfo){
|
||||
return asnGroupInfoDao.getInfoByAsnNo(AsnGroupInfo);
|
||||
}
|
||||
|
||||
public Integer getGroupIdByOrganization(String groupName){
|
||||
return asnGroupInfoDao.getGroupIdByOrganization(groupName);
|
||||
}
|
||||
|
||||
public AsnGroupInfo getGroupInfo(AsnGroupInfo AsnGroupInfo){
|
||||
return asnGroupInfoDao.getGroupInfo(AsnGroupInfo);
|
||||
}
|
||||
|
||||
public AsnGroupInfo getGroupIdByNameAndASNId(String organization,String country,Long asnId) {
|
||||
return asnGroupInfoDao.getGroupIdByNameAndASNId(organization,country,asnId);
|
||||
}
|
||||
public Map<Long,AsnGroupInfo> getGroupList() {
|
||||
Map<Long,AsnGroupInfo> map=Maps.newConcurrentMap();
|
||||
for(AsnGroupInfo info:asnGroupInfoDao.findAsnGroupInfos()) {
|
||||
map.put(info.getAsnId(), info);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -18,27 +18,29 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.basics.Varibles;
|
||||
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;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.basics.PolicyGroupInfoDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
@Service
|
||||
public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
@Autowired
|
||||
@@ -48,7 +50,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
@Autowired
|
||||
private ConfigGroupInfoDao configGroupInfoDao;
|
||||
@Autowired
|
||||
private PolicyGroupInfoDao policyGroupInfoDao;
|
||||
private AsnGroupInfoDao asnGroupInfoDao;
|
||||
/**
|
||||
* @param page
|
||||
* @param entity
|
||||
@@ -66,41 +68,32 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
List<AsnIpCfg> list=asnIpCfgDao.findByPage(ids);
|
||||
return list;
|
||||
}
|
||||
public boolean hasValidAsnIp(Long asnId) {
|
||||
return asnIpCfgDao.hasValidAsnIp(asnId)>0;
|
||||
}
|
||||
|
||||
|
||||
public AsnIpCfg get(Long id ) {
|
||||
return asnIpCfgDao.get(id);
|
||||
}
|
||||
|
||||
// public void save(List<AsnIpCfg> entitys){
|
||||
// this.saveBatch(entitys, AsnIpCfgDao.class);
|
||||
// }
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void save(List<AsnIpCfg> entitys) {
|
||||
logger.warn("Start to save IP,size:"+entitys.size());
|
||||
long start=System.currentTimeMillis();
|
||||
int len=0;
|
||||
List<AsnIpCfg> tempList=Lists.newArrayList();
|
||||
// Varibles maxPacket=asnIpCfgDao.getVaribles("max_allowed_packet");
|
||||
for(AsnIpCfg asnIpCfg:entitys) {
|
||||
int tempLen=asnIpCfg.toString().getBytes(Charset.forName("UTF-8")).length;
|
||||
if((len+tempLen)<Constants.MAX_ALLOWED_PACKET) {
|
||||
tempList.add(asnIpCfg);
|
||||
len+=tempLen;
|
||||
}else {
|
||||
// logger.warn("save ip size:"+tempList.size());
|
||||
asnIpCfgDao.insertBatch(tempList);
|
||||
tempList.clear();
|
||||
tempList.add(asnIpCfg);
|
||||
len=tempLen;
|
||||
}
|
||||
}
|
||||
if(tempList.size()>0) {
|
||||
// logger.warn("save ip size:"+tempList.size());
|
||||
asnIpCfgDao.insertBatch(tempList);
|
||||
tempList.clear();
|
||||
}
|
||||
// entitys.clear();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(AsnIpCfg asnIpCfg:entitys) {
|
||||
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(asnIpCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("Save IP finish,cost:"+(end-start));
|
||||
}
|
||||
@@ -109,122 +102,133 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
Date editTime=new Date();
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
if(entity.getAsnIpGroup()==null) {
|
||||
throw new RuntimeException("asn group name not found!");
|
||||
}
|
||||
ConfigGroupInfo groupInfo=configGroupInfoDao.getConfigGroupInfoByGroupId(entity.getAsnIpGroup());
|
||||
if(groupInfo.getIsIssued()==0) {//未下发,可修改
|
||||
asnIpCfgDao.update(entity);
|
||||
}else {
|
||||
throw new RuntimeException("asn group is issued, cannot update asn ip!");
|
||||
}
|
||||
|
||||
String org=entity.getOrganization().trim();
|
||||
String country=entity.getCountry().trim();
|
||||
String detail=entity.getDetail().trim();
|
||||
entity.setOrganization(org);
|
||||
entity.setCountry(country);
|
||||
entity.setDetail(detail);
|
||||
asnIpCfgDao.update(entity);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void processGroup(Map<Long,Integer> asnNoMap){
|
||||
public void processGroup(Map<Long,AsnGroupInfo> asnNoMap){
|
||||
logger.warn("Start to save group");
|
||||
long start=System.currentTimeMillis();
|
||||
List<PolicyGroupInfo> policyGroupInfos=Lists.newArrayList();
|
||||
List<ConfigGroupInfo> configGroupInfoS=Lists.newArrayList();
|
||||
Date createTime=new Date();
|
||||
int len=0,len1=0;
|
||||
// Varibles maxPacket=asnIpCfgDao.getVaribles("max_allowed_packet");
|
||||
for(Entry<Long, Integer> e:asnNoMap.entrySet()) {
|
||||
PolicyGroupInfo info=new PolicyGroupInfo();
|
||||
info.setAsnNo(e.getKey());
|
||||
info.setDescription("Create by import excel");
|
||||
info.setGroupName("Import"+e.getKey());
|
||||
info.setGroupType(4);
|
||||
info.setServiceGroupId(asnNoMap.get(e.getKey()));
|
||||
info.setIsValid(1);
|
||||
info.setCreatorId(UserUtils.getUser().getId());
|
||||
info.setCreateTime(createTime);
|
||||
int tempLen=info.toString().getBytes(Charset.forName("UTF-8")).length;
|
||||
if((len+tempLen)<Constants.MAX_ALLOWED_PACKET) {
|
||||
policyGroupInfos.add(info);
|
||||
len+=tempLen;
|
||||
}else {
|
||||
policyGroupInfoDao.insertBatch(policyGroupInfos);
|
||||
policyGroupInfos.clear();
|
||||
policyGroupInfos.add(info);
|
||||
len=tempLen;
|
||||
}
|
||||
ConfigGroupInfo group=new ConfigGroupInfo();
|
||||
group.setGroupId(info.getServiceGroupId());
|
||||
group.setGroupName(info.getGroupName());
|
||||
group.setIsIssued(0);
|
||||
group.setGroupType(info.getGroupType());
|
||||
group.setAsnId(info.getAsnNo());
|
||||
int tempLen1=group.toString().getBytes(Charset.forName("UTF-8")).length;
|
||||
if((len1+tempLen1)<Constants.MAX_ALLOWED_PACKET) {
|
||||
configGroupInfoS.add(group);
|
||||
len1+=tempLen1;
|
||||
}else {
|
||||
configGroupInfoDao.insertBatch(configGroupInfoS);
|
||||
configGroupInfoS.clear();
|
||||
configGroupInfoS.add(group);
|
||||
len1=tempLen1;
|
||||
}
|
||||
}
|
||||
if(policyGroupInfos.size()>0) {
|
||||
policyGroupInfoDao.insertBatch(policyGroupInfos);
|
||||
policyGroupInfos.clear();
|
||||
}
|
||||
if(configGroupInfoS.size()>0) {
|
||||
configGroupInfoDao.insertBatch(configGroupInfoS);
|
||||
configGroupInfoS.clear();
|
||||
}
|
||||
int index=0;
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
Set<String> groupSet=new HashSet<>();
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
if(!asnNoMap.isEmpty()) {
|
||||
List<Integer> compileIds=ConfigServiceUtil.getId(1, asnNoMap.size());
|
||||
List<Integer> groupIds=ConfigServiceUtil.getId(2, asnNoMap.size());
|
||||
for(Entry<Long, AsnGroupInfo> e:asnNoMap.entrySet()) {
|
||||
AsnGroupInfo info=e.getValue();
|
||||
info.setAsnId(e.getKey());
|
||||
info.setIsValid(0);
|
||||
info.setCreatorId(UserUtils.getUser().getId());
|
||||
info.setCreateTime(createTime);
|
||||
info.setGroupId(groupIds.get(index));
|
||||
info.setCompileId(compileIds.get(index));
|
||||
if(!groupSet.contains(info.getOrganization())) {
|
||||
groupSet.add(info.getOrganization());
|
||||
}
|
||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).insert(info);
|
||||
if(index%Constants.IMPORT_LIMIT==0) {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
batchSaveConfigGroupInfo(groupSet);
|
||||
//刷新缓存
|
||||
AsnCacheUtils.init(true);
|
||||
//AsnCacheUtils.init(true);
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("Save group finish,cost:"+(end-start));
|
||||
}
|
||||
public void deleteIps(Map<Long,Integer> asnNoMap){
|
||||
List<AsnIpCfg> toDelAndSendAsnIpCfgs=Lists.newArrayList();
|
||||
List<Long> asnIds=Lists.newArrayList(asnNoMap.size());
|
||||
for(Entry<Long, Integer> e:asnNoMap.entrySet()) {
|
||||
ConfigGroupInfo configGroupInfo=AsnCacheUtils.get(e.getKey());
|
||||
if(configGroupInfo==null) {
|
||||
configGroupInfo=this.getConfigGroupInfoByAsnNo(e.getKey());
|
||||
}
|
||||
if(configGroupInfo.getIsIssued()==1) {//已下发
|
||||
List<AsnIpCfg> _toDelAsnIpCfgs=this.getByAsnNo(configGroupInfo.getAsnId());
|
||||
toDelAndSendAsnIpCfgs.addAll(_toDelAsnIpCfgs);
|
||||
}else {
|
||||
asnIds.add(e.getKey());
|
||||
}
|
||||
}
|
||||
if(asnIds.size()>0) {
|
||||
this.deleteByAsnNo(asnIds);
|
||||
}
|
||||
if(toDelAndSendAsnIpCfgs.size()>0) {
|
||||
int pointsDataLimit = Constants.MAAT_JSON_SEND_SIZE;//限制条数
|
||||
Integer size = toDelAndSendAsnIpCfgs.size();
|
||||
//判断是否有必要分批
|
||||
if(pointsDataLimit<size){
|
||||
int part = size/pointsDataLimit;//分批数
|
||||
for (int i = 0; i < part; i++) {
|
||||
//pointsDataLimit条
|
||||
List<AsnIpCfg> listPage = toDelAndSendAsnIpCfgs.subList(0, pointsDataLimit);
|
||||
delAndSend(listPage);
|
||||
//剔除
|
||||
toDelAndSendAsnIpCfgs.subList(0, pointsDataLimit).clear();
|
||||
public void batchSaveConfigGroupInfo(Set<String> groupSet) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
if(groupSet.size()>0) {
|
||||
int index=0;
|
||||
List<Integer> groupIds=ConfigServiceUtil.getId(2, groupSet.size());
|
||||
for(String org:groupSet) {
|
||||
ConfigGroupInfo configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(org);
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfo.setGroupId(groupIds.get(index));
|
||||
((ConfigGroupInfoDao) batchSqlSession.getMapper(ConfigGroupInfoDao.class)).insertConfigGroupInfo(configGroupInfo);
|
||||
if(index%Constants.IMPORT_LIMIT==0) {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
//最后剩下的
|
||||
if(!toDelAndSendAsnIpCfgs.isEmpty()){
|
||||
delAndSend(toDelAndSendAsnIpCfgs);
|
||||
|
||||
}
|
||||
}else {
|
||||
delAndSend(toDelAndSendAsnIpCfgs);
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
}
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 根据Id 批量删除
|
||||
* @param entities
|
||||
*/
|
||||
public void deleteByIdsBatch(List<AsnIpCfg> entities) {
|
||||
// public void deleteIps(Map<Long,AsnGroupInfo> asnNoMap){
|
||||
// List<AsnIpCfg> toDelAndSendAsnIpCfgs=Lists.newArrayList();
|
||||
// List<Long> asnIds=Lists.newArrayList(asnNoMap.size());
|
||||
// for(Entry<Long, AsnGroupInfo> e:asnNoMap.entrySet()) {
|
||||
// AsnGroupInfo asnGroupInfo=e.getValue();
|
||||
// if(asnGroupInfo==null) {
|
||||
// asnGroupInfo=this.getAsnGroupInfoByAsnNo(e.getKey());
|
||||
// }
|
||||
// if(asnGroupInfo.getIsValid()==1) {//已下发
|
||||
// List<AsnIpCfg> _toDelAsnIpCfgs=this.getByAsnNo(asnGroupInfo.getAsnId());
|
||||
// toDelAndSendAsnIpCfgs.addAll(_toDelAsnIpCfgs);
|
||||
// }else {
|
||||
// asnIds.add(e.getKey());
|
||||
// }
|
||||
// }
|
||||
// if(asnIds.size()>0) {
|
||||
// this.deleteByAsnNo(asnIds);
|
||||
// }
|
||||
// if(toDelAndSendAsnIpCfgs.size()>0) {
|
||||
// int pointsDataLimit = Constants.MAAT_JSON_SEND_SIZE;//限制条数
|
||||
// Integer size = toDelAndSendAsnIpCfgs.size();
|
||||
// //判断是否有必要分批
|
||||
// if(pointsDataLimit<size){
|
||||
// int part = size/pointsDataLimit;//分批数
|
||||
// for (int i = 0; i < part; i++) {
|
||||
// //pointsDataLimit条
|
||||
// List<AsnIpCfg> listPage = toDelAndSendAsnIpCfgs.subList(0, pointsDataLimit);
|
||||
// delAndSend(listPage);
|
||||
// //剔除
|
||||
// toDelAndSendAsnIpCfgs.subList(0, pointsDataLimit).clear();
|
||||
// }
|
||||
// //最后剩下的
|
||||
// if(!toDelAndSendAsnIpCfgs.isEmpty()){
|
||||
// delAndSend(toDelAndSendAsnIpCfgs);
|
||||
//
|
||||
// }
|
||||
// }else {
|
||||
// delAndSend(toDelAndSendAsnIpCfgs);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delAndSend(List<AsnIpCfg> entities) {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
for(AsnIpCfg ip:entities) {
|
||||
sb.append(ip.getCfgId());
|
||||
@@ -232,134 +236,87 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
sb.deleteCharAt(sb.toString().lastIndexOf(","));
|
||||
asnIpCfgDao.delete(sb.toString());
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delAndSend(List<AsnIpCfg> entities) {
|
||||
deleteByIdsBatch(entities);
|
||||
asnIPRegionSendToMaat(entities,Constants.VALID_NO);
|
||||
}
|
||||
/**
|
||||
* 分割IP region分次下发
|
||||
* 由于在Controller中分割,此方法不需要调用,直接使用asnIPRegionSendToMaat方法即可
|
||||
* @param asnIpCfgs
|
||||
* @param valid
|
||||
*/
|
||||
@Deprecated
|
||||
public void splitAndSend(List<AsnIpCfg> asnIpCfgs,Integer valid){
|
||||
if(asnIpCfgs!=null&&asnIpCfgs.size()>0) {
|
||||
// List<AsnIpCfg> asnIpCfgs=Lists.newArrayList(list.size());
|
||||
// asnIpCfgs.addAll(list);
|
||||
int pointsDataLimit = Constants.MAAT_JSON_SEND_SIZE;//限制条数
|
||||
Integer size = asnIpCfgs.size();
|
||||
//判断是否有必要分批
|
||||
if(pointsDataLimit<size){
|
||||
int part = size/pointsDataLimit;//分批数
|
||||
for (int i = 0; i < part; i++) {
|
||||
//pointsDataLimit条
|
||||
List<AsnIpCfg> listPage = asnIpCfgs.subList(0, pointsDataLimit);
|
||||
asnIPRegionSendToMaat(listPage,valid);
|
||||
//剔除
|
||||
asnIpCfgs.subList(0, pointsDataLimit).clear();
|
||||
}
|
||||
//最后剩下的
|
||||
if(!asnIpCfgs.isEmpty()){
|
||||
asnIPRegionSendToMaat(asnIpCfgs,valid);
|
||||
}
|
||||
}else {
|
||||
asnIPRegionSendToMaat(asnIpCfgs,valid);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存asn PolicyGroupInfo
|
||||
* @param entities
|
||||
* @return
|
||||
* @throws MaatConvertException
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public Map<Long,ConfigGroupInfo> saveAsnGroupBatch(List<PolicyGroupInfo> entities) throws MaatConvertException{
|
||||
Map<Long,ConfigGroupInfo> configGroupInfoMap=new HashMap<>(entities.size());
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,entities.size());
|
||||
if(groupIds.size()!=entities.size()) {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
int ind=0;
|
||||
for(PolicyGroupInfo entity:entities) {
|
||||
entity.setIsValid(1);
|
||||
ConfigGroupInfo group=new ConfigGroupInfo();
|
||||
//新增
|
||||
Date createTime=new Date();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
//asn类型从综合服务获取groupId
|
||||
if(4!=entity.getGroupType().intValue()) {
|
||||
throw new RuntimeException("ConfigGroupInfo is not asn type 4!");
|
||||
}
|
||||
entity.setServiceGroupId(groupIds.get(ind).intValue());
|
||||
//新增协议分组
|
||||
group.setGroupId(groupIds.get(ind).intValue());
|
||||
group.setGroupName(entity.getGroupName());
|
||||
group.setIsIssued(0);
|
||||
group.setGroupType(entity.getGroupType());
|
||||
group.setAsnId(entity.getAsnNo());
|
||||
configGroupInfoDao.insertConfigGroupInfo(group);
|
||||
if(group.getGroupType().intValue()==4) {
|
||||
AsnCacheUtils.put(entity.getAsnNo(), group);
|
||||
}
|
||||
policyGroupInfoDao.insert(entity);
|
||||
configGroupInfoMap.put(group.getAsnId(), group);
|
||||
ind++;
|
||||
}
|
||||
return configGroupInfoMap;
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAsnIpCfg(CfgIndexInfo entity) {
|
||||
Date createTime=new Date();
|
||||
ConfigGroupInfo groupInfo=configGroupInfoDao.getConfigGroupInfoByGroupId(entity.getAsnIpGroup().intValue());
|
||||
if(groupInfo==null) {
|
||||
throw new RuntimeException("ConfigGroupInfo is null!");
|
||||
//组织去除首尾空格
|
||||
entity.setOrganization(entity.getOrganization().trim());
|
||||
entity.setCountry(entity.getCountry().trim());
|
||||
entity.setDetail(entity.getDetail().trim());
|
||||
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getAsnGroupByName(entity.getOrganization());
|
||||
AsnGroupInfo asnGroupInfo=asnGroupInfoDao.getGroupIdByNameAndASNId(entity.getOrganization(), entity.getCountry(), Long.parseLong(entity.getUserRegion1()));
|
||||
Integer orgGroup=0;
|
||||
Integer compileId=0;
|
||||
Integer asnIdGroup=0;
|
||||
if(configGroupInfo==null) {
|
||||
configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(entity.getOrganization());
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfo.setIsIssued(0);
|
||||
if(asnGroupInfo==null) {
|
||||
List<Integer> groupIdList=ConfigServiceUtil.getId(2, 2);
|
||||
orgGroup=groupIdList.get(0);
|
||||
|
||||
asnIdGroup=groupIdList.get(1);
|
||||
}else {
|
||||
List<Integer> groupIdList=ConfigServiceUtil.getId(2, 1);
|
||||
orgGroup=groupIdList.get(0);
|
||||
configGroupInfo.setGroupId(orgGroup);
|
||||
asnIdGroup=asnGroupInfo.getGroupId();
|
||||
}
|
||||
configGroupInfo.setGroupId(orgGroup);
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
||||
}else {
|
||||
orgGroup=configGroupInfo.getGroupId();
|
||||
if(asnGroupInfo==null) {
|
||||
List<Integer> groupIdList=ConfigServiceUtil.getId(2, 1);
|
||||
asnIdGroup=groupIdList.get(0);
|
||||
}else {
|
||||
asnIdGroup=asnGroupInfo.getGroupId();
|
||||
}
|
||||
}
|
||||
if(asnGroupInfo==null) {
|
||||
asnGroupInfo=new AsnGroupInfo();
|
||||
asnGroupInfo.setOrganization(entity.getOrganization());
|
||||
asnGroupInfo.setCountry(entity.getCountry());
|
||||
asnGroupInfo.setDetail(entity.getDetail());
|
||||
asnGroupInfo.setIsValid(0);
|
||||
asnGroupInfo.setCreateTime(new Date());
|
||||
asnGroupInfo.setCreatorId(entity.getCurrentUser().getId());
|
||||
asnGroupInfo.setAsnId(Long.parseLong(entity.getUserRegion1()));
|
||||
asnGroupInfo.setGroupId(asnIdGroup);
|
||||
List<Integer> compileIds=ConfigServiceUtil.getId(1, 1);
|
||||
asnGroupInfo.setCompileId(compileIds.get(0));
|
||||
asnGroupInfoDao.insert(asnGroupInfo);
|
||||
}
|
||||
entity.setAsnIpGroup(asnIdGroup);
|
||||
entity.setCompileId(asnGroupInfo.getCompileId());
|
||||
List<Integer> idList=ConfigServiceUtil.getId(3, entity.getAsnIpCfgs().size());
|
||||
int index=0;
|
||||
if(groupInfo.getIsIssued()==1) {//如果已经下发,则需要下到综合服务中
|
||||
if(entity.getAsnIpCfgs()!=null) {
|
||||
for(AsnIpCfg cfg:entity.getAsnIpCfgs()) {
|
||||
if(StringUtils.isNotBlank(entity.getCfgDesc())) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
}else {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId","cfgDesc"});
|
||||
}
|
||||
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setAsnIpGroup(entity.getAsnIpGroup());
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setRegionId(idList.get(index));
|
||||
index++;
|
||||
}
|
||||
if(entity.getAsnIpCfgs()!=null) {
|
||||
for(AsnIpCfg cfg:entity.getAsnIpCfgs()) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setRequestId(0);
|
||||
cfg.setClassify("0");
|
||||
cfg.setAttribute("0");
|
||||
cfg.setLable("0");
|
||||
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));
|
||||
index++;
|
||||
}
|
||||
this.save(entity.getAsnIpCfgs());
|
||||
asnIPRegionSendToMaat(entity.getAsnIpCfgs(),Constants.VALID_YES);
|
||||
// splitAndSend(entity.getAsnIpCfgs(),Constants.VALID_YES);
|
||||
}else {
|
||||
if(entity.getAsnIpCfgs()!=null) {
|
||||
for(AsnIpCfg cfg:entity.getAsnIpCfgs()) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setAsnIpGroup(entity.getAsnIpGroup().intValue());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setRegionId(idList.get(index));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
this.save(entity.getAsnIpCfgs());
|
||||
}
|
||||
this.save(entity.getAsnIpCfgs());
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isValid,String ids) {
|
||||
public void delete(String ids) {
|
||||
/*for(String id:ids.split(",")) {
|
||||
Long.parseLong(id);
|
||||
}*/
|
||||
@@ -368,13 +325,13 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
|
||||
for(AsnIpCfg asnIpCfg:asnIpCfgList) {
|
||||
if(asnIpCfg.getIsValid()==Constants.VALID_YES) {//代表下发过了
|
||||
asnIpCfg.setIsValid(isValid);
|
||||
asnIpCfg.setIsValid(Constants.VALID_DEL);
|
||||
issuedList.add(asnIpCfg);
|
||||
Integer groupId=asnIpCfg.getAsnIpGroup();
|
||||
List result=asnIpCfgDao.findOtherIps(groupId, asnIpCfg.getCfgId().intValue());
|
||||
if(result==null||result.size()==0) {
|
||||
throw new RuntimeException("Cant not delete ip from asn group, there is only one ip left in the group!");
|
||||
}
|
||||
// groupId=asnIpCfg.getAsnIpGroup();
|
||||
//List result=asnIpCfgDao.findOtherIps(groupId, asnIpCfg.getCfgId().intValue());
|
||||
//if(result==null||result.size()==0) {
|
||||
// throw new RuntimeException("Cant not delete ip from asn group, there is only one ip left in the group!");
|
||||
//}
|
||||
}
|
||||
}
|
||||
asnIpCfgDao.delete(ids);
|
||||
@@ -385,10 +342,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
|
||||
}
|
||||
// public List<ConfigGroupInfo> findPolicyGroupInfosByType(Integer groupId) {
|
||||
// // TODO Auto-generated method stub
|
||||
// return asnIpCfgDao.findPolicyGroupInfosByType(groupId);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 选中组中是否含有只剩一个未删除IP的组
|
||||
* @param serviceGroupIds
|
||||
@@ -410,9 +364,10 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public ConfigGroupInfo getConfigGroupInfoByAsnNo(Long asnNo) {
|
||||
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getInfoByAsnNo(asnNo);
|
||||
AsnCacheUtils.put(asnNo, configGroupInfo);
|
||||
public AsnGroupInfo getAsnGroupInfoByAsnNo(Long asnNo) {
|
||||
AsnGroupInfo configGroupInfo=new AsnGroupInfo();
|
||||
configGroupInfo.setAsnId(asnNo);
|
||||
configGroupInfo=asnGroupInfoDao.getInfoByAsnNo(configGroupInfo);
|
||||
return configGroupInfo;
|
||||
}
|
||||
public List<AsnIpCfg> getByAsnNo(Long asnNo) {
|
||||
@@ -421,12 +376,12 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
return asnIpCfgDao.getByAsnNo(asnNo.longValue());
|
||||
}
|
||||
// public void deleteByAsnGroup(Long asnNo) {
|
||||
// if(asnNo==null) {
|
||||
// throw new RuntimeException("asnNo is null!");
|
||||
// }
|
||||
// asnIpCfgDao.deleteByAsnGroup(asnNo.longValue());
|
||||
// }
|
||||
public List<AsnIpCfg> getByIds(String ids) {
|
||||
if(ids==null) {
|
||||
throw new RuntimeException("ids is null!");
|
||||
}
|
||||
return asnIpCfgDao.getByIds(ids);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deleteByAsnNo(List<Long> asnNoList) {
|
||||
int pointsDataLimit = 1000;//限制条数
|
||||
@@ -442,7 +397,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnGroup(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
}while(result>0);
|
||||
//剔除
|
||||
asnNoList.subList(0, pointsDataLimit).clear();
|
||||
@@ -455,7 +410,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnGroup(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
@@ -467,7 +422,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnGroup(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
@@ -475,4 +430,129 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
public void ajaxDeleteAsnIp(String ids) {
|
||||
asnIpCfgDao.ajaxDeleteAsnIp(ids);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditIpBatch(非IP类配置用,审核区域IP)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param data
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditIpBatch(Map<Long,List<AsnIpCfg>> data,Integer isValid) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
final SqlSession batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
try{
|
||||
data.entrySet().stream().forEach( enrty->{
|
||||
Long asn=enrty.getKey();//ans group 的group id
|
||||
List<AsnIpCfg> asnIpCfgs=enrty.getValue();
|
||||
for(int index = 0; index < asnIpCfgs.size();index++){
|
||||
AsnIpCfg t = asnIpCfgs.get(index);
|
||||
BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
BeanUtils.copyProperties(t, ipCfg);
|
||||
ipCfg.setTableName(AsnIpCfg.getTablename());
|
||||
((IpCfgDao) batchSqlSession.getMapper(IpCfgDao.class)).audit(ipCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
AsnGroupInfo asnGroupInfo=new AsnGroupInfo();
|
||||
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();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
if(isValid==Constants.VALID_YES) {//审核通过
|
||||
if(asnGroupInfo.getIsValid()==0) {//ans组未下发过,下发编译配置
|
||||
asnGroupInfo.setIsValid(1);
|
||||
asnGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
asnGroupInfo.setEditTime(new Date());
|
||||
asnGroupInfoDao.updateValid(asnGroupInfo);
|
||||
maatCfg.initDefaultValue();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
groupCfg.setGroupId(groupId);
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
BeanUtils.copyProperties(asnIpCfgs.get(0), maatCfg);
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(asnIpCfgs,Constants.VALID_YES,groupId));
|
||||
maatCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
maatCfg.setAction(asnIpCfgs.get(0).getAction());
|
||||
maatCfg.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(isValid);
|
||||
// 设置ASN自定义域
|
||||
String userRegion = "ASN_ID=" + asnIpCfgs.get(0).getUserRegion1();
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatBean.setCreatorName(asnIpCfgs.get(0).getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
// 调用服务接口下发配置数据
|
||||
String json = gsonToJson(maatBean);
|
||||
logger.info("ASN IP配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ASN IP配置下发响应信息:" + result.getMsg());
|
||||
}else if(asnGroupInfo.getIsValid()==1){//已经下发过,走分组复用
|
||||
asnIPRegionSendToMaat(asnIpCfgs,isValid);
|
||||
}else {
|
||||
throw new RuntimeException("asnGroupInfo isValid value is "+asnGroupInfo.getIsValid());
|
||||
}
|
||||
}else if(isValid==Constants.VALID_NO) {//取消审核通过
|
||||
//已经下发过的,调用分组复用配置删除接口
|
||||
// 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);
|
||||
//如果一个asn组下没有IP了,修改有效状态
|
||||
//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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,11 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.basics.PolicyGroupInfoDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.dao.specific.SpecificServiceCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@@ -105,9 +103,9 @@ public class PolicyGroupInfoService extends BaseService{
|
||||
group.setGroupType(entity.getGroupType());
|
||||
group.setAsnId(entity.getAsnNo());
|
||||
configGroupInfoDao.insertConfigGroupInfo(group);
|
||||
if(group.getGroupType().intValue()==4) {
|
||||
AsnCacheUtils.put(entity.getAsnNo(), group);
|
||||
}
|
||||
// if(group.getGroupType().intValue()==4) {
|
||||
// AsnCacheUtils.put(entity.getAsnNo(), group);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
@@ -18,7 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
@@ -33,14 +30,13 @@ import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
@@ -48,7 +44,6 @@ import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* IP相关配置事务类
|
||||
@@ -65,6 +60,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
protected AreaIpCfgDao areaIpCfgDao;
|
||||
@Autowired
|
||||
//protected SpecificServiceCfgDao specificServiceCfgDao;
|
||||
protected AsnGroupInfoDao asnGroupInfoDao;
|
||||
@Autowired
|
||||
protected ConfigGroupInfoDao configGroupInfoDao;
|
||||
@Autowired
|
||||
protected AsnIpCfgDao asnIpCfgDao;
|
||||
@@ -647,105 +644,136 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
entity.setIsAudit(isAudit);
|
||||
ipCfgDao.auditCfg(entity);
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
|
||||
List<MaatCfg> configCompileList = new ArrayList<>();
|
||||
List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||
List<StringCfg> strRegionList = new ArrayList<>();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||
List<DigestCfg> digestRegionList = new ArrayList<>();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList<>();
|
||||
|
||||
if(isAudit==Constants.AUDIT_YES) {
|
||||
ConfigGroupInfo group=configGroupInfoDao.getConfigGroupInfoByGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
if(group.getIsIssued()==1) {//复用,只下编译跟分组
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entity.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
if(group.getAsnId()!=null) {
|
||||
maatCfg.setUserRegion("ASN_ID="+group.getAsnId());
|
||||
}
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ipaddr asn组复用配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ipaddr asn组复用配置下发响应信息:"+result.getMsg());
|
||||
}else {//首次下发
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
if(group.getAsnId()!=null) {
|
||||
maatCfg.setUserRegion("ASN_ID="+group.getAsnId());
|
||||
}
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entity.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
//region
|
||||
//查询asn group id下所有的 ip
|
||||
AsnIpCfg asnIpCfg=new AsnIpCfg();
|
||||
asnIpCfg.setAsnIpGroup(Integer.parseInt(entity.getUserRegion4()));
|
||||
List<AsnIpCfg> allAsnIpCfgs=asnIpCfgDao.findAllList(asnIpCfg);
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(allAsnIpCfgs,Constants.VALID_YES,null));
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ipaddr asn配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ipaddr asn配置下发响应信息:"+result.getMsg());
|
||||
ConfigGroupInfo info=new ConfigGroupInfo();
|
||||
BeanUtils.copyProperties(group, info);
|
||||
info.setIsIssued(1);
|
||||
//info.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
configGroupInfoDao.updateConfigGroupInfobyGroupId(info);
|
||||
AsnCacheUtils.put(info.getAsnId(), info);
|
||||
AsnIpCfg cfg=new AsnIpCfg();
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAsnIpGroup(Integer.parseInt(entity.getUserRegion4()));
|
||||
asnIpCfgDao.updateIssued(cfg);
|
||||
AsnGroupInfo asnGroupInfo=new AsnGroupInfo();
|
||||
asnGroupInfo.setOrganization(entity.getUserRegion4());
|
||||
asnGroupInfo.setIsValid(1);
|
||||
List<AsnGroupInfo> groups=asnGroupInfoDao.findAsnGroupInfoList(asnGroupInfo);
|
||||
if(groups!=null&&groups.size()>0) {
|
||||
// if(configGroupInfo.getIsIssued()==1) {//复用,只下编译跟分组
|
||||
// for(AsnGroupInfo group:groups) {
|
||||
// MaatCfg maatCfg = new MaatCfg();
|
||||
// List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||
// List<IpCfg> ipRegionList = new ArrayList<>();
|
||||
// List<StringCfg> strRegionList = new ArrayList<>();
|
||||
// List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||
// List<DigestCfg> digestRegionList = new ArrayList<>();
|
||||
// List<IpCfg> areaIpRegionList = new ArrayList<>();
|
||||
// maatCfg.initDefaultValue();
|
||||
// BeanUtils.copyProperties(entity, maatCfg);
|
||||
// maatCfg.setAction(entity.getAction());
|
||||
// maatCfg.setAuditTime(entity.getAuditTime());
|
||||
// maatCfg.setIpRegionList(ipRegionList);
|
||||
// maatCfg.setStrRegionList(strRegionList);
|
||||
// maatCfg.setNumRegionList(numRegionList);
|
||||
// maatCfg.setDigestRegionList(digestRegionList);
|
||||
// maatCfg.setGroupRelationList(groupRelationList);
|
||||
// maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
// maatCfg.setIsValid(entity.getIsValid());
|
||||
// //group
|
||||
// GroupCfg groupCfg=new GroupCfg();
|
||||
// groupCfg.setCompileId(entity.getCompileId());
|
||||
// groupCfg.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
// groupCfg.setIsValid(Constants.VALID_YES);
|
||||
// groupCfg.setAuditTime(entity.getAuditTime());
|
||||
// groupRelationList.add(groupCfg);
|
||||
// maatCfg.setGroupNum(groupRelationList.size());
|
||||
// if(group.getAsnId()!=null) {
|
||||
// maatCfg.setUserRegion("ASN_ID="+group.getAsnId());
|
||||
// }
|
||||
// configCompileList.add(maatCfg);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// maatBean.setConfigCompileList(configCompileList);
|
||||
// maatBean.setAuditTime(entity.getAuditTime());
|
||||
// maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
// maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
// maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//
|
||||
// //调用服务接口下发配置数据
|
||||
// String json=gsonToJson(maatBean);
|
||||
// logger.info("ipaddr asn组复用配置下发配置参数:"+json);
|
||||
// //调用服务接口下发配置
|
||||
// ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
// logger.info("ipaddr asn组复用配置下发响应信息:"+result.getMsg());
|
||||
// }else {//首次下发
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||
List<StringCfg> strRegionList = new ArrayList<>();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||
List<DigestCfg> digestRegionList = new ArrayList<>();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList<>();
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
//group
|
||||
List<Integer> groupIds=ConfigServiceUtil.getId(2, 1);
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entity.getCompileId());
|
||||
//groupCfg.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
groupCfg.setGroupId(groupIds.get(0));
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
List<Integer> regions=ConfigServiceUtil.getId(3, groups.size());
|
||||
int index=0;
|
||||
List<FunctionRegionDict> functionRegionDicts=DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
String cfgType=null;
|
||||
for(FunctionRegionDict dict:functionRegionDicts) {
|
||||
if("asn".equals(dict.getConfigServiceType())) {
|
||||
cfgType=dict.getCfgType();
|
||||
}
|
||||
}
|
||||
for(AsnGroupInfo group:groups) {
|
||||
StringCfg cfg=new StringCfg();
|
||||
cfg.setRegionId(index);
|
||||
cfg.setCfgKeywords("AS"+group.getAsnId());
|
||||
cfg.setExprType(0);
|
||||
cfg.setIsHexbin(0);
|
||||
cfg.setMatchMethod(3);
|
||||
//需要根据文档
|
||||
cfg.setCfgType(StringUtils.isBlank(cfgType)?"NTC_ASN_NUMBER":cfgType);
|
||||
cfg.setGroupId(groupIds.get(0));
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setRegionId(regions.get(index));
|
||||
//cfg.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
strRegionList.add(cfg);
|
||||
index++;
|
||||
}
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ipaddr asn配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ipaddr asn配置下发响应信息:"+result.getMsg());
|
||||
// }
|
||||
}
|
||||
|
||||
}else if(isAudit==Constants.AUDIT_NOT_YES) {//取消审核通过
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
@@ -834,8 +862,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
entity.setIpPortList(ipPortList);
|
||||
entity.setNtcSubscribeIdCfgList(subscribeIdList);
|
||||
if(StringUtils.isNotBlank(entity.getUserRegion4())) {
|
||||
ConfigGroupInfo info=configGroupInfoDao.getConfigGroupInfoByGroupId(Integer.parseInt(entity.getUserRegion4().trim()));
|
||||
entity.setAsnIpGroupName(info.getGroupName());
|
||||
List<AsnGroupInfo> infos=asnGroupInfoDao.getValidConfigGroupInfoByName((entity.getUserRegion4().trim()));
|
||||
entity.setAsnGroups(infos);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
@@ -843,8 +871,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
List<IpPortCfg> ipPortList = ipCfgDao.getIpPortList(entity);
|
||||
entity.setIpPortList(ipPortList);
|
||||
if(StringUtils.isNotBlank(entity.getUserRegion4())) {
|
||||
ConfigGroupInfo info=configGroupInfoDao.getConfigGroupInfoByGroupId(Integer.parseInt(entity.getUserRegion4().trim()));
|
||||
entity.setAsnIpGroupName(info.getGroupName());
|
||||
List<AsnGroupInfo> infos=asnGroupInfoDao.getValidConfigGroupInfoByName(entity.getUserRegion4().trim());
|
||||
entity.setAsnGroups(infos);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
|
||||
41
src/main/resources/sql/20190103/asn_group_info.sql
Normal file
41
src/main/resources/sql/20190103/asn_group_info.sql
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : 204
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 100214
|
||||
Source Host : 192.168.10.204:3306
|
||||
Source Schema : gwall_dev
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 100214
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 03/01/2019 08:29:09
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for asn_group_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `asn_group_info`;
|
||||
CREATE TABLE `asn_group_info` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`group_id` int(11) NOT NULL,
|
||||
`organization` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`country` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`detail` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`create_time` datetime(0) NOT NULL,
|
||||
`creator_id` int(11) NOT NULL,
|
||||
`edit_time` datetime(0) NULL DEFAULT NULL,
|
||||
`editor_id` int(11) NULL DEFAULT NULL,
|
||||
`is_valid` int(2) NOT NULL COMMENT '-1删除 1有效0无效',
|
||||
`asn_id` bigint(20) NOT NULL COMMENT 'asn号',
|
||||
`org_group_id` int(11) UNSIGNED NULL DEFAULT NULL,
|
||||
`compile_id` int(11) NOT NULL COMMENT 'asn 号的编译ID',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
16
src/main/resources/sql/20190103/update_asn.sql
Normal file
16
src/main/resources/sql/20190103/update_asn.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
#ASN IP region菜单移动位置到Policy Object菜单下
|
||||
UPDATE sys_menu SET parent_id =717,parent_ids='0,1,86,717,' WHERE id=1039;
|
||||
INSERT INTO sys_menu VALUES(1202,750,'0,1,150,750,','asn_ip_configuration','ASN IP配置','480','/basics/asn/list','','fa fa-industry',1,'asn:ip:confirm',1,'2019-01-02 16:32:38',1,'2019-01-02 16:32:38','',1,NULL,0,0,600);
|
||||
INSERT INTO sys_menu VALUES(1203,865,'0,1,151,865,','asn_ip_configuration','ASN IP配置','480','/basics/asn/list','','fa fa-industry',1,'asn:ip:audit',1,'2019-01-02 16:32:38',1,'2019-01-02 16:32:38','',1,NULL,0,0,600);
|
||||
#asn_ip_cfg增加四列
|
||||
ALTER TABLE asn_ip_cfg ADD COLUMN organization varchar(1024) NULL COMMENT '组织';
|
||||
ALTER TABLE asn_ip_cfg ADD COLUMN country varchar(512) NULL COMMENT '国家';
|
||||
ALTER TABLE asn_ip_cfg ADD COLUMN detail varchar(1024) NULL COMMENT '详情';
|
||||
alter table asn_ip_cfg add column `compile_id` int(11) not null default 0;
|
||||
#修改tablename
|
||||
UPDATE function_region_dict SET config_region_value='ASN_IP_REGION' WHERE dict_id=194;
|
||||
UPDATE function_region_dict SET config_region_value='NTC_ASN_NUMBER' WHERE dict_id=229;
|
||||
#增加业务号
|
||||
INSERT INTO function_service_dict VALUES(162,600,0,1,'monit',400,'asn_ip_region','asn_ip',1,1,'2019-01-02 18:12:46',NULL,NULL,1,1,1);
|
||||
#asn 组菜单,如果已经存在,则不用修改
|
||||
INSERT INTO sys_menu VALUES(1201,109,'0,1,109,','asn_group','ASN组','410','/basics/asnGroup/asnGroupList','','',1,'',1,'2019-01-02 16:21:38',1,'2019-01-02 16:24:41','',1,NULL,0,0,NULL);
|
||||
@@ -195,7 +195,6 @@
|
||||
</div>
|
||||
</br>
|
||||
</c:if>
|
||||
<c:if test="${cfg.functionId eq 5 or cfg.functionId eq 34 or cfg.functionId eq 6}">
|
||||
<div class="row">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="examine"/></label>
|
||||
<div class="col-md-6">
|
||||
@@ -208,7 +207,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</br>
|
||||
</c:if>
|
||||
<div class="col-md-12 fileSelDiv">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label" style="margin-top:5px;"><spring:message
|
||||
|
||||
@@ -118,11 +118,11 @@ function update(url){
|
||||
return;
|
||||
}
|
||||
//处理asnIp,asn组下发过的ip配置不允许修改
|
||||
if(cked.attr("serviceGroupId")&&cked.attr("isValid")){
|
||||
var serviceGroupId=cked.attr("serviceGroupId");
|
||||
if(cked.attr("asnGroup")&&cked.attr("isValid")){
|
||||
var asnGroup=cked.attr("asnGroup");
|
||||
var _isValid=cked.attr("isValid");
|
||||
if(_isValid==1){
|
||||
top.$.jBox.tip("<spring:message code='can_not_edit_issued_ans_ip'/>", "<spring:message code='info'/>");
|
||||
if(asnGroup&&_isValid==1){
|
||||
top.$.jBox.tip("<spring:message code='can_not_edit_issued_ans_group'/>", "<spring:message code='info'/>");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
129
src/main/webapp/WEB-INF/views/basics/asnGroupForm.jsp
Normal file
129
src/main/webapp/WEB-INF/views/basics/asnGroupForm.jsp
Normal file
@@ -0,0 +1,129 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
var repeatTip='<spring:message code="duplicated_group"/>';
|
||||
$("#cfgFrom").validate({
|
||||
errorPlacement: function(error,element){
|
||||
if($(element).parents().hasClass("tagsinput")){
|
||||
$(element).parents(".col-md-6").next("div").append(error);
|
||||
}else{
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
}
|
||||
},
|
||||
submitHandler: function(form){
|
||||
var _id=$("[name='id']").val();
|
||||
var organization=$("[name='organization']").val();
|
||||
var country=$("[name='country']").val();
|
||||
var asnId=$("[name='asnId']").val();
|
||||
var detail=$("[name='detail']").val();
|
||||
$.ajax({
|
||||
type:'post',
|
||||
async:false,
|
||||
url: "${ctx}/basics/asnGroup/asnGroupName",
|
||||
data:{"id":_id,"organization":organization,"country":country,"asnId":asnId,"detail":detail},
|
||||
success:function(data){
|
||||
if(data==1){
|
||||
top.$.jBox.tip(repeatTip);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<h3 class="page-title">
|
||||
<spring:message code="asn_group_manage"/>
|
||||
</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet box blue">
|
||||
<div class="portlet-title">
|
||||
<div class="caption">
|
||||
<i class="fa fa-gift"></i>
|
||||
<c:if test="${empty _cfg.groupId}"><spring:message code="add"></spring:message></c:if>
|
||||
<c:if test="${not empty _cfg.groupId}"><spring:message code="edit"></spring:message></c:if>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<!-- BEGIN FORM-->
|
||||
<form:form id="cfgFrom" modelAttribute="_cfg" action="${ctx}/basics/asnGroup/saveOrUpdate" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="id" value="${_cfg.id}">
|
||||
<input type="hidden" name="groupId" value="${_cfg.groupId}">
|
||||
<input type="hidden" name="isValid" value="${_cfg.isValid}">
|
||||
<div class="form-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="organization"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="organization" value="${_cfg.organization}" >
|
||||
</div>
|
||||
<div for="organization"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group asnNo">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="asn_no"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="asnNo" class="form-control required asnNoUnique number" type="text" name="asnId" value="${_cfg.asnId}" autocomplete="off" maxlength="15" ctx="${ctx }">
|
||||
</div>
|
||||
<div for="asnId"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="country"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="country" value="${_cfg.country}" >
|
||||
</div>
|
||||
<div for="country"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label"><spring:message code="detail"/>:</label>
|
||||
<div class="col-md-6">
|
||||
<form:textarea path="detail" htmlEscape="false" maxlength="128" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-3 col-md-8">
|
||||
<button id="save" type="submit" class="btn green"><spring:message code="submit"/></button>
|
||||
<button id="cancel" type="button" class="btn default"><spring:message code="cancel"/></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</form:form>
|
||||
<!-- END FORM-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
266
src/main/webapp/WEB-INF/views/basics/asnGroupList.jsp
Normal file
266
src/main/webapp/WEB-INF/views/basics/asnGroupList.jsp
Normal file
@@ -0,0 +1,266 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
//搜索框提示语初始化
|
||||
if("${cfg.organization}"){
|
||||
$("#intype").val("${cfg.organization}");
|
||||
}else if(''!="${cfg.asnId}"){
|
||||
$("#intype").val("${cfg.asnId}");
|
||||
}else{
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
|
||||
}
|
||||
$("#seltype").change(function(){
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$(this).find("option:selected").text());
|
||||
});
|
||||
//筛选功能初始化
|
||||
filterActionInit();
|
||||
//reset
|
||||
$("#resetBtn").on("click",function(){
|
||||
$("select.selectpicker").each(function(){
|
||||
$(this).selectpicker('val',$(this).find('option:first').val());
|
||||
$(this).find("option").attr("selected",false);
|
||||
$(this).find("option:first").attr("selected",true);
|
||||
});
|
||||
$(".Wdate").attr("value",'');
|
||||
$("#searchForm")[0].reset();
|
||||
});
|
||||
});
|
||||
function deletes(url){
|
||||
var checkboxes=$("tbody tr td input.i-checks:checkbox");
|
||||
var str="";
|
||||
var ids=[];
|
||||
var asnIds=[];
|
||||
var canDel=true;
|
||||
checkboxes.each(function(){
|
||||
if(true == $(this).is(':checked')){
|
||||
ids.push($(this).attr("id"));
|
||||
asnIds.push($(this).attr("asnId"));
|
||||
/* if($(this).attr("isIssued")==1){
|
||||
canDel=false;
|
||||
} */
|
||||
}
|
||||
});
|
||||
if(str.substr(str.length-1)== ','){
|
||||
ids = str.substr(0,str.length-1);
|
||||
}
|
||||
var tip='<spring:message code="can_not_delete_asn_group_with_audited_ip"/>';
|
||||
if(asnIds.length>0){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/asnGroup/ajaxGetAuditedIP',
|
||||
data:{"asnIds":asnIds.join(',')},
|
||||
async:false,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(data){
|
||||
canDel=false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if(canDel){
|
||||
var added = "";
|
||||
if(ids.length != 0){
|
||||
added = "<spring:message code='asn_ip_group_delete'/>";
|
||||
}
|
||||
top.$.jBox.confirm("<spring:message code='confirm_message'/>"+added,"<spring:message code='info'/>",function(v,h,f){
|
||||
if(v=="ok"){
|
||||
if(ids.length != 0){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/asnGroup/delete',
|
||||
data:{"ids":ids.join(','),"asnIds":asnIds.join(',')},
|
||||
async:false,
|
||||
success:function(data,textStatus){
|
||||
if(textStatus == "success"){
|
||||
top.$.jBox.tip("<spring:message code='delete_success'/>");
|
||||
window.location = "${ctx}/basics/asnGroup/asnGroupList";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},{buttonsFocus:1});
|
||||
top.$('.jbox-body .jbox-icon').css('top','55px');
|
||||
}else{
|
||||
$.jBox.tip(tip);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="theme-panel hidden-xs hidden-sm">
|
||||
|
||||
<%-- <shiro:hasPermission name="avContUrl:config"> --%>
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="javascript:window.location='${ctx}/basics/asnGroup/asnGroupForm'">
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="add"></spring:message></button>
|
||||
<%--</shiro:hasPermission>--%>
|
||||
</div>
|
||||
|
||||
<h3 class="page-title">
|
||||
<spring:message code="asn_group_manage"/>
|
||||
</h3>
|
||||
<h5 class="page-header"></h5>
|
||||
<div class="col-md-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-body">
|
||||
<div class="row" >
|
||||
<form:form id="searchForm" modelAttribute="cfg" action="${ctx}/basics/asnGroup/asnGroupList" method="post" class="form-search">
|
||||
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
||||
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
||||
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}"
|
||||
callback="page();" />
|
||||
<!-- 筛选按钮展开状态-->
|
||||
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${cfg.isFilterAction }"/>
|
||||
<!-- 搜索内容与操作按钮栏 -->
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="pull-left">
|
||||
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn">
|
||||
|
||||
<form:select path="seltype" class="selectpicker select2 input-small" >
|
||||
<form:option value="organization"><spring:message code="organization"></spring:message></form:option>
|
||||
<form:option value="asnId"><spring:message code="asn_no"></spring:message></form:option>
|
||||
</form:select>
|
||||
|
||||
</div>
|
||||
|
||||
<input id="intype" class="form-control input-medium" type="text" value="">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<button type="button" class="btn blue" onClick="return page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
|
||||
<button type="button" class="btn btn-default" id="resetBtn"> <i class="fa fa-refresh"></i> <spring:message code="reset"/> </button>
|
||||
<button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/> <i class="fa fa-angle-double-down"></i></button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<%-- <shiro:hasPermission name="avContUrl:config"> --%>
|
||||
<sys:delRow url="${ctx}/basics/asnGroup/asnGroupForm" id="contentTable" label="update"></sys:delRow>
|
||||
<a href="javascript:void(0);" class="btn btn-default" onclick="deletes('${ctx}/basics/asnGroup/delete')" data-toggle="tooltip" data-placement="top">
|
||||
<i class="fa fa-trash"> <spring:message code="delete"/></i>
|
||||
</a>
|
||||
<%-- <sys:delRow url="${ctx}/basics/asn/delete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow> --%>
|
||||
<%-- </shiro:hasPermission> --%>
|
||||
|
||||
<a class="btn btn-icon-only btn-default setfields tooltips"
|
||||
data-container="body" data-placement="top" data-original-title=<spring:message code="custom_columns"/> href="javascript:;">
|
||||
<i class="icon-wrench"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /搜索内容与操作按钮栏 -->
|
||||
|
||||
<!-- 筛选搜索内容栏默认隐藏-->
|
||||
<div class="col-md-12 filter-action-select-panle hide" >
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="config_time"/>:</label>
|
||||
<input name="search_create_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value='${cfg.search_create_time_start}' pattern='yyyy-MM-dd HH:mm:ss'/>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<input name="search_create_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_create_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="edit_time"/>:</label>
|
||||
<input name="search_edit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_edit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<input name="search_edit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_edit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /筛选搜索内容栏 结束-->
|
||||
</form:form>
|
||||
</div>
|
||||
<sys:message content="${message}" type="${messageType }"/>
|
||||
<div class="table-responsive">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
|
||||
<th class="sort-column r.organization"><spring:message code="organization"/></th>
|
||||
<th class="sort-column r.country"><spring:message code="country"/></th>
|
||||
<th class="sort-column r.detail"><spring:message code="detail"/></th>
|
||||
<th class="sort-column r.asn_id"><spring:message code="asn_no"/></th>
|
||||
<th><spring:message code="is_issued"/></th>
|
||||
<th><spring:message code="creator"/></th>
|
||||
<th class="sort-column r.create_time"><spring:message code="config_time"/></th>
|
||||
<th><spring:message code="editor"/></th>
|
||||
<th class="sort-column r.edit_time"><spring:message code="edit_time"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.id}" asnId="${cfg.asnId}" isValid="${cfg.isValid}" asnGroup="${cfg.groupId}"></td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${cfg.organization}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(cfg.organization,20)}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${cfg.country}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(cfg.country,20)}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${cfg.detail}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(cfg.detail,20)}
|
||||
</a>
|
||||
</td>
|
||||
<td>${cfg.asnId}</td>
|
||||
<td>
|
||||
<c:if test="${cfg.isValid==0}"><spring:message code="no"/></c:if>
|
||||
<c:if test="${cfg.isValid==1}"><spring:message code="yes"/></c:if>
|
||||
</td>
|
||||
<td>${cfg.creatorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${cfg.editorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.editTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="page">${page}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,15 +17,58 @@ $(function(){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
$("[name='country']").val($("[name='userRegion1'] option:selected").attr("country"));
|
||||
$("[name='detail']").val($("[name='userRegion1'] option:selected").attr("detail"));
|
||||
$("[name='asnIpGroup']").val($("[name='userRegion1'] option:selected").attr("asnIpGroup"));
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
$("#asnId").val($("select[name='asnIpGroup'] option:selected").attr("asnId"));
|
||||
/* $("#asnId").val($("select[name='asnIpGroup'] option:selected").attr("asnId"));
|
||||
$("select[name='asnIpGroup']").on("change",function(){
|
||||
var asnId=$(this).find("option[value='"+$(this).val()+"']").attr("asnId");
|
||||
$("#asnId").val(asnId);
|
||||
}); */
|
||||
var organization=$("[name='organization']").val();
|
||||
if(organization){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/asn/ajaxGetGroups',
|
||||
data:{"org":organization},
|
||||
async:false,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(data){
|
||||
var html='';
|
||||
for(var i in data){
|
||||
html+="<option value='"+data[i].asnId+"' country='"+data[i].country+"' detail='"+data[i].detail+"' asnIpGroup='"+data[i].groupId+"' >"
|
||||
+data[i].country+" AS"+data[i].asnId+" "+data[i].detail+"</option>"
|
||||
}
|
||||
$("[name='userRegion1']").empty().append(html);
|
||||
$("[name='userRegion1']").selectpicker("refresh");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$("[name='organization']").on("change",function(){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/asn/ajaxGetGroups',
|
||||
data:{"org":$(this).val()},
|
||||
async:false,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(data){
|
||||
var html='';
|
||||
for(var i in data){
|
||||
html+="<option value='"+data[i].asnId+"' country='"+data[i].country+"' detail='"+data[i].detail+"' asnIpGroup='"+data[i].groupId+"' >"
|
||||
+data[i].country+" AS"+data[i].asnId+" "+data[i].detail+"</option>"
|
||||
}
|
||||
$("[name='userRegion1']").empty().append(html);
|
||||
$("[name='userRegion1']").selectpicker("refresh");
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
//业务窗口打开
|
||||
@@ -105,11 +148,14 @@ var reSort=function(obj,index){
|
||||
<!-- BEGIN FORM-->
|
||||
<form id="cfgFrom" action="${ctx}/basics/asn/save" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="0">
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="0">
|
||||
<input type="hidden" id="action" name="action" value="0">
|
||||
<input type="hidden" id="compileId" name="compileId" value="0">
|
||||
<input type="hidden" id="requestId" name="requestId" value="0">
|
||||
<input type="hidden" id="asnIpGroup" name="asnIpGroup" value="0">
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="${service.serviceId}">
|
||||
<input type="hidden" id="action" name="action" value="${service.action}">
|
||||
</c:forEach>
|
||||
<!-- 配置域类型 -->
|
||||
<c:forEach items="${regionList}" var="region">
|
||||
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||
@@ -138,13 +184,13 @@ var reSort=function(obj,index){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<%-- <div class="col-md-6">
|
||||
<input type="hidden" id="asnId" name="userRegion1" value="${_cfg.userRegion1}">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="asnIpGroup" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<%-- <option value="0" ><spring:message code="default_group"/></option>--%>
|
||||
<option value="0" ><spring:message code="default_group"/></option>
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option asnId="${policyGroup.asnNo}" value="${policyGroup.serviceGroupId}" <c:if test="${_cfg.asnIpGroup==policyGroup.serviceGroupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
@@ -152,6 +198,53 @@ var reSort=function(obj,index){
|
||||
</div>
|
||||
<div for="asnIpGroup"></div>
|
||||
</div>
|
||||
</div> --%>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="organization"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="organization" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option value="${policyGroup.groupName}" <c:if test="${_cfg.organization eq policyGroup.groupName }">selected</c:if>>${policyGroup.groupName}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
<%-- <input class="form-control required" type="text" name="organization" value="${_cfg.organization}"> --%>
|
||||
</div>
|
||||
<div for="organization"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ASN"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion1" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
</select>
|
||||
<%-- <input class="form-control required digits" type="text" name="userRegion1" value="${_cfg.userRegion1}"> --%>
|
||||
</div>
|
||||
<div for="userRegion1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 hidden">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="country"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="hidden" name="country" value="${_cfg.country}">
|
||||
</div>
|
||||
<div for="country"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 hidden">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="detail"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="hidden" name="detail" value="${_cfg.detail}">
|
||||
</div>
|
||||
<div for="detail"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- desc and action -->
|
||||
|
||||
@@ -14,15 +14,62 @@ $(function(){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
$("[name='country']").val($("[name='userRegion1'] option:selected").attr("country"));
|
||||
$("[name='detail']").val($("[name='userRegion1'] option:selected").attr("detail"));
|
||||
$("[name='asnIpGroup']").val($("[name='userRegion1'] option:selected").attr("asnIpGroup"));
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
$("#asnId").val($("select[name='asnIpGroup'] option:selected").attr("asnId"));
|
||||
/* $("#asnId").val($("select[name='asnIpGroup'] option:selected").attr("asnId"));
|
||||
$("select[name='asnIpGroup']").on("change",function(){
|
||||
var asnId=$(this).find("option[value='"+$(this).val()+"']").attr("asnId");
|
||||
$("#asnId").val(asnId);
|
||||
}); */
|
||||
var organization=$("[name='organization']").val();
|
||||
if(organization){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/asn/ajaxGetGroups',
|
||||
data:{"org":organization},
|
||||
async:false,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(data){
|
||||
var html='';
|
||||
for(var i in data){
|
||||
html+="<option value='"+data[i].asnId+"' country='"+data[i].country+"' detail='"+data[i].detail+"' asnIpGroup='"+data[i].groupId+"'";
|
||||
if("${_cfg.userRegion1}"!='' && "${_cfg.userRegion1}"==data[i].asnId){
|
||||
html+=" selected ";
|
||||
}
|
||||
html+=" >";
|
||||
html+=data[i].country+" AS"+data[i].asnId+" "+data[i].detail+"</option>"
|
||||
}
|
||||
$("[name='userRegion1']").empty().append(html);
|
||||
$("[name='userRegion1']").selectpicker("refresh");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$("[name='organization']").on("change",function(){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/asn/ajaxGetGroups',
|
||||
data:{"org":$(this).val()},
|
||||
async:false,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(data){
|
||||
var html='';
|
||||
for(var i in data){
|
||||
html+="<option value='"+data[i].asnId+"' country='"+data[i].country+"' detail='"+data[i].detail+"' asnIpGroup='"+data[i].groupId+"' >"
|
||||
+data[i].country+" AS"+data[i].asnId+" "+data[i].detail+"</option>"
|
||||
}
|
||||
$("[name='userRegion1']").empty().append(html);
|
||||
$("[name='userRegion1']").selectpicker("refresh");
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -54,6 +101,7 @@ $(function(){
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="0">
|
||||
<input type="hidden" id="requestId" name="requestId" value="${_cfg.requestId}">
|
||||
<input type="hidden" id="protocolId" name="protocolId" value="${_cfg.protocolId}">
|
||||
<input type="hidden" id="asnIpGroup" name="asnIpGroup" value="${_cfg.asnIpGroup}">
|
||||
<!-- 配置域类型 -->
|
||||
<c:forEach items="${regionList}" var="region">
|
||||
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||
@@ -83,19 +131,19 @@ $(function(){
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="hidden" id="asnId" name="userRegion1" value="${_cfg.userRegion1}">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="asnIpGroup" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option asnId="${policyGroup.asnNo}" value="${policyGroup.serviceGroupId}" <c:if test="${_cfg.asnIpGroup==policyGroup.serviceGroupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="asnIpGroup"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="organization"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="organization" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option value="${policyGroup.groupName}" <c:if test="${_cfg.organization eq policyGroup.groupName }">selected</c:if>>${policyGroup.groupName}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
<%-- <input class="form-control required" type="text" name="organization" value="${_cfg.organization}"> --%>
|
||||
</div>
|
||||
<div for="organization"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 hidden">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="action"/></label>
|
||||
@@ -122,6 +170,38 @@ $(function(){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ASN"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion1" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search"></select>
|
||||
<%-- <input class="form-control" type="text" name="userRegion1" value="${_cfg.userRegion1}"> --%>
|
||||
</div>
|
||||
<div for="userRegion1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group hidden">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="country"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="hidden" name="country" value="${_cfg.country}">
|
||||
</div>
|
||||
<div for="country"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 hidden">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="detail"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="hidden" name="detail" value="${_cfg.detail}">
|
||||
</div>
|
||||
<div for="detail"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- desc and action -->
|
||||
<%-- <%@include file="/WEB-INF/include/form/complexIpInfo.jsp" %> --%>
|
||||
<div class="row ipInfo">
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
$("#intype").val("${cfg.cfgDesc}");
|
||||
}else if("${cfg.destIpAddress}"){
|
||||
$("#intype").val("${cfg.destIpAddress}");
|
||||
}else if("${cfg.organization}"){
|
||||
$("#intype").val("${cfg.organization}");
|
||||
}else if("${cfg.country}"){
|
||||
$("#intype").val("${cfg.country}");
|
||||
}else if("${cfg.detail}"){
|
||||
$("#intype").val("${cfg.detail}");
|
||||
}else{
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
|
||||
}
|
||||
@@ -108,7 +114,7 @@
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div> --%>
|
||||
<%--<div class="pull-left">
|
||||
<div class="pull-left">
|
||||
<c:set var="state"><spring:message code='group'/></c:set>
|
||||
<form:select path="isAudit" class="selectpicker select2 input-small">
|
||||
<form:option value=""><spring:message code="all_states"/></form:option>
|
||||
@@ -117,7 +123,7 @@
|
||||
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
|
||||
<form:option value="3"><spring:message code="cancel_approved"></spring:message></form:option>
|
||||
</form:select>
|
||||
</div>--%>
|
||||
</div>
|
||||
|
||||
<div class="pull-left">
|
||||
|
||||
@@ -128,7 +134,10 @@
|
||||
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
|
||||
<form:option value="destIpAddress"><spring:message code="IP"></spring:message></form:option>
|
||||
<%-- <form:option value="destPort"><spring:message code="port"></spring:message></form:option> --%>
|
||||
<form:option value="isValid"><spring:message code="is_issued"></spring:message></form:option>
|
||||
<form:option value="isValid"><spring:message code="valid_identifier"></spring:message></form:option>
|
||||
<form:option value="organization"><spring:message code="organization"></spring:message></form:option>
|
||||
<form:option value="country"><spring:message code="country"></spring:message></form:option>
|
||||
<form:option value="detail"><spring:message code="detail"></spring:message></form:option>
|
||||
</form:select>
|
||||
|
||||
</div>
|
||||
@@ -166,7 +175,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<%-- <shiro:hasPermission name="asn:ip:confirm">
|
||||
<shiro:hasPermission name="asn:ip:confirm">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-wrench"></i> <spring:message code="examine"></spring:message>
|
||||
@@ -178,7 +187,7 @@
|
||||
<li><sys:delRow url="${ctx}/basics/asn/audit?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
|
||||
</ul>
|
||||
</div>
|
||||
</shiro:hasPermission> --%>
|
||||
</shiro:hasPermission>
|
||||
<a class="btn btn-icon-only btn-default setfields tooltips"
|
||||
data-container="body" data-placement="top" data-original-title=<spring:message code="custom_columns"/> href="javascript:;">
|
||||
<i class="icon-wrench"></i>
|
||||
@@ -225,7 +234,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%-- <div class="col-md-2">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="audit_time"/>:</label>
|
||||
<input name="search_audit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
@@ -241,7 +250,7 @@
|
||||
value="<fmt:formatDate value="${cfg.search_audit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div> --%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -256,10 +265,14 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
|
||||
<th class="sort-column r.compile_id" style="display: none;" column="cfg_id" ><spring:message code="cfg_id"/></th>
|
||||
<%-- <th><spring:message code="seq"/></th> --%>
|
||||
<th column="config_describe" ><spring:message code="config_describe"/></th>
|
||||
<th column="group" ><spring:message code="group"/></th>
|
||||
<th column="userregion1" ><spring:message code="asn_no"/></th>
|
||||
<%-- <th><spring:message code="group"/></th> --%>
|
||||
<th class="sort-column r.organization"><spring:message code="organization"/></th>
|
||||
<th class="sort-column r.country"><spring:message code="country"/></th>
|
||||
<th class="sort-column r.detail"><spring:message code="detail"/></th>
|
||||
<th class="sort-column r.user_region1" column="userregion1" ><spring:message code="asn_no"/></th>
|
||||
<th column="ip_type" ><spring:message code="ip_type"/></th>
|
||||
<th column="IP" ><spring:message code="IP"/></th>
|
||||
<%-- <th><spring:message code="port"/></th> --%>
|
||||
@@ -270,24 +283,28 @@
|
||||
<th><spring:message code="classification"/></th>
|
||||
<th><spring:message code="attribute"/></th>
|
||||
<th><spring:message code="label"/></th> --%>
|
||||
<th column="is_issued" ><spring:message code="is_issued"/></th>
|
||||
<%-- <th><spring:message code="is_audit"/></th> --%>
|
||||
<th column="valid_identifier" ><spring:message code="valid_identifier"/></th>
|
||||
<th><spring:message code="is_audit"/></th>
|
||||
<%-- <th><spring:message code="log_total"/></th> --%>
|
||||
<th column="creator" ><spring:message code="creator"/></th>
|
||||
<th column="config_time" class="sort-column r.create_time"><spring:message code="config_time"/></th>
|
||||
<th column="editor" ><spring:message code="editor"/></th>
|
||||
<th column="edit_time" class="sort-column r.edit_time"><spring:message code="edit_time"/></th>
|
||||
<%-- <th><spring:message code="auditor"/></th>
|
||||
<th class="sort-column r.audit_time"><spring:message code="audit_time"/></th> --%>
|
||||
<th><spring:message code="auditor"/></th>
|
||||
<th class="sort-column r.audit_time"><spring:message code="audit_time"/></th>
|
||||
<%-- <th><spring:message code="operation"></spring:message></th> --%>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.cfgId}" isValid="${cfg.isValid}" serviceGroupId="${cfg.asnIpGroup}" value="0"></td>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.cfgId}" isValid="${cfg.isValid}" value="${cfg.isAudit}"></td>
|
||||
<td>${cfg.compileId }</td>
|
||||
<td>${cfg.cfgDesc }</td>
|
||||
<td class="configGroup" asnNo="${cfg.userRegion1}">${cfg.asnIpGroup }</td>
|
||||
<%-- <td asnNo="${cfg.userRegion1}">${cfg.asnIpGroup }</td> --%>
|
||||
<td>${cfg.organization }</td>
|
||||
<td>${cfg.country }</td>
|
||||
<td>${cfg.detail }</td>
|
||||
<td>${cfg.userRegion1}</td>
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
|
||||
@@ -377,21 +394,30 @@
|
||||
<c:if test="${cfg.isValid==1}"><spring:message code="yes"/></c:if>
|
||||
<c:if test="${cfg.isValid==-1}"><spring:message code="deleted"/></c:if>
|
||||
</td>
|
||||
<%-- <td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '3'}"><span class="label label-warning"><spring:message code="cancel_approved"></spring:message></span></c:when>
|
||||
|
||||
</c:choose>
|
||||
</td> --%>
|
||||
<%-- <c:choose>
|
||||
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
|
||||
<c:when test="${cfg.isAudit eq '3'}">
|
||||
<span indexTable="${cfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon=""> <spring:message code="cancel_approved"/></span>
|
||||
</c:when>
|
||||
</c:choose> --%>
|
||||
</td>
|
||||
<%-- <td audit="${cfg.isAudit}" functionId="${cfg.functionId}" compileId="${cfg.compileId}" action="${cfg.action}"><div class="loading-total"></div></td> --%>
|
||||
<td>${cfg.creatorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${cfg.editorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.editTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<%-- <td>${cfg.auditorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.auditTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td> --%>
|
||||
<td>${cfg.auditorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.auditTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
|
||||
@@ -61,9 +61,9 @@ $(function(){
|
||||
<c:if test="${_cfg.groupType==1}">
|
||||
<spring:message code="dns_group_manage"/>
|
||||
</c:if>
|
||||
<c:if test="${_cfg.groupType==4}">
|
||||
<%-- <c:if test="${_cfg.groupType==4}">
|
||||
<spring:message code="asn_group_manage"/>
|
||||
</c:if>
|
||||
</c:if> --%>
|
||||
<c:if test="${_cfg.groupType==5}">
|
||||
<spring:message code="ip_group_manage"/>
|
||||
</c:if>
|
||||
@@ -127,7 +127,7 @@ $(function(){
|
||||
<div class="form-group asnNo hidden">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="asn_no"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="asnNo" class="form-control required asnNoUnique number" type="text" name="asnNo" value="${_cfg.asnNo}" autocomplete="off" maxlength="15" ctx="${ctx }">
|
||||
<input id="asnNo" class="form-control required number" type="text" name="asnNo" value="${_cfg.asnNo}" autocomplete="off" maxlength="15" ctx="${ctx }">
|
||||
</div>
|
||||
<div for="asnNo"></div>
|
||||
</div>
|
||||
|
||||
@@ -36,12 +36,12 @@
|
||||
var checkboxes=$("tbody tr td input.i-checks:checkbox");
|
||||
var ids="";
|
||||
var str="";
|
||||
var serviceGroupIds=[];
|
||||
/* var serviceGroupIds=[]; */
|
||||
checkboxes.each(function(){
|
||||
if(true == $(this).is(':checked')){
|
||||
if($(this).attr("groupType")==4){
|
||||
/* if($(this).attr("groupType")==4){
|
||||
serviceGroupIds.push($(this).attr("serviceGroupId"));
|
||||
}
|
||||
} */
|
||||
str+=$(this).attr("id")+",";
|
||||
}
|
||||
});
|
||||
@@ -50,7 +50,7 @@
|
||||
}
|
||||
|
||||
var canDel=true;
|
||||
var tip='<spring:message code="can_not_delete_issued_asn_group"/>';
|
||||
/* var tip='<spring:message code="can_not_delete_issued_asn_group"/>';
|
||||
if(serviceGroupIds.length>0){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
@@ -63,29 +63,15 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
/* if(canDel){ // 不能删除包含ASN IP的 ASN组
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/policyGroup/ajaxHasAsnIPs',
|
||||
data:{"serviceGroupIds":serviceGroupIds.join(',')},
|
||||
async:false,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(data){
|
||||
canDel=false;
|
||||
tip='<spring:message code="can_not_delete_has_ip_asn_group"/>';
|
||||
}
|
||||
}
|
||||
});
|
||||
} */
|
||||
}
|
||||
} */
|
||||
if(canDel){
|
||||
var added = "";
|
||||
if(serviceGroupIds.length != 0){
|
||||
/* if(serviceGroupIds.length != 0){
|
||||
added = "<spring:message code='asn_ip_group_delete'/>";
|
||||
}
|
||||
} */
|
||||
top.$.jBox.confirm("<spring:message code='confirm_message'/>"+added,"<spring:message code='info'/>",function(v,h,f){
|
||||
if(v=="ok"){
|
||||
if(serviceGroupIds.length != 0){
|
||||
/* if(serviceGroupIds.length != 0){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/asn/ajaxDeleteAsnIp',
|
||||
@@ -97,9 +83,9 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
}else{ */
|
||||
window.location = url+"&ids="+ids;
|
||||
}
|
||||
/* } */
|
||||
|
||||
}
|
||||
},{buttonsFocus:1});
|
||||
@@ -125,7 +111,7 @@
|
||||
</div>
|
||||
|
||||
<h3 class="page-title">
|
||||
<%-- <c:if test="${cfg.groupType==1}">
|
||||
<c:if test="${cfg.groupType==1}">
|
||||
<spring:message code="dns_group_manage"/>
|
||||
</c:if>
|
||||
<c:if test="${cfg.groupType==4}">
|
||||
@@ -136,8 +122,8 @@
|
||||
</c:if>
|
||||
<c:if test="${cfg.groupType==6}">
|
||||
<spring:message code="ip_spoofing_group_manage"/>
|
||||
</c:if> --%>
|
||||
<spring:message code="policy_group_manage"/>
|
||||
</c:if>
|
||||
<%-- <spring:message code="policy_group_manage"/> --%>
|
||||
</h3>
|
||||
<h5 class="page-header"></h5>
|
||||
<div class="col-md-12">
|
||||
@@ -179,9 +165,9 @@
|
||||
|
||||
<form:select path="seltype" class="selectpicker select2 input-small" >
|
||||
<form:option value="groupName"><spring:message code="group_name"></spring:message></form:option>
|
||||
<c:if test="${cfg.groupType==4}">
|
||||
<%-- <c:if test="${cfg.groupType==4}">
|
||||
<form:option value="asnNo"><spring:message code="asn_no"></spring:message></form:option>
|
||||
</c:if>
|
||||
</c:if> --%>
|
||||
</form:select>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="hidden" name="userRegion5" value="${_cfg.userRegion5}">
|
||||
<%-- <input type="hidden" name="userRegion5" value="${_cfg.userRegion5}"> --%>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion4" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option asnId="${policyGroup.asnId}" value="${policyGroup.groupId}" <c:if test="${asn==policyGroup.groupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
<option asnId="${policyGroup.asnId}" value="${policyGroup.groupName}" <c:if test="${asn==policyGroup.groupName }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -219,28 +219,50 @@
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
<c:if test="${(region[0] eq 3) && (not empty _cfg.userRegion4)}">
|
||||
<div id="${region[1]}Info${index}" class="content" name="subCfg${index}">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='group'/>:</label>
|
||||
<label>
|
||||
${_cfg.asnIpGroupName}
|
||||
</label>
|
||||
<c:forEach items="${_cfg.asnGroups}" var="asn">
|
||||
<div id="${region[1]}Info${index}" class="content" name="subCfg${index}">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='organization'/>:</label>
|
||||
<label>
|
||||
${asn.organization}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='country'/>:</label>
|
||||
<label>
|
||||
${asn.country}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='asn_no'/>:</label>
|
||||
<label>
|
||||
${asn.asnId}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='detail'/>:</label>
|
||||
<label>
|
||||
${asn.detail}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='asn_no'/>:</label>
|
||||
<label>
|
||||
${_cfg.userRegion5}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</html>
|
||||
@@ -945,14 +945,14 @@ jQuery.validator.addMethod("addrPoolUnique",function(value, element) {
|
||||
// 策略分组管理asn号唯一
|
||||
jQuery.validator.addMethod("asnNoUnique",function(value, element) {
|
||||
var ctx=$(element).attr("ctx");
|
||||
var groupId= $("[name='groupId']").val();
|
||||
var url = ctx+"/basics/policyGroup/checkAsnNo";
|
||||
var id= $("[name='id']").val();
|
||||
var url = ctx+"/basics/asnGroup/checkAsnNo";
|
||||
var result = true;
|
||||
$.ajax({
|
||||
type:'post',
|
||||
async:false,
|
||||
url: url,
|
||||
data:{"groupId":groupId,"asnNo":value},
|
||||
data:{"id":id,"asnId":value},
|
||||
success:function(data){
|
||||
result = data;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ $(function(){
|
||||
}
|
||||
});
|
||||
}
|
||||
var asnNos=[];
|
||||
/*var asnNos=[];
|
||||
$(".configGroup").each(function(){
|
||||
if($(this).attr("asnNo")&&$(this).attr("asnNo")!=''){
|
||||
asnNos.push($(this).attr("asnNo"));
|
||||
@@ -53,5 +53,5 @@ $(function(){
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
});
|
||||
Reference in New Issue
Block a user