Compare commits
164 Commits
demo_appse
...
feature-im
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4157f58ab9 | ||
|
|
d27ba7ec93 | ||
|
|
bd29b40573 | ||
|
|
298eeef5e4 | ||
|
|
873b3333af | ||
|
|
068d2e859c | ||
|
|
a1ad694260 | ||
|
|
253adc1396 | ||
|
|
fc302fe984 | ||
|
|
fcface8471 | ||
|
|
19b1d1b40c | ||
|
|
dc1a75c9c9 | ||
|
|
1896c51a87 | ||
|
|
f284491963 | ||
|
|
f309b8b79b | ||
|
|
805d444d01 | ||
|
|
36f09542da | ||
|
|
6017b7f454 | ||
|
|
f90d3dbf32 | ||
|
|
b588f12b0c | ||
|
|
9a9b050fc7 | ||
|
|
e977d00657 | ||
|
|
ef5c6cdfa6 | ||
|
|
62056ed718 | ||
|
|
e1966eb0c3 | ||
|
|
db00cafd84 | ||
|
|
785150f921 | ||
|
|
c8e43c81f1 | ||
|
|
b87f99c852 | ||
|
|
c348697e3b | ||
|
|
6b37a95ee2 | ||
|
|
d8b05f9431 | ||
|
|
8682124d04 | ||
|
|
b12f45a187 | ||
|
|
ba56de3336 | ||
|
|
518600da40 | ||
|
|
e98c8f2f2a | ||
|
|
322e5ba8a8 | ||
|
|
c87a465200 | ||
|
|
bf74483f77 | ||
|
|
c690c68aad | ||
|
|
9b2f41cd39 | ||
|
|
88199a222b | ||
|
|
7583c01432 | ||
|
|
6d9060bb49 | ||
|
|
2b452af4b3 | ||
|
|
c5aae2302c | ||
|
|
a8468064d6 | ||
|
|
ba3aeb199f | ||
|
|
d8a5ecf8ab | ||
|
|
043cb275dc | ||
|
|
60392b2493 | ||
|
|
a2f311f18c | ||
|
|
220b3be2b0 | ||
|
|
668c435862 | ||
|
|
47966248dc | ||
|
|
8b60648f3e | ||
|
|
745076678a | ||
|
|
22ed019dbd | ||
|
|
737833492b | ||
|
|
edb9f11b92 | ||
|
|
be3811688f | ||
|
|
851fb85ca1 | ||
|
|
2dadd96484 | ||
|
|
0ebee67507 | ||
|
|
85f09a60be | ||
|
|
fa20de4df1 | ||
|
|
2abffe2e34 | ||
|
|
32d4ad3cd7 | ||
|
|
453ed153bc | ||
|
|
c458bb0e6b | ||
|
|
b307bffb26 | ||
|
|
e940073eae | ||
|
|
07b7040df4 | ||
|
|
8d8a6dc97e | ||
|
|
4a627eacaa | ||
|
|
ecdaa47d8a | ||
|
|
98747b329b | ||
|
|
26078a9cd1 | ||
|
|
776dc47ad6 | ||
|
|
faf8f45585 | ||
|
|
e33e91cb46 | ||
|
|
90ffb5388f | ||
|
|
6931832c8c | ||
|
|
281ea2f2a9 | ||
|
|
a4c566089f | ||
|
|
049550dc1c | ||
|
|
ea13a037e8 | ||
|
|
b2bfd83e1f | ||
|
|
00f40e6394 | ||
|
|
40ad762853 | ||
|
|
e319a19135 | ||
|
|
de813e15d9 | ||
|
|
2febc9e5b7 | ||
|
|
a7914aafac | ||
|
|
10e0064556 | ||
|
|
18491f2644 | ||
|
|
2db43e69d9 | ||
|
|
c1c5c8f5bb | ||
|
|
1c2833ee8e | ||
|
|
8c70356e44 | ||
|
|
41e5202cbf | ||
|
|
9d6e3a3d4a | ||
|
|
63882ac75e | ||
|
|
0a76ce337a | ||
|
|
5c63f85483 | ||
|
|
2181a420b9 | ||
|
|
5d86fb0fd4 | ||
|
|
9b304e3c13 | ||
|
|
87e07376fa | ||
|
|
736c4cda04 | ||
|
|
a2dc1dd6f5 | ||
|
|
787484c721 | ||
|
|
5c8b81c67e | ||
|
|
56e9cebe26 | ||
|
|
469c753161 | ||
|
|
72b88b09c4 | ||
|
|
3e706f7027 | ||
|
|
498fee3727 | ||
|
|
1f4618ae7f | ||
|
|
1f024e6b81 | ||
|
|
839f06b495 | ||
|
|
e3bade38b9 | ||
|
|
1346fd1bfc | ||
|
|
da24fa3b84 | ||
|
|
ee20daadb3 | ||
|
|
a80c9267df | ||
|
|
b0a6fe7c86 | ||
|
|
493c5e7c63 | ||
|
|
ad310f6d48 | ||
|
|
86365ad7b1 | ||
|
|
372232d206 | ||
|
|
4dfd9b2d70 | ||
|
|
f105fca9a7 | ||
|
|
c4db370870 | ||
|
|
0756af0d6e | ||
|
|
daac82f77a | ||
|
|
f71711ed8f | ||
|
|
5b8a342625 | ||
|
|
d9f5398fc6 | ||
|
|
8d6d6da7f3 | ||
|
|
44ea7d6ca2 | ||
|
|
cca47e3823 | ||
|
|
f8a90c0c8f | ||
|
|
e412d22569 | ||
|
|
4ed438f8aa | ||
|
|
77f9d927be | ||
|
|
abbb76031b | ||
|
|
5ee58bc895 | ||
|
|
a437417da1 | ||
|
|
b41f0d8ad5 | ||
|
|
9ff1643e30 | ||
|
|
7e1875b384 | ||
|
|
aa5eccf995 | ||
|
|
9e6e2fbd37 | ||
|
|
104d06fd19 | ||
|
|
216c64b031 | ||
|
|
25ea439564 | ||
|
|
d225b81903 | ||
|
|
b1ee15772b | ||
|
|
84e691d03b | ||
|
|
0409a5f8c8 | ||
|
|
6a5b07f8ce | ||
|
|
de8496e003 |
@@ -32,22 +32,7 @@ public class AsnGroupInfo extends BaseCfg<AsnGroupInfo> implements Serializable{
|
||||
|
||||
private Integer isUsed;
|
||||
private Integer regionId;
|
||||
private Integer orgGroupId;
|
||||
|
||||
private Integer onlyGroupId;// ip地址独用组id
|
||||
|
||||
public Integer getOnlyGroupId() {
|
||||
return onlyGroupId;
|
||||
}
|
||||
public void setOnlyGroupId(Integer onlyGroupId) {
|
||||
this.onlyGroupId = onlyGroupId;
|
||||
}
|
||||
public Integer getOrgGroupId() {
|
||||
return orgGroupId;
|
||||
}
|
||||
public void setOrgGroupId(Integer orgGroupId) {
|
||||
this.orgGroupId = orgGroupId;
|
||||
}
|
||||
|
||||
public Integer getIsUsed() {
|
||||
return isUsed;
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.nis.domain.basics;
|
||||
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class UrlCommGroupCfg extends BaseStringCfg<UrlCommGroupCfg>{
|
||||
|
||||
private static final long serialVersionUID = 398247881810945300L;
|
||||
private static final String tableName="http_url_cfg";
|
||||
|
||||
@ExcelField(title="key_word",sort=3)
|
||||
protected String cfgKeywords;//url关键字配置
|
||||
|
||||
// protected Integer exprType;//表达式类型
|
||||
// protected Integer matchMethod;//匹配类型
|
||||
protected Integer isHexbin;//是否大小写敏感
|
||||
protected String ratelimit;//限速比例,0到1之间
|
||||
@ExcelField(title="group_name",sort=108)
|
||||
protected String groupName;//公共组名称
|
||||
|
||||
|
||||
|
||||
public String getCfgKeywords() {
|
||||
return cfgKeywords;
|
||||
}
|
||||
public void setCfgKeywords(String cfgKeywords) {
|
||||
this.cfgKeywords = cfgKeywords;
|
||||
}
|
||||
// public Integer getExprType() {
|
||||
// return exprType;
|
||||
// }
|
||||
// public void setExprType(Integer exprType) {
|
||||
// this.exprType = exprType;
|
||||
// }
|
||||
// public Integer getMatchMethod() {
|
||||
// return matchMethod;
|
||||
// }
|
||||
// public void setMatchMethod(Integer matchMethod) {
|
||||
// this.matchMethod = matchMethod;
|
||||
// }
|
||||
public Integer getIsHexbin() {
|
||||
return isHexbin;
|
||||
}
|
||||
public void setIsHexbin(Integer isHexbin) {
|
||||
this.isHexbin = isHexbin;
|
||||
}
|
||||
public String getRatelimit() {
|
||||
return ratelimit;
|
||||
}
|
||||
public void setRatelimit(String ratelimit) {
|
||||
this.ratelimit = ratelimit;
|
||||
}
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,43 +44,23 @@ public class AppComplexFeatureCfg extends BaseCfg<AppComplexFeatureCfg> {
|
||||
private List<AppIpCfg> ipPortList = new ArrayList();
|
||||
private String cfgRegionCode1;
|
||||
//以下参数为APP PAYLOAD L3_HEADER的特殊属性(使用偏移表达式处理)
|
||||
private String ver; // s: 为session组件复用时的属性含义 // s:传输协议
|
||||
private String ihl; // s:L7层协议未知×
|
||||
private String tos; // s:L7层协议
|
||||
private String totalLength; // s:链接建立方式
|
||||
private String flags; // s:TCP包发送特性
|
||||
private String fragmentOffset; // s:域名初筛标识
|
||||
private String protocol; // s:S2C Frequent Payload Size
|
||||
private String icmpType; // s:S2C Payload Size Sequence
|
||||
private String icmpCode; // s:C2S Frequent Payload Size
|
||||
private String icmpIdentifier; // s:C2S Payload Size Sequence
|
||||
private String headerType; // s:传输服务端端口
|
||||
|
||||
private String ver;
|
||||
private String ihl;
|
||||
private String tos;
|
||||
private String totalLength;
|
||||
private String flags;
|
||||
private String fragmentOffset;
|
||||
private String protocol;
|
||||
private String icmpType;
|
||||
private String icmpCode;
|
||||
private String icmpIdentifier;
|
||||
private String headerType;
|
||||
//以下参数为APP payload payload的特殊属性(偏移量表达式时处理)
|
||||
private Integer payloadOffset; // s:session size min
|
||||
private Integer payloadSize;//下发综合服务接口时,为单独的域配置 // s:session size max
|
||||
private String payloadPacketDirection;//下发综合服务接口时,为单独的域配置 // s:清洗标识
|
||||
|
||||
private String sessionC2sRadio;
|
||||
private String sessionS2cRadio;
|
||||
|
||||
private Integer payloadOffset;
|
||||
private Integer payloadSize;//下发综合服务接口时,为单独的域配置
|
||||
private String payloadPacketDirection;//下发综合服务接口时,为单独的域配置
|
||||
|
||||
|
||||
public String getSessionC2sRadio() {
|
||||
return sessionC2sRadio;
|
||||
}
|
||||
|
||||
public void setSessionC2sRadio(String sessionC2sRadio) {
|
||||
this.sessionC2sRadio = sessionC2sRadio;
|
||||
}
|
||||
|
||||
public String getSessionS2cRadio() {
|
||||
return sessionS2cRadio;
|
||||
}
|
||||
|
||||
public void setSessionS2cRadio(String sessionS2cRadio) {
|
||||
this.sessionS2cRadio = sessionS2cRadio;
|
||||
}
|
||||
|
||||
public String getCfgRegionCode1() {
|
||||
return cfgRegionCode1;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
*/
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
@@ -41,10 +38,6 @@ public class AppDomainCfg extends BaseCfg<AppDomainCfg> {
|
||||
private String cfgKeywords;
|
||||
@ExcelField(title="social_app",sort=2)
|
||||
private String appName;
|
||||
|
||||
private AppFeatureProperties appFeaturePropCfg;
|
||||
private List<AppFeatureProperties> appFeaturePropCfgList = new ArrayList();
|
||||
|
||||
/**
|
||||
* 表达式类型
|
||||
*/
|
||||
@@ -78,22 +71,6 @@ public class AppDomainCfg extends BaseCfg<AppDomainCfg> {
|
||||
|
||||
|
||||
|
||||
public AppFeatureProperties getAppFeaturePropCfg() {
|
||||
return appFeaturePropCfg;
|
||||
}
|
||||
|
||||
public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) {
|
||||
this.appFeaturePropCfg = appFeaturePropCfg;
|
||||
}
|
||||
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfgList() {
|
||||
return appFeaturePropCfgList;
|
||||
}
|
||||
|
||||
public void setAppFeaturePropCfgList(List<AppFeatureProperties> appFeaturePropCfgList) {
|
||||
this.appFeaturePropCfgList = appFeaturePropCfgList;
|
||||
}
|
||||
|
||||
public Integer getIsHex() {
|
||||
return isHex;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ package com.nis.domain.configuration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
|
||||
@@ -36,12 +37,8 @@ public class AppFeatureIndex extends BaseCfg<AppFeatureIndex> {
|
||||
private AppByteCfg strCfg;
|
||||
private AppIpCfg ipCfg;
|
||||
private List<AppIpCfg> ipPortList = new ArrayList();
|
||||
private AppFeatureProperties appFeaturePropCfg;
|
||||
private List<AppFeatureProperties> appFeaturePropCfgList = new ArrayList();
|
||||
|
||||
private List<AppStringFeatureCfg> strList = new ArrayList();
|
||||
private List<AppComplexFeatureCfg> complexList = new ArrayList();
|
||||
private List<AppComplexFeatureCfg> sessionList = new ArrayList();
|
||||
private List<AppTcpCfg> numCfgList = new ArrayList();
|
||||
protected Integer exprType ;
|
||||
protected Integer matchMethod ;
|
||||
@@ -197,23 +194,4 @@ public class AppFeatureIndex extends BaseCfg<AppFeatureIndex> {
|
||||
this.relationTime = relationTime;
|
||||
}
|
||||
|
||||
public List<AppComplexFeatureCfg> getSessionList() {
|
||||
return sessionList;
|
||||
}
|
||||
public void setSessionList(List<AppComplexFeatureCfg> sessionList) {
|
||||
this.sessionList = sessionList;
|
||||
}
|
||||
|
||||
public AppFeatureProperties getAppFeaturePropCfg() {
|
||||
return appFeaturePropCfg;
|
||||
}
|
||||
public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) {
|
||||
this.appFeaturePropCfg = appFeaturePropCfg;
|
||||
}
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfgList() {
|
||||
return appFeaturePropCfgList;
|
||||
}
|
||||
public void setAppFeaturePropCfgList(List<AppFeatureProperties> appFeaturePropCfgList) {
|
||||
this.appFeaturePropCfgList = appFeaturePropCfgList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName:AppCorrelationIpCfg
|
||||
* @Description:TODO(这里用一句话描述这个类的作用)
|
||||
* @author zdx
|
||||
* @date 2019年1月28日 下午6:09:24
|
||||
* @version V1.0
|
||||
*/
|
||||
public class AppFeatureProperties extends BaseCfg<AppFeatureProperties> {
|
||||
|
||||
private static final long serialVersionUID = -5994798049255256431L;
|
||||
private static final String tableName="app_feature_prop_cfg";
|
||||
@Expose
|
||||
@ExcelField(title="cfg_id",sort=0)
|
||||
private Long cfgId;
|
||||
private Integer compileId;
|
||||
private Integer dropOpt;
|
||||
private Integer loopOpt;
|
||||
private String weakFeature;
|
||||
private String whitelistFeature;
|
||||
private Integer extendScanPktNum;
|
||||
private Integer correlationValidTime;
|
||||
private String correlationBlockAfter;
|
||||
private Integer longStreamLockTime;
|
||||
public Long getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Long cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
public Integer getDropOpt() {
|
||||
return dropOpt;
|
||||
}
|
||||
public void setDropOpt(Integer dropOpt) {
|
||||
this.dropOpt = dropOpt;
|
||||
}
|
||||
public Integer getLoopOpt() {
|
||||
return loopOpt;
|
||||
}
|
||||
public void setLoopOpt(Integer loopOpt) {
|
||||
this.loopOpt = loopOpt;
|
||||
}
|
||||
public String getWeakFeature() {
|
||||
return weakFeature;
|
||||
}
|
||||
public void setWeakFeature(String weakFeature) {
|
||||
this.weakFeature = weakFeature;
|
||||
}
|
||||
public String getWhitelistFeature() {
|
||||
return whitelistFeature;
|
||||
}
|
||||
public void setWhitelistFeature(String whitelistFeature) {
|
||||
this.whitelistFeature = whitelistFeature;
|
||||
}
|
||||
public Integer getExtendScanPktNum() {
|
||||
return extendScanPktNum;
|
||||
}
|
||||
public void setExtendScanPktNum(Integer extendScanPktNum) {
|
||||
this.extendScanPktNum = extendScanPktNum;
|
||||
}
|
||||
public Integer getCorrelationValidTime() {
|
||||
return correlationValidTime;
|
||||
}
|
||||
public void setCorrelationValidTime(Integer correlationValidTime) {
|
||||
this.correlationValidTime = correlationValidTime;
|
||||
}
|
||||
public String getCorrelationBlockAfter() {
|
||||
return correlationBlockAfter;
|
||||
}
|
||||
public void setCorrelationBlockAfter(String correlationBlockAfter) {
|
||||
this.correlationBlockAfter = correlationBlockAfter;
|
||||
}
|
||||
public Integer getLongStreamLockTime() {
|
||||
return longStreamLockTime;
|
||||
}
|
||||
public void setLongStreamLockTime(Integer longStreamLockTime) {
|
||||
this.longStreamLockTime = longStreamLockTime;
|
||||
}
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -43,9 +42,6 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
|
||||
protected String srcPort;
|
||||
@ExcelField(title="server_port",sort=5)
|
||||
protected String destPort;
|
||||
private AppFeatureProperties appFeaturePropCfg;
|
||||
private List<AppFeatureProperties> appFeaturePropCfgList = new ArrayList();
|
||||
|
||||
|
||||
/**
|
||||
* 方向
|
||||
@@ -75,18 +71,6 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
|
||||
public Integer getIpType() {
|
||||
return ipType;
|
||||
}
|
||||
public AppFeatureProperties getAppFeaturePropCfg() {
|
||||
return appFeaturePropCfg;
|
||||
}
|
||||
public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) {
|
||||
this.appFeaturePropCfg = appFeaturePropCfg;
|
||||
}
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfgList() {
|
||||
return appFeaturePropCfgList;
|
||||
}
|
||||
public void setAppFeaturePropCfgList(List<AppFeatureProperties> appFeaturePropCfgList) {
|
||||
this.appFeaturePropCfgList = appFeaturePropCfgList;
|
||||
}
|
||||
/**
|
||||
* @param ipType the ipType to set
|
||||
*/
|
||||
|
||||
@@ -39,6 +39,8 @@ public class AsnKeywordCfg extends BaseStringCfg<AsnKeywordCfg>{
|
||||
this.matchMethod=3;
|
||||
this.isHexbin=0;
|
||||
}
|
||||
@ExcelField(title="organization",sort=3)
|
||||
protected String userRegion4;
|
||||
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
|
||||
@@ -287,20 +287,7 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
protected Integer regionId;//仅用于copy属性使用
|
||||
protected Integer numberRegionGroupId;//仅用于copy属性使用
|
||||
protected Integer numberRegionRegionId;//仅用于copy属性使用
|
||||
private Integer groupType; //url组以及dns组相关功能使用
|
||||
private Integer udFlag; //url组以及dns组相关功能使用 过滤数据库数据标记
|
||||
public Integer getGroupType() {
|
||||
return groupType;
|
||||
}
|
||||
public void setGroupType(Integer groupType) {
|
||||
this.groupType = groupType;
|
||||
}
|
||||
public Integer getUdFlag() {
|
||||
return udFlag;
|
||||
}
|
||||
public void setUdFlag(Integer udFlag) {
|
||||
this.udFlag = udFlag;
|
||||
}
|
||||
|
||||
public Integer getNumberRegionGroupId() {
|
||||
return numberRegionGroupId;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.google.gson.annotations.Expose;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.basics.UrlCommGroupCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
@@ -89,9 +88,8 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
private List<AsnKeywordCfg> asnKeywords;
|
||||
@ExcelField(title="log_total",sort=42)
|
||||
private Long totalLogs;
|
||||
|
||||
private UrlCommGroupCfg urlCommGroupCfg;
|
||||
private List<UrlCommGroupCfg> urlCommGroupList;
|
||||
|
||||
|
||||
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
|
||||
|
||||
public static class CachePolicyUserRegion{
|
||||
@@ -413,16 +411,4 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
public void setTotalLogs(Long totalLogs) {
|
||||
this.totalLogs = totalLogs;
|
||||
}
|
||||
public List<UrlCommGroupCfg> getUrlCommGroupList() {
|
||||
return urlCommGroupList;
|
||||
}
|
||||
public void setUrlCommGroupList(List<UrlCommGroupCfg> urlCommGroupList) {
|
||||
this.urlCommGroupList = urlCommGroupList;
|
||||
}
|
||||
public UrlCommGroupCfg getUrlCommGroupCfg() {
|
||||
return urlCommGroupCfg;
|
||||
}
|
||||
public void setUrlCommGroupCfg(UrlCommGroupCfg urlCommGroupCfg) {
|
||||
this.urlCommGroupCfg = urlCommGroupCfg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
/**
|
||||
*@Title: BaseEnhancedStringConfig.java
|
||||
*@Package com.nis.domain.restful
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年2月5日 下午5:42:52
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.taglibs.standard.functions.Functions;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @ClassName: BaseEnhancedStringConfig.java
|
||||
* @Description: 基础增强字符串类配置
|
||||
* @author (wx)
|
||||
* @date 2018年2月5日 下午5:42:52
|
||||
* @version V1.0
|
||||
*/
|
||||
public class DnsKeywordCfg extends BaseCfg<DnsKeywordCfg>{
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = -1417089397345367232L;
|
||||
private static final String tableName="dns_domain_cfg";
|
||||
/**
|
||||
* 匹配区域
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="district",sort=301)
|
||||
@SerializedName("district")
|
||||
protected String district ;
|
||||
protected String districtShowName;
|
||||
|
||||
protected String dnsGroupName;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("keywords")
|
||||
@ExcelField(title="key_word",sort=302)
|
||||
protected String cfgKeywords;
|
||||
protected String keywordsShowName;
|
||||
/**
|
||||
* 表达式类型
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("exprType")
|
||||
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=303)
|
||||
protected Integer exprType ;
|
||||
/**
|
||||
* 匹配方式
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=304)
|
||||
@SerializedName("matchMethod")
|
||||
protected Integer matchMethod ;
|
||||
|
||||
/**
|
||||
* 是否hex
|
||||
*/
|
||||
@ExcelField(title="is_hex",sort=305)
|
||||
protected Integer isHex;
|
||||
/**
|
||||
* 是否hex
|
||||
*/
|
||||
@ExcelField(title="is_case_insenstive",sort=306)
|
||||
protected Integer isCaseInsenstive;
|
||||
|
||||
/**
|
||||
* 是否hex二进制
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("isHexbin")
|
||||
protected Integer isHexbin ;
|
||||
/**
|
||||
* district
|
||||
* @return district
|
||||
*/
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
/**
|
||||
* copy属性使用
|
||||
*/
|
||||
protected Long dnsStrategyId;
|
||||
protected Integer appCode;//仅用于copy属性使用
|
||||
protected Integer behavCode;//仅用于copy属性使用
|
||||
protected Integer specServiceId;//仅用于copy属性使用
|
||||
|
||||
public Integer getAppCode() {
|
||||
return appCode;
|
||||
}
|
||||
public void setAppCode(Integer appCode) {
|
||||
this.appCode = appCode;
|
||||
}
|
||||
public Integer getBehavCode() {
|
||||
return behavCode;
|
||||
}
|
||||
public void setBehavCode(Integer behavCode) {
|
||||
this.behavCode = behavCode;
|
||||
}
|
||||
public Integer getSpecServiceId() {
|
||||
return specServiceId;
|
||||
}
|
||||
public void setSpecServiceId(Integer specServiceId) {
|
||||
this.specServiceId = specServiceId;
|
||||
}
|
||||
public Long getDnsStrategyId() {
|
||||
return dnsStrategyId;
|
||||
}
|
||||
public void setDnsStrategyId(Long dnsStrategyId) {
|
||||
this.dnsStrategyId = dnsStrategyId;
|
||||
}
|
||||
/**
|
||||
* @param district the district to set
|
||||
*/
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
public String getCfgKeywords() {
|
||||
// cfgKeywords = StringEscapeUtils.unescapeHtml4(cfgKeywords);
|
||||
return cfgKeywords;
|
||||
}
|
||||
public void setCfgKeywords(String cfgKeywords) {
|
||||
this.cfgKeywords = cfgKeywords;
|
||||
}
|
||||
public String getDistrictShowName() {
|
||||
return districtShowName;
|
||||
}
|
||||
public void setDistrictShowName(String districtShowName) {
|
||||
this.districtShowName = districtShowName;
|
||||
}
|
||||
/**
|
||||
* exprType
|
||||
* 继承此类的类会覆盖该方法写自己的缺省值
|
||||
* @return exprType
|
||||
*/
|
||||
|
||||
public Integer getExprType() {
|
||||
return this.exprType;
|
||||
}
|
||||
/**
|
||||
* @param exprType the exprType to set
|
||||
*/
|
||||
public void setExprType(Integer exprType) {
|
||||
this.exprType = exprType;
|
||||
}
|
||||
/**
|
||||
* matchMethod
|
||||
* 继承此类的类会覆盖该方法写自己的缺省值
|
||||
* @return matchMethod
|
||||
*/
|
||||
|
||||
public Integer getMatchMethod() {
|
||||
return this.matchMethod;
|
||||
}
|
||||
/**
|
||||
* @param matchMethod the matchMethod to set
|
||||
*/
|
||||
public void setMatchMethod(Integer matchMethod) {
|
||||
this.matchMethod = matchMethod;
|
||||
}
|
||||
/**
|
||||
* isHexbin
|
||||
* @return isHexbin
|
||||
*/
|
||||
|
||||
public Integer getIsHexbin() {
|
||||
return isHexbin;
|
||||
}
|
||||
/**
|
||||
* @param isHexbin the isHexbin to set
|
||||
*/
|
||||
public void setIsHexbin(Integer isHexbin) {
|
||||
this.isHexbin = isHexbin;
|
||||
}
|
||||
public Integer getIsHex() {
|
||||
return isHex;
|
||||
}
|
||||
public void setIsHex(Integer isHex) {
|
||||
this.isHex =isHex;
|
||||
}
|
||||
public Integer getIsCaseInsenstive() {
|
||||
return isCaseInsenstive;
|
||||
}
|
||||
public void setIsCaseInsenstive(Integer isCaseInsenstive) {
|
||||
this.isCaseInsenstive =isCaseInsenstive;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.nis.domain.configuration.BaseCfg#initDefaultValue()
|
||||
*/
|
||||
@Override
|
||||
public void initDefaultValue() {
|
||||
// TODO Auto-generated method stub
|
||||
super.initDefaultValue();
|
||||
this.exprType=0;
|
||||
this.isHexbin = 0 ;
|
||||
this.matchMethod=3;
|
||||
}
|
||||
|
||||
public static List<DnsKeywordCfg> replaceComplexKeyList(List<DnsKeywordCfg> list){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DnsKeywordCfg base=(DnsKeywordCfg)list.get(i);
|
||||
base.setIsHex(base.getIsHexbin());
|
||||
// '默认为0:大小写不敏感,且非HEX;1:HEX格式二进制;2:大小写敏感,且非HEX',
|
||||
if(base.getIsHexbin()==2){
|
||||
base.setIsCaseInsenstive(1);
|
||||
}else{
|
||||
base.setIsCaseInsenstive(0);
|
||||
}
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public Integer getIndex() {
|
||||
return index;
|
||||
}
|
||||
public void setIndex(Integer index) {
|
||||
this.index = index;
|
||||
}
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
public void setDnsGroupName(String dnsGroupName) {
|
||||
this.dnsGroupName = dnsGroupName;
|
||||
}
|
||||
public String getDnsGroupName() {
|
||||
return dnsGroupName;
|
||||
}
|
||||
}
|
||||
34
src/main/java/com/nis/domain/configuration/HelpInfo.java
Normal file
34
src/main/java/com/nis/domain/configuration/HelpInfo.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class HelpInfo extends BaseEntity<HelpInfo>{
|
||||
|
||||
private static final long serialVersionUID = 2451757008384840494L;
|
||||
private String fileName;
|
||||
private String fileComment;
|
||||
private String backFileComment;
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
public String getFileComment() {
|
||||
return fileComment;
|
||||
}
|
||||
public void setFileComment(String fileComment) {
|
||||
this.fileComment = fileComment;
|
||||
}
|
||||
public String getBackFileComment() {
|
||||
return backFileComment;
|
||||
}
|
||||
public void setBackFileComment(String backFileComment) {
|
||||
this.backFileComment = backFileComment;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public class AsnIpTemplate extends BasicTemplate{
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
/*private String cfgDesc;*/
|
||||
private String cfgDesc;
|
||||
private String userRegion1;
|
||||
private String destIpAddress;
|
||||
private String organization;
|
||||
@@ -21,12 +21,12 @@ public class AsnIpTemplate extends BasicTemplate{
|
||||
private String detail;
|
||||
|
||||
// @ExcelField(title="config_describe",align=2,sort=1)
|
||||
/*public String getCfgDesc() {
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}*/
|
||||
}
|
||||
@ExcelField(title="asn_no",align=2,sort=11)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
@@ -42,14 +42,14 @@ public class AsnIpTemplate extends BasicTemplate{
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
@ExcelField(title="organization",align=2,sort=1)
|
||||
@ExcelField(title="asn_name",align=2,sort=1)
|
||||
public String getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
public void setOrganization(String organization) {
|
||||
this.organization = organization;
|
||||
}
|
||||
@ExcelField(title="country",align=2,sort=14)
|
||||
@ExcelField(title="country_code",align=2,sort=14)
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListComplexStringTemplate extends ComplexStringAllTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=3)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListIPTemplate extends IpAllTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=3)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListP2pHashStringTemplate extends P2pHashStringTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=4)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListP2pIpTemplate extends P2pIpTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=4)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListStringTemplate extends StringAllTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=3)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class DnsStringTemplate extends StringAllTemplate {
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
private Integer dnsStrategyId;
|
||||
|
||||
@ExcelField(title="policy_name",align=2,sort=3)
|
||||
public Integer getDnsStrategyId() {
|
||||
return dnsStrategyId;
|
||||
}
|
||||
public void setDnsStrategyId(Integer dnsStrategyId) {
|
||||
this.dnsStrategyId = dnsStrategyId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.nis.util.excel.ExcelField;
|
||||
public class P2pHashStringTemplate extends StringAllTemplate {
|
||||
private String userRegion1;
|
||||
|
||||
@ExcelField(title="p2p_hash_type",dictType="P2P_HASH_TYPE",align=2,sort=2)
|
||||
@ExcelField(title="p2p_hash_type",dictType="P2P_HASH_TYPE",align=2,sort=3)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public class P2pIpTemplate extends IpAllTemplate {
|
||||
|
||||
private String userRegion2;
|
||||
|
||||
@ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=2)
|
||||
@ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @Description: excel导入url分组 配置
|
||||
*/
|
||||
public class UrlCommGroupTemplate extends BasicTemplate{
|
||||
|
||||
private String cfgDesc;
|
||||
private String cfgKeywords;
|
||||
private String matchMethod;
|
||||
|
||||
|
||||
@ExcelField(title="config_describe",align=2,sort=1)
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}
|
||||
@ExcelField(title="key_word",align=2,sort=2)
|
||||
public String getCfgKeywords() {
|
||||
return cfgKeywords;
|
||||
}
|
||||
public void setCfgKeywords(String cfgKeywords) {
|
||||
this.cfgKeywords = cfgKeywords;
|
||||
}
|
||||
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=3)
|
||||
public String getMatchMethod() {
|
||||
return matchMethod;
|
||||
}
|
||||
public void setMatchMethod(String matchMethod) {
|
||||
this.matchMethod = matchMethod;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class GroupReuseAddBean implements Serializable{
|
||||
@Expose
|
||||
private Integer opAction;
|
||||
@Expose
|
||||
@SerializedName("commonGroupList")
|
||||
@SerializedName("groupReuseList")
|
||||
private List<GroupReuseCfg> groupReuseCfgList;
|
||||
|
||||
public String getVersion() {
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
*
|
||||
*/
|
||||
public class GroupReuseCfg implements Serializable {
|
||||
/*@Expose
|
||||
@Expose
|
||||
@SerializedName("service")
|
||||
private Integer serviceId;
|
||||
public Integer getServiceId() {
|
||||
@@ -23,7 +23,7 @@ public class GroupReuseCfg implements Serializable {
|
||||
public void setServiceId(Integer serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
*/ /**
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1830956100866313836L;
|
||||
|
||||
@@ -95,8 +95,6 @@ public class MaatCfg implements Serializable {
|
||||
@Expose
|
||||
@SerializedName("ipClientRangeList")
|
||||
private List<IpCfg> areaIpRegionList;
|
||||
@Expose
|
||||
private List<GroupCfg> keepGroupList;
|
||||
|
||||
public static class GroupCfg{
|
||||
@Expose
|
||||
@@ -106,8 +104,6 @@ public class MaatCfg implements Serializable {
|
||||
@Expose
|
||||
private Integer isValid;
|
||||
@Expose
|
||||
private Integer isCommonGroup;
|
||||
@Expose
|
||||
@SerializedName("opTime")
|
||||
private Date auditTime;
|
||||
public Integer getGroupId() {
|
||||
@@ -134,12 +130,7 @@ public class MaatCfg implements Serializable {
|
||||
public void setAuditTime(Date auditTime) {
|
||||
this.auditTime = auditTime;
|
||||
}
|
||||
public Integer getIsCommonGroup() {
|
||||
return isCommonGroup;
|
||||
}
|
||||
public void setIsCommonGroup(Integer isCommonGroup) {
|
||||
this.isCommonGroup = isCommonGroup;
|
||||
}
|
||||
|
||||
}
|
||||
public static class StringCfg{
|
||||
@Expose
|
||||
@@ -688,13 +679,6 @@ public class MaatCfg implements Serializable {
|
||||
public void setRequestId(Integer requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public List<GroupCfg> getKeepGroupList() {
|
||||
return keepGroupList;
|
||||
}
|
||||
public void setKeepGroupList(List<GroupCfg> keepGroupList) {
|
||||
this.keepGroupList = keepGroupList;
|
||||
}
|
||||
public void initDefaultValue() {
|
||||
this.doLog=Constants.MAAT_CFG_DOLOG_DEFAULT;
|
||||
// this.doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
|
||||
|
||||
@@ -23,21 +23,6 @@ public class ConfigGroupInfo implements Serializable{
|
||||
@ExcelField(title="cfg_id",sort=301)
|
||||
private Integer compileId;
|
||||
private Long asnId;
|
||||
private Integer isAuditAll; //是否有策略选择了此公共组下发所有;
|
||||
private Integer isUsed; //是否有策略选择了此公共组;
|
||||
|
||||
public Integer getIsUsed() {
|
||||
return isUsed;
|
||||
}
|
||||
public void setIsUsed(Integer isUsed) {
|
||||
this.isUsed = isUsed;
|
||||
}
|
||||
public Integer getIsAuditAll() {
|
||||
return isAuditAll;
|
||||
}
|
||||
public void setIsAuditAll(Integer isAuditAll) {
|
||||
this.isAuditAll = isAuditAll;
|
||||
}
|
||||
|
||||
public Long getAsnId() {
|
||||
return asnId;
|
||||
|
||||
@@ -69,6 +69,8 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{
|
||||
static {
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.SchedulerDao.updateCfgTableStatus");
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.basics.ServiceDictInfoDao");
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.configuration.PxyObjKeyringDao.updatePxyObjTrustedCaCrl");
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.configuration.CommonPolicyDao.auditCfgBatch");
|
||||
}
|
||||
/**
|
||||
* is_valid 字段名
|
||||
|
||||
@@ -191,6 +191,9 @@ public class ScheduleCfgJob implements Job {
|
||||
String mode = cfg.getUserRegion1().toUpperCase();//定时任务运行模式:一次,每天,每周,每月
|
||||
List<Trigger> triList = null;
|
||||
switch (mode) {
|
||||
case "ALWAYS"://单次运行,但只创建单次生效触发器
|
||||
triList = createSimpleTrigger(cfg);
|
||||
break;
|
||||
case "SINGLE"://单次运行
|
||||
triList = createSimpleTrigger(cfg);
|
||||
break;
|
||||
@@ -254,32 +257,42 @@ public class ScheduleCfgJob implements Job {
|
||||
Integer compileId = cfg.getCompileId();
|
||||
String cronValid = cfg.getCronValid();
|
||||
String cronInvalid = cfg.getCronInvalid();
|
||||
Date validDate = DateUtil.convertStringToDate(cronValid, Constants.COMMON_DATE_FORMAT);
|
||||
Date invalidDate = DateUtil.convertStringToDate(cronInvalid, Constants.COMMON_DATE_FORMAT);
|
||||
Date validDate = null;
|
||||
Date invalidDate = null;
|
||||
if(StringUtils.isNotBlank(cronValid)){
|
||||
validDate = DateUtil.convertStringToDate(cronValid, Constants.COMMON_DATE_FORMAT);
|
||||
}
|
||||
if(StringUtils.isNotBlank(cronInvalid)){
|
||||
invalidDate = DateUtil.convertStringToDate(cronInvalid, Constants.COMMON_DATE_FORMAT);
|
||||
}
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", true);
|
||||
dataMap.put("cfg", cfg);
|
||||
String triName = VALID_KEY + cfg.getUserRegion1() + "_" + cronValid;
|
||||
Trigger trigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(SimpleScheduleBuilder.simpleSchedule())
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(validDate)
|
||||
.build();
|
||||
triList.add(trigger);
|
||||
dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", false);
|
||||
dataMap.put("cfg", cfg);
|
||||
triName = INVALID_KEY + cfg.getUserRegion1() + "_" + cronInvalid;
|
||||
trigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(SimpleScheduleBuilder.simpleSchedule())
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(invalidDate)
|
||||
.build();
|
||||
triList.add(trigger);
|
||||
if(validDate!=null){//生效时间如果不为空,则创建定时生效触发器
|
||||
dataMap.put("isValid", true);
|
||||
dataMap.put("cfg", cfg);
|
||||
String triName = VALID_KEY + cfg.getUserRegion1() + "_" + cronValid;
|
||||
Trigger trigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(SimpleScheduleBuilder.simpleSchedule())
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(validDate)
|
||||
.build();
|
||||
triList.add(trigger);
|
||||
}
|
||||
if(invalidDate!=null){//失效时间如果不为空,则创建定时失效触发器
|
||||
dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", false);
|
||||
dataMap.put("cfg", cfg);
|
||||
String triName = INVALID_KEY + cfg.getUserRegion1() + "_" + cronInvalid;
|
||||
Trigger trigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(SimpleScheduleBuilder.simpleSchedule())
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(invalidDate)
|
||||
.build();
|
||||
triList.add(trigger);
|
||||
}
|
||||
return triList;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ public class ConfigConvertUtil {
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
cfg.setGroupId(asnIpCfg.getAsnIpGroup());
|
||||
cfg.setRegionId(asnIpCfg.getRegionId());
|
||||
String userRegion = "ASN_ID=" + asnIpCfg.getUserRegion1();
|
||||
String userRegion = "ASN_ID=AS" + asnIpCfg.getUserRegion1();
|
||||
cfg.setUserRegion(userRegion);
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setAuditTime(opTime);
|
||||
|
||||
@@ -212,7 +212,7 @@ public class ConfigDictUtils {
|
||||
* @param compileId
|
||||
* @return
|
||||
*/
|
||||
public static List<Integer> getASNIPNum(Long groupId ) {
|
||||
public static List<Integer> getASNIPNum(Integer groupId ) {
|
||||
List<Integer> ipNum=new ArrayList<>();
|
||||
try {
|
||||
if(!StringUtil.isEmpty(groupId)){
|
||||
@@ -234,8 +234,7 @@ public class ConfigDictUtils {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(ipNum.size() ==0){
|
||||
if(ipNum ==null || ipNum.size()==0){
|
||||
ipNum.add(0, 0);
|
||||
ipNum.add(1, 0);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public class ConfigServiceUtil {
|
||||
}else if(type==2){
|
||||
url = url+Constants.CALLBACK_CFG;
|
||||
}else if(type==3) {
|
||||
url = url+Constants.DELETE_COMMON_REIGON;
|
||||
url = url+Constants.GROUP_REUSE_SOURCES;
|
||||
}
|
||||
//创建连接
|
||||
WebTarget wt = ClientUtil.getWebTarger(url);
|
||||
@@ -400,9 +400,9 @@ public class ConfigServiceUtil {
|
||||
url = url+Constants.MAAT_CFG;
|
||||
}else if(type==2){
|
||||
url = url+Constants.CALLBACK_CFG;
|
||||
}/*else if(type==3) {
|
||||
}else if(type==3) {
|
||||
url = url+Constants.GROUP_REUSE_SOURCES;
|
||||
}*/
|
||||
}
|
||||
logger.info("put url:"+url);
|
||||
//创建连接
|
||||
try {
|
||||
@@ -451,6 +451,7 @@ public class ConfigServiceUtil {
|
||||
JSONObject resObject = JSONObject.fromObject(result);
|
||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||
}else{
|
||||
logger.info("获取文件摘要响应结果"+result);
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -463,43 +464,26 @@ public class ConfigServiceUtil {
|
||||
return bean;
|
||||
}
|
||||
/**
|
||||
* 分组复用域配置新增,修改,删除
|
||||
* 分组复用域配置新增
|
||||
* @param params
|
||||
* @return
|
||||
* @throws MaatConvertException
|
||||
*/
|
||||
public static ToMaatResult auditCommonGroupRegionSources(String params,Integer action) throws MaatConvertException{
|
||||
public static ToMaatResult postGroupReuseSources(String params) throws MaatConvertException{
|
||||
ToMaatResult bean = null;
|
||||
Response response=null;
|
||||
try {
|
||||
logger.warn("postGroupReuseSources start");
|
||||
long start=System.currentTimeMillis();
|
||||
String result = null;
|
||||
String url = "";
|
||||
if(action.equals(Constants.OPACTION_POST)){
|
||||
url=Constants.SERVICE_URL+Constants.ADD_COMMON_REGION;
|
||||
}
|
||||
if(action.equals(Constants.OPACTION_PUT)){
|
||||
url=Constants.SERVICE_URL+Constants.UPDATE_COMMON_REIGON;
|
||||
}
|
||||
if(action.equals(Constants.OPACTION_DELETE)){
|
||||
url=Constants.SERVICE_URL+Constants.DELETE_COMMON_REIGON;
|
||||
}
|
||||
String url = Constants.SERVICE_URL+Constants.GROUP_REUSE_SOURCES;
|
||||
//创建连接
|
||||
WebTarget wt = ClientUtil.getWebTarger(url);
|
||||
logger.info("auditCommonGroupRegionSources url:"+url);
|
||||
logger.info("postGroupReuseSources url:"+url);
|
||||
//获取响应结果
|
||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
||||
try {
|
||||
if(action.equals(Constants.OPACTION_POST)){
|
||||
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||
}
|
||||
if(action.equals(Constants.OPACTION_PUT)){
|
||||
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||
}
|
||||
if(action.equals(Constants.OPACTION_DELETE)){
|
||||
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||
}
|
||||
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||
if(response != null) {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
@@ -515,7 +499,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("auditCommonGroupRegionSources end,cost:"+(end-start));
|
||||
logger.warn("postGroupReuseSources end,cost:"+(end-start));
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
@@ -525,7 +509,6 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* getReport(配置日志总量统计查询)
|
||||
@@ -745,14 +728,20 @@ public class ConfigServiceUtil {
|
||||
logger.info("cgi info:"+result);
|
||||
}else{
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map = (Map<String, String>) JSON.parse(result);
|
||||
String error = map.get("error");
|
||||
if (!StringUtil.isEmpty(error)) {
|
||||
error=cgiError(error);
|
||||
throw new MaatConvertException(error);
|
||||
result= response.readEntity(String.class);
|
||||
if(!StringUtil.isEmpty(result)){
|
||||
map = (Map<String, String>) JSON.parse(result);
|
||||
String error = map.get("error");
|
||||
if (!StringUtil.isEmpty(error)) {
|
||||
error=cgiError(error);
|
||||
throw new MaatConvertException(error);
|
||||
}else{
|
||||
throw new MaatConvertException(null);
|
||||
}
|
||||
}else{
|
||||
throw new MaatConvertException(null);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
@@ -811,10 +800,11 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
}
|
||||
|
||||
bean = JSONObject.fromObject(result);
|
||||
if(response != null && response.getStatus() == 200){
|
||||
logger.info("get result success");
|
||||
bean = JSONObject.fromObject(result);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
@@ -856,6 +846,7 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
if(response != null && response.getStatus() == 200){
|
||||
logger.info("get result success");
|
||||
//result="{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}";
|
||||
bean= JSONObject.fromObject(result);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
|
||||
@@ -13,10 +13,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 Object IMPORT_ASN_LOCK=new Object();
|
||||
public static final String ADD_COMMON_REGION=Configurations.getStringProperty("addRegionToCommonGroup","");
|
||||
public static final String UPDATE_COMMON_REIGON=Configurations.getStringProperty("updateRegionToCommonGroup","");
|
||||
public static final String DELETE_COMMON_REIGON=Configurations.getStringProperty("deleteRegionToCommonGroup","");
|
||||
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);
|
||||
public static String APP_CFG_USERREGION_SPLITOR=Configurations.getStringProperty("app_cfg_userregion_splitor", "&");
|
||||
@@ -497,9 +494,6 @@ public final class Constants {
|
||||
public static final String HTTP_URL_REGION = Configurations.getStringProperty("http_url_region","http_url");
|
||||
public static final String VOIP_IP_REGION = Configurations.getStringProperty("voip_ip","av_voip_ip");
|
||||
public static final String VOIP_ACCOUNT_REGION = Configurations.getStringProperty("voip_account","av_voip_account");
|
||||
public static final String NTC_ASN_NUMBER = Configurations.getStringProperty("ntc_asn_number","NTC_ASN_NUMBER");
|
||||
public static final String ASN_KEY = Configurations.getStringProperty("asn_key","AS");
|
||||
public static final String ASN_REGION_KEY = Configurations.getStringProperty("asn_region_key","ASN_ID");
|
||||
public static final String MAAT_VERSION = Configurations.getStringProperty("maat_version","1.0");
|
||||
public static final Integer INSERT_ACTION = Configurations.getIntProperty("insert_action",1);
|
||||
public static final Integer UPDATE_ACTION = Configurations.getIntProperty("update_action",2);
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.Node;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -246,6 +247,24 @@ public class DictUtils {
|
||||
|
||||
return allDictList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能业务字典,获取相应功能菜单对应的业务信息
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
public static List<FunctionServiceDict> getAllServiceList(){
|
||||
List<FunctionServiceDict> serviceList = new ArrayList();
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
List<Node> serviceNodeList= serviceTemplate.getServiceNodeList();
|
||||
for (Node node : serviceNodeList) {
|
||||
FunctionServiceDict service=new FunctionServiceDict();
|
||||
service.setServiceId(Integer.valueOf(node.valueOf("@id")));
|
||||
service.setServiceName(node.valueOf("@desc"));
|
||||
serviceList.add(service);
|
||||
}
|
||||
return serviceList;
|
||||
}
|
||||
/**
|
||||
* 功能配置域字典,获取相应功能菜单对应的配置域信息
|
||||
* @param functionId
|
||||
|
||||
@@ -536,6 +536,29 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
//doBlackList
|
||||
if("doBlacklist".equals(headerStr)) {
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
commentStr=commentStr+itemCode+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue = String.valueOf(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
if(!StringUtil.isEmpty(defaultValue)){
|
||||
//1、默认值说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/** Ip Spoofing **/
|
||||
if("spoofing".equals(headerStr) && (region.getFunctionId().equals(214))){
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
@@ -427,13 +429,17 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
||||
}
|
||||
// Get excel data
|
||||
BlockingQueue<E> _dataList =new ArrayBlockingQueue(dataList.size(),true);
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
E e = (E)cls.newInstance();
|
||||
if(i<=headerNum) {
|
||||
Map<String, Map<String, Object>> dictMap = new HashMap<String,Map<String, Object>>();
|
||||
Object val1 = null;
|
||||
for (int i = 0, len = dataList.size(); i < len; i++) {
|
||||
List<Object> row=dataList.get(i);
|
||||
//boolean flag = row.stream().allMatch(obj -> "".equals(obj));
|
||||
if(i <= headerNum || row.size() == 0) {// 跳过第一行和空行
|
||||
continue;
|
||||
}
|
||||
|
||||
E e = (E)cls.newInstance();
|
||||
int column = 0;
|
||||
List<Object> row=dataList.get(i);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Object[] os : annotationList){
|
||||
Object val=row.get(column);
|
||||
@@ -442,7 +448,23 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
||||
ExcelField ef = (ExcelField)os[0];
|
||||
// If is dict type, get dict value
|
||||
if (StringUtils.isNotBlank(ef.dictType())){
|
||||
Object val1 = DictUtils.getDictCode(ef.dictType(), val.toString(), "");
|
||||
// 缓存当前excel文件获取过的字典值
|
||||
if(!dictMap.containsKey(ef.dictType())) {
|
||||
val1 = DictUtils.getDictCode(ef.dictType(), val.toString(), "");
|
||||
Map<String, Object> putMap = new HashMap<String,Object>();
|
||||
putMap.put(val.toString(), val1);
|
||||
dictMap.put(ef.dictType(), putMap);
|
||||
}else {
|
||||
Map<String, Object> map = dictMap.get(ef.dictType());
|
||||
if(!map.containsKey(val.toString())) {
|
||||
val1 = DictUtils.getDictCode(ef.dictType(), val.toString(), "");
|
||||
map.put(val.toString(), val1);
|
||||
dictMap.put(ef.dictType(), map);
|
||||
}else {
|
||||
val1 = map.get(val.toString());
|
||||
}
|
||||
}
|
||||
|
||||
//没有获取到字典值的话会影响验证判断
|
||||
if(val1!=null&&StringUtils.isNotBlank(val1.toString())) {
|
||||
val=val1;
|
||||
|
||||
@@ -112,7 +112,8 @@ public abstract class XLSXCovertCSVReader {
|
||||
// private String[] record;
|
||||
// private List<String[]> rows = new ArrayList<String[]>();
|
||||
private boolean isCellNull = false;
|
||||
|
||||
|
||||
private int upRowId; // 记录上一行行号
|
||||
/**
|
||||
* Accepts objects needed while parsing.
|
||||
*
|
||||
@@ -203,8 +204,23 @@ public abstract class XLSXCovertCSVReader {
|
||||
if (this.formatString == null)
|
||||
this.formatString = BuiltinFormats
|
||||
.getBuiltinFormat(this.formatIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else if("row".equals(name)) {
|
||||
// 获取行号
|
||||
String r = attributes.getValue("r");
|
||||
int index = Integer.parseInt(r);
|
||||
|
||||
int gap = index - upRowId;
|
||||
if(gap > 1) { // 存在空行
|
||||
while(gap > 1) {
|
||||
optRows(sheetIndex,lastColumnNumber,rowlist);
|
||||
gap--;
|
||||
}
|
||||
|
||||
}
|
||||
upRowId = index;
|
||||
}
|
||||
lastContents = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,8 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseStringCfg,errInfo);
|
||||
|
||||
//doBlackList属性检验
|
||||
this.validDoBlackList(baseStringCfg, errInfo);
|
||||
if (regionDict.getRegionType().equals(3)) {
|
||||
if (regionDict.getFunctionId().equals(7)) {
|
||||
Long dnsStrategyId = baseStringCfg.getDnsStrategyId();
|
||||
@@ -381,45 +382,46 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("is_case_insenstive")) + ";");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isHex.intValue() != 0 && isHex.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.equals("1") && isHex.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 关键字十六进制校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isHex = baseStringCfg.getIsHex();
|
||||
isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
if (isHex.intValue() != 0 && isHex.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.equals("1") && isHex.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 关键字十六进制校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
|
||||
if (isHex != null && isCaseInsenstive != null) {
|
||||
if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) {
|
||||
baseStringCfg.setIsHexbin(0);
|
||||
@@ -465,11 +467,44 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
}
|
||||
Integer doLog = baseStringCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
if(configDoLog.startsWith("0")) {
|
||||
baseStringCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* doBlackList属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoBlackList(ComplexkeywordCfg baseStringCfg, StringBuffer errInfo) {
|
||||
if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(6)||
|
||||
regionDict.getFunctionId().equals(635)||regionDict.getFunctionId().equals(8)
|
||||
)&&serviceDict.getAction().equals(16)
|
||||
) {
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(baseStringCfg.getDoBlackList()==null) {
|
||||
baseStringCfg.setDoBlackList(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
String dobalcklistVals=new String();
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
dobalcklistVals+=itemCode+",";
|
||||
}
|
||||
}
|
||||
Integer doBlackList = baseStringCfg.getDoBlackList();
|
||||
if(!dobalcklistVals.contains(doBlackList+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_blacklist"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.nis.util.excel.thread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -20,13 +19,11 @@ 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.AsnIpCfg;
|
||||
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.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -40,16 +37,8 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// private DnsResStrategyService dnsResStrategyService;
|
||||
private FunctionServiceDict serviceDict;
|
||||
private FunctionRegionDict regionDict;
|
||||
//【0】 新的asn group info
|
||||
//【1】 旧的asn group info
|
||||
//【2】 所有的asn group info
|
||||
//【3】 所有已审核通过的asn group info
|
||||
private List<Map<Long,AsnGroupInfo>> asnNoMaps;
|
||||
private Map<String,List<IpPortCfg>> asnIpMap;
|
||||
//组织之间的关系
|
||||
//【0】 新的组织信息
|
||||
//【1】 旧的组织信息
|
||||
private List<Map<String,ConfigGroupInfo>> asnOrgList;
|
||||
private Map<Long,AsnGroupInfo> asnGroupInfos;
|
||||
// private DnsResStrategyDao dnsResStrategyDao;
|
||||
public CheckIpFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseIpCfg> destQueue) {
|
||||
this.serviceDict=serviceDict;
|
||||
@@ -68,7 +57,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE);
|
||||
if(regionDict.getRegionType().intValue()==1) {
|
||||
try {
|
||||
List<BaseIpCfg> ipcfgs=this.checkIpCfg(msg,asnNoMaps,asnIpMap, dataList);
|
||||
List<BaseIpCfg> ipcfgs=this.checkIpCfg(msg,asnNoMaps, dataList);
|
||||
boolean success=destQueue.addAll(ipcfgs);
|
||||
}catch (Exception e) {
|
||||
logger.error("checkIpCfg error,",e);
|
||||
@@ -87,7 +76,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
|
||||
return msg.toString();
|
||||
}
|
||||
public List<BaseIpCfg> checkIpCfg(StringBuffer msg,List<Map<Long,AsnGroupInfo>> asnNos,Map<String, List<IpPortCfg>> asnIpCfgs, List<Object> list)
|
||||
public List<BaseIpCfg> checkIpCfg(StringBuffer msg,List<Map<Long,AsnGroupInfo>> asnNos, List<Object> list)
|
||||
throws ServiceException {
|
||||
logger.warn("start to validate ip...");
|
||||
long start=System.currentTimeMillis();
|
||||
@@ -140,15 +129,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseIpCfg,errInfo);
|
||||
|
||||
if(regionDict.getFunctionId().equals(200)) {
|
||||
if(!serviceDict.getAction().equals(1)) {
|
||||
baseIpCfg.setDoLog(0);
|
||||
}
|
||||
}
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseIpCfg,errInfo);
|
||||
|
||||
this.validDoBlackList(baseIpCfg, errInfo);
|
||||
// 特殊字段验证
|
||||
// packet ip ratelimit
|
||||
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
||||
@@ -270,7 +251,6 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
}
|
||||
if (regionDict.getFunctionId().equals(600)) {//asn
|
||||
//组织的非空和长度校验
|
||||
String organization=baseIpCfg.getOrganization();
|
||||
if(!StringUtils.isBlank(organization)) {
|
||||
if(organization.length() > 1024){
|
||||
@@ -282,15 +262,14 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
baseIpCfg.setOrganization(organization.trim().toUpperCase());
|
||||
}
|
||||
}
|
||||
//国家的非空和长度校验
|
||||
String country=baseIpCfg.getCountry();
|
||||
|
||||
if(!StringUtils.isBlank(country) && country.length() > 512){
|
||||
errInfo.append(prop.getProperty("country_code")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":512") + ";");
|
||||
}else {
|
||||
baseIpCfg.setCountry(country.trim().toUpperCase());
|
||||
if(!StringUtils.isBlank(country)) {
|
||||
if(country.length() > 512){
|
||||
errInfo.append(prop.getProperty("country_code")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":512") + ";");
|
||||
}else {
|
||||
baseIpCfg.setCountry(country.trim().toUpperCase());
|
||||
}
|
||||
}
|
||||
//详情可以为空
|
||||
String detail=baseIpCfg.getDetail();
|
||||
if(!StringUtils.isBlank(detail)) {
|
||||
if(detail.length() > 1024||detail.length()<4){
|
||||
@@ -299,12 +278,12 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
baseIpCfg.setDetail(detail.trim());
|
||||
}
|
||||
}
|
||||
//asn id 校验
|
||||
//asn id
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();
|
||||
if(StringUtils.isBlank(userRegion1)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("asn_no"))
|
||||
+ ";");
|
||||
+ ";org:"+baseIpCfg.getOrganization()+ ";asn:"+baseIpCfg.getOrganization()+ ";ip:"+baseIpCfg.getDestIpAddress());
|
||||
}else {
|
||||
try {
|
||||
Long asnNo=Long.parseLong(userRegion1);
|
||||
@@ -317,62 +296,51 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
baseIpCfg.setOrganization(asnNo.toString());
|
||||
baseIpCfg.setCfgDesc(asnNo.toString());
|
||||
}
|
||||
// ConfigGroupInfo configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
|
||||
if(asnNos!=null) {
|
||||
//数据库中是否已经存在
|
||||
AsnGroupInfo asnGroupInfo=asnNos.get(1)==null?null:asnNos.get(1).get(asnNo);
|
||||
if(asnGroupInfo==null) {
|
||||
AsnGroupInfo configGroupInfo=asnGroupInfos==null?null:asnGroupInfos.get(asnNo);//从缓存中取
|
||||
//缓存中没有
|
||||
if(configGroupInfo==null) {
|
||||
synchronized (Constants.IMPORT_LOCK) {
|
||||
if(StringUtils.isNotBlank(baseIpCfg.getOrganization())) {
|
||||
AsnGroupInfo groupInfo=new AsnGroupInfo();
|
||||
groupInfo.setOrganization(baseIpCfg.getOrganization().trim().toUpperCase());
|
||||
groupInfo.setCountry(StringUtil.isEmpty(baseIpCfg.getCountry()) ? "":baseIpCfg.getCountry().trim().toUpperCase());
|
||||
groupInfo.setDetail(StringUtil.isEmpty(baseIpCfg.getDetail()) ? "":baseIpCfg.getDetail().trim().toUpperCase());
|
||||
groupInfo.setIsUsed(0);
|
||||
groupInfo.setDetail(StringUtil.isEmpty(baseIpCfg.getDetail()) ? "":baseIpCfg.getDetail().trim());
|
||||
groupInfo.setIsValid(0);
|
||||
groupInfo.setAsnId(asnNo);
|
||||
if(asnNos.get(2).containsKey(asnNo)) {
|
||||
if(!asnNos.get(2).get(asnNo).getOrganization().equalsIgnoreCase(baseIpCfg.getOrganization().trim())) {
|
||||
if(asnNos.get(0).containsKey(asnNo)) {
|
||||
if(!asnNos.get(0).get(asnNo).getOrganization().equals(baseIpCfg.getOrganization().trim().toUpperCase())) {
|
||||
//一个asn号不能被两个组织拥有
|
||||
logger.error("ASN "+asnNo+" Found two Organization "+asnNos.get(2).get(asnNo).getOrganization()+" "+baseIpCfg.getOrganization().trim().toUpperCase());
|
||||
errInfo.append(asnNos.get(2).get(asnNo).getOrganization()+" "+baseIpCfg.getOrganization().trim().toUpperCase()+" "+prop.getProperty("asn_no")+" "+asnNo+" "+prop.getProperty("repeat")
|
||||
logger.error("ASN "+asnNo+" Found two Organization "+asnNos.get(0).get(asnNo).getOrganization()+" "+baseIpCfg.getOrganization().trim().toUpperCase());
|
||||
errInfo.append(asnNos.get(0).get(asnNo).getOrganization()+" "+baseIpCfg.getOrganization().trim().toUpperCase()+" "+prop.getProperty("asn_no")+" "+asnNo+" "+prop.getProperty("repeat")
|
||||
+";");
|
||||
}else {
|
||||
asnNos.get(0).put(asnNo,groupInfo);
|
||||
asnNos.get(2).put(asnNo,groupInfo);
|
||||
if(!asnOrgList.get(0).containsKey(groupInfo.getOrganization()) && !asnOrgList.get(1).containsKey(groupInfo.getOrganization())){
|
||||
ConfigGroupInfo configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(groupInfo.getOrganization());
|
||||
asnOrgList.get(0).put(groupInfo.getOrganization(), configGroupInfo);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
asnNos.get(0).put(asnNo,groupInfo);
|
||||
asnNos.get(2).put(asnNo,groupInfo);
|
||||
if(!asnOrgList.get(0).containsKey(groupInfo.getOrganization()) && !asnOrgList.get(1).containsKey(groupInfo.getOrganization())){
|
||||
ConfigGroupInfo configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(groupInfo.getOrganization());
|
||||
asnOrgList.get(0).put(groupInfo.getOrganization(), configGroupInfo);
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
if(StringUtils.isNotBlank(baseIpCfg.getOrganization())) {
|
||||
logger.error("ASN "+asnNo+" Organization is Null");
|
||||
}
|
||||
if(StringUtils.isNotBlank(baseIpCfg.getCountry())) {
|
||||
logger.error("ASN "+asnNo+" Country is Null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
if(!asnGroupInfo.getOrganization().equalsIgnoreCase(baseIpCfg.getOrganization().trim())) {
|
||||
if(!configGroupInfo.getOrganization().equalsIgnoreCase(baseIpCfg.getOrganization().trim())) {
|
||||
errInfo.append(prop.getProperty("organization","Organization")+" "+prop.getProperty("mismatch","Mismatch"));
|
||||
}
|
||||
|
||||
configGroupInfo.setDetail(baseIpCfg.getDetail());
|
||||
configGroupInfo.setCountry(baseIpCfg.getCountry());
|
||||
if(StringUtils.isBlank(errInfo.toString())) {
|
||||
//已下发过的asn no
|
||||
if(asnGroupInfo.getIsValid() ==1){
|
||||
asnNos.get(3).put(asnNo,asnGroupInfo);
|
||||
}
|
||||
asnNos.get(1).put(asnNo,asnGroupInfo);
|
||||
asnGroupInfo.setOrganization(organization);
|
||||
asnGroupInfo.setCountry(baseIpCfg.getCountry());
|
||||
asnGroupInfo.setDetail(baseIpCfg.getDetail());
|
||||
asnNos.get(2).put(asnNo,asnGroupInfo);
|
||||
asnNos.get(1).put(asnNo,configGroupInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -955,16 +923,6 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
errTip.append(errInfo);
|
||||
errTip.append("<br>");
|
||||
}else {
|
||||
synchronized (Constants.IMPORT_ASN_LOCK) {
|
||||
//asn根据asn号分组存储asn ip信息
|
||||
if(StringUtil.isEmpty(asnIpCfgs.get(baseIpCfg.getUserRegion1()))){
|
||||
List<IpPortCfg> asnIpList=new ArrayList<>();
|
||||
asnIpList.add(baseIpCfg);
|
||||
asnIpCfgs.put(baseIpCfg.getUserRegion1(), asnIpList);
|
||||
}else{
|
||||
asnIpCfgs.get(baseIpCfg.getUserRegion1()).add(baseIpCfg);
|
||||
}
|
||||
}
|
||||
ipList.add(baseIpCfg);
|
||||
}
|
||||
}
|
||||
@@ -1264,14 +1222,45 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
Integer doLog = baseIpCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
if(configDoLog.startsWith("0")) {
|
||||
baseIpCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* doBlackList属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoBlackList(IpPortCfg baseIpCfg, StringBuffer errInfo) {
|
||||
if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(8)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(510))&&serviceDict.getAction().equals(16)) {
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(baseIpCfg.getDoBlackList()==null) {
|
||||
baseIpCfg.setDoBlackList(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
String dobalcklistVals=new String();
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
dobalcklistVals+=itemCode+",";
|
||||
}
|
||||
}
|
||||
Integer doBlackList = baseIpCfg.getDoBlackList();
|
||||
if(!dobalcklistVals.contains(doBlackList+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_blacklist"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 根据位运算把 byte[] -> int
|
||||
*
|
||||
@@ -1412,16 +1401,11 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
public void setAsnNoMaps(List<Map<Long, AsnGroupInfo>> asnNoMaps) {
|
||||
this.asnNoMaps = asnNoMaps;
|
||||
}
|
||||
public List<Map<String, ConfigGroupInfo>> getAsnOrgList() {
|
||||
return asnOrgList;
|
||||
public Map<Long, AsnGroupInfo> getAsnGroupInfos() {
|
||||
return asnGroupInfos;
|
||||
}
|
||||
public void setAsnOrgList(List<Map<String, ConfigGroupInfo>> asnOrgList) {
|
||||
this.asnOrgList = asnOrgList;
|
||||
}
|
||||
public Map<String, List<IpPortCfg>> getAsnIpMap() {
|
||||
return asnIpMap;
|
||||
}
|
||||
public void setAsnIpMap(Map<String, List<IpPortCfg>> asnIpMap) {
|
||||
this.asnIpMap = asnIpMap;
|
||||
public void setAsnGroupInfos(Map<Long, AsnGroupInfo> asnGroupInfos) {
|
||||
this.asnGroupInfos = asnGroupInfos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
|
||||
@@ -111,7 +110,8 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseStringCfg,errInfo);
|
||||
|
||||
// doBlackList校验
|
||||
this.validDoBlackList(baseStringCfg,errInfo);
|
||||
if (regionDict.getRegionType().equals(2)) {
|
||||
if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();
|
||||
@@ -437,49 +437,50 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("is_case_insenstive")) + ";");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isHex.intValue() != 0 && isHex.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.equals("1") && isHex.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 十六进制 关键字校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
String message = prop.getProperty("key_word");
|
||||
if(regionDict.getFunctionId().equals(403) || regionDict.getFunctionId().equals(200)) {
|
||||
message = prop.getProperty("domain_name");
|
||||
}
|
||||
errInfo.append(
|
||||
message + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isHex = baseStringCfg.getIsHex();
|
||||
isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
if (isHex.intValue() != 0 && isHex.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.equals("1") && isHex.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 十六进制 关键字校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
String message = prop.getProperty("key_word");
|
||||
if(regionDict.getFunctionId().equals(403) || regionDict.getFunctionId().equals(200)) {
|
||||
message = prop.getProperty("domain_name");
|
||||
}
|
||||
errInfo.append(
|
||||
message + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
|
||||
if (isHex != null && isCaseInsenstive != null) {
|
||||
if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) {
|
||||
baseStringCfg.setIsHexbin(0);
|
||||
@@ -517,7 +518,6 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoLog(BaseStringCfg baseStringCfg, StringBuffer errInfo) {
|
||||
|
||||
String configDoLog = serviceDict.getConfigDoLog();
|
||||
if(StringUtils.isNotBlank(configDoLog)) {
|
||||
String defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
|
||||
@@ -527,11 +527,45 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
Integer doLog = baseStringCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
if(configDoLog.startsWith("0")) {
|
||||
baseStringCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* doBlackList属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoBlackList(BaseStringCfg baseStringCfg, StringBuffer errInfo) {
|
||||
if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(6)||
|
||||
regionDict.getFunctionId().equals(635)||regionDict.getFunctionId().equals(8)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(510))
|
||||
&&serviceDict.getAction().equals(16)) {
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(baseStringCfg.getDoBlackList()==null) {
|
||||
baseStringCfg.setDoBlackList(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
String dobalcklistVals=new String();
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
dobalcklistVals+=itemCode+",";
|
||||
}
|
||||
}
|
||||
Integer doBlackList = baseStringCfg.getDoBlackList();
|
||||
if(!dobalcklistVals.contains(doBlackList+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_blacklist"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,45 +254,46 @@ public class CheckTopicWebsiteFormatThread implements Callable<String>{
|
||||
prop.getProperty("is_case_insenstive")) + ";");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isHex.intValue() != 0 && isHex.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.equals("1") && isHex.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 十六进制 关键字校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("domain_name") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isHex = baseStringCfg.getIsHex();
|
||||
isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
if (isHex.intValue() != 0 && isHex.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.equals("1") && isHex.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 十六进制 关键字校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("domain_name") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
|
||||
if (isHex != null && isCaseInsenstive != null) {
|
||||
if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) {
|
||||
baseStringCfg.setIsHexbin(0);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
while(!asnNos.isEmpty()) {
|
||||
asnNos.drainTo(asnNoList,5);
|
||||
for(Long asnNo:asnNoList) {
|
||||
AsnGroupInfo configGroupInfo=null;//AsnCacheUtils.get(asnNo);
|
||||
AsnGroupInfo configGroupInfo=AsnCacheUtils.get(asnNo);
|
||||
if(configGroupInfo==null) {
|
||||
configGroupInfo=new AsnGroupInfo();
|
||||
configGroupInfo.setAsnId(asnNo);
|
||||
@@ -85,7 +85,7 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
}
|
||||
sb.deleteCharAt(sb.toString().lastIndexOf(","));
|
||||
asnIpCfgDao.delete(sb.toString());
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(listPage, Constants.VALID_NO,1);
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(listPage, Constants.VALID_NO);
|
||||
transactionManager.commit(status);
|
||||
listPage.clear();
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -112,7 +112,7 @@ public class SaveAsnIpThread implements Callable<Throwable>{
|
||||
_cfg.setAsnIpGroup(asnNoMaps.get(1).get(Long.parseLong(_cfg.getUserRegion1())));
|
||||
}else {
|
||||
// ConfigGroupInfo info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(_cfg.getUserRegion1()));
|
||||
AsnGroupInfo info=null;//AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
AsnGroupInfo info=AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
if(info==null) {
|
||||
info=new AsnGroupInfo();
|
||||
info.setAsnId(Long.parseLong(_cfg.getUserRegion1()));
|
||||
@@ -166,7 +166,7 @@ public class SaveAsnIpThread implements Callable<Throwable>{
|
||||
this.save(cfgs);
|
||||
// splitAndSend(toAddRegionAsnIpCfgs,Constants.VALID_YES);
|
||||
if(toAddRegionAsnIpCfgs.size()>0) {
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES,1);
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES);
|
||||
}
|
||||
cfgs.clear();
|
||||
toAddRegionAsnIpCfgs.clear();
|
||||
|
||||
69
src/main/java/com/nis/util/redis/RedisPoolHelper.java
Normal file
69
src/main/java/com/nis/util/redis/RedisPoolHelper.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.nis.util.redis;
|
||||
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.nis.util.Configurations;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
public class RedisPoolHelper {
|
||||
private Logger logger=Logger.getLogger(RedisPoolHelper.class);
|
||||
private JedisPool jedisPool;
|
||||
private String host;
|
||||
private int timeout;
|
||||
public RedisPoolHelper(){
|
||||
init();
|
||||
}
|
||||
private void init() {
|
||||
synchronized (this) {
|
||||
if (jedisPool == null) {
|
||||
host=Configurations.getStringProperty("redis.host", "127.0.0.1:6379");
|
||||
timeout=Configurations.getIntProperty("redis.timeout", 10000);
|
||||
String[] hostAndPort = host.split(":");
|
||||
jedisPool = new JedisPool(getPoolConfig(), hostAndPort[0], Integer.parseInt(hostAndPort[1]), timeout);
|
||||
logger.info("redis pool init complate! host-->"+hostAndPort[0]+" port:"+Integer.parseInt(hostAndPort[1]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public Jedis getJedis() {
|
||||
if (jedisPool == null) {
|
||||
init();
|
||||
}
|
||||
return jedisPool.getResource();
|
||||
}
|
||||
public JedisPool getJedisPool() {
|
||||
return jedisPool;
|
||||
}
|
||||
|
||||
public void setJedisPool(JedisPool jedisPool) {
|
||||
this.jedisPool = jedisPool;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* getPoolConfig(初始化连接池的配置,这里可以设置很多参数的,不过目前没加)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*GenericObjectPoolConfig
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private GenericObjectPoolConfig getPoolConfig(){
|
||||
GenericObjectPoolConfig config=new GenericObjectPoolConfig();
|
||||
config.setMaxTotal(Configurations.getIntProperty("redis.pool.maxtotal", 500));//整个池的最大值
|
||||
config.setMaxIdle(Configurations.getIntProperty("redis.pool.maxidle", 100));//最大空闲
|
||||
config.setMaxWaitMillis(Configurations.getIntProperty("redis.pool.maxwaitmillis", -1));//获取不到永远等待
|
||||
config.setBlockWhenExhausted(Configurations.getBooleanProperty("redis.pool.blockwhenexhausted", true));
|
||||
config.setNumTestsPerEvictionRun(Configurations.getIntProperty("redis.pool.numtestsperevictionrun", Integer.MAX_VALUE));//always test all idle object
|
||||
config.setTestOnBorrow(Configurations.getBooleanProperty("redis.pool.testonborrow", true));
|
||||
config.setTestOnReturn(Configurations.getBooleanProperty("redis.pool.testonreturn", false));
|
||||
config.setTestWhileIdle(Configurations.getBooleanProperty("redis.pool.testwhileidle", true));//发呆过长时间是否先test一下
|
||||
config.setTimeBetweenEvictionRunsMillis(Configurations.getLongProperty("redis.pool.timebetweenevictionrunsmillis", 60000L));//-1不启动,默认1min一次
|
||||
config.setMinEvictableIdleTimeMillis(Configurations.getLongProperty("redis.pool.minevictableidletimemillis", 60000L));//可发呆的时间,10mins
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
||||
38
src/main/java/com/nis/util/redis/SaveHelpInfoThread.java
Normal file
38
src/main/java/com/nis/util/redis/SaveHelpInfoThread.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.nis.util.redis;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
public class SaveHelpInfoThread extends Thread {
|
||||
private Logger logger=Logger.getLogger(SaveHelpInfoThread.class);
|
||||
private JedisPool jedisPool;
|
||||
private Jedis jedis;
|
||||
private String key;
|
||||
private String value;
|
||||
private int expire;
|
||||
public SaveHelpInfoThread(JedisPool jedisPool,String key,String value,int expire){
|
||||
this.jedisPool=jedisPool;
|
||||
this.key=key;
|
||||
this.value=value;
|
||||
this.expire=expire;
|
||||
jedis=jedisPool.getResource();
|
||||
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
jedis.set(key, value);
|
||||
if(expire!=-1){
|
||||
jedis.expire(key, expire);
|
||||
}
|
||||
logger.debug("cache help[key --> "+key+"]");
|
||||
} catch (Exception e) {
|
||||
logger.error("save redis error",e);
|
||||
}finally{
|
||||
jedis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,5 @@
|
||||
package com.nis.web.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -11,7 +7,7 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -19,13 +15,17 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.configuration.HelpInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.configuration.HelpInfoService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/sys/")
|
||||
public class SystemController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private HelpInfoService helpService;
|
||||
@RequestMapping("index")
|
||||
public String index(HttpServletRequest request, HttpServletResponse response,ModelMap model){
|
||||
return "/sys/sysIndex";
|
||||
@@ -99,6 +99,9 @@ public class SystemController extends BaseController{
|
||||
System.out.println(menu.getParentIds());
|
||||
newList.add(menu);
|
||||
}*/
|
||||
//将帮助文档缓存到redis
|
||||
helpService.cacheAllHelpInfo();
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -108,29 +111,91 @@ public class SystemController extends BaseController{
|
||||
model.addAttribute("menuList",newList);
|
||||
return "/help";
|
||||
}
|
||||
/**
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @param editedHelpInfo 修改之后的帮助文档内容
|
||||
* @param helpHrefVal 文档的路径
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("saveHelp")
|
||||
@ResponseBody
|
||||
public boolean saveHelp(HttpServletRequest request, HttpServletResponse response,ModelMap model,@RequestParam(required=true,value="editedHelpInfo")String editedHelpInfo,@RequestParam(required=true,value="helpHrefVal")String helpHrefVal){
|
||||
|
||||
try {
|
||||
StringBuffer helpInfo=new StringBuffer();
|
||||
helpInfo.append(URLDecoder.decode(editedHelpInfo,"utf-8"));
|
||||
String htmlName=URLDecoder.decode(helpHrefVal,"utf-8");
|
||||
String htmlPath=request.getServletContext().getRealPath("/")+htmlName;
|
||||
|
||||
File file=new File(htmlPath);
|
||||
OutputStream out=new FileOutputStream(file);
|
||||
out.write(helpInfo.toString().getBytes());
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
if(StringUtils.strIsBlank(helpHrefVal)){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
try {
|
||||
StringBuffer helpInfoText=new StringBuffer(); //修改之后的内容
|
||||
helpInfoText.append(URLDecoder.decode(editedHelpInfo,"utf-8"));
|
||||
String helpHref=URLDecoder.decode(helpHrefVal,"utf-8");
|
||||
String[] split = StringUtils.split(helpHref, "/");
|
||||
if(split!=null&&split.length>0){
|
||||
HelpInfo helpInfo = new HelpInfo();
|
||||
helpInfo.setFileComment(helpInfoText.toString());
|
||||
helpInfo.setFileName(split[split.length-1]);
|
||||
helpService.saveHelpInfo(helpInfo);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("save helpInfo error",e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 查看帮助文档内容
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @param helpHref
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("viewHelp")
|
||||
@ResponseBody
|
||||
public HelpInfo viewHelp(HttpServletRequest request, HttpServletResponse response,ModelMap model,@RequestParam(required=true,value="helpHref")String helpHref){
|
||||
|
||||
if(StringUtils.strIsBlank(helpHref)){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
helpHref=URLDecoder.decode(helpHref,"utf-8");
|
||||
|
||||
String[] split = StringUtils.split(helpHref, "/");
|
||||
if(split!=null&&split.length>0){
|
||||
HelpInfo helpInfo = helpService.findHelpCommentByName(split[split.length-1]);
|
||||
return helpInfo;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("view helpInfo error",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 查看帮助文档备份内容
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @param helpHref
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("viewBakHelp")
|
||||
@ResponseBody
|
||||
public HelpInfo viewBakHelp(HttpServletRequest request, HttpServletResponse response,ModelMap model,@RequestParam(required=true,value="helpHref")String helpHref){
|
||||
|
||||
if(StringUtils.strIsBlank(helpHref)){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
helpHref=URLDecoder.decode(helpHref,"utf-8");
|
||||
|
||||
String[] split = StringUtils.split(helpHref, "/");
|
||||
if(split!=null&&split.length>0){
|
||||
HelpInfo helpInfo = helpService.findHelpBakCommentByName(split[split.length-1]);
|
||||
return helpInfo;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("view helpBakInfo error",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -22,9 +17,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.configuration.AsnKeywordCfg;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
@@ -85,13 +78,8 @@ public class AsnGroupController extends BaseController {
|
||||
asnGroupInfoService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
|
||||
logger.error("新增失败",e);
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
@@ -106,19 +94,13 @@ public class AsnGroupController extends BaseController {
|
||||
*/
|
||||
//@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,String groupIds) {
|
||||
public String delete(RedirectAttributes redirectAttributes,String ids,String asnIds) {
|
||||
try {
|
||||
asnGroupInfoService.delete(ids,asnIds,groupIds);
|
||||
//TODO 查询本次删除的所有asnOrg组中是否存在asn 没有is_used=0的asn,如果存在则需要将整个组删除
|
||||
|
||||
asnGroupInfoService.delete(ids,asnIds);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
}
|
||||
@@ -173,15 +155,10 @@ public class AsnGroupController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/checkAsnNo"})
|
||||
public AsnGroupInfo checkAsnNo(AsnGroupInfo cfg, HttpServletRequest request, HttpServletResponse response){
|
||||
AsnGroupInfo policyGroup=null;
|
||||
policyGroup = asnGroupInfoService.getInfoByAsnNo(cfg);
|
||||
if(policyGroup != null){
|
||||
ConfigGroupInfo group=configGroupInfoService.getAsnOrganization(policyGroup.getOrganization());
|
||||
if(group != null){
|
||||
policyGroup.setCommonGroupIds(group.getGroupId().toString());
|
||||
}
|
||||
}
|
||||
public AsnGroupInfo checkIp(AsnGroupInfo cfg, HttpServletRequest request, HttpServletResponse response){
|
||||
|
||||
AsnGroupInfo policyGroup = asnGroupInfoService.getInfoByAsnNo(cfg);
|
||||
|
||||
return policyGroup;
|
||||
}
|
||||
/**
|
||||
@@ -195,100 +172,8 @@ public class AsnGroupController extends BaseController {
|
||||
if(asnIpCfg == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 异步获取ASN组织信息
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="ajaxGetAsnOrg")
|
||||
@ResponseBody
|
||||
public List ajaxGetAsnOrg( ConfigGroupInfo orgGroup,Model model){
|
||||
List<ConfigGroupInfo> orgaList=new ArrayList<>();
|
||||
try {
|
||||
orgaList=configGroupInfoService.findAllList(orgGroup);
|
||||
} catch (Exception e) {
|
||||
logger.error("异步获取ASN组织信息失败",e);
|
||||
return orgaList;
|
||||
}
|
||||
return orgaList;
|
||||
}
|
||||
/**
|
||||
* 异步获取ASN组织信息
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="ajaxGetAsnNo")
|
||||
@ResponseBody
|
||||
public List ajaxGetAsnNo(AsnGroupInfo asnGroup,Model model){
|
||||
List<AsnGroupInfo> orgaList=new ArrayList<>();
|
||||
try {
|
||||
orgaList=asnGroupInfoService.findAsnGroupList(asnGroup);
|
||||
} catch (Exception e) {
|
||||
logger.error("异步获取ASN NO信息失败",e);
|
||||
return orgaList;
|
||||
}
|
||||
return orgaList;
|
||||
}
|
||||
/**
|
||||
* 校验是否有配置的ASN域已被删除
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="checkAsnRegionIsDeleted")
|
||||
@ResponseBody
|
||||
public Map<Integer,String> checkAsnRegionIsDeleted(@RequestParam(required=true,value="compileIds")String compileIds,Model model){
|
||||
Map<Integer,String> resultMap=new HashMap<>();
|
||||
try {
|
||||
if(!StringUtil.isEmpty(compileIds)){
|
||||
compileIds=compileIds.substring(0,compileIds.length()-1);
|
||||
Map<Integer, List<String>> compileWithGroupMap=new HashMap<>();
|
||||
Map<String, String> groupIdWithAsn=new HashMap<>();
|
||||
//先查询此compileId下是否有is_valid=0和is_audit=0的asn_keyword_cfgs
|
||||
List<AsnKeywordCfg> asnList=asnGroupInfoService.findAsnKeywordCfgByCompileId(compileIds);
|
||||
String groupIds="";
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
//根据asnKeyword的userRegion2[asn group Id]
|
||||
groupIds+=asnKeywordCfg.getUserRegion2()+",";
|
||||
|
||||
if(compileWithGroupMap.keySet().contains(asnKeywordCfg.getCompileId())){
|
||||
List<String> groupList=compileWithGroupMap.get(asnKeywordCfg.getCompileId());
|
||||
groupList.add(asnKeywordCfg.getUserRegion2());
|
||||
compileWithGroupMap.put(asnKeywordCfg.getCompileId(), groupList);
|
||||
}else{
|
||||
List<String> groupList=new ArrayList<>();
|
||||
groupList.add(asnKeywordCfg.getUserRegion2());
|
||||
compileWithGroupMap.put(asnKeywordCfg.getCompileId(), groupList);
|
||||
}
|
||||
groupIdWithAsn.put(asnKeywordCfg.getUserRegion2(), asnKeywordCfg.getCfgKeywords());
|
||||
}
|
||||
if(!StringUtil.isEmpty(groupIds)){
|
||||
Properties prop=this.getMsgProp();
|
||||
groupIds=groupIds.substring(0,groupIds.length()-1);
|
||||
List<String> groupIdList=asnGroupInfoService.findAsnGroupIdByGroupIds(groupIds);
|
||||
for (Integer compileId : compileWithGroupMap.keySet()) {
|
||||
for (String groupIdOld : compileWithGroupMap.get(compileId)) {
|
||||
if(!groupIdList.contains(groupIdOld)){
|
||||
String tip=prop.getProperty("deletedAsnTip").replace("asnId", groupIdWithAsn.get(groupIdOld));
|
||||
tip=tip.replace("cfgId", compileId+"");
|
||||
resultMap.put(compileId, tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("校验编译下的asn是否被删除失败",e);
|
||||
return resultMap;
|
||||
}
|
||||
/*List<AsnGroupInfo> orgaList=new ArrayList<>();
|
||||
try {
|
||||
orgaList=asnGroupInfoService.findAsnGroupList(asnGroup);
|
||||
} catch (Exception e) {
|
||||
logger.error("异步获取ASN NO信息失败",e);
|
||||
return orgaList;
|
||||
}*/
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -134,24 +135,11 @@ public class AsnIpController extends BaseController{
|
||||
asnIpMap.put(Long.parseLong(asnIpCfg.getUserRegion1()), _asnIps);
|
||||
}
|
||||
}
|
||||
/********************每次下发一个组的region,保证事物********************/
|
||||
for (Long asnId : asnIpMap.keySet()) {
|
||||
try {
|
||||
asnIpCfgService.auditIpBatch(asnIpMap.get(asnId),asnId,isValid);
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}/*else {
|
||||
asnIpCfgService.auditIpBatch(asnIpMap,isValid);
|
||||
}else {
|
||||
//条件下所有配置审核
|
||||
Page<AsnIpCfg> searchPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
Page<AsnIpCfg> auditPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
Page<AsnIpCfg> searchPage=new Page<AsnIpCfg>(request,response,"r");
|
||||
Page<AsnIpCfg> auditPage=new Page<AsnIpCfg>(request,response,"r");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
@@ -167,7 +155,7 @@ public class AsnIpController extends BaseController{
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}*/
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
|
||||
@@ -1,194 +0,0 @@
|
||||
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 jersey.repackaged.com.google.common.collect.Lists;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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.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.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsKeywordCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
//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;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/dns/keyword")
|
||||
public class DnsKeywordController extends BaseController{
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")DnsKeywordCfg entity
|
||||
){
|
||||
Page<DnsKeywordCfg> page = dnsKeywordCfgService.findPage(new Page<DnsKeywordCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model, entity);
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
model.addAttribute("regionList", regionList);
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
return "/basics/dnsKeywordCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/addForm"})
|
||||
public String addForm(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
cfg.setGroupType(12);
|
||||
initFormCondition(model,cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/dnsKeywordCfgFormAdd";
|
||||
}
|
||||
@RequestMapping(value = {"/updateForm"})
|
||||
public String updateForm(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")DnsKeywordCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
cfg = dnsKeywordCfgService.get(Long.parseLong(ids));
|
||||
cfg.setGroupType(12);
|
||||
initFormCondition(model, cfg);
|
||||
//List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(4);
|
||||
//model.addAttribute("policyGroups", groupInfos);
|
||||
model.addAttribute("cfg", cfg);
|
||||
return "/basics/dnsKeywordCfgFormUpdate";
|
||||
}
|
||||
@RequestMapping(value = {"/save"})
|
||||
@RequiresPermissions(value={"dns:keyword:config"})
|
||||
public String save(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
dnsKeywordCfgService.saveDnsKeywordCfg(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/dns/keyword/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/update"})
|
||||
@RequiresPermissions(value={"dns:keyword:config"})
|
||||
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DnsKeywordCfg cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
dnsKeywordCfgService.update(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/dns/keyword/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"dns:keyword:config"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DnsKeywordCfg cfg
|
||||
,Integer isAudit
|
||||
,Integer isValid
|
||||
,String ids
|
||||
,Integer functionId
|
||||
, HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
//选中配置审核
|
||||
/*if(!StringUtil.isEmpty(ids)) {
|
||||
List<DnsKeywordCfg> infoList=dnsKeywordCfgService.getByIds(ids);
|
||||
Map<Long,List<DnsKeywordCfg>> dnsKeywordMap=Maps.newHashMap();
|
||||
for(DnsKeywordCfg entity:infoList) {
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
if(dnsKeywordMap.containsKey(Long.parseLong(entity.getUserRegion1()))) {
|
||||
dnsKeywordMap.get(Long.parseLong(entity.getUserRegion1())).add(entity);
|
||||
}else {
|
||||
List<DnsKeywordCfg> keywords=Lists.newArrayList();
|
||||
keywords.add(entity);
|
||||
dnsKeywordMap.put(Long.parseLong(entity.getUserRegion1()), keywords);
|
||||
}
|
||||
}
|
||||
*//********************每次下发一个组的region,保证事物********************//*
|
||||
for (Long groupId : dnsKeywordMap.keySet()) {
|
||||
try {
|
||||
dnsKeywordCfgService.auditDnsKeywordBatch(dnsKeywordMap.get(groupId),groupId,isValid);
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//条件下所有配置审核
|
||||
Page<AsnIpCfg> searchPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
Page<AsnIpCfg> auditPage=new Page<AsnIpCfg>(request,response,"a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}*/
|
||||
return "redirect:" + adminPath +"/basics/dns/keyword/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"dns:keyword:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
dnsKeywordCfgService.delete(ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/dns/keyword/list?functionId="+functionId;
|
||||
}
|
||||
}
|
||||
@@ -1,261 +0,0 @@
|
||||
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.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.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.AsnIpCfg;
|
||||
import com.nis.domain.basics.UrlCommGroupCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
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 com.nis.web.service.basics.UrlCommGroupService;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Lists;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/url")
|
||||
public class UrlCommGroupController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private UrlCommGroupService urlCommGroupService;
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")UrlCommGroupCfg entity
|
||||
){
|
||||
Page<UrlCommGroupCfg> page = urlCommGroupService.findPage(new Page<UrlCommGroupCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
model.addAttribute("regionList", regionList);
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
return "/basics/urlCommGroupList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/addForm"})
|
||||
public String addForm(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
|
||||
|
||||
// UrlCommGroupCfg urlCfg = new UrlCommGroupCfg();
|
||||
// urlCfg.setCfgType("NTC_URL_REGION");
|
||||
// cfg.setUrlCommGroupCfg(urlCfg);
|
||||
// List<UrlCommGroupCfg> urlList = new ArrayList<UrlCommGroupCfg>();
|
||||
// urlList.add(urlCfg);
|
||||
// cfg.setUrlCommGroupList(urlList);
|
||||
// initFormCondition(model, entity);
|
||||
cfg.setGroupType(11);
|
||||
initFormCondition(model,cfg);
|
||||
//List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(4);
|
||||
//model.addAttribute("policyGroups", groupInfos);
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/urlCommGroupFormAdd";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/save"})
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String save(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
|
||||
// System.out.println("URL分组");
|
||||
try{
|
||||
urlCommGroupService.saveUrlCommGroupCfg(cfg);
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/updateForm"})
|
||||
public String updateForm(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")UrlCommGroupCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
cfg = urlCommGroupService.get(Long.parseLong(ids));
|
||||
// initUpdateFormCondition(model, cfg);
|
||||
cfg.setGroupType(11);
|
||||
initUpdateFormCondition(model,cfg);
|
||||
//List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(4);
|
||||
//model.addAttribute("policyGroups", groupInfos);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/urlCommGroupFormUpdate";
|
||||
}
|
||||
@RequestMapping(value = {"/update"})
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")UrlCommGroupCfg cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
urlCommGroupService.update(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")UrlCommGroupCfg cfg
|
||||
,Integer isAudit
|
||||
,Integer isValid
|
||||
,String ids
|
||||
,Integer functionId
|
||||
, HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
//选中配置审核
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
List<UrlCommGroupCfg> urlGroupCfgs=urlCommGroupService.getByIds(ids);
|
||||
// Map<Long,List<UrlCommGroupCfg>> urlcfgMap=Maps.newHashMap();
|
||||
// for(UrlCommGroupCfg urlCommCfg:urlGroupCfgs) {
|
||||
// urlCommCfg.setIsAudit(isAudit);
|
||||
// urlCommCfg.setIsValid(isValid);
|
||||
// urlCommCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
// urlCommCfg.setAuditTime(new Date());
|
||||
// urlCommCfg.setFunctionId(functionId);
|
||||
// if(urlcfgMap.containsKey(Long.parseLong(urlCommCfg.getUserRegion3()))) {
|
||||
// urlcfgMap.get(Long.parseLong(urlCommCfg.getUserRegion3())).add(urlCommCfg);
|
||||
// }else {
|
||||
// List<UrlCommGroupCfg> _urlCfgs=Lists.newArrayList();
|
||||
// _urlCfgs.add(urlCommCfg);
|
||||
// urlcfgMap.put(Long.parseLong(urlCommCfg.getUserRegion3()), _urlCfgs);
|
||||
// }
|
||||
// }
|
||||
/********************每次下发一个组的region,保证事物********************/
|
||||
// for (Long groupId : urlcfgMap.keySet()) {
|
||||
// try {
|
||||
// urlCommGroupService.audit(urlcfgMap.get(groupId),groupId,isValid);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("配置下发失败:",e);
|
||||
// if(e instanceof MaatConvertException) {
|
||||
// addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
// }else {
|
||||
// addMessage(redirectAttributes,"error", "audit_failed");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
for (UrlCommGroupCfg urlCommGroup : urlGroupCfgs) {
|
||||
try {
|
||||
urlCommGroupService.audit(urlCommGroup,isAudit,isValid);
|
||||
} catch (Exception e) {
|
||||
logger.error("审核失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
urlCommGroupService.delete(ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+functionId;
|
||||
}
|
||||
//urlComm配置导出
|
||||
@RequestMapping(value = "/exportUrlComm")
|
||||
public void exportAsnIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")UrlCommGroupCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
List<UrlCommGroupCfg> list = new ArrayList<UrlCommGroupCfg>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = urlCommGroupService.findByPage(ids);
|
||||
} else {
|
||||
Page<UrlCommGroupCfg> pageInfo=new Page<UrlCommGroupCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<UrlCommGroupCfg> page = urlCommGroupService.findPage(pageInfo, entity);
|
||||
list=page.getList();
|
||||
}
|
||||
//
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), UrlCommGroupCfg.class);
|
||||
String cfgIndexInfoNoExport=",block_type,do_log,action"
|
||||
+ ",letter,whether_area_block,classification,attribute,label,expression_type,match_method"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,is_hex,is_case_insenstive,";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null ) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), list);
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("urlGroupConfig export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -15,6 +17,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.taglibs.standard.functions.Functions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -28,6 +31,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
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.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.AppBuiltInFeatureFile;
|
||||
@@ -40,10 +45,14 @@ import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppSslCertCfg;
|
||||
import com.nis.domain.configuration.AppTcpCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
@@ -55,6 +64,7 @@ import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -346,7 +356,6 @@ public class AppCfgController extends BaseController {
|
||||
public String ipCfgForm(Model model, String ids, AppIpCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppIpCfg(Long.parseLong(ids));
|
||||
entity.setAppFeaturePropCfgList(appMultiFeatureCfgService.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null));
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
@@ -672,7 +681,6 @@ public class AppCfgController extends BaseController {
|
||||
public String domainCfgForm(Model model, String ids, AppDomainCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppDomainCfg(Long.parseLong(ids));
|
||||
entity.setAppFeaturePropCfgList(appMultiFeatureCfgService.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null));
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
@@ -2191,4 +2199,14 @@ public class AppCfgController extends BaseController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping(value = "policyCfgImport", method=RequestMethod.POST)
|
||||
public String importAppPolicyList(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, @RequestParam("files")MultipartFile[] files, Integer serviceDictId, Integer requestId,
|
||||
String attribute, String classify, String regionDictIds, String importPath) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.importAppPolicyList(request, response, redirectAttributes, files, serviceDictId, requestId, attribute,
|
||||
classify, regionDictIds, importPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -11,25 +12,52 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.taglibs.standard.functions.Functions;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.AppBuiltInFeatureFile;
|
||||
import com.nis.domain.configuration.AppByteCfg;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppFeatureProperties;
|
||||
import com.nis.domain.configuration.AppHeaderCfg;
|
||||
import com.nis.domain.configuration.AppHttpCfg;
|
||||
import com.nis.domain.configuration.AppIpCfg;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppSslCertCfg;
|
||||
import com.nis.domain.configuration.AppStringFeatureCfg;
|
||||
import com.nis.domain.configuration.AppTcpCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -82,27 +110,15 @@ public class AppFeatureCfgController extends BaseController {
|
||||
appMultiFeatureCfgService.getAppIpRangeCfg(entity.getCompileId(), entity.getFunctionId()));
|
||||
entity.setStrList(appMultiFeatureCfgService.getAppStringFeatureCfg(entity.getCompileId(),
|
||||
entity.getFunctionId(), null));
|
||||
entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfgNotRegionCode(entity.getCompileId(),
|
||||
entity.getFunctionId(), 6));
|
||||
entity.setSessionList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(),
|
||||
entity.getFunctionId(), 6));
|
||||
entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(),
|
||||
entity.getFunctionId(), null));
|
||||
entity.setNumCfgList(
|
||||
appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(), null));
|
||||
entity.setAppFeaturePropCfgList(appMultiFeatureCfgService.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null));
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
// 获取L7 Protocol
|
||||
SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg();
|
||||
specificServiceCfg.setCfgType(3);
|
||||
List<SpecificServiceCfg> l7ProtoList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg, null);
|
||||
|
||||
model.addAttribute("_cfg", entity);
|
||||
model.addAttribute("l7ProtoList", l7ProtoList);
|
||||
if(entity.getFunctionId() == 567) { // APP关联特征配置
|
||||
return "/cfg/app/appCorrelationFeatureCfgForm";
|
||||
}
|
||||
return "/cfg/app/appMultiFeatureCfgForm";
|
||||
}
|
||||
|
||||
@@ -253,26 +269,8 @@ public class AppFeatureCfgController extends BaseController {
|
||||
Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("numCfgList", numCfgList);
|
||||
}
|
||||
if ("8".equals(cfgRegionType[i])) {
|
||||
List<AppComplexFeatureCfg> sessionList = appMultiFeatureCfgService
|
||||
.getAppComplexFeatureCfg(compileId, functionId, Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("sessionList", sessionList);
|
||||
}
|
||||
if ("9".equals(cfgRegionType[i])) {
|
||||
List<AppFeatureProperties> featureList = appMultiFeatureCfgService
|
||||
.getAppFeaturePropCfg(compileId, functionId, null);
|
||||
map.put("featureList", featureList);
|
||||
}
|
||||
|
||||
tabList.add(map);
|
||||
}
|
||||
// 获取L7 Protocol
|
||||
SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg();
|
||||
specificServiceCfg.setCfgType(3);
|
||||
List<SpecificServiceCfg> l7ProtoList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg, null);
|
||||
|
||||
model.addAttribute("l7ProtoList", l7ProtoList);
|
||||
|
||||
} else {
|
||||
Map<String, Object> map = new HashMap();
|
||||
map.put("regionType", "0");
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -21,29 +18,24 @@ 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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.report.NtcPzReport;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import net.sf.json.JsonConfig;
|
||||
|
||||
/**
|
||||
* 基础协议控制类
|
||||
*
|
||||
@@ -396,5 +388,13 @@ public class BasicProtocolController extends BaseController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importAppPolicyList(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, @RequestParam("files")MultipartFile[] files, Integer serviceDictId, Integer requestId,
|
||||
String attribute, String classify, String regionDictIds, String importPath) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.importAppPolicyList(request, response, redirectAttributes, files, serviceDictId, requestId, attribute,
|
||||
classify, regionDictIds, importPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,10 +51,11 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
* 下发同步命令
|
||||
*/
|
||||
@RequestMapping(value = {"configSync"})
|
||||
public String configSync(Model model,Integer cmd,HttpServletRequest request,HttpServletResponse response){
|
||||
public String configSync(Model model,Integer cmd,Integer serviceId,HttpServletRequest request,HttpServletResponse response){
|
||||
Map<String,Integer> map = new HashMap();
|
||||
map.put("syncStatus", cmd);
|
||||
JSONObject result = ConfigServiceUtil.configSyncCmd(BaseService.gsonToJson(map));
|
||||
//JSONObject result=JSONObject.fromObject("{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}");
|
||||
if(result.get("status").equals(201)){//响应成功
|
||||
if(cmd.equals(1)){//同步
|
||||
SysDataDictionaryName sysDictName = new SysDataDictionaryName();
|
||||
@@ -73,11 +74,12 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
CacheUtils.remove(Constants.CACHE_DICT_MAP);
|
||||
}
|
||||
}
|
||||
send(model,request,response);
|
||||
send(serviceId,model,request,response);
|
||||
}else if(cmd.equals(0)){//取消
|
||||
|
||||
}
|
||||
}
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
return "/sys/configSyncInfo";
|
||||
}
|
||||
|
||||
@@ -85,10 +87,10 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
* 下发同步配置
|
||||
*/
|
||||
@RequestMapping(value = {"send"})
|
||||
public void send(Model model,HttpServletRequest request,HttpServletResponse response){
|
||||
public void send(Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response){
|
||||
int status = -2;
|
||||
try {
|
||||
configSynchronizationService.send(request,response,null);
|
||||
configSynchronizationService.send(serviceId,request,response,null);
|
||||
status = 1;
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
@@ -129,6 +131,7 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
boolean isFinished = true;
|
||||
while(isFinished){
|
||||
JSONObject result = ConfigServiceUtil.configSyncStatus();//获取同步状态
|
||||
//JSONObject result = JSONObject.fromObject("{\"status\": 200,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":3,\"opTime\":\"2016-11-22 08:31:27\"}]}");
|
||||
if(result.get("status").equals(200)){
|
||||
List<Map<String,Object>> list = result.getJSONArray("data");
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
@@ -180,6 +183,7 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
String failStatus = DictUtils.getDictCode("config_sync_status", "fail","-2");
|
||||
Map<String,Object> map = Maps.newHashMap();
|
||||
if(!currentStatus.equals(successStatus) && !currentStatus.equals(failStatus) && !currentStatus.equals(serverFailStatus)){
|
||||
//JSONObject result = JSONObject.fromObject("{\"status\": 200,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}");
|
||||
JSONObject result = ConfigServiceUtil.configSyncStatus();//获取同步状态
|
||||
if(result.get("status").equals(200)){
|
||||
List<Map<String,Object>> list = result.getJSONArray("data");
|
||||
|
||||
@@ -19,7 +19,9 @@ 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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
@@ -434,4 +436,14 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping(value = { "import" })
|
||||
public String importAppPolicyList(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, @RequestParam("files")MultipartFile[] files, Integer serviceDictId, Integer requestId,
|
||||
String attribute, String classify, String regionDictIds, String importPath) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.importAppPolicyList(request, response, redirectAttributes, files, serviceDictId, requestId, attribute,
|
||||
classify, regionDictIds, importPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -188,6 +188,7 @@ public class UserManageController extends BaseController{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}else{
|
||||
entity.setEditTime(createTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
@@ -271,7 +272,7 @@ public class UserManageController extends BaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addMessage(redirectAttributes,"success","update_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
if(!StringUtil.isEmpty(e.getMessage())) {
|
||||
|
||||
@@ -6,35 +6,40 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
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.jets3t.service.ServiceException;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -266,4 +271,156 @@ public class DdosCfgController extends BaseController {
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/ddosSubList";
|
||||
}
|
||||
@RequestMapping(value = {"import"}, method=RequestMethod.POST)
|
||||
public String importCfg(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
//加载模板
|
||||
ei.loadInitParams(DdosIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
org.springframework.beans.BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ddosCfgService.saveAndSend(regionDict, _ipPortCfgs, isSend.equals("1"));
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,20 +8,28 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
@@ -29,18 +37,29 @@ import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.AvContUrlCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.domain.configuration.AvVoipIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 处理音视频文本业务
|
||||
@@ -1177,4 +1196,318 @@ public class AvContentController extends BaseController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"contUrlImport","voipImport"}, method=RequestMethod.POST)
|
||||
public String importCfg(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if((regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
avContentCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
avContentCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
avContentCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,48 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcBgpAsCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -312,5 +324,210 @@ public class BgpCfgController extends BaseController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = "bgpImport")
|
||||
public String bgpImport(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
Properties properties=this.getMsgProp();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if (regionDict.getRegionType().equals(2)) {// 字符串类
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
bgpCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(2)) {
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
bgpCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -19,32 +21,54 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.taglibs.standard.functions.Functions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
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.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.P2pHashCfg;
|
||||
import com.nis.domain.configuration.P2pKeywordCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -984,4 +1008,340 @@ public class FileTransferCfgController extends BaseController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ftpImport","p2pImport"}, method=RequestMethod.POST)
|
||||
public String importDns(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
if("p2p_ip".equals(regionDict.getConfigServiceType())) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListP2pIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListP2pIpTemplate> list = ei.getDataList(BlackListP2pIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
|
||||
}else if("p2p_ip".equals(regionDict.getConfigServiceType())) { // P2p IP
|
||||
ei.loadInitParams(P2pIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<P2pIpTemplate> list = ei.getDataList(P2pIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
if("p2p_hash".equals(regionDict.getConfigServiceType())) {
|
||||
ei.loadInitParams(BlackListP2pHashStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListP2pHashStringTemplate> list = ei.getDataList(BlackListP2pHashStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}else if("p2p_hash".equals(regionDict.getConfigServiceType())) { // P2p hash
|
||||
ei.loadInitParams(P2pHashStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<P2pHashStringTemplate> list = ei.getDataList(P2pHashStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if((regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
fileTransferCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
fileTransferCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
fileTransferCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -8,12 +10,18 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -23,18 +31,33 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
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.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.AsnKeywordCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.AppDomainTemplate;
|
||||
import com.nis.domain.configuration.template.AppPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
@@ -66,16 +89,18 @@ import com.nis.domain.configuration.template.SnatTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.configuration.template.TopicWebsiteTemplate;
|
||||
import com.nis.domain.configuration.template.UrlCommGroupTemplate;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
* @author dell
|
||||
@@ -363,10 +388,17 @@ public class IpController extends BaseController{
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(510) && "p2p_ip".equals(regionDict.getConfigServiceType())){ //P2p IP
|
||||
List<P2pIpTemplate> classList=new ArrayList<P2pIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, P2pIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
if(serviceDict!=null&&serviceDict.getAction().equals(16)) {
|
||||
List<BlackListP2pIpTemplate> classList=new ArrayList<BlackListP2pIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListP2pIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else {
|
||||
List<P2pIpTemplate> classList=new ArrayList<P2pIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, P2pIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}else if(regionDict.getFunctionId().equals(600)){ //asnip
|
||||
List<AsnIpTemplate> classList=new ArrayList<AsnIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, AsnIpTemplate.class, 2);
|
||||
@@ -430,6 +462,17 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllNotDoLogTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(8)||regionDict.getFunctionId().equals(35)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(22)||regionDict.getFunctionId().equals(24))&&serviceDict.getAction().equals(16)) {//SSL , HTTP ADVANCED URL mail,FTP,Steaming Media 的BLOCK
|
||||
List<BlackListIPTemplate> classList=new ArrayList<BlackListIPTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, BlackListIPTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if((regionDict.getFunctionId().equals(63)||regionDict.getFunctionId().equals(407)||regionDict.getFunctionId().equals(408)) && serviceDict.getAction().equals(64)){// APP Policy限速
|
||||
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
|
||||
@@ -439,7 +482,12 @@ public class IpController extends BaseController{
|
||||
}
|
||||
//str类模板
|
||||
if(regionDict.getRegionType().equals(2)){
|
||||
if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())){ //P2p hash
|
||||
if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())&&serviceDict!=null&&serviceDict.getAction().equals(16)){ //P2p hash block
|
||||
List<BlackListP2pHashStringTemplate> classList=new ArrayList<BlackListP2pHashStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListP2pHashStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())){ //P2p hash
|
||||
List<P2pHashStringTemplate> classList=new ArrayList<P2pHashStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, P2pHashStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
@@ -491,9 +539,22 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, TopicWebsiteTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(111)) {// url分组配置
|
||||
List<UrlCommGroupTemplate> classList=new ArrayList<UrlCommGroupTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, UrlCommGroupTemplate.class, 2);
|
||||
}else if(regionDict.getFunctionId().equals(34)&&serviceDict.getAction().equals(16)) {//SSL BLOCK
|
||||
List<BlackListStringTemplate> classList=new ArrayList<BlackListStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, BlackListStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if((regionDict.getFunctionId().equals(6)||regionDict.getFunctionId().equals(635)||regionDict.getFunctionId().equals(8)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(510)||regionDict.getFunctionId().equals(22)
|
||||
||regionDict.getFunctionId().equals(24)
|
||||
)&&serviceDict.getAction().equals(16)) {//URL, Advanced Website Keyword FTP Steaming Media BLOCK
|
||||
List<BlackListStringTemplate> classList=new ArrayList<BlackListStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, BlackListStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(6)&&serviceDict.getAction().equals(128)) {//URL WHITELIST
|
||||
List<StringAllNotDoLogTemplate> classList=new ArrayList<StringAllNotDoLogTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllNotDoLogTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
@@ -541,6 +602,21 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if((regionDict.getFunctionId().equals(8))&&serviceDict.getAction().equals(16)) {// request header response header
|
||||
List<BlackListComplexStringTemplate> classList=new ArrayList<BlackListComplexStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListComplexStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(37)&&serviceDict!=null&&serviceDict.getAction().intValue()==128) {//mail whiltelist
|
||||
List<ComplexStringAllNotDoLogTemplate> classList=new ArrayList<ComplexStringAllNotDoLogTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(37)&&serviceDict!=null&&serviceDict.getAction().intValue()==16) {//mail Block
|
||||
List<BlackListComplexStringTemplate> classList=new ArrayList<BlackListComplexStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListComplexStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<ComplexStringAllTemplate> classList=new ArrayList<ComplexStringAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, ComplexStringAllTemplate.class, 2);
|
||||
@@ -559,18 +635,173 @@ public class IpController extends BaseController{
|
||||
}
|
||||
|
||||
//ip配置导入
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify);
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
@Deprecated
|
||||
// @RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify);
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIPList(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
ImportBigExcel ei=null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
try {
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
//------------------------------------check format start----------------------------
|
||||
if (serviceDict!=null&&serviceDict.getAction().equals(64)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpRateLimitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class
|
||||
);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
} else if(serviceDict!=null&&serviceDict.getAction().equals(32)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllNotDoLogTemplate> list = ei.getDataList(IpAllNotDoLogTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
} else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("获取编译ID出错",e);
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(405)&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setUserRegion1(regionIds.get(ind).toString());
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSendIPList(regionDict, serviceDict, _ipPortCfgs, cfgIndexInfos,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
|
||||
@@ -8,8 +8,10 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -17,30 +19,50 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
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.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -377,5 +399,322 @@ public class MailCfgController extends BaseController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"mailImport"}, method=RequestMethod.POST)
|
||||
public String importMail(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if(serviceDict.getAction().intValue()==128) {
|
||||
ei.loadInitParams(ComplexStringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllNotDoLogTemplate> list = ei.getDataList(ComplexStringAllNotDoLogTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
mailCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
mailCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
mailCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,14 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.taglibs.standard.functions.Functions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -25,29 +26,37 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.ComplexStringCfgTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -403,12 +412,8 @@ public class WebsiteController extends BaseController {
|
||||
public String dnsForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = websiteCfgService.getDnsCfg(Long.parseLong(ids), null);
|
||||
entity.setGroupType(12);
|
||||
//entity.setUdFlag(1);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
entity.setGroupType(12);
|
||||
//entity.setUdFlag(1);
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
// 获取所有响应策略信息
|
||||
@@ -457,8 +462,6 @@ public class WebsiteController extends BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoService.findPolicyGroupInfosByTypeforUD(12, null);
|
||||
model.addAttribute("policyGroupInfos", policyGroupInfos);// 显示分组名称 12:dns 1:有效
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
@@ -1088,4 +1091,331 @@ public class WebsiteController extends BaseController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"dnsImport","sslImport","httpImport"}, method=RequestMethod.POST)
|
||||
public String importDns(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(regionDict.getFunctionId().intValue()==7&&serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(DnsIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DnsIpTemplate> list = ei.getDataList(DnsIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if((regionDict.getFunctionId().intValue()==34||regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(regionDict.getFunctionId().intValue()==7&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(DnsStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DnsStringTemplate> list = ei.getDataList(DnsStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if((regionDict.getFunctionId().intValue()==34||regionDict.getFunctionId().intValue()==635||regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if(regionDict.getFunctionId().equals(7)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(DnsComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DnsComplexStringTemplate> list = ei.getDataList(DnsComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if((regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
websiteCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
websiteCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
websiteCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,31 +6,54 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpWhitelistTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.configuration.template.WhiteListIpTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -170,7 +193,7 @@ public class WhiteListController extends CommonController {
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/whitelist/domainList";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = { "saveHttpUrlCfgs" })
|
||||
public String saveHttpUrlCfgs(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
CfgIndexInfo entity) {
|
||||
@@ -202,8 +225,6 @@ public class WhiteListController extends CommonController {
|
||||
if (entity.getHttpUrlList().size() == 0) {
|
||||
entity.getHttpUrlList().add(urlCfg);
|
||||
}
|
||||
entity.setGroupType(11);
|
||||
//entity.setUdFlag(1);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
@@ -212,8 +233,6 @@ public class WhiteListController extends CommonController {
|
||||
List<HttpUrlCfg> urlList = new ArrayList<HttpUrlCfg>();
|
||||
urlList.add(urlCfg);
|
||||
entity.setHttpUrlList(urlList);
|
||||
entity.setGroupType(11);
|
||||
//entity.setUdFlag(1);
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
@@ -249,8 +268,6 @@ public class WhiteListController extends CommonController {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoService.findPolicyGroupInfosByTypeforUD(11, null);
|
||||
model.addAttribute("policyGroupInfos", policyGroupInfos);// 显示分组名称 11:url 1:有效
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
@@ -345,7 +362,147 @@ public class WhiteListController extends CommonController {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
WhiteListIpTemplate.class);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "ip/import", method=RequestMethod.POST)
|
||||
public String importIPWhiteList(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
ImportBigExcel ei=null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
try {
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//加载模板
|
||||
ei.loadInitParams(IpWhitelistTemplate.class, properties, regionDict, serviceDict);
|
||||
//------------------------------------check format start----------------------------
|
||||
BlockingQueue<IpWhitelistTemplate> list = ei.getDataList(IpWhitelistTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("获取编译ID出错",e);
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(405)&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setUserRegion1(regionIds.get(ind).toString());
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSendIPList(regionDict, serviceDict, _ipPortCfgs, cfgIndexInfos,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "ip/export")
|
||||
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@@ -574,5 +731,139 @@ public class WhiteListController extends CommonController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "domain/import", method=RequestMethod.POST)
|
||||
public String importDomain(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==128) {
|
||||
ei.loadInitParams(StringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllNotDoLogTemplate> list = ei.getDataList(StringAllNotDoLogTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
domainService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -15,17 +16,22 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
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.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
@@ -35,10 +41,27 @@ import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectIpTemplate;
|
||||
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.IpAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -499,4 +522,367 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
* +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
*/
|
||||
}
|
||||
@RequestMapping(value = {"import"}, method=RequestMethod.POST)
|
||||
public String importDns(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRejectIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRejectIpTemplate> list = ei.getDataList(HttpsRejectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRedirectIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRedirectIpTemplate> list = ei.getDataList(HttpsRedirectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsReplaceIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsReplaceIpTemplate> list = ei.getDataList(HttpsReplaceIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllNotDoLogTemplate> list = ei.getDataList(IpAllNotDoLogTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRejectTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRejectTemplate> list = ei.getDataList(HttpsRejectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRedirectTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRedirectTemplate> list = ei.getDataList(HttpsRedirectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsReplaceTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsReplaceTemplate> list = ei.getDataList(HttpsReplaceTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(StringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllNotDoLogTemplate> list = ei.getDataList(StringAllNotDoLogTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRejectComplexTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRejectComplexTemplate> list = ei.getDataList(HttpsRejectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRedirectComplexTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRedirectComplexTemplate> list = ei.getDataList(HttpsRedirectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsReplaceComplexTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsReplaceComplexTemplate> list = ei.getDataList(HttpsReplaceComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(ComplexStringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllNotDoLogTemplate> list = ei.getDataList(ComplexStringAllNotDoLogTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=com.beust.jcommander.internal.Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
|
||||
httpRedirectCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=com.beust.jcommander.internal.Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
httpRedirectCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=com.beust.jcommander.internal.Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
httpRedirectCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,31 +8,59 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.InterceptPktBin;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
|
||||
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.IpSpoofingTemplate;
|
||||
import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -250,7 +278,248 @@ public class InterceptController extends CommonController {
|
||||
* redirectAttributes){ this._exportIp(columns,model, request, response,
|
||||
* entity, ids, redirectAttributes); }
|
||||
*/
|
||||
|
||||
@RequestMapping(value = {"/ippayload/import","/ip/import","/domain/import"}, method=RequestMethod.POST)
|
||||
public String importIPList(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
ImportBigExcel ei=null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
try {
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getFunctionId().equals(212)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpPayloadTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpPayloadTemplate> list = ei.getDataList(IpPayloadTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
} else if(regionDict.getFunctionId().equals(214)) { // IpSpoofing
|
||||
//加载模板
|
||||
ei.loadInitParams(IpSpoofingTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpSpoofingTemplate> list = ei.getDataList(IpSpoofingTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
} else if(regionDict.getFunctionId().equals(200)) {//Intercept Policy
|
||||
if(regionDict.getDictId().equals(53)) {
|
||||
if(serviceDict.getAction().equals(64)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpRateLimitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllNotDoLogTemplate> list = ei.getDataList(IpAllNotDoLogTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
}
|
||||
}
|
||||
if(regionDict.getDictId().equals(56)) {
|
||||
if(serviceDict.getAction().equals(1)){// 监测
|
||||
//加载模板
|
||||
ei.loadInitParams(DomainInterceptMonitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DomainInterceptMonitTemplate> list = ei.getDataList(DomainInterceptMonitTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(serviceDict.getAction().equals(64)){// 限速
|
||||
//加载模板
|
||||
ei.loadInitParams(DomainInterceptRateLimitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DomainInterceptRateLimitTemplate> list = ei.getDataList(DomainInterceptRateLimitTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else{// 白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(DomainInterceptTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DomainInterceptTemplate> list = ei.getDataList(DomainInterceptTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(212)||regionDict.getFunctionId().equals(200)) {// IP Payload ,Intercept Policy
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
if(serviceDict.getFunctionId().equals(214)) {// IpSpoofing
|
||||
interceptCfgService.saveAndSendSpoofingIpPool(_ipPortCfgs, cfgIndexInfos,isSend.equals("1"));
|
||||
}else {
|
||||
interceptCfgService.saveAndSend(regionDict,cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
}
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if(regionDict.getRegionType().equals(2)){//String
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(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());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
interceptCfgService.saveAndSend(regionDict,cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@@ -441,5 +710,5 @@ public class InterceptController extends CommonController {
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
* App趋势界面 独立IP访问数量趋势图
|
||||
*/
|
||||
@RequestMapping(value="appTrendList")
|
||||
public String appTrendList(Model model,String beginDate,String endDate,String appName,Integer appType,Integer entranceId){
|
||||
public String appTrendList(Model model,String beginDate,String endDate,Integer appType,Integer entranceId){
|
||||
if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
@@ -472,6 +472,20 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 2);
|
||||
beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
}
|
||||
//标签集合
|
||||
List<CodeResult> codeList = CodeDicUtils.getCodeList("appCode");
|
||||
//将数字替换为标签文字
|
||||
String appName="";
|
||||
if(appType!=null){
|
||||
Double value1 = Double.valueOf(appType);
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
appName= code.getItem().trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("appName", appName);
|
||||
model.addAttribute("appType", appType);
|
||||
model.addAttribute("entranceId", entranceId);
|
||||
|
||||
@@ -276,11 +276,10 @@ public class ReportController extends BaseController {
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcAsnRecord> page = new PageLog<NtcAsnRecord>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
page.setPageSize(-1);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//params.put("pageNo", page.getPageNo());
|
||||
// 判断请求参数
|
||||
if (StringUtils.isNotEmpty(log.getSearchAsnType())) {
|
||||
params.put("searchAsnType", log.getSearchAsnType());
|
||||
@@ -381,11 +380,10 @@ public class ReportController extends BaseController {
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcIpRangeReport> page = new PageLog<NtcIpRangeReport>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
//page.setPageNo(1);
|
||||
page.setPageSize(-1);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
log.setSearchAreaType(seType);
|
||||
// 判断请求参数
|
||||
// 查询国家
|
||||
@@ -473,11 +471,11 @@ public class ReportController extends BaseController {
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcURLReport> page = new PageLog<NtcURLReport>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
//page.setPageNo(1);
|
||||
page.setPageSize(-1);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//params.put("pageNo", page.getPageNo());
|
||||
// 判断请求参数
|
||||
if (StringUtils.isNotBlank(log.getSearchReportStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
|
||||
@@ -29,13 +29,6 @@ public interface AsnGroupInfoDao extends CrudDao<AsnGroupInfo> {
|
||||
List<AsnGroupInfo> findAsnGroupInfos();
|
||||
Long getCount();
|
||||
void modifyIssuedIp(AsnGroupInfo info);
|
||||
List<AsnGroupInfo> findAsnGroupInfoByAsnGroup(AsnGroupInfo asnGroupInfo);
|
||||
void updateIsUsedAndIsValid(@Param("groupIds")List groupIds,@Param("isUsed")Integer isUsed,@Param("isValid")Integer isValid);
|
||||
List<AsnGroupInfo> findAsnGroupInfoByGroupIds(@Param("groupIds")List groupIds,@Param("isUsed")Integer isUsed);
|
||||
List<String> findAsnGroupIdByGroupIds(@Param("groupIds")String groupIds);
|
||||
void deleteAll();
|
||||
void insertWithId(AsnGroupInfo asnGroupInfo);
|
||||
void insertWithoutId(AsnGroupInfo asnGroupInfo);
|
||||
void updateIpNum(@Param("v4Num")long v4Num,@Param("v6Num")long v6Num,@Param("groupId")Integer groupId);
|
||||
List<Object[]> getASNIPNum(@Param("asnNo")Long asnNo);
|
||||
List<Object[]> getASNIPNum(@Param("asnNo")Integer asnNo);
|
||||
}
|
||||
@@ -15,13 +15,10 @@
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="asn_id" property="asnId" jdbcType="BIGINT" />
|
||||
<result column="issued_ips" property="issuedIPs" jdbcType="INTEGER" />
|
||||
<result column="is_used" property="isUsed" jdbcType="INTEGER" />
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="org_group_id" property="orgGroupId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="AsnGroupInfoColumns">
|
||||
r.id,r.group_id,r.compile_id,r.organization,r.country,r.detail,r.is_valid,r.create_time,r.edit_time,
|
||||
r.creator_id,r.editor_id,r.asn_id,r.issued_ips,r.is_used,r.region_id,r.org_group_id,r.only_group_id
|
||||
r.creator_id,r.editor_id,r.asn_id,r.issued_ips
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
@@ -63,9 +60,6 @@
|
||||
</if>
|
||||
<if test="isValid != null and isValid != ''">
|
||||
AND r.is_valid =#{isValid }
|
||||
</if>
|
||||
<if test="orgGroupId != null and orgGroupId != ''">
|
||||
AND r.org_group_id =#{orgGroupId }
|
||||
</if>
|
||||
AND r.is_valid !=-1
|
||||
<!-- 数据范围过滤 -->
|
||||
@@ -85,7 +79,7 @@
|
||||
<select id="findAsnGroupInfos" resultMap="AsnGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM asn_group_info r where r.is_valid !=-1
|
||||
FROM asn_group_info r where is_valid !=-1
|
||||
</select>
|
||||
<select id="getCount" resultType="java.lang.Long">
|
||||
SELECT count(1)
|
||||
@@ -93,22 +87,7 @@
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
insert into asn_group_info(
|
||||
group_id,
|
||||
compile_id,
|
||||
organization,
|
||||
country,
|
||||
detail,
|
||||
is_valid,
|
||||
creator_id,
|
||||
create_time,
|
||||
editor_id,
|
||||
edit_time,
|
||||
asn_id,
|
||||
is_used,
|
||||
region_id,
|
||||
org_group_id,
|
||||
only_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
|
||||
)values (
|
||||
#{groupId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
@@ -120,83 +99,10 @@
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{asnId,jdbcType=INTEGER},
|
||||
#{isUsed,jdbcType=INTEGER},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{orgGroupId,jdbcType=INTEGER},
|
||||
#{onlyGroupId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertWithoutId" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
insert into asn_group_info(
|
||||
group_id,
|
||||
compile_id,
|
||||
organization,
|
||||
country,
|
||||
detail,
|
||||
is_valid,
|
||||
creator_id,
|
||||
create_time,
|
||||
editor_id,
|
||||
edit_time,
|
||||
asn_id,
|
||||
is_used,
|
||||
region_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},
|
||||
#{isUsed,jdbcType=INTEGER},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{orgGroupId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertWithId" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
insert into asn_group_info(
|
||||
id,
|
||||
group_id,
|
||||
compile_id,
|
||||
organization,
|
||||
country,
|
||||
detail,
|
||||
is_valid,
|
||||
creator_id,
|
||||
create_time,
|
||||
editor_id,
|
||||
edit_time,
|
||||
asn_id,
|
||||
is_used,
|
||||
region_id,
|
||||
org_group_id,
|
||||
only_group_id
|
||||
)values (
|
||||
#{id,jdbcType=INTEGER},
|
||||
#{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},
|
||||
#{isUsed,jdbcType=INTEGER},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{orgGroupId,jdbcType=INTEGER},
|
||||
#{onlyGroupId,jdbcType=INTEGER}
|
||||
#{asnId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
update asn_group_info
|
||||
<set >
|
||||
@@ -231,15 +137,6 @@
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="isUsed != null" >
|
||||
is_used = #{isUsed,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="regionId != null" >
|
||||
region_id = #{regionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orgGroupId != null" >
|
||||
org_group_id = #{orgGroupId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
@@ -250,28 +147,6 @@
|
||||
</trim>
|
||||
</where>
|
||||
</update>
|
||||
<update id="updateIsUsedAndIsValid" >
|
||||
update asn_group_info
|
||||
<set >
|
||||
<if test="isUsed != null" >
|
||||
is_used = #{isUsed,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
<where>
|
||||
<if test="groupIds != null" >
|
||||
and group_id in
|
||||
<foreach collection ="groupIds" item="groupId" separator ="," open="(" close=")">
|
||||
#{groupId}
|
||||
</foreach >
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
and is_valid != #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<update id="updateValid" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
||||
update asn_group_info
|
||||
<set >
|
||||
@@ -330,7 +205,7 @@
|
||||
<select id="getByGroupId" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
select <include refid="AsnGroupInfoColumns"/>
|
||||
from asn_group_info r
|
||||
where r.group_id =#{groupId} and r.is_valid !=-1
|
||||
where r.group_id =#{groupId} and is_valid !=-1
|
||||
</select>
|
||||
<select id="getGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
select <include refid="AsnGroupInfoColumns"/>
|
||||
@@ -368,13 +243,13 @@
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r WHERE r.group_id = #{groupId,jdbcType=INTEGER} AND r.is_valid !=-1
|
||||
asn_group_info r WHERE group_id = #{groupId,jdbcType=INTEGER} AND is_valid !=-1
|
||||
</select>
|
||||
<select id="getConfigGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r WHERE r.organization = #{organization,jdbcType=VARCHAR} AND r.is_valid !=-1
|
||||
asn_group_info r WHERE organization = #{organization,jdbcType=VARCHAR} AND is_valid !=-1
|
||||
</select>
|
||||
<select id="getValidConfigGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
||||
SELECT
|
||||
@@ -403,68 +278,17 @@
|
||||
asn_group_info r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="organization != null and organization != ''" >
|
||||
AND r.organization = #{organization,jdbcType=VARCHAR}
|
||||
AND organization = #{organization,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="asnId != null" >
|
||||
AND r.asn_id = #{asnId,jdbcType=INTEGER}
|
||||
AND asn_id = #{asnId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="findAsnGroupInfoByAsnGroup" resultMap="AsnGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r
|
||||
<where>
|
||||
<if test="asnId != null" >
|
||||
AND r.asn_id = #{asnId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isUsed != null" >
|
||||
AND r.is_used = #{isUsed,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="organization != null and organization != ''" >
|
||||
AND r.organization = #{organization,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
AND r.is_valid = #{isValid,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="findAsnGroupInfoByGroupIds" resultMap="AsnGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="AsnGroupInfoColumns"/>
|
||||
FROM
|
||||
asn_group_info r
|
||||
<where>
|
||||
<if test="isUsed != null" >
|
||||
AND r.is_used = #{isUsed,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="groupIds != null" >
|
||||
and r.group_id in
|
||||
<foreach collection ="groupIds" item="groupId" separator ="," open="(" close=")">
|
||||
#{groupId}
|
||||
</foreach >
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="findAsnGroupIdByGroupIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
group_id
|
||||
FROM
|
||||
asn_group_info r
|
||||
<where>
|
||||
AND r.is_valid != -1
|
||||
and r.group_id in (${groupIds})
|
||||
</where>
|
||||
</select>
|
||||
<delete id="deleteAll" >
|
||||
delete from asn_group_info
|
||||
</delete>
|
||||
<update id="updateIpNum" >
|
||||
update asn_group_info set v4_num=#{v4Num},v6_num=#{v6Num} where group_id=#{groupId}
|
||||
</update>
|
||||
<select id="getASNIPNum" resultType="map">
|
||||
select v4_num,v6_num from asn_group_info where asn_id=#{asnNo}
|
||||
</select>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -4,7 +4,6 @@ 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.domain.basics.Varibles;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
@@ -21,7 +20,6 @@ public interface AsnIpCfgDao extends CrudDao<AsnIpCfg>{
|
||||
public List<Integer> hasASNIds(@Param("ids")String ids);
|
||||
public List<Integer> hasASNIpAddrs(@Param("ids")String ids);
|
||||
public List<AsnIpCfg> findAllList(AsnIpCfg cfg);
|
||||
public List<AsnIpCfg> findAllListByAsnGroup(@Param("entity")AsnIpCfg entity,@Param("asnGroups")List<AsnGroupInfo> asnGroups,@Param("asnIds")String asnIds);
|
||||
// public List<ConfigGroupInfo> findPolicyGroupInfosByType(@Param("groupId")Integer groupId);
|
||||
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
|
||||
public List<Integer> countValidIPs(@Param("groups")String groups,@Param("ids")String ids);
|
||||
@@ -33,8 +31,7 @@ public interface AsnIpCfgDao extends CrudDao<AsnIpCfg>{
|
||||
public void ajaxDeleteAsnIp(@Param("ids")String ids);
|
||||
public int hasValidAsnIp(@Param("asnId")Long asnNo);
|
||||
public AsnIpCfg getOne(AsnIpCfg cfg);
|
||||
public void updateAsn(@Param("asnId")String asnNo,@Param("organization")String organization,@Param("country")String country,@Param("detail")String detail,@Param("groupId")String groupId);
|
||||
public void updateAsnIpByAsnGroups(@Param("entity")AsnIpCfg entity,@Param("asnGroups")List<AsnGroupInfo> asnGroups,@Param("asnIds")String asnIds);
|
||||
public void deleteAll();
|
||||
public void updateAsn(@Param("asnId")String asnNo,@Param("organization")String organization,@Param("country")String country,@Param("detail")String detail);
|
||||
public List<Object[]> findAllAsnIpCfgList();
|
||||
public int deleteByAsnIdAndIpType(@Param("asnId")String ids,@Param("ipType")Integer ipType);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,9 @@
|
||||
<if test="detail != null">
|
||||
AND r.detail like concat(concat('%',#{detail,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="userRegion1 != null">
|
||||
AND r.user_region1 like concat(concat('%',#{userRegion1,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
@@ -308,26 +311,6 @@
|
||||
AND r.asn_ip_group =#{asnIpGroup}
|
||||
</if>
|
||||
</select>
|
||||
<select id="findAllListByAsnGroup" resultMap="asnIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
from asn_ip_cfg r
|
||||
<where>
|
||||
and is_valid=#{entity.isValid,jdbcType=INTEGER}
|
||||
and is_audit=#{entity.isAudit,jdbcType=INTEGER}
|
||||
<if test=" asnGroups != null">
|
||||
and r.user_region1 in
|
||||
<foreach collection ="asnGroups" item="asnGroup" separator ="," open="(" close=")">
|
||||
#{asnGroup.asnId,jdbcType=INTEGER}
|
||||
</foreach >
|
||||
</if>
|
||||
<if test=" asnIds != null and asnIds !=''">
|
||||
and r.user_region1 in (select asn_id from asn_group_info where asn_id in(${asnIds}) and is_used=0)
|
||||
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
<select id="getByIds" resultMap="asnIpCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
@@ -560,7 +543,7 @@
|
||||
delete from asn_ip_cfg where asn_ip_group in (${ids})
|
||||
</update>
|
||||
<update id="updateAsn" parameterType="java.lang.String" >
|
||||
update asn_ip_cfg set organization=#{organization}, country=#{country}, detail=#{detail},user_region1 =#{asnId} where asn_ip_group =#{groupId} and is_valid=0
|
||||
update asn_ip_cfg set organization=#{organization}, country=#{country}, detail=#{detail} where user_region1 =#{asnId} and is_valid=0
|
||||
</update>
|
||||
<select id="findOtherIps" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
||||
select 1 from asn_ip_cfg where is_valid=1 and asn_ip_group=#{groupId} and cfg_id !=#{cfgId} limit 1
|
||||
@@ -647,34 +630,20 @@
|
||||
<!-- left join policy_group_info d on r.asn_ip_group = d.service_group_id -->
|
||||
where r.CFG_ID in (${ids})
|
||||
</select>
|
||||
<update id="updateAsnIpByAsnGroups" >
|
||||
update asn_ip_cfg set
|
||||
<if test=" asnIds != null and asnIds !=''">
|
||||
is_valid=#{entity.isValid} ,
|
||||
is_audit=#{entity.isAudit},
|
||||
</if>
|
||||
AUDITOR_ID = #{entity.auditorId,jdbcType=INTEGER}
|
||||
,AUDIT_TIME = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<where>
|
||||
<if test=" asnGroups != null">
|
||||
and user_region1 in
|
||||
<foreach collection ="asnGroups" item="asnGroup" separator ="," open="(" close=")">
|
||||
#{asnGroup.asnId,jdbcType=INTEGER}
|
||||
</foreach >
|
||||
</if>
|
||||
<if test=" asnIds != null and asnIds !=''">
|
||||
and user_region1 in (select asn_id from asn_group_info where asn_id in(${asnIds}) and is_used=0)
|
||||
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<delete id="deleteAll" >
|
||||
delete from asn_ip_cfg
|
||||
</delete>
|
||||
|
||||
<select id="findAllAsnIpCfgList" resultType="map">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
from asn_ip_cfg r
|
||||
where r.is_valid !=-1
|
||||
</select>
|
||||
<delete id="deleteByAsnIdAndIpType" >
|
||||
delete from asn_ip_cfg
|
||||
<where>
|
||||
and user_region1 in(${asnId})
|
||||
<if test="ipType != null" >
|
||||
and ip_type = #{ipType,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -26,5 +26,4 @@ public interface PolicyGroupInfoDao extends CrudDao<PolicyGroupInfo> {
|
||||
PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo);
|
||||
|
||||
List<PolicyGroupInfo> findPolicyByGroupInfoList(@Param("ids")String ids);
|
||||
List<PolicyGroupInfo> findPolicyGroupInfosByTypeForUD(@Param("groupType")Integer groupType,@Param("flag")Integer flag);
|
||||
}
|
||||
@@ -266,14 +266,6 @@
|
||||
WHERE
|
||||
r.group_id IN (${ids})
|
||||
</select>
|
||||
|
||||
<select id="findPolicyGroupInfosByTypeForUD" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM policy_group_info r
|
||||
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
|
||||
<if test="flag!=null and flag != ''">
|
||||
and ud_flag=#{flag}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.nis.web.dao.basics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.UrlCommGroupCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface UrlCommGroupDao extends CrudDao<UrlCommGroupCfg>{
|
||||
|
||||
// 查询列表
|
||||
public List<UrlCommGroupCfg> findAllPageList(UrlCommGroupCfg entity);
|
||||
|
||||
public List<UrlCommGroupCfg> findByPage(@Param("ids")String ids);
|
||||
|
||||
public List<UrlCommGroupCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
|
||||
//新增
|
||||
public int insertUrlCommGroupCfg(UrlCommGroupCfg entity);
|
||||
|
||||
public Integer findUrlUdFlag(@Param("groupId")Integer groupId);
|
||||
|
||||
public int updateUrlUdFlag(@Param("groupId")Integer groupId,@Param("udFlag")Integer udFlag);
|
||||
|
||||
//修改
|
||||
public int update(UrlCommGroupCfg entity);
|
||||
|
||||
//删除
|
||||
public int delete(@Param("ids")String ids);
|
||||
|
||||
public List<UrlCommGroupCfg> getByIds(@Param("ids")String ids);
|
||||
|
||||
|
||||
public Integer getGroupIdCount(@Param("groupId")String groupId);
|
||||
|
||||
}
|
||||
@@ -1,388 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.basics.UrlCommGroupDao">
|
||||
<resultMap id="urlCommGroupCfgMap" type="com.nis.domain.basics.UrlCommGroupCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
|
||||
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
|
||||
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
|
||||
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findAllPageList" parameterType="com.nis.domain.basics.UrlCommGroupCfg" resultMap="urlCommGroupCfgMap">
|
||||
SELECT
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
|
||||
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
|
||||
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
|
||||
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5,
|
||||
s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
|
||||
FROM
|
||||
http_url_cfg r
|
||||
LEFT JOIN sys_user s ON r.creator_id = s.id
|
||||
LEFT JOIN sys_user e ON r.editor_id = e.id
|
||||
LEFT JOIN sys_user u ON r.auditor_id = u.id
|
||||
LEFT JOIN policy_group_info c ON c.service_group_id=r.user_region3
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="cfgKeywords != null and cfgKeywords != ''">
|
||||
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="cfgRegionCode != null">
|
||||
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName !=''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="createTime != null and createTime !=''">
|
||||
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editorName != null and editorName !=''">
|
||||
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editTime != null and editTime !='' ">
|
||||
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName !=''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime !=''">
|
||||
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify !=''">
|
||||
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute !=''">
|
||||
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable !=''">
|
||||
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
|
||||
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.is_audit,r.create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="findByPage" resultMap="urlCommGroupCfgMap">
|
||||
SELECT
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
|
||||
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
|
||||
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
|
||||
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5,
|
||||
s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
|
||||
FROM
|
||||
http_url_cfg r
|
||||
LEFT JOIN sys_user s ON r.creator_id = s.id
|
||||
LEFT JOIN sys_user e ON r.editor_id = e.id
|
||||
LEFT JOIN sys_user u ON r.auditor_id = u.id
|
||||
where r.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
<select id="findInfoByCfgId" resultMap="urlCommGroupCfgMap">
|
||||
SELECT
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
|
||||
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
|
||||
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
|
||||
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5
|
||||
FROM
|
||||
http_url_cfg r
|
||||
where r.CFG_ID =#{cfgId}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="get" resultMap="urlCommGroupCfgMap">
|
||||
SELECT
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
|
||||
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
|
||||
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
|
||||
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5
|
||||
from http_url_cfg r
|
||||
where r.cfg_id=#{cfgId}
|
||||
</select>
|
||||
|
||||
<insert id="insertUrlCommGroupCfg" parameterType="com.nis.domain.basics.UrlCommGroupCfg">
|
||||
insert into http_url_cfg (
|
||||
CFG_DESC,
|
||||
cfg_keywords,
|
||||
action,
|
||||
is_valid,
|
||||
is_audit,
|
||||
creator_id,
|
||||
create_time,
|
||||
editor_id,
|
||||
edit_time,
|
||||
auditor_id,
|
||||
audit_time,
|
||||
service_id,
|
||||
request_id,
|
||||
compile_id,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin,
|
||||
area_effective_ids,
|
||||
function_id,
|
||||
cfg_region_code,
|
||||
cfg_type,
|
||||
ratelimit,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{cfgKeywords,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{ratelimit,jdbcType=VARCHAR},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="findUrlUdFlag" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
||||
SELECT ud_flag from policy_group_info
|
||||
where service_group_id=#{groupId}
|
||||
and group_type=11
|
||||
</select>
|
||||
|
||||
<update id="updateUrlUdFlag" parameterType="java.lang.Integer">
|
||||
UPDATE policy_group_info SET ud_flag =#{udFlag}
|
||||
WHERE service_group_id=#{groupId}
|
||||
and group_type=11
|
||||
</update>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.UrlCommGroupCfg" >
|
||||
update http_url_cfg
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgKeywords != null and cfgKeywords != ''" >
|
||||
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="compileId != null and compileId != ''" >
|
||||
compile_id = #{compileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null and classify != ''" >
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''" >
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null and lable != ''" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="exprType != null" >
|
||||
expr_type = #{exprType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="matchMethod != null" >
|
||||
match_method = #{matchMethod,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isHexbin != null" >
|
||||
is_hexbin = #{isHexbin,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null " >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="ratelimit != null and ratelimit != ''" >
|
||||
ratelimit = #{ratelimit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
user_region1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion2 != null and userRegion2 != ''" >
|
||||
user_region2 = #{userRegion2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion3 != null and userRegion3 != ''" >
|
||||
user_region3 = #{userRegion3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion4 != null and userRegion4 != ''" >
|
||||
user_region4 = #{userRegion4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion5 != null and userRegion5 != ''" >
|
||||
user_region5 = #{userRegion5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="java.lang.String" >
|
||||
delete from http_url_cfg where cfg_id in (${ids})
|
||||
</delete>
|
||||
|
||||
<select id="getByIds" resultMap="urlCommGroupCfgMap">
|
||||
select
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
|
||||
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
|
||||
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
|
||||
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5
|
||||
from http_url_cfg r
|
||||
where r.cfg_id in (${ids}) and is_valid !=-1
|
||||
</select>
|
||||
|
||||
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
|
||||
SELECT COUNT(cfg_id) groupCount from http_url_cfg
|
||||
WHERE user_region3= #{groupId}
|
||||
and is_valid=1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -123,6 +123,4 @@ public interface AppCfgDao {
|
||||
|
||||
//app ssl证书特征配置CRUD
|
||||
public List<AppSslCertCfg> findAppBySslList(@Param("ids")String ids);
|
||||
//查找此分组下是否有App IP
|
||||
public List<AppIpCfg> findAppIpByCompileId(@Param("compileId")Integer compileId) ;
|
||||
}
|
||||
|
||||
@@ -3113,7 +3113,4 @@
|
||||
left join request_info ri on r.request_id=ri.id
|
||||
where r.CFG_ID in (${ids})
|
||||
</select>
|
||||
<select id="findAppIpByCompileId" resultMap="AppIpCfgMap">
|
||||
select * from app_ip_cfg where is_valid=1 and compile_Id = #{compileId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,16 +1,34 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.AppByteCfg;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppComplexKeywordCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppFeatureProperties;
|
||||
import com.nis.domain.configuration.AppHeaderCfg;
|
||||
import com.nis.domain.configuration.AppHttpCfg;
|
||||
import com.nis.domain.configuration.AppIdCfg;
|
||||
import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex;
|
||||
import com.nis.domain.configuration.AppInnerRuleCfg;
|
||||
import com.nis.domain.configuration.AppIpCfg;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppSslCertCfg;
|
||||
import com.nis.domain.configuration.AppStringCfg;
|
||||
import com.nis.domain.configuration.AppStringFeatureCfg;
|
||||
import com.nis.domain.configuration.AppTcpCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
|
||||
@@ -41,8 +59,6 @@ public interface AppMultiFeatureCfgDao {
|
||||
//数值类特征配置
|
||||
public List<AppTcpCfg> getAppTcpCfg(@Param("compileId")Integer compileId,
|
||||
@Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode);
|
||||
public List<AppComplexFeatureCfg> getAppComplexFeatureCfgNotRegionCode(@Param("compileId")Integer compileId,
|
||||
@Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode);
|
||||
public int insertAppTcpCfg(AppTcpCfg entity);
|
||||
public void deleteAppTcpCfg(BaseCfg entity);
|
||||
|
||||
@@ -55,11 +71,4 @@ public interface AppMultiFeatureCfgDao {
|
||||
public void deleteAppIpRangeCfg(BaseCfg entity);
|
||||
|
||||
public List<AppFeatureIndex> findAppByFeatureIndexList(@Param("ids")String ids);
|
||||
//App特征属性配置
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfg(@Param("compileId")Integer compileId,
|
||||
@Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode);
|
||||
|
||||
public int insertAppFeaturePropCfg(AppFeatureProperties entity);
|
||||
public void deleteAppFeaturePropCfg(BaseCfg entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -118,12 +118,6 @@
|
||||
<result column="payload_offset" property="payloadOffset" jdbcType="INTEGER" />
|
||||
<result column="payload_size" property="payloadSize" jdbcType="INTEGER" />
|
||||
<result column="payload_packet_direction" property="payloadPacketDirection" jdbcType="VARCHAR" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
|
||||
</resultMap>
|
||||
<!-- APP字符串类配置映射 -->
|
||||
<resultMap id="AppStringFeatureCfgMap" type="com.nis.domain.configuration.AppStringFeatureCfg" >
|
||||
@@ -187,36 +181,6 @@
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="do_log" property="doLog" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<!-- APP 特征属性配置映射 -->
|
||||
<resultMap id="AppFeaturePropCfgMap" type="com.nis.domain.configuration.AppFeatureProperties" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="drop_opt" property="dropOpt" jdbcType="INTEGER" />
|
||||
<result column="loop_opt" property="loopOpt" jdbcType="INTEGER" />
|
||||
<result column="weak_feature" property="weakFeature" jdbcType="VARCHAR" />
|
||||
<result column="whitelist_feature" property="whitelistFeature" jdbcType="VARCHAR" />
|
||||
<result column="extend_scan_pkt_num" property="extendScanPktNum" jdbcType="INTEGER" />
|
||||
<result column="correlation_valid_time" property="correlationValidTime" jdbcType="INTEGER" />
|
||||
<result column="correlation_block_after" property="correlationBlockAfter" jdbcType="VARCHAR" />
|
||||
<result column="long_stream_lock_time" property="longStreamLockTime" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="AppFeaturePropCfg_Column" >
|
||||
r.CFG_ID, r.compile_id,r.function_id,r.service_id,r.request_id,r.is_valid,
|
||||
r.is_audit,r.creator_id,r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,
|
||||
r.drop_opt,r.loop_opt,r.weak_feature,r.whitelist_feature,
|
||||
r.extend_scan_pkt_num,r.correlation_valid_time,r.correlation_block_after,r.long_stream_lock_time
|
||||
</sql>
|
||||
|
||||
<sql id="AppFeatureIndex_Column" >
|
||||
r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT,
|
||||
@@ -242,7 +206,6 @@
|
||||
r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY,
|
||||
r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE,
|
||||
r.DISTRICT,r.CFG_KEYWORDS,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG,
|
||||
r.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5,
|
||||
r.ver,r.ihl,r.tos,r.total_length,r.flags,r.fragment_offset,r.protocol,r.icmp_type,r.icmp_code,r.icmp_identifier,
|
||||
r.header_type,r.payload_offset,r.payload_size,r.payload_packet_direction
|
||||
</sql>
|
||||
@@ -548,16 +511,6 @@
|
||||
AND r.cfg_region_code = #{cfgRegionCode,jdbcType=BIGINT}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getAppComplexFeatureCfgNotRegionCode" resultMap="AppComplexFeatureCfgMap">
|
||||
SELECT
|
||||
<include refid="AppComplexFeatureCfg_Column" />
|
||||
FROM app_complex_feature_cfg r
|
||||
WHERE r.compile_id=#{compileId} and r.function_id=#{functionId}
|
||||
<if test="cfgRegionCode !=null ">
|
||||
AND r.cfg_region_code != #{cfgRegionCode,jdbcType=BIGINT}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 新增app_ip_range子配置 -->
|
||||
<insert id="insertAppIpRangeCfg" parameterType="com.nis.domain.configuration.AppIpCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
@@ -700,39 +653,5 @@
|
||||
where r.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
<insert id="insertAppFeaturePropCfg" parameterType="com.nis.domain.configuration.AppFeatureProperties" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into app_feature_prop_cfg(
|
||||
compile_id,function_id,service_id,request_id,is_valid,
|
||||
is_audit,creator_id,create_time,editor_id,edit_time,auditor_id,
|
||||
audit_time,drop_opt,loop_opt,weak_feature,whitelist_feature,
|
||||
extend_scan_pkt_num,correlation_valid_time,correlation_block_after,long_stream_lock_time
|
||||
)values (
|
||||
#{compileId,jdbcType=INTEGER},#{functionId,jdbcType=INTEGER},#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{dropOpt,jdbcType=INTEGER},#{loopOpt,jdbcType=INTEGER},
|
||||
#{weakFeature,jdbcType=VARCHAR},#{whitelistFeature,jdbcType=VARCHAR},#{extendScanPktNum,jdbcType=INTEGER},
|
||||
#{correlationValidTime,jdbcType=INTEGER},#{correlationBlockAfter,jdbcType=VARCHAR},
|
||||
#{longStreamLockTime,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<!-- 删除App 特征属性子配置 -->
|
||||
<delete id="deleteAppFeaturePropCfg" >
|
||||
delete from app_feature_prop_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
<!-- 查询特征属性配置列表 -->
|
||||
<select id="getAppFeaturePropCfg" resultMap="AppFeaturePropCfgMap">
|
||||
SELECT
|
||||
<include refid="AppFeaturePropCfg_Column" />
|
||||
FROM app_feature_prop_cfg r
|
||||
WHERE r.compile_id=#{compileId} and r.function_id=#{functionId}
|
||||
<if test="cfgRegionCode !=null ">
|
||||
AND r.cfg_region_code = #{cfgRegionCode,jdbcType=BIGINT}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -777,55 +777,66 @@
|
||||
|
||||
</update>
|
||||
<update id="auditCfgBatch">
|
||||
<if test="tableName != 'config_group_info'" >
|
||||
update ${tableName} set is_audit = #{entity.isAudit,jdbcType=INTEGER},
|
||||
auditor_id = #{entity.auditorId,jdbcType=INTEGER},
|
||||
audit_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="entity.isValid != null" >
|
||||
,is_valid = #{entity.isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
,cancel_request_id = #{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<where>
|
||||
<choose>
|
||||
<when test="tableName == 'app_ip_cfg'">
|
||||
and user_region1 in
|
||||
<choose>
|
||||
<when test="tableName == 'config_group_info'" >
|
||||
update ${tableName} set is_issued = #{entity.isValid,jdbcType=INTEGER},
|
||||
update_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<where>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'asn_ip_cfg'">
|
||||
and asn_ip_group in
|
||||
</where>
|
||||
</when>
|
||||
<when test="tableName == 'asn_group_info'" >
|
||||
update ${tableName} set is_valid = #{entity.isValid,jdbcType=INTEGER}
|
||||
<where>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'pxy_obj_trusted_ca_crl'">
|
||||
and cert_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<otherwise>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</if>
|
||||
<if test="tableName == 'config_group_info'" >
|
||||
update ${tableName} set is_issued = #{entity.isAudit,jdbcType=INTEGER},
|
||||
update_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<where>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
</where>
|
||||
</when>
|
||||
<otherwise>
|
||||
update ${tableName} set is_audit = #{entity.isAudit,jdbcType=INTEGER},
|
||||
auditor_id = #{entity.auditorId,jdbcType=INTEGER},
|
||||
audit_time = #{entity.auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="entity.isValid != null" >
|
||||
,is_valid = #{entity.isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
,cancel_request_id = #{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<where>
|
||||
<choose>
|
||||
<when test="tableName == 'app_ip_cfg'">
|
||||
and user_region1 in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'asn_ip_cfg'">
|
||||
and region_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<when test=" tableName == 'pxy_obj_trusted_ca_crl'">
|
||||
and cert_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</when >
|
||||
<otherwise>
|
||||
and compile_id in
|
||||
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
|
||||
#{compileId}
|
||||
</foreach>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</update>
|
||||
<update id="deleteHttpUrlCfg">
|
||||
update ${tableName} set is_valid =-1,is_audit = 0,
|
||||
|
||||
@@ -97,6 +97,7 @@ public interface ConfigSynchronizationDao {
|
||||
public List<ComplexkeywordCfg> getComplexStrListByService(BaseCfg entity);
|
||||
public List<IpPortCfg> getAppIpPortList(@Param("tableName")String tableName,@Param("compileIds")List compileIds);
|
||||
public List<AppIpCfg> getAppIpFeatureList(BaseCfg entity);
|
||||
public List<AppIpCfg> getAsnIpList(BaseCfg entity);
|
||||
|
||||
public void updateCfgStatus(BaseCfg entity);
|
||||
|
||||
|
||||
@@ -777,7 +777,7 @@
|
||||
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.area_effective_ids,a.function_id,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
,a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.pps_threadshold,
|
||||
a.antiddos_protocol,a.bps_threadshold,a.do_blacklist
|
||||
a.antiddos_protocol,a.bps_threadshold
|
||||
</sql>
|
||||
<sql id="IpCfg_Column" >
|
||||
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port,
|
||||
@@ -813,9 +813,9 @@
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.compile_id
|
||||
</sql>
|
||||
<sql id="DigestCfg_Column" >
|
||||
a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time,
|
||||
a.cfg_id,a.cfg_desc,a.cfg_type,a.raw_len,a.digest,a.cfds_level,a.file_url,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time,
|
||||
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.area_effective_ids,a.function_id,a.do_log,a.user_region1,a.user_region2,
|
||||
a.area_effective_ids,a.function_id,a.do_log,a.user_region1,a.user_region2
|
||||
</sql>
|
||||
<sql id="PxyObjTrustedCaCertColumns">
|
||||
a.cfg_id,a.cfg_desc
|
||||
@@ -1062,7 +1062,7 @@
|
||||
SELECT
|
||||
<include refid="DigestCfg_Column" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,u.name as auditor_name
|
||||
s.name as creator_name,u.name as auditor_name
|
||||
</trim>
|
||||
FROM file_digest_cfg a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
@@ -1124,30 +1124,6 @@
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getAsnIpList" resultType="com.nis.domain.basics.AsnIpCfg">
|
||||
SELECT
|
||||
<include refid="AsnIpCfg_Column" />
|
||||
FROM asn_ip_cfg a
|
||||
<where>
|
||||
a.is_valid!=-1
|
||||
<if test="isAudit != null">
|
||||
AND a.is_audit=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
and a.asn_ip_group in
|
||||
<foreach collection="asnGroupIds" index="index" item="groupId" open="(" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
<!-- <if test="compileId != null">
|
||||
AND a.compile_id =#{compileId}
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.function_id =#{functionId}
|
||||
</if>
|
||||
<if test="serviceId!= null">
|
||||
AND a.service_id =#{serviceId}
|
||||
</if> -->
|
||||
</where>
|
||||
</select>
|
||||
<select id="getStrList" resultMap="stringCfgMap" >
|
||||
SELECT
|
||||
<include refid="StrCfg_Column" />
|
||||
@@ -1260,7 +1236,7 @@
|
||||
AND a.compile_id=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
and a.is_valid!=-1
|
||||
and (cert_id is null or cert_id == 0)
|
||||
and (cert_id is null or cert_id = 0)
|
||||
</trim>
|
||||
ORDER BY a.CFG_ID
|
||||
</select>
|
||||
@@ -1625,6 +1601,39 @@
|
||||
</trim>
|
||||
ORDER BY a.CFG_ID
|
||||
</select>
|
||||
<select id="getAsnIpList" resultType="com.nis.domain.basics.AsnIpCfg" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
select
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
|
||||
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
|
||||
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
|
||||
a.region_id,a.is_area_effective,a.classify,a.attribute,a.lable
|
||||
,a.area_effective_ids,a.function_id,a.cfg_region_code,a.asn_ip_group,a.user_region1
|
||||
,a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.organization,a.country,a.detail,a.compile_id
|
||||
from ${tableName} a
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="serviceId != null">
|
||||
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND a.action=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND a.is_valid=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND a.is_audit=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND a.compile_id=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
and a.is_valid!=-1
|
||||
</trim>
|
||||
ORDER BY a.CFG_ID
|
||||
</select>
|
||||
|
||||
<select id="getSpoofingIpPoolList" resultType="com.nis.domain.configuration.PxyObjSpoofingIpPool" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
|
||||
@@ -193,6 +193,9 @@
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.DdosIpCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into ddos_ip_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsKeywordCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
/**
|
||||
* @ClassName:DnsKeyworkCfgDao
|
||||
* @Description:TODO(这里用一句话描述这个类的作用)
|
||||
* @author zdx
|
||||
* @date 2019年2月15日 下午5:55:26
|
||||
* @version V1.0
|
||||
*/
|
||||
@MyBatisDao
|
||||
public interface DnsKeywordCfgDao extends CrudDao<DnsKeywordCfg>{
|
||||
public void saveDnsKeywordsCfg(ComplexkeywordCfg entity);
|
||||
public List<DnsKeywordCfg> findPage(DnsKeywordCfg entity);
|
||||
public List<DnsKeywordCfg> getByIds(@Param("ids")String ids);
|
||||
public void delete(@Param("ids")String ids);
|
||||
}
|
||||
@@ -1,340 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.configuration.DnsKeywordCfgDao" >
|
||||
|
||||
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
|
||||
<result column="do_log" property="doLog" jdbcType="INTEGER" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
<result column="source_compile_id" property="sourceCompileId" jdbcType="INTEGER" />
|
||||
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
|
||||
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="expr_type " property="exprType" jdbcType="INTEGER" />
|
||||
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
|
||||
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="dnsKeywordCfgMap" type="com.nis.domain.configuration.DnsKeywordCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
|
||||
<result column="district" property="district" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="expr_type " property="exprType" jdbcType="INTEGER" />
|
||||
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
|
||||
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="configIndexColumn" >
|
||||
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id,
|
||||
a.do_blacklist
|
||||
</sql>
|
||||
<sql id="ipCfgColumn" >
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
|
||||
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
|
||||
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
|
||||
a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable
|
||||
,a.area_effective_ids,a.function_id,a.cfg_region_code
|
||||
</sql>
|
||||
<sql id="strCfgColumn" >
|
||||
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,
|
||||
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
|
||||
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
|
||||
</sql>
|
||||
<sql id="complexCfgColumn" >
|
||||
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,a.district,a.user_region1,
|
||||
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
|
||||
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
|
||||
</sql>
|
||||
|
||||
<!-- dns域名查询 -->
|
||||
<select id="findPage" resultMap="dnsKeywordCfgMap" parameterType="com.nis.domain.configuration.DnsKeywordCfg">
|
||||
SELECT
|
||||
<include refid="complexCfgColumn" />
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
FROM dns_domain_cfg a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
where service_id=-2 and function_id=#{functionId}
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
and a.cfg_type =#{cfgType,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</select>
|
||||
<select id="get" resultMap="dnsKeywordCfgMap">
|
||||
select
|
||||
<include refid="complexCfgColumn"></include>
|
||||
from dns_domain_cfg a
|
||||
where a.cfg_id=#{cfgId}
|
||||
</select>
|
||||
<select id="getByIds" resultMap="dnsKeywordCfgMap">
|
||||
select
|
||||
<include refid="complexCfgColumn"></include>
|
||||
from dns_domain_cfg a
|
||||
where a.cfg_id in (${ids}) and is_valid !=-1
|
||||
</select>
|
||||
<update id="updateCfgValid" parameterType="com.nis.domain.configuration.BaseCfg">
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER},
|
||||
editor_id = #{editorId,jdbcType=INTEGER} ,
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP}
|
||||
<if test="isAudit !=null ">
|
||||
,is_audit = #{isAudit,jdbcType=BIGINT}
|
||||
</if>
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="cfgId !=null ">
|
||||
AND cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId !=null ">
|
||||
AND compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
and function_id=#{functionId,jdbcType=INTEGER}
|
||||
</trim>
|
||||
</update>
|
||||
<update id="auditCfg" parameterType="com.nis.domain.configuration.BaseCfg">
|
||||
update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="isValid != null" >
|
||||
,is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="cfgId !=null ">
|
||||
AND cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId !=null ">
|
||||
AND compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
and function_id=#{functionId,jdbcType=INTEGER}
|
||||
</trim>
|
||||
|
||||
</update>
|
||||
<!-- insert dns_domain_cfg表信息 -->
|
||||
<insert id="saveDnsKeywordsCfg" parameterType="com.nis.domain.configuration.DnsKeywordCfg" >
|
||||
insert into dns_domain_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
district,
|
||||
cfg_keywords,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin,
|
||||
user_region1
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{district,jdbcType=VARCHAR},
|
||||
#{cfgKeywords,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<!-- 删除dns公共组域名配置 -->
|
||||
<delete id="deleteDnsDomainCfg">
|
||||
delete from dns_domain_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
<delete id="delete" parameterType="java.lang.String" >
|
||||
delete from dns_domain_cfg where cfg_id in (${ids})
|
||||
</delete>
|
||||
<update id="update" parameterType="com.nis.domain.configuration.DnsKeywordCfg" >
|
||||
update dns_domain_cfg
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null and classify != ''" >
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''" >
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null and lable != ''" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="district != null" >
|
||||
district = #{district,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgKeywords != null and cfgKeywords != ''" >
|
||||
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgType != null" >
|
||||
cfg_type = #{cfgType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null" >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="exprType != null and exprType != ''" >
|
||||
expr_type = #{exprType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="matchMethod != null" >
|
||||
match_method = #{matchMethod,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isHexbin != null" >
|
||||
is_hexbin = #{isHexbin,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
user_region1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="compileId != null and compileId != ''" >
|
||||
compile_id = #{compileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
18
src/main/java/com/nis/web/dao/configuration/HelpInfoDao.java
Normal file
18
src/main/java/com/nis/web/dao/configuration/HelpInfoDao.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.HelpInfo;
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface HelpInfoDao extends CrudDao<HelpInfo>{
|
||||
public List<HelpInfo> findComment(@Param("fileName")String fileName);
|
||||
public List<HelpInfo> findBakComment(@Param("fileName")String fileName);
|
||||
public List<HelpInfo> findAllComment();
|
||||
public void saveHelpInfo(HelpInfo helpInfo);
|
||||
}
|
||||
34
src/main/java/com/nis/web/dao/configuration/HelpInfoDao.xml
Normal file
34
src/main/java/com/nis/web/dao/configuration/HelpInfoDao.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.configuration.HelpInfoDao">
|
||||
|
||||
<resultMap id="helpInfoMap" type="com.nis.domain.configuration.HelpInfo" >
|
||||
<id column="id" property="id" jdbcType="INTEGER"/>
|
||||
<result column="file_name" property="fileName" jdbcType="VARCHAR"/>
|
||||
<result column="file_comment" property="fileComment" jdbcType="VARCHAR"/>
|
||||
<result column="back_file_comment" property="backFileComment" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询帮助文档内容 -->
|
||||
<select id="findComment" parameterType="com.nis.domain.configuration.HelpInfo" resultMap="helpInfoMap">
|
||||
select file_name,file_comment from help_document
|
||||
<if test="fileName != null and fileName != ''">
|
||||
where file_name=#{fileName}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 查询帮助文档上一版内容 -->
|
||||
<select id="findBakComment" parameterType="com.nis.domain.configuration.HelpInfo" resultMap="helpInfoMap">
|
||||
select file_name,back_file_comment from help_document
|
||||
<if test="fileName != null and fileName != ''">
|
||||
where file_name=#{fileName}
|
||||
</if>
|
||||
</select>
|
||||
<!-- 获取帮助文档所有的信息 -->
|
||||
<select id="findAllComment" parameterType="com.nis.domain.configuration.HelpInfo" resultMap="helpInfoMap">
|
||||
select file_name,file_comment,back_file_comment from help_document
|
||||
</select>
|
||||
<!-- 保存修改内容,并备份 -->
|
||||
<update id="saveHelpInfo" parameterType="com.nis.domain.configuration.HelpInfo">
|
||||
update help_document set back_file_comment=file_comment,file_comment=#{fileComment} where file_name=#{fileName};
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -80,7 +80,6 @@
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
<result column="common_group_ids" property="commonGroupIds" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
@@ -199,7 +198,7 @@
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist,a.common_group_ids
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist
|
||||
</sql>
|
||||
<sql id="IpCfg_Column" >
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
@@ -813,7 +812,6 @@
|
||||
user_region5,
|
||||
do_log,
|
||||
do_blacklist
|
||||
,common_group_ids
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -841,8 +839,7 @@
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR},
|
||||
#{doLog,jdbcType=INTEGER},
|
||||
#{doBlackList,jdbcType=INTEGER},
|
||||
#{commonGroupIds,jdbcType=VARCHAR}
|
||||
#{doBlackList,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="saveCfgIndexForBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
@@ -873,8 +870,7 @@
|
||||
user_region4,
|
||||
user_region5,
|
||||
do_log,
|
||||
do_blacklist,
|
||||
common_group_ids
|
||||
do_blacklist
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -902,8 +898,7 @@
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR},
|
||||
#{doLog,jdbcType=INTEGER},
|
||||
#{doBlackList,jdbcType=INTEGER},
|
||||
#{commonGroupIds,jdbcType=VARCHAR}
|
||||
#{doBlackList,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<!-- insert ip_port_cfg表信息 -->
|
||||
@@ -995,7 +990,6 @@
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
do_log = #{doLog,jdbcType=INTEGER},
|
||||
do_blacklist = #{doBlackList,jdbcType=INTEGER},
|
||||
common_group_ids = #{commonGroupIds,jdbcType=VARCHAR},
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
<if test="creatorId != null" >
|
||||
@@ -1063,10 +1057,9 @@
|
||||
<include refid="ConfigIndex_Column" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName,dns.cfg_desc as dns_strategy_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM cfg_index_info a
|
||||
left join dns_res_strategy dns on a.dns_strategy_id=dns.cfg_id
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
|
||||
@@ -806,7 +806,7 @@
|
||||
<include refid="policyColumns"/>
|
||||
FROM
|
||||
ip_reuse_policy_cfg r
|
||||
where r.IS_VALID != -1
|
||||
where (r.IS_VALID != -1 and r.is_audit != 3)
|
||||
and r.user_name =#{userName}
|
||||
</select>
|
||||
|
||||
@@ -815,7 +815,7 @@
|
||||
<include refid="dnatPolicyColumns"/>
|
||||
FROM
|
||||
ip_reuse_dnat_policy a
|
||||
where a.IS_VALID != -1
|
||||
where (a.IS_VALID != -1 and a.is_audit != 3)
|
||||
and a.translated_user_id =#{userName}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.AsnKeywordCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
@@ -25,7 +24,6 @@ public interface StringCfgDao extends CrudDao<BaseStringCfg>{
|
||||
public List<BaseStringCfg> findList(BaseStringCfg entity) ;
|
||||
public int insert(BaseStringCfg entity) ;
|
||||
public int update(BaseStringCfg entity) ;
|
||||
public int updateAsnKeyword(BaseStringCfg entity) ;
|
||||
public int updateValid(BaseStringCfg entity) ;
|
||||
public int audit(BaseStringCfg entity) ;
|
||||
public int getIsValid(@Param("tableName")String tableName,@Param("cfgId")Long id);
|
||||
@@ -48,7 +46,7 @@ public interface StringCfgDao extends CrudDao<BaseStringCfg>{
|
||||
public void deleteByCompileIds(@Param("user")long user,@Param("tableName")String tableName,@Param("compileIds")String compileIds);
|
||||
public List<NtcSubscribeIdCfg> findSubscribeIdCfgListByCfgIndexInfo(CfgIndexInfo entity);
|
||||
public void deleteSubscribeIdCfgByCfgIndexInfo(CfgIndexInfo entity);
|
||||
public void deleteAsnKeyword(BaseCfg entity);
|
||||
public void deleteAsnKeyword(CfgIndexInfo entity);
|
||||
public List<NtcSubscribeIdCfg> findSubscribeIdCfgList(NtcSubscribeIdCfg ntcSubscribeIdCfg);
|
||||
public List<AsnKeywordCfg> findAsnKeywordCfgList(CfgIndexInfo entity);
|
||||
public void saveSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg);
|
||||
@@ -58,6 +56,4 @@ public interface StringCfgDao extends CrudDao<BaseStringCfg>{
|
||||
// 导入配置时数据批量入库使用
|
||||
public void saveStringCfgBatch(BaseStringCfg cfg);
|
||||
public void saveComplexkeywordCfgBatch(ComplexkeywordCfg cfg);
|
||||
|
||||
public List<AsnKeywordCfg> findAsnKeywordCfgByCompileId(@Param("compileIds")String compileIds);
|
||||
}
|
||||
|
||||
@@ -483,95 +483,6 @@
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="updateAsnKeyword" parameterType="com.nis.domain.configuration.BaseStringCfg" >
|
||||
update ${tableName}
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgKeywords != null and cfgKeywords != ''">
|
||||
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
CFG_TYPE=#{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="creatorId != null" >
|
||||
creator_id = #{creatorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="compileId != null" >
|
||||
compile_id = #{compileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null and classify != ''" >
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''" >
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null and lable != ''" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="exprType != null">
|
||||
expr_type=#{exprType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="matchMethod != null">
|
||||
match_method=#{matchMethod,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isHexbin != null">
|
||||
is_hexbin=#{isHexbin,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null" >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
USER_REGION1=#{userRegion1,jdbcType=VARCHAR},
|
||||
USER_REGION2=#{userRegion2,jdbcType=VARCHAR},
|
||||
USER_REGION3=#{userRegion3,jdbcType=VARCHAR},
|
||||
USER_REGION4=#{userRegion4,jdbcType=VARCHAR},
|
||||
USER_REGION5=#{userRegion5,jdbcType=VARCHAR},
|
||||
</trim>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="updateValid" parameterType="com.nis.domain.configuration.BaseStringCfg" >
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
@@ -841,7 +752,7 @@
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
<delete id="deleteAsnKeyword" parameterType="com.nis.domain.configuration.BaseCfg" >
|
||||
<delete id="deleteAsnKeyword" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
delete from asn_keyword_cfg
|
||||
<where>
|
||||
<if test="compileId != null" >
|
||||
@@ -977,8 +888,4 @@
|
||||
#{isHexbin,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<select id="findAsnKeywordCfgByCompileId" resultMap="AsnKeywordMap" >
|
||||
select <include refid="AsnKeywordCfg_Column" /> from asn_keyword_cfg r
|
||||
where r.compile_id in (${compileIds}) and r.is_audit=0 and r.is_valid=0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -134,7 +134,7 @@
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id,
|
||||
a.do_blacklist,a.common_group_ids
|
||||
a.do_blacklist
|
||||
</sql>
|
||||
<sql id="IpCfg_Column" >
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
@@ -490,8 +490,7 @@
|
||||
user_region5,
|
||||
do_log,
|
||||
source_compile_id,
|
||||
do_blacklist,
|
||||
common_group_ids
|
||||
do_blacklist
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -520,8 +519,7 @@
|
||||
#{userRegion5,jdbcType=VARCHAR},
|
||||
#{doLog,jdbcType=INTEGER},
|
||||
#{sourceCompileId,jdbcType=INTEGER},
|
||||
#{doBlackList,jdbcType=INTEGER},
|
||||
#{commonGroupIds,jdbcType=VARCHAR}
|
||||
#{doBlackList,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<!-- insert ip_port_cfg表信息 -->
|
||||
@@ -950,9 +948,6 @@
|
||||
user_region4 = #{userRegion4,jdbcType=VARCHAR},
|
||||
user_region5 = #{userRegion5,jdbcType=VARCHAR},
|
||||
dns_strategy_id = #{dnsStrategyId,jdbcType=INTEGER},
|
||||
<if test="commonGroupIds != null">
|
||||
common_group_ids = #{commonGroupIds,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
|
||||
@@ -15,7 +15,6 @@ public interface ConfigGroupInfoDao extends CrudDao<ConfigGroupInfo>{
|
||||
void insertConfigGroupInfo(ConfigGroupInfo entity);
|
||||
int insertBatch(List<ConfigGroupInfo> list);
|
||||
void updateConfigGroupInfobyGroupId(ConfigGroupInfo entity);
|
||||
void updateAsnOrgGroupByGroupInfo(ConfigGroupInfo entity);
|
||||
ConfigGroupInfo getConfigGroupInfoByGroupId(Integer groupId);
|
||||
@Cacheable(value="asnNoCache",key="#asnNo")
|
||||
ConfigGroupInfo getInfoByAsnNo(@Param("asnId")Long asnNo);
|
||||
@@ -24,9 +23,4 @@ public interface ConfigGroupInfoDao extends CrudDao<ConfigGroupInfo>{
|
||||
//获取asn组织的groupId
|
||||
ConfigGroupInfo getAsnGroupByName(@Param("groupName")String groupName);
|
||||
int delAsnGroup(@Param("groupName")String groupName);
|
||||
void updateIsAuditAll(@Param("groupType")Integer groupType,@Param("isAuditAll")Integer isAuditAll,@Param("groupIds")List groupIds);
|
||||
void updateIsUsed(@Param("groupType")Integer groupType,@Param("isUsed")Integer isUsed,@Param("groupIds")List groupIds);
|
||||
void deleteAllAsnGroup();
|
||||
void insertWithId(ConfigGroupInfo entity);
|
||||
void insertWithoutId(ConfigGroupInfo entity);
|
||||
}
|
||||
|
||||
@@ -10,18 +10,20 @@
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
||||
<result column="group_type" property="groupType" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_audit_all" property="isAuditAll" jdbcType="INTEGER" />
|
||||
<result column="is_used" property="isUsed" jdbcType="INTEGER" />
|
||||
<result column="asn_id" property="asnId" jdbcType="BIGINT" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="columns">
|
||||
id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id,is_audit_all
|
||||
id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||
</sql>
|
||||
<select id="findAllList" resultMap="configGroupInfoMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
from config_group_info
|
||||
where group_type =#{groupType}
|
||||
<where>
|
||||
and group_type =#{groupType}
|
||||
and is_issued =#{isIssued}
|
||||
</where>
|
||||
</select>
|
||||
<select id="findAllListByGroupInfo" resultMap="configGroupInfoMap">
|
||||
select
|
||||
@@ -44,22 +46,14 @@
|
||||
</select>
|
||||
<!-- 新增配置分组信息 -->
|
||||
<insert id="insertConfigGroupInfo" parameterType="com.nis.domain.specific.ConfigGroupInfo" useGeneratedKeys="true">
|
||||
insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type,compile_id,asn_id,is_audit_all,is_used)
|
||||
values(#{id},#{groupId},#{groupName},#{isIssued},#{insertTime},#{groupType},#{compileId},#{asnId},#{isAuditAll},#{isUsed})
|
||||
</insert>
|
||||
<insert id="insertWithoutId" parameterType="com.nis.domain.specific.ConfigGroupInfo" useGeneratedKeys="true">
|
||||
insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type,compile_id,asn_id,is_audit_all,is_used)
|
||||
values(#{id},#{groupId},#{groupName},#{isIssued},#{insertTime},#{groupType},#{compileId},#{asnId},#{isAuditAll},#{isUsed})
|
||||
</insert>
|
||||
<insert id="insertWithId" parameterType="com.nis.domain.specific.ConfigGroupInfo">
|
||||
insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type,compile_id,asn_id,is_audit_all,is_used)
|
||||
values(#{id},#{groupId},#{groupName},#{isIssued},now(),#{groupType},#{compileId},#{asnId},#{isAuditAll},#{isUsed})
|
||||
insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type,compile_id,asn_id)
|
||||
values(#{id},#{groupId},#{groupName},#{isIssued},now(),#{groupType},#{compileId},#{asnId})
|
||||
</insert>
|
||||
<insert id="insertBatch">
|
||||
insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type,compile_id,asn_id,is_audit_all,is_used)
|
||||
insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type,compile_id,asn_id)
|
||||
values
|
||||
<foreach collection ="list" item="info" separator =",">
|
||||
(#{info.id},#{info.groupId},#{info.groupName},#{info.isIssued},now(),#{info.groupType},#{info.compileId},#{info.asnId},#{info.isAuditAll},#{info.isUsed})
|
||||
(#{info.id},#{info.groupId},#{info.groupName},#{info.isIssued},now(),#{info.groupType},#{info.compileId},#{info.asnId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 修改配置分组状态信息 -->
|
||||
@@ -71,16 +65,16 @@
|
||||
where group_id = #{groupId}
|
||||
</update>
|
||||
<select id="getInfoByAsnNo" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Long">
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id,is_audit_all,is_used
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||
from config_group_info c where c.asn_id= #{asnId} and c.group_type=4
|
||||
</select>
|
||||
<!-- 根据groupId查出配置分组信息 -->
|
||||
<select id="getConfigGroupInfoByGroupId" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Integer">
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id,is_audit_all,is_used
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||
from config_group_info where group_id= #{groupId}
|
||||
</select>
|
||||
<select id="getAsnGroupByName" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.String">
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id,is_audit_all,is_used
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||
from config_group_info where group_type=4 and group_name= #{groupName}
|
||||
</select>
|
||||
<!-- <select id="findPolicyGroupInfosByType" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Integer">
|
||||
@@ -96,66 +90,4 @@
|
||||
<delete id="delAsnGroup" parameterType="java.lang.String">
|
||||
delete from config_group_info where group_name=#{groupName} and group_type=4
|
||||
</delete>
|
||||
<update id="updateAsnOrgGroupByGroupInfo" parameterType="com.nis.domain.specific.ConfigGroupInfo">
|
||||
UPDATE config_group_info set is_issued = #{isIssued},update_time=now()
|
||||
<where>
|
||||
<if test="groupType != null">
|
||||
and group_type =#{groupType}
|
||||
</if>
|
||||
<if test="groupId != null ">
|
||||
and group_id =#{groupId}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and group_name =#{groupName}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<update id="updateIsUsed" >
|
||||
UPDATE config_group_info set is_used = #{isUsed},update_time=now()
|
||||
<where>
|
||||
<if test="groupType != null">
|
||||
and group_type =#{groupType}
|
||||
</if>
|
||||
<if test="groupIds != null ">
|
||||
and group_id in
|
||||
<foreach collection ="groupIds" item="groupId" separator ="," open="(" close=")">
|
||||
#{groupId}
|
||||
</foreach >
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<update id="updateIsAuditAll" >
|
||||
UPDATE config_group_info set is_audit_all = #{isAuditAll},update_time=now()
|
||||
<where>
|
||||
<if test="groupType != null">
|
||||
and group_type =#{groupType}
|
||||
</if>
|
||||
<if test="groupIds != null ">
|
||||
and group_id in
|
||||
<foreach collection ="groupIds" item="groupId" separator ="," open="(" close=")">
|
||||
#{groupId}
|
||||
</foreach >
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<update id="update" >
|
||||
UPDATE config_group_info
|
||||
<set>
|
||||
update_time=now(),
|
||||
<if test="groupName != null and groupName != ''">
|
||||
group_name =#{groupName},
|
||||
</if>
|
||||
</set>
|
||||
<where>
|
||||
<if test="groupType != null">
|
||||
and group_type =#{groupType}
|
||||
</if>
|
||||
<if test="groupId != null">
|
||||
and group_id =#{groupId}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<delete id="deleteAllAsnGroup" >
|
||||
delete from config_group_info where group_type=4
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -7,7 +7,6 @@ import java.math.BigDecimal;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -58,7 +57,6 @@ import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.AsnKeywordCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
@@ -67,9 +65,7 @@ import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpReusePolicyCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
@@ -110,7 +106,6 @@ import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.dao.specific.SpecificServiceCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.basics.AsnGroupInfoService;
|
||||
import com.nis.web.service.basics.SysDictInfoService;
|
||||
|
||||
/**
|
||||
@@ -546,33 +541,6 @@ public abstract class BaseService {
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
dstList.add(cfg);
|
||||
}
|
||||
} else if (cfgType == 7) { //ASN关键字配置
|
||||
List<Integer> listGroupId=new ArrayList<>();
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
AsnKeywordCfg asnKeywordCfg = (AsnKeywordCfg)srcList.get(i);
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(asnKeywordCfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
group.setIsCommonGroup(1);//标识为公共组 //TODO 已下发过的组是否还需标记为公共组
|
||||
if(!listGroupId.contains(group.getGroupId())){
|
||||
groupRelationList.add(group);
|
||||
listGroupId.add(group.getGroupId());
|
||||
}
|
||||
|
||||
//****************是否下发域信息*******
|
||||
if("1".equals(asnKeywordCfg.getUserRegion3())){
|
||||
StringCfg cfg = new StringCfg();
|
||||
BeanUtils.copyProperties(asnKeywordCfg, cfg);
|
||||
cfg.setGroupId(group.getGroupId());
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
// 处理配置关键字转译
|
||||
cfg.setCfgKeywords(Constants.ASN_KEY+keywordsEscape(asnKeywordCfg.getCfgKeywords()));
|
||||
dstList.add(cfg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dstList.addAll(srcList);
|
||||
}
|
||||
@@ -1556,7 +1524,7 @@ public abstract class BaseService {
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
cfg.setGroupId(asnIpCfg.getAsnIpGroup());
|
||||
cfg.setRegionId(asnIpCfg.getRegionId());
|
||||
String userRegion = Constants.ASN_REGION_KEY+"=" +Constants.ASN_KEY+ asnIpCfg.getUserRegion1();
|
||||
String userRegion = "ASN_ID=AS" + asnIpCfg.getUserRegion1();
|
||||
cfg.setUserRegion(userRegion);
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setAuditTime(opTime);
|
||||
@@ -1648,6 +1616,7 @@ public abstract class BaseService {
|
||||
}
|
||||
return maatCfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分割并保存
|
||||
* @param regionDict
|
||||
@@ -1890,7 +1859,7 @@ public abstract class BaseService {
|
||||
group.setIssuedIPs(asnGroupAddRegion.getValue()+0l);
|
||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).modifyIssuedIp(group);;
|
||||
}
|
||||
asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES,Constants.OPACTION_POST);
|
||||
asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES);
|
||||
}
|
||||
if(toSendFirstAsnIpCfgs.size()>0) {
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
@@ -1930,7 +1899,7 @@ public abstract class BaseService {
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(info.getValue().get(0).getIsValid());
|
||||
// 设置自定义域
|
||||
String userRegion = Constants.ASN_REGION_KEY+"=" +Constants.ASN_KEY+ info.getKey();
|
||||
String userRegion = "ASN_ID=AS" + info.getKey();
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
|
||||
@@ -2180,7 +2149,7 @@ public abstract class BaseService {
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
if(configGroupInfo.getIsIssued() != null && configGroupInfo.getIsIssued()==0) {//未下发,下发region compile,group.
|
||||
if(configGroupInfo.getIsIssued()==0) {//未下发,下发region compile,group.
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
maatCfg.initDefaultValue();
|
||||
@@ -2226,7 +2195,7 @@ public abstract class BaseService {
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
/*groupReuseCfg.setUserRegion(userRegion);*/
|
||||
/*groupReuseCfg.setServiceId(tempList.get(0).getServiceId());*/
|
||||
groupReuseCfg.setServiceId(tempList.get(0).getServiceId());
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId()));
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
@@ -2241,7 +2210,7 @@ public abstract class BaseService {
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("app协议IP域新增配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,1);
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
logger.info("app协议IP域新增配置响应信息:"+result.getMsg());
|
||||
}else {
|
||||
throw new RuntimeException("Unknown configGroupInfo isIssued value");
|
||||
@@ -2311,7 +2280,7 @@ public abstract class BaseService {
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
/*groupReuseCfg.setUserRegion(userRegion);*/
|
||||
/*groupReuseCfg.setServiceId(tempList.get(0).getServiceId());*/
|
||||
groupReuseCfg.setServiceId(tempList.get(0).getServiceId());
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId()));
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
@@ -2326,7 +2295,7 @@ public abstract class BaseService {
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("app协议IP域新增配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,1);
|
||||
ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json);
|
||||
logger.info("app协议IP域新增配置响应信息:"+result.getMsg());
|
||||
}else {
|
||||
throw new RuntimeException("Unknown configGroupInfo isIssued value");
|
||||
@@ -2371,34 +2340,36 @@ public abstract class BaseService {
|
||||
SqlSession batchSqlSession = null;
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
try{
|
||||
//单独创建一个AppPolicyCfg 并赋值,appPolicyCfgs 中的isValid,isAudit会在 insertAppPolicyCfgForBatch之后改变值
|
||||
AppPolicyCfg app=new AppPolicyCfg();
|
||||
BeanUtils.copyProperties(appPolicyCfgs.get(0), app);
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < appPolicyCfgs.size();index++){
|
||||
AppPolicyCfg _cfg = appPolicyCfgs.get(index);
|
||||
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppPolicyCfgForBatch(_cfg);
|
||||
|
||||
}
|
||||
if(send) {
|
||||
StringBuffer cfgKeywords = new StringBuffer();
|
||||
if (appPolicyCfgs.get(0).getBehavCode() != null) {
|
||||
if (regionDict.getFunctionId().equals(63)) {
|
||||
cfgKeywords.append(Constants.APP_ID_REGION + "=" + appPolicyCfgs.get(0).getAppCode());
|
||||
cfgKeywords.append(Constants.APP_ID_REGION + "=" + app.getAppCode());
|
||||
} else if (regionDict.getFunctionId().equals(407)
|
||||
|| regionDict.getFunctionId().equals(408)) {
|
||||
cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + appPolicyCfgs.get(0).getAppCode());
|
||||
cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + app.getAppCode());
|
||||
}
|
||||
cfgKeywords.append(Constants.KEYWORD_EXPR);
|
||||
cfgKeywords.append(Constants.BEHAV_ID_REGION + "=" + appPolicyCfgs.get(0).getBehavCode());
|
||||
cfgKeywords.append(Constants.BEHAV_ID_REGION + "=" + app.getBehavCode());
|
||||
// appPolicyCfgs.get(0.setCfgKeywords(appPolicyCfgs.get(0.getAppCode()+Constants.KEYWORD_EXPR+appPolicyCfgs.get(0.getBehavCode());
|
||||
} else {
|
||||
if (regionDict.getFunctionId().equals(63)) {
|
||||
cfgKeywords.append(Constants.APP_ID_REGION + "=" + appPolicyCfgs.get(0).getAppCode());
|
||||
cfgKeywords.append(Constants.APP_ID_REGION + "=" + app.getAppCode());
|
||||
} else if (regionDict.getFunctionId().equals(407)
|
||||
|| regionDict.getFunctionId().equals(408)) {
|
||||
cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + appPolicyCfgs.get(0).getAppCode());
|
||||
cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + app.getAppCode());
|
||||
}
|
||||
// entity.setCfgKeywords(entity.getAppCode()+"");
|
||||
}
|
||||
appPolicyCfgs.get(0).setCfgKeywords(cfgKeywords.toString());
|
||||
app.setCfgKeywords(cfgKeywords.toString());
|
||||
}
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
@@ -2410,7 +2381,7 @@ public abstract class BaseService {
|
||||
MaatCfg maatCfg=null;
|
||||
if(send) {
|
||||
if(regionDict.getIsMaat().intValue()==1) {
|
||||
AppPolicyCfg cfg=(AppPolicyCfg) appPolicyCfgs.get(0);
|
||||
AppPolicyCfg cfg=app;
|
||||
cfg.setCompileId(list.get(index).getCompileId());
|
||||
cfg.setRegionId(regionIds.get(index));
|
||||
cfg.setGroupId(groupIds.get(index));
|
||||
@@ -2562,6 +2533,7 @@ public abstract class BaseService {
|
||||
* @param data
|
||||
* @param tableName
|
||||
*/
|
||||
@Deprecated
|
||||
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
||||
public void saveIpBatch(FunctionRegionDict regionDict, FunctionServiceDict serviceDict,List<BaseIpCfg> cfgs, boolean send) {
|
||||
if (regionDict != null) {
|
||||
@@ -2665,6 +2637,8 @@ public abstract class BaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
long start=System.currentTimeMillis();
|
||||
long end=System.currentTimeMillis();
|
||||
if (send) {
|
||||
if(configCompileList.size() > 0) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
@@ -2673,6 +2647,7 @@ public abstract class BaseService {
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
start=System.currentTimeMillis();
|
||||
// 调用服务接口下发配置数据
|
||||
String json = BaseService.gsonToJson(maatBean);
|
||||
if(configCompileList.size()>10) {
|
||||
@@ -2681,8 +2656,11 @@ public abstract class BaseService {
|
||||
logger.info("IP 配置下发配置参数:" + json);
|
||||
}
|
||||
// 调用服务接口下发配置
|
||||
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("IP 配置下发响应信息:" + result.getMsg());
|
||||
end=System.currentTimeMillis();
|
||||
logger.info("IP 配置下发配置耗时:" + (end-start));
|
||||
}else {
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(callbackIpList);
|
||||
@@ -2772,6 +2750,8 @@ public abstract class BaseService {
|
||||
|
||||
}
|
||||
}
|
||||
long start=System.currentTimeMillis();
|
||||
long end=System.currentTimeMillis();
|
||||
if (send && configCompileList.size() > 0) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
@@ -2779,6 +2759,7 @@ public abstract class BaseService {
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
start=System.currentTimeMillis();
|
||||
// 调用服务接口下发配置数据
|
||||
String json = BaseService.gsonToJson(maatBean);
|
||||
if(configCompileList.size()>10) {
|
||||
@@ -2789,6 +2770,8 @@ public abstract class BaseService {
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("字符串配置下发响应信息:" + result.getMsg());
|
||||
end=System.currentTimeMillis();
|
||||
logger.info("字符串配置下发配置耗时:" + (end-start));
|
||||
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
@@ -2901,11 +2884,10 @@ public abstract class BaseService {
|
||||
|
||||
}
|
||||
/**
|
||||
* asn ip分组复用新增[POST],修改[PUT],删除[PUT]
|
||||
* 首次下发直接走maat,公共组第二次下发直接走addCommonRegion,updateCommonRegion,delCommonRegion
|
||||
* asn ip分组复用新增
|
||||
* @param asnIpCfgs
|
||||
*/
|
||||
public void asnIPRegionSendToMaat(List<AsnIpCfg> asnIpCfgs,Integer valid,Integer action) {
|
||||
public void asnIPRegionSendToMaat(List<AsnIpCfg> asnIpCfgs,Integer valid) {
|
||||
logger.warn("asnIPRegionSendToMaat start");
|
||||
long start=System.currentTimeMillis();
|
||||
GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
@@ -2923,20 +2905,19 @@ public abstract class BaseService {
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
if(valid==Constants.VALID_YES) {
|
||||
maatBean.setOpAction(action);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
if(asnIpCfgs.size()<=100) {
|
||||
logger.info("asn ip复用域 "+action+"下发配置参数:"+json);
|
||||
logger.info("asn ip复用域新增配置下发配置参数:"+json);
|
||||
}else {
|
||||
logger.info("asn ip复用域 "+action+" 配置下发region条数:"+asnIpCfgs.size());
|
||||
logger.info("asn ip复用域新增配置下发region条数:"+asnIpCfgs.size());
|
||||
}
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result =ConfigServiceUtil.auditCommonGroupRegionSources(json,action);
|
||||
//logger.info("asn ip复用域 "+action+" 配置响应信息:"+result.getMsg());
|
||||
logger.info("asn ip复用域 "+action+" 配置响应信息:");
|
||||
ToMaatResult result =ConfigServiceUtil.postGroupReuseSources(json);
|
||||
logger.info("asn ip复用域新增配置响应信息:"+result.getMsg());
|
||||
}else {
|
||||
maatBean.setOpAction(action);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
if(asnIpCfgs.size()<=100) {
|
||||
@@ -2946,473 +2927,21 @@ public abstract class BaseService {
|
||||
|
||||
}
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,3);
|
||||
logger.info("asn ip复用域删除配置响应信息:");
|
||||
//logger.info("asn ip复用域删除配置响应信息:"+result.getMsg());
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,3);
|
||||
logger.info("asn ip复用域删除配置响应信息:"+result.getMsg());
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("asnIPRegionSendToMaat finish,cost:"+(end-start));
|
||||
}
|
||||
|
||||
/**
|
||||
* ASN关键字配置处理
|
||||
* @param asnList
|
||||
* @param entity
|
||||
*/
|
||||
public void handleAsn(List<AsnKeywordCfg> asnList,BaseCfg entity) {
|
||||
//无效子配置后,再新增子配置
|
||||
StringCfgDao stringCfgDao=SpringContextHolder.getBean(StringCfgDao.class);
|
||||
stringCfgDao.deleteAsnKeyword(entity);
|
||||
String commonGroupIds="";//公共表存储组织GroupIds
|
||||
if(asnList != null && asnList.size()>0){
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
BeanUtils.copyProperties(entity, asnKeywordCfg,new String[]{"cfgId","cfgRegionCode","cfgType","userRegion1","userRegion2","userRegion3","userRegion4","userRegion5"});
|
||||
asnKeywordCfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
asnKeywordCfg.setIsAudit(entity.getIsAudit());
|
||||
asnKeywordCfg.setIsValid(entity.getIsValid());
|
||||
asnKeywordCfg.setEditTime(entity.getEditTime());
|
||||
asnKeywordCfg.setEditorId(entity.getEditorId());
|
||||
asnKeywordCfg.setExprType(0);
|
||||
asnKeywordCfg.setMatchMethod(3);
|
||||
asnKeywordCfg.setExType("0");
|
||||
asnKeywordCfg.setIsHexbin(0);
|
||||
asnKeywordCfg.setCreateTime(new Date());
|
||||
asnKeywordCfg.setCreatorId(UserUtils.getUser().getId());
|
||||
stringCfgDao.saveStringCfgBatch(asnKeywordCfg);
|
||||
|
||||
commonGroupIds+=asnKeywordCfg.getUserRegion1()+",";//组织GroupId
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(commonGroupIds)){
|
||||
commonGroupIds=commonGroupIds.substring(0, commonGroupIds.length()-1);
|
||||
}
|
||||
/*entity.setCommonGroupIds(commonGroupIds);*/
|
||||
//return entity;
|
||||
}
|
||||
/**
|
||||
* ASN关键字配置处理
|
||||
* @param asnList
|
||||
* @param entity
|
||||
*/
|
||||
public void auditAsnCfg(List<GroupCfg> groupRelationList,List<StringCfg> strRegionList,BaseCfg entity,List<AsnKeywordCfg> asnList){
|
||||
//注意:一条配置是一个分组,keywords=asnNos|userRegion1=groupId|userRegion2=isAuditAll 0 1
|
||||
if(!StringUtil.isEmpty(asnList)){
|
||||
AsnGroupInfoDao asnGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
ConfigGroupInfoDao configGroupInfoDao=SpringContextHolder.getBean(ConfigGroupInfoDao.class);
|
||||
StringCfgDao stringCfgDao=SpringContextHolder.getBean(StringCfgDao.class);
|
||||
//域和分组的关系
|
||||
Map<String,String> groupWithRegion=new HashMap<>();
|
||||
//需要标记为下发全部域的groupId集合
|
||||
List signAuditAllGroupList=new ArrayList<>();
|
||||
//需要标记下发的groupId
|
||||
List isUsedGroupIdList=new ArrayList<>();
|
||||
//所有已被策略引用过的域
|
||||
List<AsnGroupInfo> auditRegionList=new ArrayList<>();
|
||||
//所有未被策略过的域
|
||||
List<AsnGroupInfo> notAuditRegionList=new ArrayList<>();
|
||||
//所有策略所选asn No
|
||||
List<String> asnGroupIdList=new ArrayList<>();
|
||||
//所有未下发过的asnNo
|
||||
List<String> notAuditGroupIdList=new ArrayList<>();
|
||||
//最新的asn域集合
|
||||
List<AsnKeywordCfg> newAsnList=new ArrayList<>();
|
||||
|
||||
//2、记录标记为下发all的groupId|存储组和asnno的关系|记录需要标记为已下发的group
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
//<!-- 是否自动更新ASN NO -->
|
||||
asnKeywordCfg.setUserRegion4(StringUtil.isEmpty(asnKeywordCfg.getUserRegion4()) ? "1":"0");
|
||||
if("1".equals(asnKeywordCfg.getUserRegion4())){ //是否标记为下发ALL
|
||||
signAuditAllGroupList.add(Integer.parseInt(asnKeywordCfg.getUserRegion3()));
|
||||
}
|
||||
groupWithRegion.put(asnKeywordCfg.getUserRegion2(), asnKeywordCfg.getUserRegion3());
|
||||
//需要标记为is_used=1的组织
|
||||
if(!isUsedGroupIdList.contains(Integer.parseInt(asnKeywordCfg.getUserRegion3()))){
|
||||
isUsedGroupIdList.add(Integer.parseInt(asnKeywordCfg.getUserRegion3()));
|
||||
}
|
||||
//需要标记为is_used=1的asn no,根据groupId
|
||||
asnGroupIdList.add(asnKeywordCfg.getUserRegion2());
|
||||
|
||||
AsnKeywordCfg asnCfg=new AsnKeywordCfg();
|
||||
BeanUtils.copyProperties(entity, asnCfg,new String[]{"cfgId","userReigon1","userReigon2","userReigon3","userReigon4","userReigon5"});
|
||||
asnCfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
asnCfg.setCfgId(asnKeywordCfg.getCfgId());
|
||||
asnCfg.setUserRegion1(asnKeywordCfg.getUserRegion1());
|
||||
asnCfg.setUserRegion2(asnKeywordCfg.getUserRegion2());
|
||||
asnCfg.setUserRegion3(asnKeywordCfg.getUserRegion3());
|
||||
asnCfg.setUserRegion4(asnKeywordCfg.getUserRegion4());
|
||||
asnCfg.setUserRegion5(asnKeywordCfg.getUserRegion5());
|
||||
stringCfgDao.updateAsnKeyword(asnCfg);
|
||||
}
|
||||
//3、//根据asnGroupIdList查询所有下发过的ASN NO
|
||||
if(!StringUtil.isEmpty(asnGroupIdList)){
|
||||
auditRegionList=asnGroupInfoDao.findAsnGroupInfoByGroupIds(asnGroupIdList, 1);
|
||||
}
|
||||
//已下发过的asn groupId只需要下发组
|
||||
if(!StringUtil.isEmpty(auditRegionList)){
|
||||
for (AsnGroupInfo asnGroupInfo : auditRegionList) {
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setRegionId(asnGroupInfo.getRegionId());
|
||||
cfg.setGroupId(Integer.parseInt(groupWithRegion.get(asnGroupInfo.getGroupId().toString()))); //组号
|
||||
cfg.setUserRegion3("0"); //是否下发域
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
newAsnList.add(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
//4、查询所有未下发过的 ASN NO
|
||||
if(!StringUtil.isEmpty(asnGroupIdList)){
|
||||
notAuditRegionList=asnGroupInfoDao.findAsnGroupInfoByGroupIds(asnGroupIdList, 0);
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(notAuditRegionList)){
|
||||
for (AsnGroupInfo asnGroupInfo : notAuditRegionList) {
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setCfgType(asnList.get(0).getCfgType());
|
||||
cfg.setCfgKeywords(asnGroupInfo.getAsnId().toString());//关键字
|
||||
cfg.setGroupId(Integer.parseInt(groupWithRegion.get(asnGroupInfo.getGroupId().toString()))); //groupId
|
||||
cfg.setRegionId(asnGroupInfo.getRegionId());//regionid
|
||||
cfg.setUserRegion3("1"); //是否下发域
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
newAsnList.add(cfg);
|
||||
notAuditGroupIdList.add(asnGroupInfo.getGroupId().toString());
|
||||
}
|
||||
}
|
||||
//5、修改所有下发的asn为已下发
|
||||
if(!StringUtil.isEmpty(notAuditGroupIdList)){
|
||||
asnGroupInfoDao.updateIsUsedAndIsValid(notAuditGroupIdList,1,null);
|
||||
}
|
||||
//6、标记组已被策略标记为全部下发
|
||||
if(!StringUtil.isEmpty(signAuditAllGroupList)){
|
||||
configGroupInfoDao.updateIsAuditAll(4, 1,signAuditAllGroupList );
|
||||
}
|
||||
//7、标记组已被策略引用
|
||||
if(!StringUtil.isEmpty(isUsedGroupIdList)){
|
||||
configGroupInfoDao.updateIsUsed(4, 1, isUsedGroupIdList);
|
||||
}
|
||||
//8、maat配置转换
|
||||
if(!StringUtil.isEmpty(newAsnList)){
|
||||
Map<String,List> map = cfgConvert(strRegionList,newAsnList,7,entity,groupRelationList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if(asnList!=null && asnList.size()>0){
|
||||
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
asnNoStr+=asnKeywordCfg.getCfgKeywords()+",";
|
||||
}
|
||||
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
ipCfgDao.auditCfg(cfg);
|
||||
Map<String,List> map = cfgConvert(strRegionList,asnList,7,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
//修改配置选中的ASN NO 和 asn orga是否被策略引用过
|
||||
if(!StringUtil.isEmpty(asnNoStr)){
|
||||
asnNoStr=asnNoStr.substring(0, asnNoStr.length()-1);
|
||||
if(!StringUtil.isEmpty(asnNoStr)){
|
||||
//如果asnGroup由is_use=0,修改为is_use=1;查询asn no下所有未下发的asn ip,并进行下发,走POST接口【暂时不考虑】
|
||||
AsnIpCfgDao asnIpCfgDao=SpringContextHolder.getBean(AsnIpCfgDao.class);
|
||||
AsnIpCfg asnIp=new AsnIpCfg();
|
||||
asnIp.setIsAudit(0);
|
||||
asnIp.setIsValid(0);
|
||||
List<AsnIpCfg> asnIpList=asnIpCfgDao.findAllListByAsnGroup(asnIp, null, asnNoStr);
|
||||
|
||||
//下发asn IP和修改asn ip的状态必须在一个事物中
|
||||
//重新修改下发时间,下发人员信息
|
||||
AsnIpCfg auditAsnIpCfg=new AsnIpCfg();
|
||||
auditAsnIpCfg.setIsAudit(1);
|
||||
auditAsnIpCfg.setAuditTime(new Date());
|
||||
auditAsnIpCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
auditAsnIpCfg.setIsValid(1);
|
||||
auditAllAsnRegionCfg(auditAsnIpCfg, null, asnNoStr);
|
||||
|
||||
AsnGroupInfoDao asnGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
asnGroupInfoDao.updateIsUsed(asnNoStr, 1);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
/**
|
||||
* ASN关键字配置处理 ip地址用
|
||||
* @param asnList
|
||||
* @param entity
|
||||
*/
|
||||
public void auditAsnCfgForIpAddr(List<GroupCfg> groupRelationList,List<StringCfg> strRegionList,BaseCfg entity,List<AsnKeywordCfg> asnList){
|
||||
//注意:一条配置是一个分组,keywords=asnNos|userRegion1=groupId|userRegion2=isAuditAll 0 1
|
||||
if(!StringUtil.isEmpty(asnList)){
|
||||
AsnGroupInfoDao asnGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
ConfigGroupInfoDao configGroupInfoDao=SpringContextHolder.getBean(ConfigGroupInfoDao.class);
|
||||
StringCfgDao stringCfgDao=SpringContextHolder.getBean(StringCfgDao.class);
|
||||
//域和分组的关系
|
||||
Map<String,String> groupWithRegion=new HashMap<>();
|
||||
//需要标记为下发全部域的groupId集合
|
||||
List signAuditAllGroupList=new ArrayList<>();
|
||||
//需要标记下发的groupId
|
||||
List isUsedGroupIdList=new ArrayList<>();
|
||||
//所有已被策略引用过的域
|
||||
List<AsnGroupInfo> auditRegionList=new ArrayList<>();
|
||||
//所有未被策略过的域
|
||||
List<AsnGroupInfo> notAuditRegionList=new ArrayList<>();
|
||||
//所有策略所选asn No
|
||||
List<String> asnGroupIdList=new ArrayList<>();
|
||||
//所有未下发过的asnNo
|
||||
List<String> notAuditGroupIdList=new ArrayList<>();
|
||||
//最新的asn域集合
|
||||
List<AsnKeywordCfg> newAsnList=new ArrayList<>();
|
||||
|
||||
//2、记录标记为下发all的groupId|存储组和asnno的关系|记录需要标记为已下发的group
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
//<!-- 是否自动更新ASN NO -->
|
||||
asnKeywordCfg.setUserRegion4(StringUtil.isEmpty(asnKeywordCfg.getUserRegion4()) ? "1":"0");
|
||||
if("1".equals(asnKeywordCfg.getUserRegion4())){ //是否标记为下发ALL
|
||||
signAuditAllGroupList.add(Integer.parseInt(asnKeywordCfg.getUserRegion3()));
|
||||
}
|
||||
groupWithRegion.put(asnKeywordCfg.getUserRegion2(), asnKeywordCfg.getUserRegion5()); //UserRegion5 ip地址使用组
|
||||
//需要标记为is_used=1的组织
|
||||
if(!isUsedGroupIdList.contains(Integer.parseInt(asnKeywordCfg.getUserRegion3()))){
|
||||
isUsedGroupIdList.add(Integer.parseInt(asnKeywordCfg.getUserRegion3()));
|
||||
}
|
||||
//需要标记为is_used=1的asn no,根据groupId
|
||||
asnGroupIdList.add(asnKeywordCfg.getUserRegion2());
|
||||
|
||||
AsnKeywordCfg asnCfg=new AsnKeywordCfg();
|
||||
BeanUtils.copyProperties(entity, asnCfg,new String[]{"cfgId","userReigon1","userReigon2","userReigon3","userReigon4","userReigon5"});
|
||||
asnCfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
asnCfg.setCfgId(asnKeywordCfg.getCfgId());
|
||||
asnCfg.setUserRegion1(asnKeywordCfg.getUserRegion1());
|
||||
asnCfg.setUserRegion2(asnKeywordCfg.getUserRegion2());
|
||||
asnCfg.setUserRegion3(asnKeywordCfg.getUserRegion3());
|
||||
asnCfg.setUserRegion4(asnKeywordCfg.getUserRegion4());
|
||||
asnCfg.setUserRegion5(asnKeywordCfg.getUserRegion5());
|
||||
stringCfgDao.updateAsnKeyword(asnCfg);
|
||||
}
|
||||
//3、//根据asnGroupIdList查询所有下发过的ASN NO
|
||||
if(!StringUtil.isEmpty(asnGroupIdList)){
|
||||
auditRegionList=asnGroupInfoDao.findAsnGroupInfoByGroupIds(asnGroupIdList, 1);
|
||||
}
|
||||
//已下发过的asn groupId只需要下发组
|
||||
if(!StringUtil.isEmpty(auditRegionList)){
|
||||
for (AsnGroupInfo asnGroupInfo : auditRegionList) {
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setRegionId(asnGroupInfo.getRegionId());
|
||||
cfg.setGroupId(Integer.parseInt(groupWithRegion.get(asnGroupInfo.getGroupId().toString()))); //组号
|
||||
cfg.setUserRegion3("0"); //是否下发域
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
newAsnList.add(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
//4、查询所有未下发过的 ASN NO
|
||||
if(!StringUtil.isEmpty(asnGroupIdList)){
|
||||
notAuditRegionList=asnGroupInfoDao.findAsnGroupInfoByGroupIds(asnGroupIdList, 0);
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(notAuditRegionList)){
|
||||
for (AsnGroupInfo asnGroupInfo : notAuditRegionList) {
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setCfgType(asnList.get(0).getCfgType());
|
||||
cfg.setCfgKeywords(asnGroupInfo.getAsnId().toString());//关键字
|
||||
cfg.setGroupId(Integer.parseInt(groupWithRegion.get(asnGroupInfo.getGroupId().toString()))); //groupId
|
||||
cfg.setRegionId(asnGroupInfo.getRegionId());//regionid
|
||||
cfg.setUserRegion3("1"); //是否下发域
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
newAsnList.add(cfg);
|
||||
notAuditGroupIdList.add(asnGroupInfo.getGroupId().toString());
|
||||
}
|
||||
}
|
||||
//5、修改所有下发的asn为已下发
|
||||
if(!StringUtil.isEmpty(notAuditGroupIdList)){
|
||||
asnGroupInfoDao.updateIsUsedAndIsValid(notAuditGroupIdList,1,null);
|
||||
}
|
||||
//6、标记组已被策略标记为全部下发
|
||||
if(!StringUtil.isEmpty(signAuditAllGroupList)){
|
||||
configGroupInfoDao.updateIsAuditAll(4, 1,signAuditAllGroupList );
|
||||
}
|
||||
//7、标记组已被策略引用
|
||||
if(!StringUtil.isEmpty(isUsedGroupIdList)){
|
||||
configGroupInfoDao.updateIsUsed(4, 1, isUsedGroupIdList);
|
||||
}
|
||||
//8、maat配置转换
|
||||
if(!StringUtil.isEmpty(newAsnList)){
|
||||
Map<String,List> map = cfgConvert(strRegionList,newAsnList,7,entity,groupRelationList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if(asnList!=null && asnList.size()>0){
|
||||
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
asnNoStr+=asnKeywordCfg.getCfgKeywords()+",";
|
||||
}
|
||||
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
ipCfgDao.auditCfg(cfg);
|
||||
Map<String,List> map = cfgConvert(strRegionList,asnList,7,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
//修改配置选中的ASN NO 和 asn orga是否被策略引用过
|
||||
if(!StringUtil.isEmpty(asnNoStr)){
|
||||
asnNoStr=asnNoStr.substring(0, asnNoStr.length()-1);
|
||||
if(!StringUtil.isEmpty(asnNoStr)){
|
||||
//如果asnGroup由is_use=0,修改为is_use=1;查询asn no下所有未下发的asn ip,并进行下发,走POST接口【暂时不考虑】
|
||||
AsnIpCfgDao asnIpCfgDao=SpringContextHolder.getBean(AsnIpCfgDao.class);
|
||||
AsnIpCfg asnIp=new AsnIpCfg();
|
||||
asnIp.setIsAudit(0);
|
||||
asnIp.setIsValid(0);
|
||||
List<AsnIpCfg> asnIpList=asnIpCfgDao.findAllListByAsnGroup(asnIp, null, asnNoStr);
|
||||
|
||||
//下发asn IP和修改asn ip的状态必须在一个事物中
|
||||
//重新修改下发时间,下发人员信息
|
||||
AsnIpCfg auditAsnIpCfg=new AsnIpCfg();
|
||||
auditAsnIpCfg.setIsAudit(1);
|
||||
auditAsnIpCfg.setAuditTime(new Date());
|
||||
auditAsnIpCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
auditAsnIpCfg.setIsValid(1);
|
||||
auditAllAsnRegionCfg(auditAsnIpCfg, null, asnNoStr);
|
||||
|
||||
AsnGroupInfoDao asnGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
asnGroupInfoDao.updateIsUsed(asnNoStr, 1);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置取消时,需要将公共组id发送至服务端
|
||||
* @param maatCfg
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public MaatCfg addKeepGroupList(MaatCfg maatCfg,BaseCfg entity){
|
||||
if(!StringUtil.isEmpty(entity.getCommonGroupIds())){
|
||||
List<GroupCfg> keepGroupList = new ArrayList();
|
||||
String[] orgGroupIds=entity.getCommonGroupIds().split(",");
|
||||
for (int i = 0; i < orgGroupIds.length; i++) {
|
||||
if(!StringUtil.isEmpty(orgGroupIds[i])){
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setGroupId(Integer.parseInt(orgGroupIds[i]));
|
||||
keepGroupList.add(groupCfg);
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(keepGroupList)){
|
||||
maatCfg.setKeepGroupList(keepGroupList);
|
||||
}
|
||||
}
|
||||
return maatCfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共组新增域
|
||||
* @param srcMap
|
||||
* @param isValid
|
||||
* @param cfgType
|
||||
* @param commonType 公共组类型 4 ASN
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<GroupReuseCfg> convertCommonRegion(Map<Integer,List<T>> srcMap,List<GroupReuseCfg> commonGroupList,Integer isValid,Integer cfgType,Integer commonType) {
|
||||
for (Integer groupId : srcMap.keySet()) {
|
||||
GroupReuseCfg groupCfg=new GroupReuseCfg();
|
||||
List<StringCfg> strRegionList=new ArrayList<>();
|
||||
List<IpCfg> ipRegionList=new ArrayList<>();
|
||||
List<NumBoundaryCfg> numRegionList=new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < srcMap.get(groupId).size(); i++) {
|
||||
if (cfgType == 1) {
|
||||
IpCfg cfg = new IpCfg();
|
||||
BaseIpCfg baseIpCfg = (BaseIpCfg)srcMap.get(groupId).get(i);
|
||||
// 区域IP配置,多条IP配置属于同一个分组,其他业务配置IP,一条配置一个分组
|
||||
cfg.setGroupId(groupId);
|
||||
List<IpCfg> cfgs = ipConvert(cfg, baseIpCfg);
|
||||
ipRegionList.addAll(cfgs);
|
||||
|
||||
}
|
||||
if(cfgType==4){
|
||||
// 一条业务配置创建一个分组
|
||||
NumBoundaryCfg cfg = new NumBoundaryCfg();
|
||||
BeanUtils.copyProperties(srcMap.get(groupId).get(i), cfg);
|
||||
cfg.setGroupId(groupId);
|
||||
numRegionList.add(cfg);
|
||||
}
|
||||
if(cfgType==2 || cfgType==3){
|
||||
// 一条业务配置创建一个分组
|
||||
StringCfg cfg = new StringCfg();
|
||||
BaseStringCfg strCfg=(BaseStringCfg)srcMap.get(groupId).get(i);
|
||||
BeanUtils.copyProperties(srcMap.get(groupId).get(i), cfg);
|
||||
cfg.setGroupId(groupId);
|
||||
cfg.setCfgType(strCfg.getCfgType());
|
||||
cfg.setRegionId(cfg.getRegionId());
|
||||
cfg.setAuditTime(strCfg.getAuditTime());
|
||||
cfg.setMatchMethod(strCfg.getMatchMethod());
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setIsHexbin(strCfg.getIsHexbin());
|
||||
cfg.setExprType(strCfg.getExprType());
|
||||
// 处理配置关键字转译
|
||||
if(commonType == 4){
|
||||
cfg.setCfgKeywords(Constants.ASN_KEY+keywordsEscape(cfg.getCfgKeywords()));
|
||||
}else{
|
||||
cfg.setCfgKeywords(keywordsEscape(cfg.getCfgKeywords()));
|
||||
}
|
||||
|
||||
// 增强字符串转换
|
||||
cfg.setDistrict(keywordsEscape(cfg.getDistrict()));
|
||||
strRegionList.add(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
groupCfg.setStrRegionList(strRegionList);
|
||||
groupCfg.setIpRegionList(ipRegionList);
|
||||
groupCfg.setNumRegionList(numRegionList);
|
||||
commonGroupList.add(groupCfg);
|
||||
}
|
||||
return commonGroupList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理IpSpoofing配置导入
|
||||
* @param list
|
||||
* @param cfgIndexInfos
|
||||
* @param send
|
||||
*/
|
||||
@Deprecated
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAndSendSpoofingIpPool(List<? extends BaseCfg> list, List<CfgIndexInfo> cfgIndexInfos, boolean send) {
|
||||
List<BaseIpCfg> ipCfgList = (List<BaseIpCfg>)list;
|
||||
List<Integer> spoofingPoolIds=Lists.newArrayList();
|
||||
@@ -3486,7 +3015,9 @@ public abstract class BaseService {
|
||||
|
||||
index ++;
|
||||
}
|
||||
|
||||
// if (cfgIndexInfos != null && cfgIndexInfos.size() > 0) {
|
||||
// this.saveCfgIndexOf(cfgIndexInfos);
|
||||
// }
|
||||
if(send && spoofingPools.size()>0) {
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(spoofingPools);
|
||||
@@ -3507,33 +3038,6 @@ public abstract class BaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 关键字公共组配置处理
|
||||
* @param entity
|
||||
*/
|
||||
public void auditStrGroupCfg(List<GroupCfg> groupRelationList,BaseCfg entity){
|
||||
// url,跟dns公共组下发时用的组id
|
||||
if(entity!=null&&!StringUtil.isEmpty(entity.getCommonGroupIds())){
|
||||
// maat添加公共组信息
|
||||
String[] orgGroupIds=entity.getCommonGroupIds().split(",");
|
||||
for (int i = 0; i < orgGroupIds.length; i++) {
|
||||
if(!StringUtil.isEmpty(orgGroupIds[i])){
|
||||
List<Integer> listGroupId=new ArrayList<>();
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(Integer.parseInt(orgGroupIds[i]));
|
||||
group.setCompileId(entity.getCompileId());
|
||||
group.setAuditTime(entity.getAuditTime());
|
||||
group.setIsValid(entity.getIsValid()); // '0无效,1有效,-1删除;
|
||||
group.setIsCommonGroup(1); // 标识为公共组 ,已下发过的组是否还需标记为公共组
|
||||
if(!listGroupId.contains(group.getGroupId())){
|
||||
groupRelationList.add(group);
|
||||
listGroupId.add(group.getGroupId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -15,10 +13,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.configuration.AsnKeywordCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
@@ -46,8 +40,6 @@ public class AsnGroupInfoService extends BaseService{
|
||||
private ConfigGroupInfoDao configGroupInfoDao;
|
||||
@Autowired
|
||||
private AsnIpCfgDao asnIpCfgDao;
|
||||
@Autowired
|
||||
private StringCfgDao stringCfgDao;
|
||||
|
||||
/**
|
||||
* @param page
|
||||
@@ -78,261 +70,124 @@ public class AsnGroupInfoService extends BaseService{
|
||||
String country=entity.getCountry().trim().toUpperCase();
|
||||
entity.setOrganization(org);
|
||||
entity.setCountry(country);
|
||||
|
||||
int groupId=0;
|
||||
int onlyGroupId=0;//用于ip地址中下发配置组号
|
||||
//新增
|
||||
if(entity.getGroupId()==null){
|
||||
|
||||
//1、根据信的组织名称,获取组织config_group_info
|
||||
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getAsnGroupByName(entity.getOrganization());
|
||||
if(configGroupInfo ==null){
|
||||
//新增组织
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
groupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(entity.getOrganization());
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setIsAuditAll(0);
|
||||
configGroupInfo.setIsUsed(0);
|
||||
configGroupInfo.setGroupId(groupIds.get(0));
|
||||
configGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
||||
//获取组织
|
||||
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getAsnGroupByName(org);
|
||||
|
||||
if(configGroupInfo==null) {
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,2);
|
||||
if(groupIds.size()>0) {
|
||||
groupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
|
||||
configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(org.toUpperCase());
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setGroupId(groupIds.get(1));
|
||||
configGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
||||
}else {
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
groupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
//新增组号用于ip地址新增业务
|
||||
List<Integer> onlyGroupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(onlyGroupIds.size()>0) {
|
||||
onlyGroupId=onlyGroupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
|
||||
}
|
||||
//新增
|
||||
if(entity.getGroupId()==null){
|
||||
Date createTime=new Date();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
entity.setGroupId(groupId);
|
||||
entity.setOnlyGroupId(onlyGroupId);
|
||||
entity.setOrgGroupId(configGroupInfo.getGroupId());
|
||||
entity.setIsValid(0);
|
||||
//分组已被策略设定为下发全部域,则需要自动下发新增的asno
|
||||
if(configGroupInfo.getIsAuditAll() != null && configGroupInfo.getIsAuditAll().equals(1)){
|
||||
entity.setIsUsed(1);
|
||||
}else{
|
||||
entity.setIsUsed(0);
|
||||
}
|
||||
|
||||
List<Integer> compileIds= ConfigServiceUtil.getId(1,1);
|
||||
if(compileIds.size()>0) {
|
||||
entity.setCompileId(compileIds.get(0));
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn reigon id failed");
|
||||
}
|
||||
List<Integer> regionIds= ConfigServiceUtil.getId(3,1);
|
||||
if(regionIds.size()>0) {
|
||||
entity.setRegionId(regionIds.get(0));
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn reigon id failed");
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
asnGroupInfoDao.insert(entity);
|
||||
//新增,需要判断组是否被标记为全量下发,如果标记则下发新增的,没有不下发
|
||||
if(configGroupInfo.getIsAuditAll() != null
|
||||
&& configGroupInfo.getIsAuditAll().equals(1)
|
||||
&& configGroupInfo.getIsUsed()!= null
|
||||
&& configGroupInfo.getIsUsed().equals(1)){
|
||||
auditAsn(entity,configGroupInfo,Constants.OPACTION_POST);
|
||||
}
|
||||
//修改
|
||||
}else{
|
||||
//查询旧的asn group
|
||||
AsnGroupInfo oldGroup=asnGroupInfoDao.getById(entity.getId());
|
||||
//根据旧的组织名称查询config group info
|
||||
ConfigGroupInfo oldConfigGroupInfo=configGroupInfoDao.getAsnGroupByName(oldGroup.getOrganization());
|
||||
if(oldConfigGroupInfo ==null){
|
||||
//新增组织
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
groupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
oldConfigGroupInfo=new ConfigGroupInfo();
|
||||
oldConfigGroupInfo.setGroupName(entity.getOrganization());
|
||||
oldConfigGroupInfo.setIsIssued(0);
|
||||
oldConfigGroupInfo.setGroupType(4);
|
||||
oldConfigGroupInfo.setIsAuditAll(0);
|
||||
oldConfigGroupInfo.setIsUsed(0);
|
||||
oldConfigGroupInfo.setGroupId(groupIds.get(0));
|
||||
oldConfigGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfoDao.insert(oldConfigGroupInfo);
|
||||
}else{
|
||||
ConfigGroupInfo newConfigGroupInfo=new ConfigGroupInfo();
|
||||
newConfigGroupInfo.setGroupId(oldConfigGroupInfo.getGroupId());
|
||||
newConfigGroupInfo.setId(oldConfigGroupInfo.getId());
|
||||
newConfigGroupInfo.setGroupName(entity.getOrganization());
|
||||
configGroupInfoDao.update(newConfigGroupInfo);
|
||||
long id=entity.getId();
|
||||
AsnGroupInfo group=asnGroupInfoDao.getById(id);
|
||||
int count=asnGroupInfoDao.getCountGroupInfoByName(group.getOrganization());
|
||||
if(count==1&&!group.getOrganization().equalsIgnoreCase(entity.getOrganization())) {
|
||||
configGroupInfoDao.delAsnGroup(group.getOrganization());
|
||||
}
|
||||
ConfigGroupInfo configGroupInfo1=configGroupInfoDao.getAsnGroupByName(entity.getOrganization());
|
||||
if(configGroupInfo1==null) {
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,2);
|
||||
if(groupIds.size()>0) {
|
||||
groupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
configGroupInfo1=new ConfigGroupInfo();
|
||||
configGroupInfo1.setGroupName(entity.getOrganization().toUpperCase());
|
||||
configGroupInfo1.setIsIssued(0);
|
||||
configGroupInfo1.setGroupType(4);
|
||||
configGroupInfo1.setGroupId(groupIds.get(1));
|
||||
configGroupInfo1.setInsertTime(new Date());
|
||||
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo1);
|
||||
}
|
||||
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
entity.setGroupId(groupId);
|
||||
asnGroupInfoDao.update(entity);
|
||||
asnIpCfgDao.updateAsn(String.valueOf(entity.getAsnId()),entity.getOrganization(),entity.getCountry(),entity.getDetail(),String.valueOf(entity.getGroupId()));
|
||||
if(oldConfigGroupInfo.getIsUsed()!= null
|
||||
&& oldConfigGroupInfo.getIsUsed().equals(1)){
|
||||
auditAsn(entity,oldConfigGroupInfo,Constants.OPACTION_PUT);
|
||||
}
|
||||
asnIpCfgDao.updateAsn(String.valueOf(entity.getAsnId()),entity.getOrganization(),entity.getCountry(),entity.getDetail());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public void auditAsn(AsnGroupInfo entity,ConfigGroupInfo group,Integer action){
|
||||
Map<Integer, List<AsnKeywordCfg>> srcMap=new HashMap<>();
|
||||
List srcList=new ArrayList<>();
|
||||
AsnKeywordCfg cfg=new AsnKeywordCfg();
|
||||
cfg.initDefaultValue();
|
||||
// cfg.setGroupId(group.getGroupId());
|
||||
cfg.setGroupId(entity.getOnlyGroupId());// 用于ip地址 asn
|
||||
cfg.setCfgKeywords(entity.getAsnId().toString());
|
||||
cfg.setRegionId(entity.getRegionId());
|
||||
cfg.setCfgType(Constants.NTC_ASN_NUMBER);
|
||||
cfg.setAuditTime(new Date());
|
||||
srcList.add(cfg);
|
||||
// srcMap.put(group.getGroupId(), srcList);
|
||||
srcMap.put(entity.getOnlyGroupId(), srcList);// 用于ip地址 asn
|
||||
GroupReuseAddBean commonGroupBean=new GroupReuseAddBean();
|
||||
List<GroupReuseCfg> commonGroupList=new ArrayList<>();
|
||||
commonGroupList=convertCommonRegion(srcMap,commonGroupList,1,2,4);
|
||||
commonGroupBean.setGroupReuseCfgList(commonGroupList);
|
||||
//如果已经被引用,则修改
|
||||
commonGroupBean.setAuditTime(new Date());
|
||||
commonGroupBean.setCreatorName(UserUtils.getUser().getName());
|
||||
commonGroupBean.setVersion(Constants.MAAT_VERSION);
|
||||
if(entity.getIsUsed() != null && entity.getIsUsed().equals(1)){ //已经被引用过的asn可调用修改region
|
||||
commonGroupBean.setOpAction(action);
|
||||
String json = gsonToJson(commonGroupBean);
|
||||
logger.info("ASN配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json, action);
|
||||
}else{//已经被引用过的asn可调用新增region
|
||||
commonGroupBean.setOpAction(action);
|
||||
String json = gsonToJson(commonGroupBean);
|
||||
logger.info("ASN配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json, action);
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids,String asnIds,String groupIds){
|
||||
public void delete(String ids,String asnIds){
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
List<GroupReuseCfg> commonGroupList=new ArrayList<>();
|
||||
//查询已经被策略引用的asn
|
||||
List<AsnGroupInfo> asnList=asnGroupInfoDao.findAsnGroupInfoByGroupIds(Arrays.asList(groupIds.split(",")), 1);
|
||||
//修改asn为无效,且解除引用
|
||||
asnGroupInfoDao.updateIsUsedAndIsValid(Arrays.asList(groupIds.split(",")), 0, -1);
|
||||
//删除asn下的所有asn IP
|
||||
asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
|
||||
//查询已经被策略引用的asn,需要走取消接口
|
||||
if(!StringUtil.isEmpty(asnList)){
|
||||
Map<Integer, List<AsnKeywordCfg>> srcMap=new HashMap<>();
|
||||
Map<String, Integer> groupIdMap=new HashMap<>();
|
||||
for (AsnGroupInfo asnGroupInfo : asnList) {
|
||||
//查询groupId
|
||||
if(StringUtil.isEmpty(groupIdMap.get(asnGroupInfo.getOrganization()))){
|
||||
ConfigGroupInfo group=configGroupInfoDao.getAsnGroupByName(asnGroupInfo.getOrganization());
|
||||
groupIdMap.put(asnGroupInfo.getOrganization(), group.getGroupId());
|
||||
List<AsnKeywordCfg> list1=new ArrayList<>();
|
||||
AsnKeywordCfg asnCfg=new AsnKeywordCfg();
|
||||
asnCfg.initDefaultValue();
|
||||
asnCfg.setCfgType(Constants.NTC_ASN_NUMBER);
|
||||
asnCfg.setRegionId(asnGroupInfo.getRegionId());
|
||||
asnCfg.setGroupId(group.getGroupId());
|
||||
asnCfg.setIsValid(0);
|
||||
list1.add(asnCfg);
|
||||
srcMap.put(group.getGroupId(), list1);
|
||||
}else{
|
||||
Integer groupId=groupIdMap.get(asnGroupInfo.getOrganization());
|
||||
List list2=srcMap.get(groupId);
|
||||
AsnKeywordCfg asnCfg=new AsnKeywordCfg();
|
||||
asnCfg.initDefaultValue();
|
||||
asnCfg.setCfgType(Constants.NTC_ASN_NUMBER);
|
||||
asnCfg.setRegionId(asnGroupInfo.getRegionId());
|
||||
asnCfg.setGroupId(groupId);
|
||||
asnCfg.setIsValid(0);
|
||||
list2.add(asnCfg);
|
||||
srcMap.put(groupId, list2);
|
||||
List<FunctionServiceDict> dicts=DictUtils.getFunctionServiceDictList(600);
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
}while(result>0);
|
||||
for (String id : ids.split(",")) {
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
AsnGroupInfo entity=asnGroupInfoDao.getById(Integer.parseInt(id));
|
||||
int valid=entity.getIsValid();
|
||||
entity.setIsValid(-1);
|
||||
entity.setId(Long.parseLong(id));
|
||||
asnGroupInfoDao.updateValid(entity);
|
||||
if(asnGroupInfoDao.getCountGroupInfoByName(entity.getOrganization())==0) {
|
||||
configGroupInfoDao.delAsnGroup(entity.getOrganization());
|
||||
}
|
||||
//取消下发过的编译
|
||||
if(valid==1) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(dicts.get(0).getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("asn ip配置取消配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult _result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("asn ip配置取消配置响应信息:"+_result.getMsg());
|
||||
}
|
||||
}
|
||||
commonGroupList=convertCommonRegion(srcMap, commonGroupList, 0, 2,4);
|
||||
GroupReuseAddBean commonGroupBean=new GroupReuseAddBean();
|
||||
commonGroupBean.setGroupReuseCfgList(commonGroupList);
|
||||
commonGroupBean.setAuditTime(new Date());
|
||||
commonGroupBean.setCreatorName(UserUtils.getUser().getName());
|
||||
commonGroupBean.setVersion(Constants.MAAT_VERSION);
|
||||
commonGroupBean.setOpAction(2);
|
||||
String json = gsonToJson(commonGroupBean);
|
||||
logger.info("ASN配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*List<FunctionServiceDict> dicts=DictUtils.getFunctionServiceDictList(600);
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
}while(result>0);
|
||||
for (String id : ids.split(",")) {
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
AsnGroupInfo entity=asnGroupInfoDao.getById(Integer.parseInt(id));
|
||||
int valid=entity.getIsValid();
|
||||
entity.setIsValid(-1);
|
||||
entity.setId(Long.parseLong(id));
|
||||
asnGroupInfoDao.updateValid(entity);
|
||||
if(asnGroupInfoDao.getCountGroupInfoByName(entity.getOrganization())==0) {
|
||||
configGroupInfoDao.delAsnGroup(entity.getOrganization());
|
||||
}
|
||||
//取消下发过的编译
|
||||
if(valid==1) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(dicts.get(0).getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("asn ip配置取消配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult _result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("asn ip配置取消配置响应信息:"+_result.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
public boolean checkIps(String groupIds) {
|
||||
for(String groupId:groupIds.split(",")) {
|
||||
@@ -372,47 +227,15 @@ public class AsnGroupInfoService extends BaseService{
|
||||
public AsnGroupInfo getGroupIdByNameAndASNId(String organization,String country,Long asnId) {
|
||||
return asnGroupInfoDao.getGroupIdByNameAndASNId(organization,country,asnId);
|
||||
}
|
||||
public List<AsnGroupInfo> findAsnGroupInfos() {
|
||||
List<AsnGroupInfo> asnGroupInfos=new ArrayList<>();
|
||||
asnGroupInfos=asnGroupInfoDao.findAsnGroupInfos();
|
||||
return asnGroupInfos;
|
||||
}
|
||||
/**
|
||||
* 初始化asn旧数据信息
|
||||
* @param asnGroupInfos
|
||||
* @param asnNosMap
|
||||
* @return
|
||||
*/
|
||||
public void getGroupList(List<AsnGroupInfo> asnGroupInfoList,List<Map<Long, AsnGroupInfo>> asnNosMap) {
|
||||
for(AsnGroupInfo info:asnGroupInfoList) {
|
||||
////【1】 旧的asn group info
|
||||
////【2】 所有的asn group info
|
||||
////【3】 所有已审核通过的asn group info
|
||||
asnNosMap.get(1).put(info.getAsnId(), info);
|
||||
if(info.getIsValid() ==1){
|
||||
asnNosMap.get(3).put(info.getAsnId(), info);
|
||||
}
|
||||
info.setIsValid(0);
|
||||
info.setIssuedIPs(0l);
|
||||
asnNosMap.get(2).put(info.getAsnId(), info);
|
||||
public Map<Long,AsnGroupInfo> getGroupList() {
|
||||
Map<Long,AsnGroupInfo> map=Maps.newConcurrentMap();
|
||||
for(AsnGroupInfo info:asnGroupInfoDao.findAsnGroupInfos()) {
|
||||
map.put(info.getAsnId(), info);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
public List<AsnGroupInfo> findAsnGroupList(AsnGroupInfo asnGroupInfo){
|
||||
List<AsnGroupInfo> list=asnGroupInfoDao.findAsnGroupInfoByAsnGroup(asnGroupInfo);
|
||||
public List<AsnGroupInfo> findAsnGroupInfoList(AsnGroupInfo entity) {
|
||||
List<AsnGroupInfo> list=asnGroupInfoDao.findAsnGroupInfoList(entity);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 根据compileIds获取所有需要审核通过的asn
|
||||
* @param compileIds
|
||||
* @return
|
||||
*/
|
||||
public List<AsnKeywordCfg> findAsnKeywordCfgByCompileId(String compileIds){
|
||||
List<AsnKeywordCfg> asnKeywordCfgs=stringCfgDao.findAsnKeywordCfgByCompileId(compileIds);
|
||||
return asnKeywordCfgs;
|
||||
}
|
||||
public List<String> findAsnGroupIdByGroupIds(String groupIds){
|
||||
List<String> asGroupIds=asnGroupInfoDao.findAsnGroupIdByGroupIds(groupIds);
|
||||
return asGroupIds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.nis.web.service.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -17,14 +18,11 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
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.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
@@ -34,10 +32,8 @@ import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
@@ -104,8 +100,6 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void update(AsnIpCfg entity){
|
||||
List<AsnIpCfg> auditAsnIpList=new ArrayList<>();
|
||||
List<AsnGroupInfo> auditAsnGroupList=new ArrayList<>();
|
||||
Date editTime=new Date();
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
@@ -120,374 +114,49 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
entity.setCountry(country);
|
||||
entity.setDetail(detail);
|
||||
entity.setCompileId(groupInfo.getCompileId());
|
||||
/**
|
||||
* isvalid=0 and asnNo=false 直接修改
|
||||
* isvalid=0 and asnNo=true 需要下发
|
||||
* isvalid=1 需要下发asnNo下所有的域配置
|
||||
*/
|
||||
/*if(groupInfo.getIsUsed().equals(1) && entity.getIsValid().equals(Constants.VALID_NO)){
|
||||
entity.setAuditTime(editTime);
|
||||
entity.setAuditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_YES);
|
||||
entity.setIsAudit(Constants.AUDIT_YES);
|
||||
auditAsnIpList.add(entity);
|
||||
}
|
||||
if(groupInfo.getIsUsed().equals(1) && entity.getIsValid().equals(Constants.VALID_YES)){
|
||||
entity.setAuditTime(editTime);
|
||||
entity.setAuditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_YES);
|
||||
entity.setIsAudit(Constants.AUDIT_YES);
|
||||
auditAsnGroupList.add(groupInfo);
|
||||
}*/
|
||||
if(entity.getIsValid() ==1){
|
||||
entity.setAuditTime(editTime);
|
||||
entity.setAuditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_YES);
|
||||
entity.setIsAudit(Constants.AUDIT_YES);
|
||||
}else{
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(Constants.VALID_NO);
|
||||
entity.setIsAudit(Constants.VALID_NO);
|
||||
}
|
||||
asnIpCfgDao.update(entity);
|
||||
//ASN下发状态时可以更改,更改之后直接下发
|
||||
if(entity.getIsValid() ==1){
|
||||
auditAsnIpList.add(entity);
|
||||
asnIPRegionSendToMaat(auditAsnIpList,Constants.VALID_YES,Constants.OPACTION_PUT);
|
||||
}
|
||||
//common group 新增下发 ASN IP配置
|
||||
/*if(!StringUtil.isEmpty(auditAsnIpList)){
|
||||
asnIPRegionSendToMaat(auditAsnIpList,Constants.VALID_YES,Constants.OPACTION_POST);
|
||||
}*/
|
||||
|
||||
//common group 修改已下发过的配置,全量下发 ASN NO下的所有有效配置
|
||||
/*if(entity.getIsAudit().equals(Constants.VALID_YES)){
|
||||
auditAllAsnRegionCfg(entity,auditAsnGroupList,null);
|
||||
}*/
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param asnIpCfgs
|
||||
* @param asnIds
|
||||
* @param isImportAll 增量或者全量
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAsnIp(List<AsnIpCfg> asnIpCfgs,String asnIds,String isImportAll){
|
||||
logger.warn("Start to only save asn ip size:"+asnIpCfgs.size());
|
||||
long start=System.currentTimeMillis();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
if(!StringUtil.isEmpty(asnIpCfgs)){
|
||||
//全量时需要删除asn 下的所有ip
|
||||
if("1".equals(isImportAll)){
|
||||
asnIpCfgDao.deleteByAsnId(asnIds);
|
||||
}
|
||||
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for (AsnIpCfg cfg : asnIpCfgs) {
|
||||
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("end only save asn ip finish,cost:"+(end-start));
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditAsnIp(Map<Long, List<AsnIpCfg>> auditAsnIp,List<Map<Long, AsnGroupInfo>> asnNoMaps,String auditType,int auditSize){
|
||||
logger.warn("Start to audit and save asn ip size:"+auditSize);
|
||||
long start=System.currentTimeMillis();
|
||||
Date date=new Date();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
Long asno=0l;
|
||||
List<Long> groupIds=Lists.newArrayList(auditAsnIp.size());
|
||||
List<AsnIpCfg> auditList=new ArrayList<>();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
try{
|
||||
if(!auditAsnIp.isEmpty()){
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
//maat结构配置
|
||||
if(auditType.equals("maat")){
|
||||
//maat参数
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
for (Entry<Long, List<AsnIpCfg>> e:auditAsnIp.entrySet()) {
|
||||
List<GroupCfg> groupRelationList = Lists.newArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
|
||||
//分组信息
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setAuditTime(e.getValue().get(0).getAuditTime());
|
||||
groupCfg.setCompileId(e.getValue().get(0).getCompileId());
|
||||
groupCfg.setGroupId(e.getValue().get(0).getAsnIpGroup());
|
||||
groupCfg.setIsCommonGroup(1);
|
||||
groupCfg.setIsValid(e.getValue().get(0).getIsValid());
|
||||
|
||||
groupRelationList.add(groupCfg);
|
||||
|
||||
//域信息
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(e.getValue(),Constants.VALID_YES,Integer.parseInt(e.getKey()+"")));
|
||||
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(e.getValue().get(0), maatCfg);
|
||||
maatCfg.setAction(e.getValue().get(0).getAction());
|
||||
maatCfg.setAuditTime(e.getValue().get(0).getAuditTime());
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setIsValid(e.getValue().get(0).getIsValid());
|
||||
maatCfg.setCompileId(e.getValue().get(0).getCompileId());
|
||||
// 设置ASN自定义域
|
||||
String userRegion = Constants.ASN_REGION_KEY+"=" +Constants.ASN_KEY+ e.getValue().get(0).getUserRegion1();
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
configCompileList.add(maatCfg);
|
||||
|
||||
groupIds.add(e.getKey());
|
||||
for (AsnIpCfg cfg : e.getValue()) {
|
||||
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(cfg);
|
||||
}
|
||||
//组第一次下发,需要更新已下发过的组中
|
||||
asnNoMaps.get(3).put(Long.valueOf(e.getValue().get(0).getUserRegion1()), asnNoMaps.get(2).get(Long.valueOf(e.getValue().get(0).getUserRegion1())));
|
||||
}
|
||||
|
||||
}else{
|
||||
//复用接口
|
||||
for (Entry<Long, List<AsnIpCfg>> e:auditAsnIp.entrySet()) {
|
||||
groupIds.add(e.getKey());
|
||||
for (AsnIpCfg cfg : e.getValue()) {
|
||||
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(cfg);
|
||||
}
|
||||
auditList.addAll(e.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
//第一次走maat配置的下发,需要将asn组修改为有效
|
||||
if(auditType.equals("maat") && !StringUtil.isEmpty(groupIds)){
|
||||
asnGroupInfoDao.updateIsUsedAndIsValid(groupIds, null, 1);
|
||||
}
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
logger.warn("Start to audit asn ip ");
|
||||
long startAudit=System.currentTimeMillis();
|
||||
if(auditType.equals("maat")){
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(new Date());
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("asn ip maat结构配置下发配置参数:"+json);
|
||||
//logger.info("asn ip maat结构配置下发配置参数:");
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("asn ip maat结构配置下发响应信息:"+result.getMsg());
|
||||
//logger.info("asn ip maat结构配置下发响应信息:");
|
||||
}else{
|
||||
if(!StringUtil.isEmpty(auditList)){
|
||||
asnIPRegionSendToMaat(auditList, 1, Constants.OPACTION_POST);
|
||||
}
|
||||
}
|
||||
long endAutit=System.currentTimeMillis();
|
||||
logger.warn("End to audit asn ip finish,cost:"+(endAutit-startAudit));
|
||||
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("end audit and save asn ip finish,cost:"+(end-start));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param asnNoMaps 所有asn的信息
|
||||
* @param configGroupInfos asn组织的数据库信息
|
||||
* @param asnOrgMap asn和组织的关系
|
||||
* @param isImportAll 是否导入全量
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void processGroup(FunctionServiceDict service,List<Map<Long, AsnGroupInfo>> asnNoMaps,List<Map<String, ConfigGroupInfo>> asnOrgList,String isSend,String isImportAll){
|
||||
public void processGroup(Map<Long,AsnGroupInfo> asnNoMap){
|
||||
logger.warn("Start to save group");
|
||||
long start=System.currentTimeMillis();
|
||||
Map<Long, AsnGroupInfo> deleteAsnCompile=null;
|
||||
Date createTime=new Date();
|
||||
int index=0;
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
int index=0;
|
||||
Integer serviceId=service.getServiceId();
|
||||
Set<String> groupSet=new HashSet<>();
|
||||
try{
|
||||
//1、删除所有asn ip
|
||||
//asnIpCfgDao.deleteAll();
|
||||
//2、删除所有的asn_group_info
|
||||
//asnGroupInfoDao.deleteAll();
|
||||
//3、删除所有的组织信息
|
||||
//configGroupInfoDao.deleteAllAsnGroup();
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
//4、遍历保存所有的config_group_info
|
||||
if(!StringUtil.isEmpty(asnOrgList)){
|
||||
Map<String,ConfigGroupInfo> newOrgMap=asnOrgList.get(0);//【0】 新的config group info
|
||||
Map<String,ConfigGroupInfo> oldOrgMap=asnOrgList.get(1);//【1】 旧的config group info
|
||||
|
||||
//入库旧的asn组织信息
|
||||
/*if(!StringUtil.isEmpty(oldOrgMap)){
|
||||
index=0;
|
||||
for(Entry<String, ConfigGroupInfo> e:oldOrgMap.entrySet()) {
|
||||
ConfigGroupInfo configGroupInfo=e.getValue();
|
||||
configGroupInfo.setIsIssued(0);
|
||||
((ConfigGroupInfoDao) batchSqlSession.getMapper(ConfigGroupInfoDao.class)).insertWithId(configGroupInfo);
|
||||
if(index != 0 && index%Constants.IMPORT_LIMIT==0) {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}*/
|
||||
|
||||
//入库新的asn组织信息
|
||||
if(!StringUtil.isEmpty(newOrgMap)){
|
||||
index=0;
|
||||
List<Integer> groupIds=ConfigServiceUtil.getId(2, newOrgMap.size());
|
||||
for(Entry<String, ConfigGroupInfo> e:newOrgMap.entrySet()) {
|
||||
ConfigGroupInfo configGroupInfo=e.getValue();
|
||||
configGroupInfo.setGroupId(groupIds.get(index));
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setIsUsed(0);
|
||||
configGroupInfo.setIsAuditAll(0);
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setInsertTime(createTime);
|
||||
asnOrgList.get(1).put(configGroupInfo.getGroupName(), configGroupInfo);
|
||||
((ConfigGroupInfoDao) batchSqlSession.getMapper(ConfigGroupInfoDao.class)).insertWithoutId(configGroupInfo);
|
||||
if(index != 0 && index%Constants.IMPORT_LIMIT==0) {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
if(!asnNoMap.isEmpty()) {
|
||||
List<Integer> compileIds=ConfigServiceUtil.getId(1, asnNoMap.size());
|
||||
List<Integer> groupIds=ConfigServiceUtil.getId(2, asnNoMap.size());
|
||||
for(Entry<Long, AsnGroupInfo> e:asnNoMap.entrySet()) {
|
||||
AsnGroupInfo info=e.getValue();
|
||||
info.setAsnId(e.getKey());
|
||||
info.setIsValid(0);
|
||||
info.setCreatorId(UserUtils.getUser().getId());
|
||||
info.setCreateTime(createTime);
|
||||
info.setGroupId(groupIds.get(index));
|
||||
info.setCompileId(compileIds.get(index));
|
||||
if(!groupSet.contains(info.getOrganization())) {
|
||||
groupSet.add(info.getOrganization());
|
||||
}
|
||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).insert(info);
|
||||
if(index%Constants.IMPORT_LIMIT==0) {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
|
||||
//5、遍历保存所有的asn_group_info
|
||||
if(!asnNoMaps.isEmpty()){
|
||||
Map<Long, AsnGroupInfo> newAsnGroup =asnNoMaps.get(0); //【0】 新的asn group info
|
||||
Map<Long, AsnGroupInfo> oldAsnGroup =asnNoMaps.get(1); //【1】 旧的asn group info
|
||||
Map<Long, AsnGroupInfo> allAsnGroup =asnNoMaps.get(2); //【2】 所有的asn group info
|
||||
Map<Long, AsnGroupInfo> auditedAsnNoMap=asnNoMaps.get(3); //【3】已下发的所有asn信息【失效所有的asn 编译】
|
||||
deleteAsnCompile=auditedAsnNoMap;
|
||||
//保存新增的asn 信息
|
||||
if(!newAsnGroup.isEmpty()){
|
||||
index=0;
|
||||
List<Integer> compileIds=ConfigServiceUtil.getId(1, newAsnGroup.size());
|
||||
List<Integer> groupIds=ConfigServiceUtil.getId(2, newAsnGroup.size());
|
||||
List<Integer> regionIds=ConfigServiceUtil.getId(3, newAsnGroup.size());
|
||||
int onlyGroupId=0;//用于ip地址中下发配置组号
|
||||
for(Entry<Long, AsnGroupInfo> e:newAsnGroup.entrySet()) {
|
||||
AsnGroupInfo asnGroupInfo=e.getValue();
|
||||
asnGroupInfo.setAsnId(e.getKey());
|
||||
asnGroupInfo.setIsValid(0);
|
||||
asnGroupInfo.setIsUsed(0);
|
||||
asnGroupInfo.setCreatorId(UserUtils.getUser().getId());
|
||||
asnGroupInfo.setCreateTime(createTime);
|
||||
asnGroupInfo.setGroupId(groupIds.get(index));
|
||||
asnGroupInfo.setCompileId(compileIds.get(index));
|
||||
asnGroupInfo.setRegionId(regionIds.get(index));
|
||||
asnGroupInfo.setOrgGroupId(asnOrgList.get(1).get(asnGroupInfo.getOrganization()).getGroupId());
|
||||
//新增组号用于ip地址新增业务
|
||||
List<Integer> onlyGroupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(onlyGroupIds.size()>0) {
|
||||
onlyGroupId=onlyGroupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
asnGroupInfo.setOnlyGroupId(onlyGroupId);
|
||||
asnNoMaps.get(0).put(e.getKey(), asnGroupInfo);//设置完各种id后更新map数据
|
||||
asnNoMaps.get(2).put(e.getKey(), asnGroupInfo);//设置完各种id后更新map数据
|
||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).insertWithId(asnGroupInfo);
|
||||
if(index != 0 && index%Constants.IMPORT_LIMIT==0) {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
//保存旧的asn信息
|
||||
/*if(!oldAsnGroup.isEmpty()){
|
||||
index=0;
|
||||
for(Entry<Long, AsnGroupInfo> e:oldAsnGroup.entrySet()) {
|
||||
AsnGroupInfo asnGroupInfo=e.getValue();
|
||||
asnGroupInfo.setIsValid(0);
|
||||
asnGroupInfo.setOrgGroupId(asnOrgList.get(1).get(asnGroupInfo.getOrganization()).getGroupId());
|
||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).insertWithoutId(asnGroupInfo);
|
||||
if(index != 0 && index%Constants.IMPORT_LIMIT==0) {
|
||||
batchSqlSession.commit();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
//6、配置取消所有编译[编译取消,编译下的所有group和region都会取消(已和服务端确认)]
|
||||
/*if(!StringUtil.isEmpty(deleteAsnCompile)){
|
||||
long startAudit=System.currentTimeMillis();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(600);
|
||||
for(Entry<Long, AsnGroupInfo> e:deleteAsnCompile.entrySet()) {
|
||||
maatCfg.setCompileId(e.getValue().getCompileId());
|
||||
maatCfg.setServiceId(serviceId);
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
}
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(createTime);
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ASN IP 业务的编译配置全部失效参数:"+json);
|
||||
long auditEnd=System.currentTimeMillis();
|
||||
logger.warn("Cancle all ASN compile finish,cost:"+(auditEnd-startAudit));
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("ASN IP所有编译取消返回结果:"+result.getMsg());
|
||||
long resultEnd=System.currentTimeMillis();
|
||||
logger.warn("Cancle all ASN compile finish,cost:"+(resultEnd-auditEnd));
|
||||
}*/
|
||||
|
||||
batchSaveConfigGroupInfo(groupSet);
|
||||
//刷新缓存
|
||||
//AsnCacheUtils.init(true);
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("Save group finish,cost:"+(end-start));
|
||||
}
|
||||
@@ -503,8 +172,6 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
ConfigGroupInfo configGroupInfo=new ConfigGroupInfo();
|
||||
configGroupInfo.setGroupName(org);
|
||||
configGroupInfo.setIsIssued(0);
|
||||
configGroupInfo.setIsUsed(0);
|
||||
configGroupInfo.setIsAuditAll(0);
|
||||
configGroupInfo.setGroupType(4);
|
||||
configGroupInfo.setInsertTime(new Date());
|
||||
configGroupInfo.setGroupId(groupIds.get(index));
|
||||
@@ -589,12 +256,11 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
sb.deleteCharAt(sb.toString().lastIndexOf(","));
|
||||
asnIpCfgDao.delete(sb.toString());
|
||||
asnIPRegionSendToMaat(entities,Constants.VALID_NO,Constants.OPACTION_PUT);
|
||||
asnIPRegionSendToMaat(entities,Constants.VALID_NO);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAsnIpCfg(CfgIndexInfo entity) {
|
||||
List<AsnIpCfg> auditAsnIpList=new ArrayList<>();
|
||||
Date createTime=new Date();
|
||||
//asn号
|
||||
String userRegion1=entity.getUserRegion1();
|
||||
@@ -635,27 +301,13 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setAsnIpGroup(entity.getAsnIpGroup().intValue());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setRegionId(idList.get(index));
|
||||
//TODO 注意:被策略引用并下发过的ASN NO,配置新增后直接下发【此功能暂时不做自动,asnip拥有审核功能】
|
||||
/*if(asnGroupInfo.getIsUsed().equals(1)){
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(createTime);
|
||||
auditAsnIpList.add(cfg);
|
||||
}else{*/
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
/*}*/
|
||||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
this.save(entity.getAsnIpCfgs());
|
||||
//TODO 注意:被策略引用并下发过的ASN NO,配置新增后直接下发【此功能暂时不做自动,asnip拥有审核功能】
|
||||
/*if(!StringUtil.isEmpty(auditAsnIpList)){
|
||||
asnIPRegionSendToMaat(auditAsnIpList,Constants.VALID_YES,Constants.OPACTION_POST);
|
||||
}*/
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids) {
|
||||
@@ -680,7 +332,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
//已经下发过的,调用分组复用配置删除接口
|
||||
// splitAndSend(issuedList,Constants.VALID_NO);
|
||||
if(issuedList.size() > 0){
|
||||
asnIPRegionSendToMaat(issuedList,Constants.VALID_NO,Constants.OPACTION_PUT);
|
||||
asnIPRegionSendToMaat(issuedList,Constants.VALID_NO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -725,7 +377,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
return asnIpCfgDao.getByIds(ids);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deleteByAsnNo(List<Long> asnNoList) {
|
||||
public void deleteByAsnNo(List<Long> asnNoList,Integer ipType) {
|
||||
// for(Long asnNo:asnNoList) {
|
||||
// int result=0;
|
||||
// do {
|
||||
@@ -745,7 +397,8 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
//result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnIdAndIpType(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1),ipType);
|
||||
}while(result>0);
|
||||
//剔除
|
||||
asnNoList.subList(0, pointsDataLimit).clear();
|
||||
@@ -758,7 +411,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnIdAndIpType(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1),ipType);
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
@@ -770,7 +423,7 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
}
|
||||
int result=0;
|
||||
do {
|
||||
result=asnIpCfgDao.deleteByAsnId(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1));
|
||||
result=asnIpCfgDao.deleteByAsnIdAndIpType(asnNoStr.toString().substring(0,asnNoStr.toString().length()-1),ipType);
|
||||
}while(result>0);
|
||||
asnNoList.clear();
|
||||
}
|
||||
@@ -788,143 +441,124 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditIpBatch(List<AsnIpCfg> asnIpCfgs,Long asn,Integer isValid) {
|
||||
List<AsnGroupInfo> auditAsnGroupList=new ArrayList<>();
|
||||
public void auditIpBatch(Map<Long,List<AsnIpCfg>> data,Integer isValid) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
final SqlSession batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
Integer serviceId=0;
|
||||
try{
|
||||
if(!StringUtil.isEmpty(asnIpCfgs)){
|
||||
serviceId=asnIpCfgs.get(0).getServiceId();
|
||||
int issuedNum=asnIpCfgs.size();
|
||||
for(int index = 0; index < asnIpCfgs.size();index++){
|
||||
AsnIpCfg t = asnIpCfgs.get(index);
|
||||
BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
BeanUtils.copyProperties(t, ipCfg);
|
||||
ipCfg.setTableName(AsnIpCfg.getTablename());
|
||||
((IpCfgDao) batchSqlSession.getMapper(IpCfgDao.class)).audit(ipCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
AsnGroupInfo asnGroupInfo=new AsnGroupInfo();
|
||||
asnGroupInfo.setAsnId(asn);
|
||||
asnGroupInfo=asnGroupInfoDao.getInfoByAsnNo(asnGroupInfo);
|
||||
Integer groupId=asnGroupInfo.getGroupId();
|
||||
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
if(isValid==Constants.VALID_YES) {//审核通过
|
||||
if(asnGroupInfo.getIsValid()==0) {//ans组未下发过,下发编译配置
|
||||
asnGroupInfo.setIsValid(1);
|
||||
asnGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
asnGroupInfo.setEditTime(new Date());
|
||||
asnGroupInfo.setIssuedIPs(issuedNum+0L);
|
||||
asnGroupInfoDao.updateValid(asnGroupInfo);
|
||||
maatCfg.initDefaultValue();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
groupCfg.setGroupId(groupId);
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
//asnGroupId标记为公共组
|
||||
groupCfg.setIsCommonGroup(1);
|
||||
groupCfg.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
BeanUtils.copyProperties(asnIpCfgs.get(0), maatCfg);
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(asnIpCfgs,Constants.VALID_YES,groupId));
|
||||
maatCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
maatCfg.setAction(asnIpCfgs.get(0).getAction());
|
||||
maatCfg.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(isValid);
|
||||
// 设置ASN自定义域
|
||||
String userRegion = Constants.ASN_REGION_KEY+"=" +Constants.ASN_KEY+ asnIpCfgs.get(0).getUserRegion1();
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatBean.setCreatorName(asnIpCfgs.get(0).getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
// 调用服务接口下发配置数据
|
||||
String json = gsonToJson(maatBean);
|
||||
logger.info("ASN IP配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ASN IP配置下发响应信息:" + result.getMsg());
|
||||
}else if(asnGroupInfo.getIsValid()==1){//已经下发过,走分组复用
|
||||
asnGroupInfo.setIssuedIPs(issuedNum+0l);
|
||||
asnGroupInfoDao.update(asnGroupInfo);
|
||||
asnIPRegionSendToMaat(asnIpCfgs,isValid,Constants.OPACTION_POST);
|
||||
}else {
|
||||
throw new RuntimeException("asnGroupInfo isValid value is "+asnGroupInfo.getIsValid());
|
||||
}
|
||||
}else if(isValid==Constants.VALID_NO) {//取消审核通过
|
||||
asnGroupInfo.setIssuedIPs(0L-issuedNum);
|
||||
asnGroupInfoDao.update(asnGroupInfo);
|
||||
|
||||
//如果一个asn组下没有IP了,修改有效状态,并且删除
|
||||
if(hasValidAsnIp(asn)) {
|
||||
//已经下发过的,调用分组复用配置删除接口
|
||||
GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(asnIpCfgs,Constants.VALID_NO,groupId));
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
groupReuseCfg.setNumRegionList(numRegionList);
|
||||
groupReuseList.add(groupReuseCfg);
|
||||
maatBean.setGroupReuseCfgList(groupReuseList);
|
||||
maatBean.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatBean.setCreatorName(asnIpCfgs.get(0).getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ASN IP域删除配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,3);
|
||||
logger.info("ASN IP域删除配置响应信息:"+result.getMsg());
|
||||
}else{
|
||||
asnGroupInfo.setIsValid(0);
|
||||
asnGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
asnGroupInfo.setEditTime(new Date());
|
||||
asnGroupInfoDao.updateValid(asnGroupInfo);
|
||||
//asn group下没有asn ip之后,需要失效整个compileId,并且不保留公共组信息
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
maatCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
maatCfg.setServiceId(serviceId);
|
||||
maatCfg.setIsValid(0);//无效
|
||||
//configCompileList.add(addKeepGroupList(maatCfg,entity));
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(new Date());
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("asn ip配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("asn ip配置取消配置响应信息:"+result.getMsg());
|
||||
|
||||
}
|
||||
}
|
||||
for(Entry<Long,List<AsnIpCfg>> enrty:data.entrySet()) {
|
||||
//data.entrySet().stream().forEach( enrty->{
|
||||
Long asn=enrty.getKey();//ans group 的group id
|
||||
List<AsnIpCfg> asnIpCfgs=enrty.getValue();
|
||||
int issuedNum=asnIpCfgs.size();
|
||||
for(int index = 0; index < asnIpCfgs.size();index++){
|
||||
AsnIpCfg t = asnIpCfgs.get(index);
|
||||
BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
BeanUtils.copyProperties(t, ipCfg);
|
||||
ipCfg.setTableName(AsnIpCfg.getTablename());
|
||||
((IpCfgDao) batchSqlSession.getMapper(IpCfgDao.class)).audit(ipCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
AsnGroupInfo asnGroupInfo=new AsnGroupInfo();
|
||||
asnGroupInfo.setAsnId(asn);
|
||||
asnGroupInfo=asnGroupInfoDao.getInfoByAsnNo(asnGroupInfo);
|
||||
Integer groupId=asnGroupInfo.getGroupId();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
if(isValid==Constants.VALID_YES) {//审核通过
|
||||
if(asnGroupInfo.getIsValid()==0) {//ans组未下发过,下发编译配置
|
||||
asnGroupInfo.setIsValid(1);
|
||||
asnGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
asnGroupInfo.setEditTime(new Date());
|
||||
asnGroupInfo.setIssuedIPs(issuedNum+0L);
|
||||
asnGroupInfoDao.updateValid(asnGroupInfo);
|
||||
maatCfg.initDefaultValue();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
groupCfg.setGroupId(groupId);
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
BeanUtils.copyProperties(asnIpCfgs.get(0), maatCfg);
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(asnIpCfgs,Constants.VALID_YES,groupId));
|
||||
maatCfg.setCompileId(asnGroupInfo.getCompileId());
|
||||
maatCfg.setAction(asnIpCfgs.get(0).getAction());
|
||||
maatCfg.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(isValid);
|
||||
// 设置ASN自定义域
|
||||
String userRegion = "ASN_ID=AS" + asnIpCfgs.get(0).getUserRegion1();
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
maatBean.setCreatorName(asnIpCfgs.get(0).getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
// 调用服务接口下发配置数据
|
||||
String json = gsonToJson(maatBean);
|
||||
logger.info("ASN IP配置下发配置参数:" + json);
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ASN IP配置下发响应信息:" + result.getMsg());
|
||||
}else if(asnGroupInfo.getIsValid()==1){//已经下发过,走分组复用
|
||||
asnGroupInfo.setIssuedIPs(issuedNum+0l);
|
||||
asnGroupInfoDao.update(asnGroupInfo);
|
||||
asnIPRegionSendToMaat(asnIpCfgs,isValid);
|
||||
}else {
|
||||
throw new RuntimeException("asnGroupInfo isValid value is "+asnGroupInfo.getIsValid());
|
||||
}
|
||||
}else if(isValid==Constants.VALID_NO) {//取消审核通过
|
||||
asnGroupInfo.setIssuedIPs(0L-issuedNum);
|
||||
asnGroupInfoDao.update(asnGroupInfo);
|
||||
//已经下发过的,调用分组复用配置删除接口
|
||||
// GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
// List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
// GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
// ipRegionList.addAll(groupReuseCfgAddRemoveConvert(asnIpCfgs,Constants.VALID_NO,groupId));
|
||||
// groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
// groupReuseCfg.setStrRegionList(strRegionList);
|
||||
// groupReuseCfg.setNumRegionList(numRegionList);
|
||||
// groupReuseList.add(groupReuseCfg);
|
||||
// maatBean.setGroupReuseCfgList(groupReuseList);
|
||||
// maatBean.setAuditTime(asnIpCfgs.get(0).getAuditTime());
|
||||
// maatBean.setCreatorName(asnIpCfgs.get(0).getCurrentUser().getName());
|
||||
// maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
// maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
// //调用服务接口下发配置数据
|
||||
// String json=gsonToJson(maatBean);
|
||||
// logger.info("ASN IP域删除配置下发配置参数:"+json);
|
||||
// //调用服务接口下发配置
|
||||
// ToMaatResult result = ConfigServiceUtil.put(json,3);
|
||||
// logger.info("ASN IP域删除配置响应信息:"+result.getMsg());
|
||||
asnIPRegionSendToMaat(asnIpCfgs,isValid);
|
||||
//如果一个asn组下没有IP了,修改有效状态
|
||||
//if(hasValidAsnIp(asn)) {
|
||||
// asnGroupInfo.setIsValid(0);
|
||||
// asnGroupInfo.setEditorId(UserUtils.getUser().getId());
|
||||
// asnGroupInfo.setEditTime(new Date());
|
||||
// asnGroupInfoDao.updateValid(asnGroupInfo);
|
||||
//}
|
||||
|
||||
}else {
|
||||
throw new RuntimeException("isValid value is "+isValid);
|
||||
}
|
||||
//});
|
||||
}
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user