diff --git a/src/main/java/com/nis/domain/basics/AsnGroupInfo.java b/src/main/java/com/nis/domain/basics/AsnGroupInfo.java new file mode 100644 index 000000000..991714bb4 --- /dev/null +++ b/src/main/java/com/nis/domain/basics/AsnGroupInfo.java @@ -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 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(); + } + +} diff --git a/src/main/java/com/nis/domain/basics/AsnIpCfg.java b/src/main/java/com/nis/domain/basics/AsnIpCfg.java index 7d5703ac7..447e71c34 100644 --- a/src/main/java/com/nis/domain/basics/AsnIpCfg.java +++ b/src/main/java/com/nis/domain/basics/AsnIpCfg.java @@ -28,7 +28,7 @@ public class AsnIpCfg extends BaseCfg { 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 { @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; } diff --git a/src/main/java/com/nis/domain/configuration/BaseIpCfg.java b/src/main/java/com/nis/domain/configuration/BaseIpCfg.java index 864c34c6a..520b91f31 100644 --- a/src/main/java/com/nis/domain/configuration/BaseIpCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseIpCfg.java @@ -72,7 +72,28 @@ public class BaseIpCfg extends BaseCfg { 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; } diff --git a/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java b/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java index 9a1d31108..a5cacb998 100644 --- a/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java +++ b/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java @@ -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 { private String searchKeywords;// 列表关键字查询字段 private Map userRegion; + private String organization; + private String country; + private String detail; + private List asnGroups; /*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数 @@ -92,6 +95,30 @@ public class CfgIndexInfo extends BaseCfg { }*/ + public List getAsnGroups() { + return asnGroups; + } + public void setAsnGroups(List 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; } diff --git a/src/main/java/com/nis/domain/configuration/template/AsnIpTemplate.java b/src/main/java/com/nis/domain/configuration/template/AsnIpTemplate.java index 396a07f93..50f53e26f 100644 --- a/src/main/java/com/nis/domain/configuration/template/AsnIpTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/AsnIpTemplate.java @@ -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; + } + } diff --git a/src/main/java/com/nis/util/AsnCacheUtils.java b/src/main/java/com/nis/util/AsnCacheUtils.java index bb4b8b547..858949a91 100644 --- a/src/main/java/com/nis/util/AsnCacheUtils.java +++ b/src/main/java/com/nis/util/AsnCacheUtils.java @@ -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 map=(Map)element; + Map map=(Map)element; if(map.containsKey(key)) { return map.get(key); } } return null; } - public static Map getMap(Object key) { + public static Map getMap(Object key) { Object element = getCache(ASN_NO_CACHE).get(key); - return (Map)element; + return (Map)element; } public static void clearCache() { logger.warn("clear cache!"); getCache(ASN_NO_CACHE).clear(); } - public static List getAllAsnGroup(){ - List configGroupInfos=Lists.newArrayList(); + public static List getAllAsnGroup(){ + List configGroupInfos=Lists.newArrayList(); Cache cache=getCache(ASN_NO_CACHE); for(Object val : cache.values()) { if(val!=null) { - Map map=(Map)val; + Map map=(Map)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 list=configGroupInfoDao.findAllList(4); - Map> groupMap=Maps.newHashMap(); - for(ConfigGroupInfo configGroupInfo:list) { + cache.clear(); + List list=configGroupInfoDao.findAsnGroupInfos(); + Map> 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 m=Maps.newHashMap(); + Map m=Maps.newHashMap(); m.put(configGroupInfo.getAsnId(), configGroupInfo); groupMap.put(configGroupInfo.getAsnId()/cache_rage, m); } } - for(Entry> e:groupMap.entrySet()) { + for(Entry> 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 map = getMap(key); + Map map = getMap(key); if(map != null) { c+=getMap(key).size(); } @@ -111,19 +112,19 @@ public class AsnCacheUtils{ } } if(loadDatabase) { - List list=configGroupInfoDao.findAllList(4); - Map> groupMap=Maps.newHashMap(); - for(ConfigGroupInfo configGroupInfo:list) { + List list=configGroupInfoDao.findAsnGroupInfos(); + Map> 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 m=Maps.newHashMap(); + Map m=Maps.newHashMap(); m.put(configGroupInfo.getAsnId(), configGroupInfo); groupMap.put(configGroupInfo.getAsnId()/cache_rage, m); } } - for(Entry> e:groupMap.entrySet()) { + for(Entry> 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 map=Maps.newHashMap(); + Map map=Maps.newHashMap(); map.put(key, value); getCache(ASN_NO_CACHE).put(_key,map); }else { - Map map=(Map)element; + Map map=(Map)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 map=(Map)element; + Map map=(Map)element; if(map.containsKey(key)) { map.remove(key); } diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index c8a5836d5..05b1177dd 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -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); diff --git a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java index 5d849ba57..b7b0e55db 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java @@ -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{ // private DnsResStrategyService dnsResStrategyService; private FunctionServiceDict serviceDict; private FunctionRegionDict regionDict; - private List> asnNoMaps; + private List> asnNoMaps; + private Map asnGroupInfos; // private DnsResStrategyDao dnsResStrategyDao; public CheckIpFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue srcQueue,BlockingQueue destQueue) { this.serviceDict=serviceDict; @@ -68,7 +69,7 @@ public class CheckIpFormatThread implements Callable{ } return msg.toString(); } - public List checkIpCfg(StringBuffer msg,List> asnNos, List list) + public List checkIpCfg(StringBuffer msg,List> asnNos, List list) throws ServiceException { logger.warn("start to validate ip..."); long start=System.currentTimeMillis(); @@ -104,7 +105,7 @@ public class CheckIpFormatThread implements Callable{ 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{ 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{ + ";"); }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 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(); @@ -641,7 +695,6 @@ public class CheckIpFormatThread implements Callable{ baseIpCfg.setSrcPort("0"); baseIpCfg.setPortPattern(1); } - baseIpCfg.setDestPort(baseIpCfg.getSrcPort().trim()); } else { if (baseIpCfg.getSrcPort().indexOf("/") > -1) { baseIpCfg.setPortPattern(2); @@ -649,9 +702,8 @@ public class CheckIpFormatThread implements Callable{ baseIpCfg.setPortPattern(1); } baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim()); - baseIpCfg.setDestPort(baseIpCfg.getDestPort().trim()); - } + baseIpCfg.setDestPort(baseIpCfg.getDestPort().trim()); } // TODO 判断源端口和目的端口格式 // TODO 判断源和目的端口的值 @@ -1140,11 +1192,17 @@ public class CheckIpFormatThread implements Callable{ return matchType; } - public List> getAsnNoMaps() { + public List> getAsnNoMaps() { return asnNoMaps; } - public void setAsnNoMaps(List> asnNoMaps) { + public void setAsnNoMaps(List> asnNoMaps) { this.asnNoMaps = asnNoMaps; } + public Map getAsnGroupInfos() { + return asnGroupInfos; + } + public void setAsnGroupInfos(Map asnGroupInfos) { + this.asnGroupInfos = asnGroupInfos; + } } diff --git a/src/main/java/com/nis/util/excel/thread/DeleteAsnIpTread.java b/src/main/java/com/nis/util/excel/thread/DeleteAsnIpTread.java index cb8fcdae3..95b12913d 100644 --- a/src/main/java/com/nis/util/excel/thread/DeleteAsnIpTread.java +++ b/src/main/java/com/nis/util/excel/thread/DeleteAsnIpTread.java @@ -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 { private BlockingQueue asnNos; + private AsnGroupInfoDao asnGroupInfoDao; private ConfigGroupInfoDao configGroupInfoDao; private AsnIpCfgDao asnIpCfgDao; public DeleteAsnIpTread(BlockingQueue 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 { List asnIds=Lists.newArrayList(); DataSourceTransactionManager transactionManager=(DataSourceTransactionManager)SpringContextHolder.getBean("transactionManager"); LinkedBlockingQueue toDelAndSendAsnIpCfgs=new LinkedBlockingQueue(); + List 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 _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 _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 { } 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 { } 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 { } 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(); } diff --git a/src/main/java/com/nis/util/excel/thread/SaveAsnIpThread.java b/src/main/java/com/nis/util/excel/thread/SaveAsnIpThread.java index 3ee0d719d..1ba4ffb38 100644 --- a/src/main/java/com/nis/util/excel/thread/SaveAsnIpThread.java +++ b/src/main/java/com/nis/util/excel/thread/SaveAsnIpThread.java @@ -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{ private List> 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 ipPortCfgs) { this.serviceDict=serviceDict; @@ -50,7 +49,7 @@ public class SaveAsnIpThread implements Callable{ 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{ _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()); } diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 3aa1881d1..2bc72e29b 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -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 checkIpCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,List> asnNos, BlockingQueue list) throws ServiceException, InterruptedException, ExecutionException{ + public BlockingQueue checkIpCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,List> asnNos,Map asnGroupInfos, BlockingQueue list) throws ServiceException, InterruptedException, ExecutionException{ logger.warn("start checkIpCfgMulity ,size "+list.size()); long start=System.currentTimeMillis(); BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); @@ -953,6 +957,7 @@ public class BaseController { for(int i=0;i cfgIndexInfos = new ArrayList(); List appPolicyCfgs = new ArrayList(); List appFeatureIndexs= new ArrayList(); - List> asnNoMaps=Lists.newArrayList(); - Map newAsnNoMap=Maps.newConcurrentMap(); - Map OldAsnNoMap=Maps.newConcurrentMap(); + List> asnNoMaps=Lists.newArrayList(); + Map newAsnNoMap=Maps.newConcurrentMap(); + Map OldAsnNoMap=Maps.newConcurrentMap(); + Map 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 list = ei.getDataList(IpRateLimitTemplate.class ); - ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list); + ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,asnGroupInfos, list); } else { BlockingQueue 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 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 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 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 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 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 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 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 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 list = ei.getDataList(HttpsReplaceIpTemplate.class ); - ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list); + ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list); } else { BlockingQueue 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 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(":"+e.getMessage()); - } - } List 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> list=Lists.newArrayList(); -// ExecutorService service=Executors.newFixedThreadPool(Constants.SAVE_AND_DEL_THREAD_SIZE); -// BlockingQueue queue=new ArrayBlockingQueue<>(asnNoMaps.get(1).size()); -// queue.addAll(asnNoMaps.get(1).keySet()); -// for(int j=0;j 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 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> list=Lists.newArrayList(); -// ExecutorService service=Executors.newFixedThreadPool(Constants.SAVE_AND_DEL_THREAD_SIZE); -// for(int j=0;j e:list) { -// if(e.get()!=null) { -// try { -// throw e.get(); -// } catch (Throwable e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// } -// } List asnIpCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); List _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 asnNoMap){ + List toDelAndSendAsnIpCfgs=Lists.newArrayList(); + List asnIds=Lists.newArrayList(asnNoMap.size()); + for(Entry e:asnNoMap.entrySet()) { + AsnGroupInfo asnGroupInfo=e.getValue(); + if(asnGroupInfo==null) { + asnGroupInfo=asnIpCfgService.getAsnGroupInfoByAsnNo(e.getKey()); + } + if(asnGroupInfo.getIsValid()==1) {//已下发 + List _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 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 diff --git a/src/main/java/com/nis/web/controller/basics/AsnGroupController.java b/src/main/java/com/nis/web/controller/basics/AsnGroupController.java new file mode 100644 index 000000000..2f90cd108 --- /dev/null +++ b/src/main/java/com/nis/web/controller/basics/AsnGroupController.java @@ -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 pageCondition = new Page(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; + } +} diff --git a/src/main/java/com/nis/web/controller/basics/AsnIpController.java b/src/main/java/com/nis/web/controller/basics/AsnIpController.java index 9f2aa1202..a307b78c0 100644 --- a/src/main/java/com/nis/web/controller/basics/AsnIpController.java +++ b/src/main/java/com/nis/web/controller/basics/AsnIpController.java @@ -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 page = asnIpCfgService.findPage(new Page(request, response,"r"), entity); model.addAttribute("page", page); // initPageCondition(model); @@ -44,12 +54,6 @@ public class AsnIpController extends BaseController{ model.addAttribute("regionList", regionList); List serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId()); model.addAttribute("serviceList", serviceList); - -// List policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4); -// model.addAttribute("policyGroups", policyGroups); -// AsnCacheUtils.init(false); -// List 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 policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4); - model.addAttribute("policyGroups", policyGroups); + List 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 policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4); - model.addAttribute("policyGroups", policyGroups); + List 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 asnIps=asnIpCfgService.getByIds(ids); + Map> 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 _asnIps=Lists.newArrayList(); + _asnIps.add(asnIpCfg); + asnIpMap.put(Long.parseLong(asnIpCfg.getUserRegion1()), _asnIps); + } + } + asnIpCfgService.auditIpBatch(asnIpMap,isValid); + }/*else { + //条件下所有配置审核 + Page searchPage=new Page(request,response,"a"); + Page auditPage=new Page(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 ajaxGroupName(Model model,String ids){ - AsnCacheUtils.init(false); - Map 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 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(); } @RequestMapping(value="ajaxIsLast",method=RequestMethod.POST) @ResponseBody diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java index 05da5f890..f28836828 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java @@ -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") diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java index 801831700..f22410e1d 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java @@ -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 ipList=new ArrayList(); - List groupInfoList=new ArrayList(); + List groupInfoList=new ArrayList(); 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); diff --git a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java index a85f0886a..df57ed452 100644 --- a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java +++ b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java @@ -267,8 +267,8 @@ public class DashboardController extends BaseController{ if(o1==o2&&o1==null){ return 0; } - Long ob1 = o1.getC2sByteLen()+o1.getS2cByteLen(); - Long ob2 = o2.getC2sByteLen()+o2.getS2cByteLen(); + Long ob1 = o1.getLinkNum(); + Long ob2 = o2.getLinkNum(); return -(ob1).compareTo(ob2); } }); diff --git a/src/main/java/com/nis/web/controller/sys/DictController.java b/src/main/java/com/nis/web/controller/sys/DictController.java index 745215a7b..3a7764dbc 100644 --- a/src/main/java/com/nis/web/controller/sys/DictController.java +++ b/src/main/java/com/nis/web/controller/sys/DictController.java @@ -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"; } diff --git a/src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.java b/src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.java new file mode 100644 index 000000000..3150d2cf4 --- /dev/null +++ b/src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.java @@ -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 { + List 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 getConfigGroupInfoByGroupId(Integer groupId); + List getConfigGroupInfoByName(@Param("organization")String organization); + List getValidConfigGroupInfoByName(@Param("organization")String organization); + int getCountGroupInfoByName(@Param("organization")String organization); + void insertBatch(List policyGroupInfos); + List findAsnGroupInfos(); + Long getCount(); + void audit(AsnIpCfg t); +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.xml b/src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.xml new file mode 100644 index 000000000..24163767b --- /dev/null +++ b/src/main/java/com/nis/web/dao/basics/AsnGroupInfoDao.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + 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} + ) + + + + update asn_group_info + + + + organization = #{organization,jdbcType=VARCHAR}, + + + country = #{country,jdbcType=VARCHAR}, + + + detail = #{detail,jdbcType=VARCHAR}, + + + asn_id = #{asnId,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + group_id = #{groupId,jdbcType=INTEGER}, + + + org_group_id = #{orgGroupId,jdbcType=INTEGER}, + + + compile_id = #{compileId,jdbcType=INTEGER}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + + + + + and id = #{id,jdbcType=INTEGER} + + + + + + update asn_group_info + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + + + + and group_id = #{groupId,jdbcType=INTEGER} + + + and id = #{id,jdbcType=INTEGER} + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java index ea319f613..6fd733202 100644 --- a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java +++ b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java @@ -17,14 +17,16 @@ public interface AsnIpCfgDao extends CrudDao{ public void updateIssued(AsnIpCfg cfg); public List getByIds(@Param("ids")String ids); public List hasGroupIds(@Param("ids")String ids); + public List hasASNIds(@Param("ids")String ids); public List findAllList(AsnIpCfg cfg); // public List findPolicyGroupInfosByType(@Param("groupId")Integer groupId); public List findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId); public List countValidIPs(@Param("groups")String groups,@Param("ids")String ids); public List getByAsnNo(@Param("asnId")long asnNo); - public int deleteByAsnGroup(@Param("asnId")String asnNo); + public int deleteByAsnId(@Param("asnId")String asnNo); public int insertBatch(List list); public Varibles getVaribles(@Param("name")String name); public void ajaxDeleteAsnIp(@Param("ids")String ids); + public int hasValidAsnIp(@Param("asnId")Long asnNo); } diff --git a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml index a410a0451..e1ab4042e 100644 --- a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml @@ -41,11 +41,12 @@ + + + + - - - - + 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 select 1 from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${ids}) limit 1 + - 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 (#{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}) - - - + diff --git a/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml index 0c91f1df8..4fc8da5cd 100644 --- a/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml @@ -275,8 +275,7 @@ update cfg_index_info set is_valid=#{isValid} where cfg_id in (${ids}) \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.java b/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.java index 8199c7540..f52b8a9d3 100644 --- a/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.java +++ b/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.java @@ -20,4 +20,7 @@ public interface ConfigGroupInfoDao extends CrudDao{ 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); } diff --git a/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.xml b/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.xml index c3fd2c166..734a50880 100644 --- a/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.xml +++ b/src/main/java/com/nis/web/dao/specific/ConfigGroupInfoDao.xml @@ -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} + + + + + +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/basics/asnGroupList.jsp b/src/main/webapp/WEB-INF/views/basics/asnGroupList.jsp new file mode 100644 index 000000000..d8cde8837 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/basics/asnGroupList.jsp @@ -0,0 +1,266 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +

+ +

+ +
+
+
+
+ + + + + + + +
+ +
+ +
+
+ + + + + + +
+ + + +
+
+
+ + + +
+
+ <%-- --%> + + + + + <%-- --%> + <%-- --%> + + href="javascript:;"> + + +
+
+ + + +
+
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ${fns:abbr(cfg.organization,20)} + + + + ${fns:abbr(cfg.country,20)} + + + + ${fns:abbr(cfg.detail,20)} + + ${cfg.asnId} + + + ${cfg.creatorName }${cfg.editorName }
+
${page}
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormAdd.jsp b/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormAdd.jsp index f70df9208..e91057eba 100644 --- a/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormAdd.jsp +++ b/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormAdd.jsp @@ -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+="" + } + $("[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+="" + } + $("[name='userRegion1']").empty().append(html); + $("[name='userRegion1']").selectpicker("refresh"); + + } + } + }); }); }); //业务窗口打开 @@ -105,11 +148,14 @@ var reSort=function(obj,index){
- - + + + + + @@ -138,13 +184,13 @@ var reSort=function(obj,index){ -
+ <%--
+ + + + + <%-- --%> +
+
+
+
+
+
+
+
+ +
+ + <%-- --%> +
+
+
+
+ +
+
+
diff --git a/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormUpdate.jsp b/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormUpdate.jsp index ae9f1ad65..968b5013f 100644 --- a/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormUpdate.jsp +++ b/src/main/webapp/WEB-INF/views/basics/asnIpCfgFormUpdate.jsp @@ -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+="" + } + $("[name='userRegion1']").empty().append(html); + $("[name='userRegion1']").selectpicker("refresh"); + + } + } + }); }); }); @@ -54,6 +101,7 @@ $(function(){ + @@ -83,19 +131,19 @@ $(function(){
- -
- -
- -
-
-
-
+
+ +
+ + <%-- --%> +
+
+
+ +
+
+
+ +
+ + <%-- --%> +
+
+
+
+
+ +
+
+
+ +
<%-- <%@include file="/WEB-INF/include/form/complexIpInfo.jsp" %> --%>
diff --git a/src/main/webapp/WEB-INF/views/basics/asnIpCfgList.jsp b/src/main/webapp/WEB-INF/views/basics/asnIpCfgList.jsp index 98fbbb783..35addb20b 100644 --- a/src/main/webapp/WEB-INF/views/basics/asnIpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/asnIpCfgList.jsp @@ -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"," "+$("#seltype").find("option:selected").text()); } @@ -108,7 +114,7 @@
--%> - <%--
+
@@ -117,7 +123,7 @@ -
--%> +
@@ -128,7 +134,10 @@ <%-- --%> - + + + +
@@ -166,7 +175,7 @@ - <%-- +
-
--%> +
href="javascript:;"> @@ -225,7 +234,7 @@ - <%--
+
" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
-
--%> +
@@ -256,10 +265,14 @@ + <%-- --%> - - + <%-- --%> + + + + <%-- --%> @@ -270,24 +283,28 @@ --%> - - <%-- --%> + + <%-- --%> - <%-- - --%> + + <%-- --%> - + + ${cfg.compileId } ${cfg.cfgDesc } - ${cfg.asnIpGroup } + <%-- ${cfg.asnIpGroup } --%> + ${cfg.organization } + ${cfg.country } + ${cfg.detail } ${cfg.userRegion1} @@ -377,21 +394,30 @@ - <%-- + + - --%> + <%-- + + + + + + + --%> + <%--
--%> ${cfg.creatorName } ${cfg.editorName } - <%-- ${cfg.auditorName } - --%> + ${cfg.auditorName } +
diff --git a/src/main/webapp/WEB-INF/views/basics/policyGroupForm.jsp b/src/main/webapp/WEB-INF/views/basics/policyGroupForm.jsp index 7abc1c023..a205db40a 100644 --- a/src/main/webapp/WEB-INF/views/basics/policyGroupForm.jsp +++ b/src/main/webapp/WEB-INF/views/basics/policyGroupForm.jsp @@ -61,9 +61,9 @@ $(function(){ - + <%-- - + --%> @@ -127,7 +127,7 @@ $(function(){ diff --git a/src/main/webapp/WEB-INF/views/basics/policyGroupList.jsp b/src/main/webapp/WEB-INF/views/basics/policyGroupList.jsp index b7ac63c7a..10ea63231 100644 --- a/src/main/webapp/WEB-INF/views/basics/policyGroupList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/policyGroupList.jsp @@ -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=''; + /* var tip=''; 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=''; - } - } - }); - } */ - } + } */ if(canDel){ var added = ""; - if(serviceGroupIds.length != 0){ + /* if(serviceGroupIds.length != 0){ added = ""; - } + } */ top.$.jBox.confirm(""+added,"",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 @@

- <%-- + @@ -136,8 +122,8 @@ - --%> - + + <%-- --%>

@@ -179,9 +165,9 @@ - + <%-- - + --%>
diff --git a/src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp b/src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp index d6537941c..7472e627f 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipaddr/asnForm.jsp @@ -15,13 +15,13 @@
- + <%-- --%>
diff --git a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipSubList.jsp index 0740788c7..534fcdc91 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipSubList.jsp @@ -219,28 +219,50 @@ -
-
-
-
- - + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
-
-
-
- - -
-
-
-
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp b/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp index 1552c2b34..248dba0a8 100644 --- a/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp +++ b/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp @@ -122,8 +122,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -131,8 +133,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp index 451157281..30271429d 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp @@ -108,8 +108,10 @@
- + <%-- --%> +
@@ -117,8 +119,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp index f193d503e..05bb801cb 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp @@ -57,8 +57,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -66,8 +68,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp index e92b5532d..60fd1d8a4 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp @@ -120,8 +120,10 @@
- + <%-- --%> +
@@ -129,8 +131,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp index dd49a716a..802516419 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp @@ -112,8 +112,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -121,8 +123,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp index 7a163f1ce..65f37839e 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp @@ -109,8 +109,10 @@
- + <%-- --%> +
@@ -118,8 +120,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp index 69450f0d9..2138cabed 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp @@ -110,8 +110,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -119,8 +121,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp index 3348eaa34..87ffd21f6 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp @@ -135,8 +135,10 @@
- + <%-- --%> +
@@ -144,8 +146,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp index 7bd74b432..a8b7f6873 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp @@ -119,8 +119,10 @@
- + <%-- --%> +
@@ -128,8 +130,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/irDnatLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/irDnatLogList.jsp index 314c8afe9..a05570726 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/irDnatLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/irDnatLogList.jsp @@ -75,8 +75,10 @@
- + <%-- --%> +
@@ -84,8 +86,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/irSnatLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/irSnatLogList.jsp index d76b7206b..1a1d7a55c 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/irSnatLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/irSnatLogList.jsp @@ -76,8 +76,10 @@
- + <%-- --%> +
@@ -85,8 +87,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp index fb2592159..9a79e125c 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp @@ -108,8 +108,10 @@
- + <%-- --%> +
@@ -117,8 +119,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp index d98692844..f93afe476 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp @@ -109,8 +109,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -118,8 +120,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp index dbf510caf..b5a164f5b 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp @@ -110,8 +110,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -119,8 +121,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp index 3a3e77381..7710faf5f 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp @@ -127,8 +127,10 @@
- + <%-- --%> +
@@ -136,8 +138,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp index de6d4aee7..75385dba8 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp @@ -110,8 +110,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -119,8 +121,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp index f25043ca4..afb82965f 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp @@ -111,8 +111,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -120,8 +122,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp index ac0192ccb..9a11889e2 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp @@ -110,8 +110,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -119,8 +121,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp index 1482777ec..100da5d3e 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp @@ -111,8 +111,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -120,8 +122,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp index 161e8260b..7db8cfdd8 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp @@ -110,8 +110,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -119,8 +121,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp index 8829dda91..f9b7e4edb 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp @@ -83,8 +83,10 @@ $(document).ready(function(){
- + <%-- --%> +
@@ -92,8 +94,10 @@ $(document).ready(function(){
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp index 92247de1b..4f0d6712d 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp @@ -108,8 +108,10 @@
- + <%-- --%> +
@@ -117,8 +119,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp index 76dca53cb..b19906b61 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp @@ -79,8 +79,10 @@
- + <%-- --%> +
@@ -88,8 +90,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp index c69d18a9a..7933e91ec 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp @@ -124,8 +124,10 @@
- + <%-- --%> +
@@ -133,8 +135,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/log/pxy/pxyHttpList.jsp b/src/main/webapp/WEB-INF/views/log/pxy/pxyHttpList.jsp index 7cc411d01..9e30384d1 100644 --- a/src/main/webapp/WEB-INF/views/log/pxy/pxyHttpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/pxy/pxyHttpList.jsp @@ -94,8 +94,10 @@
- + <%-- --%> +
@@ -103,8 +105,10 @@
- + <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp b/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp index 862b67008..ccc773417 100644 --- a/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp +++ b/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp @@ -145,9 +145,8 @@
<%-- value="${log.searchFoundStartTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> --%> - + value="${log.searchFoundStartTime}" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setStartTime('#searchFoundStartTime','#searchFoundEndTime',1,'d','yyyy-MM-dd hh:mm:ss',false)"/>
@@ -158,7 +157,7 @@ <%-- value="${log.searchFoundEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> --%> + value="${log.searchFoundEndTime}" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setEndTime('#searchFoundStartTime','#searchFoundEndTime',1,'d','yyyy-MM-dd hh:mm:ss',false)"/>
diff --git a/src/main/webapp/WEB-INF/views/report/urlReportList.jsp b/src/main/webapp/WEB-INF/views/report/urlReportList.jsp index b2d7e9cd4..b419adc36 100644 --- a/src/main/webapp/WEB-INF/views/report/urlReportList.jsp +++ b/src/main/webapp/WEB-INF/views/report/urlReportList.jsp @@ -145,7 +145,7 @@ <%-- value="${log.searchReportStartTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> --%> + value="${log.searchReportStartTime}" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setStartTime('#searchReportStartTime','#searchReportEndTime',1,'d','yyyy-MM-dd hh:mm:ss',false)"/>
@@ -156,7 +156,7 @@ <%-- value="${log.searchReportEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> --%> + value="${log.searchReportEndTime}" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setEndTime('#searchReportStartTime','#searchReportEndTime',1,'d','yyyy-MM-dd hh:mm:ss',false)"/>
diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js index e24c3c119..153653db1 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js @@ -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; } diff --git a/src/main/webapp/static/pages/scripts/appNames.js b/src/main/webapp/static/pages/scripts/appNames.js index 6a37ed096..aece709a8 100644 --- a/src/main/webapp/static/pages/scripts/appNames.js +++ b/src/main/webapp/static/pages/scripts/appNames.js @@ -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(){ } } }); - } + }*/ }); \ No newline at end of file diff --git a/src/main/webapp/static/pages/scripts/echart.js b/src/main/webapp/static/pages/scripts/echart.js index 28e80b01f..f700613f6 100644 --- a/src/main/webapp/static/pages/scripts/echart.js +++ b/src/main/webapp/static/pages/scripts/echart.js @@ -282,11 +282,11 @@ var data=new Array(); var xData=new Array(); var drillData=new Array(); - var unit="bytes"; + var unit="Link Times"; $(rs).each(function(i, d) { var inoctetsNum=d.linkNum; - unit=changeUnit(inoctetsNum); - inoctetsNum=changeNum(inoctetsNum); +// unit=changeUnit(inoctetsNum); +// inoctetsNum=changeNum(inoctetsNum); /*var pktNum=new Array(); var byteLen=new Array();*/ xData.push(d.ipAddr);