Compare commits
300 Commits
demo_appse
...
develop_20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d6dd1352d | ||
|
|
883a7e46f1 | ||
|
|
a4d8bd11e8 | ||
|
|
a941afae72 | ||
|
|
04c12c67ae | ||
|
|
06d08fce4e | ||
|
|
af926a7a37 | ||
|
|
4845198a76 | ||
|
|
1060a5f85e | ||
|
|
148c18e943 | ||
|
|
e0d7ad06ef | ||
|
|
516ea7e653 | ||
|
|
beb45e5059 | ||
|
|
6af0b7b3b6 | ||
|
|
9f4eb23b8c | ||
|
|
0704e85a9f | ||
|
|
d6866b7407 | ||
|
|
f7f2d5ad1b | ||
|
|
d5b790f3a3 | ||
|
|
37c032d7a4 | ||
|
|
8f524daa01 | ||
|
|
89c8dbefc7 | ||
|
|
8828d88584 | ||
|
|
8c5b78d165 | ||
|
|
92605e323e | ||
|
|
38d1fb5a82 | ||
|
|
3910bcb4e1 | ||
|
|
ad5e517f23 | ||
|
|
5f36272250 | ||
|
|
ac524ee76f | ||
|
|
f5a4d31498 | ||
|
|
6b55ae266f | ||
|
|
8b1258e06e | ||
|
|
cb98f7c7fb | ||
|
|
754d82e9f4 | ||
|
|
fdb270e0ff | ||
|
|
8c199d8be4 | ||
|
|
3ae64f6645 | ||
|
|
b12a74e27f | ||
|
|
627dc7661c | ||
|
|
826543d5ba | ||
|
|
d7ceba7e5c | ||
|
|
2c19901ef8 | ||
|
|
a540ad577e | ||
|
|
c2f07c514f | ||
|
|
ba141e1a5d | ||
|
|
aa465f5fd5 | ||
|
|
752386dd28 | ||
|
|
b76dc62cbb | ||
|
|
001b8948bd | ||
|
|
cd114c263d | ||
|
|
cd4bd32b3f | ||
|
|
6f83f45d6e | ||
|
|
ba151692c0 | ||
|
|
3b98511c29 | ||
|
|
007416034f | ||
|
|
db040c2752 | ||
|
|
45a99aa7ab | ||
|
|
9cc00beaae | ||
|
|
3016a82c17 | ||
|
|
7fdd0f7568 | ||
|
|
6bcb9d6fd6 | ||
|
|
bf3921c9e0 | ||
|
|
00acc9c94a | ||
|
|
c982b506a4 | ||
|
|
aaa0028cbb | ||
|
|
6bd04a92ce | ||
|
|
e69992d712 | ||
|
|
4725a3ff90 | ||
|
|
6ac930fd22 | ||
|
|
7b5c9092d1 | ||
|
|
1cf9594bd2 | ||
|
|
cc8cb48da1 | ||
|
|
b8d1bd9ab9 | ||
|
|
3acdae76d0 | ||
|
|
7b27b457a2 | ||
|
|
7c36ec0abc | ||
|
|
80b590b673 | ||
|
|
f52651b382 | ||
|
|
a1998f24f7 | ||
|
|
3bd9c15566 | ||
|
|
84eff37a0d | ||
|
|
233a02b7dc | ||
|
|
02bade2de0 | ||
|
|
bdcc2bb1b4 | ||
|
|
4c2872c5ea | ||
|
|
36e990a247 | ||
|
|
f06830ae23 | ||
|
|
e4effb7ab4 | ||
|
|
910072f66f | ||
|
|
359dd64696 | ||
|
|
96e8493509 | ||
|
|
faad92ed0d | ||
|
|
a2f8cf56d3 | ||
|
|
32804e2a9a | ||
|
|
c224080ef9 | ||
|
|
ecb1fed2d5 | ||
|
|
a769757728 | ||
|
|
8b36721749 | ||
|
|
451c114419 | ||
|
|
161c545fcd | ||
|
|
84f5646f86 | ||
|
|
47029f0eaf | ||
|
|
1f93d4f3b0 | ||
|
|
a478bee5f3 | ||
|
|
bca7de6990 | ||
|
|
268a0ae81b | ||
|
|
fc08261929 | ||
|
|
04a94458ed | ||
|
|
7f9a1c4f70 | ||
|
|
9b5792d748 | ||
|
|
002ad20be4 | ||
|
|
9f97dc2202 | ||
|
|
bcc0f7f220 | ||
|
|
add20445ad | ||
|
|
3be1c1a625 | ||
|
|
aa25c49a87 | ||
|
|
4ce7ebef05 | ||
|
|
f3ea596e5a | ||
|
|
da9ea20e8f | ||
|
|
7af6c7c203 | ||
|
|
c2faf2a2a3 | ||
|
|
af4491d739 | ||
|
|
ae0f91e36d | ||
|
|
4880832028 | ||
|
|
f6405c6f04 | ||
|
|
04db6bcb47 | ||
|
|
f2b5d7413c | ||
|
|
b372f4a9d8 | ||
|
|
851301c671 | ||
|
|
6eea9ee15b | ||
|
|
7189f2a671 | ||
|
|
85da9461e5 | ||
|
|
2809d1890d | ||
|
|
e4cf2aa1b4 | ||
|
|
91d93e7840 | ||
|
|
5e1095f2bb | ||
|
|
bea5312e9f | ||
|
|
09405e06e1 | ||
|
|
bf00ccd875 | ||
|
|
08dd0f3868 | ||
|
|
b7a64234f8 | ||
|
|
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 |
19
README.md
19
README.md
@@ -1 +1,18 @@
|
||||
gk for web
|
||||
5.8号升级版本。
|
||||
|
||||
1、系统支持单独配置 SubscribeID,即仅使用SubscribeID作为配置条件进行监测或者封堵,无需与其它条件组合;
|
||||
|
||||
|
||||
2、系统增加配置30个用户并发进行导入,每次导入不超过2w条 。
|
||||
|
||||
|
||||
3、系统增加saveAndAudit角色,拥有该角色的用户新增配置,配置不经过审核流程直接生效。
|
||||
|
||||
4、日志页面单次可以下载2万条以内的日志;
|
||||
|
||||
|
||||
5、支持监测、统计志查询条件扩展到1个月 (通联日志只能是1天)。
|
||||
|
||||
|
||||
6、配置 页面支持按照配置 id进行查询,支持配置 id输入方式为 10-15;10,13,15;
|
||||
|
||||
|
||||
6
pom.xml
6
pom.xml
@@ -727,6 +727,10 @@
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.1.10</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.57</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -14,6 +14,8 @@ public class ScheduleCfg extends BaseCfg<ScheduleCfg>{
|
||||
private String cronValid;//生效cron表达式
|
||||
private String cronInvalid;//失效cron表达式
|
||||
private String whereStr;//动态where 条件
|
||||
private int delFlag;
|
||||
private int type;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -38,6 +40,17 @@ public class ScheduleCfg extends BaseCfg<ScheduleCfg>{
|
||||
public void setWhereStr(String whereStr) {
|
||||
this.whereStr = whereStr;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
public int getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
public void setDelFlag(int delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
92
src/main/java/com/nis/domain/SysUserWarn.java
Normal file
92
src/main/java/com/nis/domain/SysUserWarn.java
Normal file
@@ -0,0 +1,92 @@
|
||||
package com.nis.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
public class SysUserWarn {
|
||||
|
||||
private String serviceId; //业务Id
|
||||
private String serviceDesc;//业务描述
|
||||
private Integer interfaceCfgTotal;//界面配置数量
|
||||
|
||||
private Integer systemCfgTotal;//服务端配置数量
|
||||
|
||||
private Date time;//时间
|
||||
private String remark;//备注
|
||||
|
||||
private Integer id;//serviceID
|
||||
private String tableName;//表名
|
||||
/**
|
||||
* 当前实体分页对象
|
||||
*/
|
||||
protected Page<SysUserWarn> page;
|
||||
|
||||
public String getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
public void setServiceId(String serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
public String getServiceDesc() {
|
||||
return serviceDesc;
|
||||
}
|
||||
public void setServiceDesc(String serviceDesc) {
|
||||
this.serviceDesc = serviceDesc;
|
||||
}
|
||||
public Integer getInterfaceCfgTotal() {
|
||||
return interfaceCfgTotal;
|
||||
}
|
||||
public void setInterfaceCfgTotal(Integer interfaceCfgTotal) {
|
||||
this.interfaceCfgTotal = interfaceCfgTotal;
|
||||
}
|
||||
public Integer getSystemCfgTotal() {
|
||||
return systemCfgTotal;
|
||||
}
|
||||
public void setSystemCfgTotal(Integer systemCfgTotal) {
|
||||
this.systemCfgTotal = systemCfgTotal;
|
||||
}
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
@JsonIgnore
|
||||
@XmlTransient
|
||||
public Page<SysUserWarn> getPage() {
|
||||
if (page == null){
|
||||
page = new Page<SysUserWarn>();
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<SysUserWarn> setPage(Page<SysUserWarn> page) {
|
||||
this.page = page;
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
46
src/main/java/com/nis/domain/SysUserWarnData.java
Normal file
46
src/main/java/com/nis/domain/SysUserWarnData.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.nis.domain;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SysUserWarnData {
|
||||
|
||||
private Map<String,List<String>> effective;
|
||||
private Integer effectiveCount;
|
||||
private Map<String,List<String>> obsolete;
|
||||
private Integer obsoleteCount;
|
||||
|
||||
|
||||
public Map<String, List<String>> getEffective() {
|
||||
return effective;
|
||||
}
|
||||
public void setEffective(Map<String, List<String>> effective) {
|
||||
this.effective = effective;
|
||||
}
|
||||
public Integer getEffectiveCount() {
|
||||
return effectiveCount;
|
||||
}
|
||||
public void setEffectiveCount(Integer effectiveCount) {
|
||||
this.effectiveCount = effectiveCount;
|
||||
}
|
||||
public Map<String, List<String>> getObsolete() {
|
||||
return obsolete;
|
||||
}
|
||||
public void setObsolete(Map<String, List<String>> obsolete) {
|
||||
this.obsolete = obsolete;
|
||||
}
|
||||
public Integer getObsoleteCount() {
|
||||
return obsoleteCount;
|
||||
}
|
||||
public void setObsoleteCount(Integer obsoleteCount) {
|
||||
this.obsoleteCount = obsoleteCount;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUserWarnData [effective=" + effective + ", effectiveCount=" + effectiveCount + ", obsolete="
|
||||
+ obsolete + ", obsoleteCount=" + obsoleteCount + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
67
src/main/java/com/nis/domain/SysUserWarnRecvData.java
Normal file
67
src/main/java/com/nis/domain/SysUserWarnRecvData.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.nis.domain;
|
||||
|
||||
public class SysUserWarnRecvData {
|
||||
private Integer status;
|
||||
private Integer businessCode;
|
||||
private String reason;
|
||||
private String msg;
|
||||
private String fromuri;
|
||||
private String logSource;
|
||||
private String traceCode;
|
||||
private SysUserWarnData data;
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
public Integer getBusinessCode() {
|
||||
return businessCode;
|
||||
}
|
||||
public void setBusinessCode(Integer businessCode) {
|
||||
this.businessCode = businessCode;
|
||||
}
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
public String getFromuri() {
|
||||
return fromuri;
|
||||
}
|
||||
public void setFromuri(String fromuri) {
|
||||
this.fromuri = fromuri;
|
||||
}
|
||||
public String getLogSource() {
|
||||
return logSource;
|
||||
}
|
||||
public void setLogSource(String logSource) {
|
||||
this.logSource = logSource;
|
||||
}
|
||||
public String getTraceCode() {
|
||||
return traceCode;
|
||||
}
|
||||
public void setTraceCode(String traceCode) {
|
||||
this.traceCode = traceCode;
|
||||
}
|
||||
public SysUserWarnData getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(SysUserWarnData data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
57
src/main/java/com/nis/domain/basics/ProtectionListInfo.java
Normal file
57
src/main/java/com/nis/domain/basics/ProtectionListInfo.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.nis.domain.basics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
|
||||
public class ProtectionListInfo extends BaseCfg<ProtectionListInfo> implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3781310894175345207L;
|
||||
private Integer proId;
|
||||
private String keyword;
|
||||
private String targetType;
|
||||
private String description;
|
||||
|
||||
|
||||
public Integer getProId() {
|
||||
return proId;
|
||||
}
|
||||
public void setProId(Integer proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
public void setKeyword(String keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
public String getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
public void setTargetType(String targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Date getEditTime() {
|
||||
return editTime;
|
||||
}
|
||||
public void setEditTime(Date editTime) {
|
||||
this.editTime = editTime;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -9,8 +9,18 @@ package com.nis.domain.configuration;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class AvVoipAccountCfg extends BaseStringCfg<AvVoipAccountCfg>{
|
||||
|
||||
private static final String tableName="av_voip_account_cfg";
|
||||
|
||||
private static final long serialVersionUID = -7398698517584394431L;
|
||||
|
||||
@Override
|
||||
public void initDefaultValue() {
|
||||
super.initDefaultValue();
|
||||
this.exprType=0;
|
||||
this.matchMethod=0;
|
||||
}
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,9 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
protected Integer compileIsIssued;
|
||||
protected String exType;//导出类型
|
||||
protected String hColumns;//导出隐藏列
|
||||
|
||||
protected String compileIdNew;// 查询 配置ID 范围
|
||||
|
||||
/**
|
||||
* 定时任务信息
|
||||
*/
|
||||
@@ -107,7 +110,13 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
public void setCompileGroupMap(Map<Integer, Integer> compileGroupMap) {
|
||||
this.compileGroupMap = compileGroupMap;
|
||||
}
|
||||
|
||||
public String getCompileIdNew() {
|
||||
return compileIdNew;
|
||||
}
|
||||
public void setCompileIdNew(String compileIdNew) {
|
||||
this.compileIdNew = compileIdNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编译id
|
||||
*/
|
||||
@@ -287,20 +296,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;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class DomainInterceptMonitTemplate extends StringAllNotDoLogTemplate{
|
||||
private String userRegion5;
|
||||
private String cfgKeywords;
|
||||
|
||||
@ExcelField(title="intercept_intensity",dictType="INTERCEPT_DOMAIN_INTENSITY",align=2,sort=2)
|
||||
@ExcelField(title="intercept_intensity",dictType="INTERCEPT_DOMAIN_INTENSITY",align=2,sort=12)
|
||||
public String getUserRegion5() {
|
||||
return userRegion5;
|
||||
}
|
||||
|
||||
@@ -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=5)
|
||||
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,9 @@ 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");
|
||||
EXCLUDE_MAPPER_IDS.add("com.nis.web.dao.configuration.CommonPolicyDao.deleteCfgBatch");
|
||||
}
|
||||
/**
|
||||
* is_valid 字段名
|
||||
@@ -159,10 +162,11 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{
|
||||
//整理需要 insert 的 schedule_cfg 的数据
|
||||
List<ScheduleCfg> scheduleList = Lists.newArrayList();
|
||||
for(BaseCfg<?> baseCfg : cfgList) {
|
||||
baseCfg.setIsValid(0);//设置默认值
|
||||
baseCfg.setIsAudit(0);//设置默认值
|
||||
ScheduleCfg scList = copyScheduleCfgFromBaseCfg(baseCfg, tableName);
|
||||
if(scList!=null){
|
||||
//TODO 定时任务设置默认为isValid=0 isAudit=0,需要考虑允许用户新增isValid=1 isAudit=1的配置下发
|
||||
scList.setIsValid(0);//设置默认值
|
||||
scList.setIsAudit(0);//设置默认值
|
||||
scheduleList.add(scList);
|
||||
}
|
||||
}
|
||||
@@ -197,6 +201,7 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{
|
||||
sc.setCompileId(compileId);
|
||||
sc.setEditorId(bc.getEditorId());
|
||||
sc.setEditTime(bc.getEditTime());
|
||||
sc.setType(1);
|
||||
sc.setCfgId(cfgId);
|
||||
//根据 compileId 删除之前的
|
||||
MappedStatement statement = configuration.getMappedStatement("com.nis.web.dao.SchedulerDao.deleteByCompileId");
|
||||
@@ -273,6 +278,7 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{
|
||||
MappedStatement statement = configuration.getMappedStatement("com.nis.web.dao.SchedulerDao.insert");
|
||||
scfg.setIsValid(isValid);
|
||||
scfg.setIsAudit(isAudit);
|
||||
scfg.setType(1);
|
||||
executor.update(statement, scfg);
|
||||
}
|
||||
//手动 审核通过,立即生效时 已经下发,修改 exce_new 表的是否需要下发字段为 不需要 : 0
|
||||
@@ -329,6 +335,7 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{
|
||||
if(schedule != null ) {
|
||||
BeanUtils.copyProperties(baseCfg, schedule,new String[]{"userRegion1","userRegion2","userRegion3","userRegion4","userRegion5"});
|
||||
schedule.setTableName(tableName);
|
||||
schedule.setType(1);
|
||||
}
|
||||
return schedule;
|
||||
}
|
||||
|
||||
@@ -82,15 +82,21 @@ public class ScheduleCfgJob implements Job {
|
||||
SchedulerDao dao = SpringContextHolder.getBean(SchedulerDao.class);
|
||||
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
||||
long scheduleCfgId = dataMap.get("scheduleCfgId") == null ? 0:dataMap.getLong("scheduleCfgId");
|
||||
long limit = dataMap.get("limit") == null ? 1000:dataMap.getLong("limit");
|
||||
long limit = dataMap.get("limit") == null ? Constants.MAAT_JSON_SEND_SIZE:dataMap.getLong("limit");
|
||||
log.info(String.format("定时配置任务开始执行,scheduleCfgId:%s,limit:%s",scheduleCfgId,limit ));
|
||||
List<ScheduleCfg> newlyCfg = null;
|
||||
List<ScheduleCfg> allNewlySche = null;
|
||||
int totalNum = 0;
|
||||
do {
|
||||
newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit);
|
||||
if(newlyCfg != null && newlyCfg.size() > 0) {
|
||||
totalNum += newlyCfg.size();
|
||||
for(ScheduleCfg cfg : newlyCfg) {//先取消之前的定时配置
|
||||
allNewlySche = dao.findNewlyCfg(scheduleCfgId, limit,1,1);
|
||||
if(allNewlySche != null && allNewlySche.size() > 0) {
|
||||
List<ScheduleCfg> allAddSche = new ArrayList<>();
|
||||
totalNum += allNewlySche.size();
|
||||
//先取消之前的定时配置
|
||||
for(ScheduleCfg cfg : allNewlySche) {
|
||||
//获取有效的任务
|
||||
if(cfg.getDelFlag()==1) {
|
||||
allAddSche.add(cfg);
|
||||
}
|
||||
Integer compileId = cfg.getCompileId();
|
||||
try {
|
||||
//取消之前所有的 trigger
|
||||
@@ -106,7 +112,7 @@ public class ScheduleCfgJob implements Job {
|
||||
log.error(String.format("定时任务取消异常,compileId:%s", compileId),e);
|
||||
}
|
||||
}
|
||||
for(ScheduleCfg cfg : newlyCfg) {
|
||||
for(ScheduleCfg cfg : allAddSche) {
|
||||
Integer compileId = cfg.getCompileId();
|
||||
try {
|
||||
//判断状态,重新添加最新的 trigger
|
||||
@@ -123,12 +129,12 @@ public class ScheduleCfgJob implements Job {
|
||||
}
|
||||
}
|
||||
//最后 保存此次 最后的id
|
||||
ScheduleCfg lastCfg = newlyCfg.get(newlyCfg.size() -1);
|
||||
ScheduleCfg lastCfg = allNewlySche.get(allNewlySche.size() -1);
|
||||
scheduleCfgId = lastCfg.getId();
|
||||
dataMap.put("scheduleCfgId", scheduleCfgId);
|
||||
log.info(String.format("加载定时任务,total num :%s", newlyCfg.size()));
|
||||
log.info(String.format("加载定时任务,total num :%s", allNewlySche.size()));
|
||||
}
|
||||
} while (newlyCfg != null && newlyCfg.size() > 0);
|
||||
} while (allNewlySche != null && allNewlySche.size() > 0);
|
||||
log.info(String.format("定时配置任务结束执行,total num:%s",totalNum));
|
||||
}
|
||||
|
||||
@@ -191,6 +197,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 +263,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;
|
||||
}
|
||||
|
||||
@@ -302,6 +321,34 @@ public class ScheduleCfgJob implements Job {
|
||||
Date invalidTime = DateBuilder.todayAt(invalidList.get(0), invalidList.get(1), invalidList.get(2));
|
||||
CalendarIntervalScheduleBuilder intervalBuilder = null;
|
||||
if("EVERYDAY".equalsIgnoreCase(dayOrWeek)) {
|
||||
//开始时间+2分钟
|
||||
Calendar validStartCal=Calendar.getInstance();
|
||||
validStartCal.setTime(validStartTime);
|
||||
validStartCal.add(Calendar.MINUTE, 2);
|
||||
long validStartTimes=validStartCal.getTime().getTime();
|
||||
//结束时间+2分钟
|
||||
Calendar invalidCal=Calendar.getInstance();
|
||||
invalidCal.setTime(invalidTime);
|
||||
invalidCal.add(Calendar.MINUTE, 2);
|
||||
long invalidTimes=validStartCal.getTime().getTime();
|
||||
long currentTimes=new Date().getTime();
|
||||
//开始时间设置为今天已过时,则将开始时间加上周期
|
||||
if((currentTimes-validStartTimes) > 0) {
|
||||
Calendar validStartCalNew=Calendar.getInstance();
|
||||
validStartCalNew.setTime(validStartTime);
|
||||
validStartCalNew.add(Calendar.DAY_OF_MONTH, interval);
|
||||
validStartTime=validStartCalNew.getTime();
|
||||
}
|
||||
|
||||
//结束时间设置为今天已过时,则将开始时间加上周期
|
||||
if((currentTimes-invalidTimes) > 0) {
|
||||
Calendar invalidCalNew=Calendar.getInstance();
|
||||
invalidCalNew.setTime(invalidTime);
|
||||
invalidCalNew.add(Calendar.DAY_OF_MONTH, interval);
|
||||
invalidTime=invalidCalNew.getTime();
|
||||
}
|
||||
|
||||
|
||||
intervalBuilder = CalendarIntervalScheduleBuilder.calendarIntervalSchedule().withIntervalInDays(interval);
|
||||
//valid
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
@@ -316,6 +363,7 @@ public class ScheduleCfgJob implements Job {
|
||||
.startAt(validStartTime)
|
||||
.build();
|
||||
triList.add(validTri);
|
||||
|
||||
//invalid
|
||||
dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", false);
|
||||
@@ -465,14 +513,25 @@ public class ScheduleCfgJob implements Job {
|
||||
|
||||
|
||||
/**
|
||||
* 查找最近的 星期几 ,包括今天
|
||||
* 查找最近的 星期几 ,包括今天(如果今天的时间点已过,从明天开始算)
|
||||
* @param date
|
||||
* @param w 周一开始 1 -7
|
||||
* @return
|
||||
*/
|
||||
public static Date closestAfterWeek(Date date,int w) {
|
||||
//设置calC为开始时间+2分钟,判断calC时间是否已过,如果小于当前时间则直接从明天开始算
|
||||
Calendar calC = Calendar.getInstance();
|
||||
calC.setTime(date);
|
||||
calC.add(Calendar.MINUTE, 2);
|
||||
long currentDate=new Date().getTime();//当前时间
|
||||
long weekStartDate=calC.getTime().getTime();//周任务开始时间+2分钟
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
//如果开始时间已过期,则从明天开始算
|
||||
if((currentDate-weekStartDate) > 0) {
|
||||
cal.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
int i = cal.get(Calendar.DAY_OF_WEEK);//周日开始 1-7
|
||||
i = (i==1)? 7: i-1;//转换为 周一到 周日 1-7
|
||||
cal.add(Calendar.DAY_OF_MONTH, (i>w)?(7-(i-w)) : (w-i));
|
||||
|
||||
137
src/main/java/com/nis/quartz/ScheduleStatisticASNIPNumJob.java
Normal file
137
src/main/java/com/nis/quartz/ScheduleStatisticASNIPNumJob.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.nis.quartz;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.PersistJobDataAfterExecution;
|
||||
|
||||
import com.nis.util.IPUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* 定时任务: 定时统计ASN 下IPv4和IPV6的个数
|
||||
* 1、每 n s 执行一次(两个小时执行一次)
|
||||
* 2、单线程执行
|
||||
* @author ddm
|
||||
*
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
@PersistJobDataAfterExecution
|
||||
public class ScheduleStatisticASNIPNumJob implements Job {
|
||||
private static final Logger logger = Logger.getLogger(ScheduleStatisticASNIPNumJob.class);
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
AsnIpCfgDao asnIpCfgDao = SpringContextHolder.getBean(AsnIpCfgDao.class);
|
||||
logger.info("定时统计ASN IP个数开始。。。。。。。。。。。。。。");
|
||||
long start=System.currentTimeMillis();
|
||||
Map<Integer,Map<String,Long>> asnNumerMap=new HashMap<>();
|
||||
List<Object[]> asnIpList=new ArrayList<>();
|
||||
asnIpList=asnIpCfgDao.findAllAsnIpCfgList();
|
||||
|
||||
getAllASNIPNumber(asnIpList, asnNumerMap);
|
||||
|
||||
updateAllASNIPNumber(asnNumerMap);
|
||||
|
||||
long end=System.currentTimeMillis();
|
||||
logger.info("定时统计ASN IP个数结束:耗时("+(end-start)+"/毫秒)。。。。。。。。。。。。。。");
|
||||
}
|
||||
|
||||
public void getAllASNIPNumber(List<Object[]> asnIpList,Map<Integer,Map<String,Long>> asnNumerMap){
|
||||
logger.info("计算ASN IP开始:asn ip size:"+asnIpList.size()+"。。。。。。。。。。。。。。");
|
||||
long start=System.currentTimeMillis();
|
||||
if(!StringUtil.isEmpty(asnIpList)){
|
||||
try {
|
||||
for (Iterator iterator = asnIpList.iterator(); iterator.hasNext();) {
|
||||
Map asnIpMap=(Map) iterator.next();
|
||||
//groupId
|
||||
Integer asnGroupId = (Integer)asnIpMap.get("asn_ip_group");
|
||||
//ipType(4:v4,6:v6)
|
||||
Integer ipType= (Integer)asnIpMap.get("ip_type");
|
||||
//(1:mask,2:range,3:ip)
|
||||
//Integer ipPattern= (Integer)asnIpMap.get("ip_pattern");
|
||||
//dest_ip_address
|
||||
String ipAddress= (String)asnIpMap.get("dest_ip_address");
|
||||
long IPNumber=0;
|
||||
if(ipType.equals(4)){
|
||||
if(ipAddress.indexOf("/") > -1){
|
||||
Integer mask=Integer.parseInt(ipAddress.split("/")[1]);
|
||||
ipAddress=ipAddress.split("/")[0];
|
||||
IPNumber=IPUtil.getIpNum(ipAddress, mask);
|
||||
}else{
|
||||
IPNumber=1;
|
||||
}
|
||||
//判断组是否已经存在
|
||||
if(asnNumerMap.keySet().contains(asnGroupId)){
|
||||
asnNumerMap.get(asnGroupId).put("v4", asnNumerMap.get(asnGroupId).get("v4")+IPNumber);
|
||||
asnNumerMap.put(asnGroupId, asnNumerMap.get(asnGroupId));
|
||||
}else{
|
||||
Map<String, Long> map=new HashMap<>();
|
||||
map.put("v4", IPNumber);
|
||||
map.put("v6", 0l);
|
||||
asnNumerMap.put(asnGroupId, map);
|
||||
}
|
||||
}else{
|
||||
IPNumber=1;
|
||||
//判断组是否已经存在
|
||||
if(asnNumerMap.keySet().contains(asnGroupId)){
|
||||
asnNumerMap.get(asnGroupId).put("v6", asnNumerMap.get(asnGroupId).get("v6")+IPNumber);
|
||||
asnNumerMap.put(asnGroupId, asnNumerMap.get(asnGroupId));
|
||||
}else{
|
||||
Map<String, Long> map=new HashMap<>();
|
||||
map.put("v4", 0l);
|
||||
map.put("v6", IPNumber);
|
||||
asnNumerMap.put(asnGroupId, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("计算ASN IP个数失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
long end=System.currentTimeMillis();
|
||||
logger.info("计算ASN IP个数结束:耗时("+(end-start)+"/毫秒)。。。。。。。。。。。。。。");
|
||||
}
|
||||
public void updateAllASNIPNumber(Map<Integer,Map<String,Long>> asnNumerMap) {
|
||||
logger.info("修改ASN IP个数开始:asn size:"+asnNumerMap.size()+"。。。。。。。。。。。。。。");
|
||||
long start=System.currentTimeMillis();
|
||||
if(!StringUtil.isEmpty(asnNumerMap)){
|
||||
int index=0;
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try {
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, true);
|
||||
for(Entry<Integer,Map<String,Long>> e: asnNumerMap.entrySet()) {
|
||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).updateIpNum(e.getValue().get("v4"),e.getValue().get("v6"),e.getKey());
|
||||
batchSqlSession.commit();
|
||||
index++;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logger.error("修改ASN IP个数失败", e);
|
||||
} finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.info("修改ASN IP个数结束:耗时("+(end-start)+"/毫秒)。。。。。。。。。。。。。。");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,20 @@
|
||||
package com.nis.quartz;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import com.nis.domain.ScheduleCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtil;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.web.dao.SchedulerDao;
|
||||
import com.nis.web.service.ScheduleService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
@@ -23,16 +31,52 @@ public class ScheduleStatusJob implements Job{
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
//从trigger中 获取 配置信息
|
||||
JobDataMap jobDataMap = context.getTrigger().getJobDataMap();
|
||||
boolean isValid = jobDataMap.getBoolean("isValid");
|
||||
ScheduleCfg cfg = (ScheduleCfg)jobDataMap.get("cfg");
|
||||
Integer compileId = cfg.getCompileId();
|
||||
log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid ));
|
||||
//配置下发,并修改 配置表的状态,保存下发记录等
|
||||
ScheduleService scheduleService = SpringContextHolder.getBean(ScheduleService.class);
|
||||
scheduleService.issueCompileInfo(cfg, isValid?1:0);
|
||||
log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid ));
|
||||
|
||||
//全量同步状态
|
||||
String currentStatus = DictUtils.getDictLabel("currrent_sync_status", "status","0");
|
||||
//0:start:开始 1:init:初始化 2:doing:进行中
|
||||
|
||||
//全量同步过程中未执行的任务进入另一个job中,等待全量同步完成开始执行
|
||||
if(currentStatus.equals("0") || currentStatus.equals("1")||currentStatus.equals("2")) {
|
||||
//配置下发,并修改 配置表的状态,保存下发记录等
|
||||
SchedulerDao schedulerDao = SpringContextHolder.getBean(SchedulerDao.class);
|
||||
//从trigger中 获取 配置信息
|
||||
JobDataMap jobDataMap = context.getTrigger().getJobDataMap();
|
||||
boolean isValid = jobDataMap.getBoolean("isValid");
|
||||
|
||||
ScheduleCfg cfg = (ScheduleCfg)jobDataMap.get("cfg");
|
||||
cfg.setId(null);//新入库一个任务
|
||||
cfg.setType(2);//全量同步中未执行的任务
|
||||
cfg.setUserRegion1("single"); //只执行一次
|
||||
if(isValid) {
|
||||
cfg.setCronValid("1900-01-01 01:01:01"); //无实际效果,仅仅为填充值
|
||||
cfg.setCronInvalid("");
|
||||
}else {
|
||||
cfg.setCronValid("");
|
||||
cfg.setCronInvalid("1900-01-01 01:01:01");//无实际效果,仅仅为填充值
|
||||
}
|
||||
schedulerDao.insert(cfg);
|
||||
|
||||
}else {
|
||||
//从trigger中 获取 配置信息
|
||||
JobDataMap jobDataMap = context.getTrigger().getJobDataMap();
|
||||
boolean isValid = jobDataMap.getBoolean("isValid");
|
||||
ScheduleCfg cfg = (ScheduleCfg)jobDataMap.get("cfg");
|
||||
Integer compileId = cfg.getCompileId();
|
||||
log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid ));
|
||||
//配置下发,并修改 配置表的状态,保存下发记录等
|
||||
ScheduleService scheduleService = SpringContextHolder.getBean(ScheduleService.class);
|
||||
try {
|
||||
scheduleService.issueCompileInfo(cfg, isValid?1:0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("定时任务"+cfg.getId()+"执行失败",e);
|
||||
}finally {
|
||||
log.debug(String.format("任务执行完成,compileId:%s,isValid:%s",compileId,isValid ));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
548
src/main/java/com/nis/quartz/ScheduleSyncCfgJob.java
Normal file
548
src/main/java/com/nis/quartz/ScheduleSyncCfgJob.java
Normal file
@@ -0,0 +1,548 @@
|
||||
package com.nis.quartz;
|
||||
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.quartz.CalendarIntervalScheduleBuilder;
|
||||
import org.quartz.CalendarIntervalTrigger;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.DateBuilder;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobBuilder;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.PersistJobDataAfterExecution;
|
||||
import org.quartz.ScheduleBuilder;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.SimpleScheduleBuilder;
|
||||
import org.quartz.SimpleTrigger;
|
||||
import org.quartz.Trigger;
|
||||
import org.quartz.TriggerBuilder;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.quartz.impl.matchers.GroupMatcher;
|
||||
import org.quartz.impl.triggers.CalendarIntervalTriggerImpl;
|
||||
import org.quartz.impl.triggers.CronTriggerImpl;
|
||||
import org.quartz.spi.MutableTrigger;
|
||||
|
||||
import com.nis.domain.ScheduleCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtil;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.dao.SchedulerDao;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* 定时任务 配置全量同步时未执行的定时任务加载
|
||||
* 1、每 n s 执行一次,每次读取 schedule_cfg 最新的数据
|
||||
* 2、删除或新增 定时任务
|
||||
* 3、单线程执行
|
||||
* @author ddm
|
||||
*
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
@PersistJobDataAfterExecution
|
||||
public class ScheduleSyncCfgJob implements Job {
|
||||
SimpleDateFormat sdf=new SimpleDateFormat(Constants.COMMON_DATE_FORMAT);
|
||||
private static final Logger log = Logger.getLogger(ScheduleSyncCfgJob.class);
|
||||
|
||||
/**
|
||||
* 状态组,格式:statusGroup-compileId
|
||||
*/
|
||||
private static final String STATUS_GROUP = "syncGroup-";
|
||||
private static final String STATUS_JOB = "SYNC-JOB";
|
||||
/**
|
||||
* 生效标识:valid-cronexp
|
||||
*/
|
||||
private static final String VALID_KEY = "valid-";
|
||||
/**
|
||||
* 失效标识:invalid-cronexp
|
||||
*/
|
||||
private static final String INVALID_KEY = "invalid-";
|
||||
private static final JobKey STATUS_JOBKEY = JobKey.jobKey(STATUS_JOB, "syncGroup");
|
||||
private static final JobDetail STATUS_JOBDETAIL = JobBuilder.newJob(ScheduleStatusJob.class)
|
||||
.withIdentity(STATUS_JOBKEY)
|
||||
.storeDurably(true)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
Scheduler scheduler = context.getScheduler();
|
||||
SchedulerDao dao = SpringContextHolder.getBean(SchedulerDao.class);
|
||||
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
||||
long scheduleCfgId = dataMap.get("scheduleCfgId") == null ? 0:dataMap.getLong("scheduleCfgId");
|
||||
long limit = dataMap.get("limit") == null ? Constants.MAAT_JSON_SEND_SIZE:dataMap.getLong("limit");
|
||||
log.info(String.format("Sync定时配置任务开始扫描,scheduleCfgId:%s,limit:%s",scheduleCfgId,limit ));
|
||||
List<ScheduleCfg> newlyCfg = null;
|
||||
int totalNum = 0;
|
||||
|
||||
//全量同步当前状态 0:start:开始 1:init:初始化 2:doing:进行中
|
||||
String currentStatus = DictUtils.getDictLabel("currrent_sync_status", "status","0");
|
||||
if(!(currentStatus.equals("0") || currentStatus.equals("1") || currentStatus.equals("2"))) {
|
||||
do {
|
||||
newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit,2,null);
|
||||
if(newlyCfg != null && newlyCfg.size() > 0) {
|
||||
totalNum += newlyCfg.size();
|
||||
for(ScheduleCfg cfg : newlyCfg) {//先取消之前的定时配置
|
||||
Integer compileId = cfg.getCompileId();
|
||||
try {
|
||||
//取消之前所有的 trigger
|
||||
GroupMatcher<TriggerKey> groupMatcher= GroupMatcher.triggerGroupEquals(STATUS_GROUP + compileId);
|
||||
Set<TriggerKey> triggerKeys = scheduler.getTriggerKeys(groupMatcher);
|
||||
if(triggerKeys != null && triggerKeys.size() > 0) {
|
||||
for(TriggerKey tk : triggerKeys) {
|
||||
scheduler.unscheduleJob(tk);
|
||||
}
|
||||
log.info(String.format("Sync定时任务取消成功,compile:%s", compileId));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("Sync定时任务取消异常,compileId:%s", compileId),e);
|
||||
}
|
||||
}
|
||||
int index=0;
|
||||
for(ScheduleCfg cfg : newlyCfg) {
|
||||
Integer compileId = cfg.getCompileId();
|
||||
try {
|
||||
//判断状态,重新添加最新的 trigger
|
||||
Integer isValid = cfg.getIsValid();
|
||||
Integer isAudit = cfg.getIsAudit();
|
||||
//添加定时任务的条件
|
||||
if((isValid == 1 && isAudit == 1) || (isValid == 0 && isAudit == 0)) {
|
||||
//添加定时任务,包括valid 和 invalid
|
||||
addJob(scheduler, cfg,index);
|
||||
log.info(String.format("Sync定时任务添加成功,compile:%s", compileId));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("Sync定时任务更新异常,compileId:%s", compileId),e);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
//最后 保存此次 最后的id
|
||||
ScheduleCfg lastCfg = newlyCfg.get(newlyCfg.size() -1);
|
||||
scheduleCfgId = lastCfg.getId();
|
||||
dataMap.put("scheduleCfgId", scheduleCfgId);
|
||||
log.info(String.format("Sync加载定时任务,total num :%s", newlyCfg.size()));
|
||||
}
|
||||
} while (newlyCfg != null && newlyCfg.size() > 0);
|
||||
log.info(String.format("Sync定时配置任务结束执行,total num:%s",totalNum));
|
||||
}
|
||||
log.info("全量同步中缓存的定时配置正在扫描(currentStatus:"+currentStatus+")");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将定时任务信息添加到 定时器框架中调度
|
||||
* @param scheduler
|
||||
* @param cfg
|
||||
* @throws SchedulerException
|
||||
*/
|
||||
/*public static void addJob(Scheduler scheduler,ScheduleCfg cfg) throws SchedulerException {
|
||||
Integer compileId = cfg.getCompileId();
|
||||
String cronValid = cfg.getCronValid();
|
||||
String cronInvalid = cfg.getCronInvalid();
|
||||
Trigger validTrigger = createTrigger(cronValid, compileId, true, cfg);
|
||||
Trigger invalidTrigger = createTrigger(cronInvalid, compileId, false, cfg);
|
||||
boolean jobExist = scheduler.checkExists(STATUS_JOBKEY);
|
||||
if(!jobExist) {//判断 job 是否存在,不存在添加
|
||||
scheduler.addJob(STATUS_JOBDETAIL, false);
|
||||
}
|
||||
boolean checkExists = scheduler.checkExists(validTrigger.getKey());
|
||||
if(!checkExists) {//判断 valid trigger 是否存在,不存在添加
|
||||
scheduler.scheduleJob(validTrigger);
|
||||
}else {
|
||||
log.warn(String.format("Trigger already exists:%s ", validTrigger.getKey().toString()));
|
||||
}
|
||||
checkExists = scheduler.checkExists(invalidTrigger.getKey());
|
||||
if(!checkExists) {//判断 invalid trigger 是否存在,不存在添加
|
||||
scheduler.scheduleJob(invalidTrigger);
|
||||
}else {
|
||||
log.warn(String.format("Trigger already exists:%s ", invalidTrigger.getKey().toString()));
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
public static void addJob(Scheduler scheduler,ScheduleCfg cfg,int expire) throws SchedulerException {
|
||||
List<Trigger> triList = createTrigger(cfg,expire);
|
||||
boolean jobExist = scheduler.checkExists(STATUS_JOBKEY);
|
||||
if(!jobExist) {//判断 job 是否存在,不存在添加
|
||||
scheduler.addJob(STATUS_JOBDETAIL, false);
|
||||
}
|
||||
for(Trigger tri : triList) {
|
||||
boolean checkExists = scheduler.checkExists(tri.getKey());
|
||||
if(!checkExists) {//判断 valid trigger 是否存在,不存在添加
|
||||
log.debug(String.format("Sync定时任务添加,%s", tri.getKey()));
|
||||
scheduler.scheduleJob(tri);
|
||||
log.info(String.format("Sync定时任务添加成功,%s", tri.getKey()));
|
||||
}else {
|
||||
log.warn(String.format("Trigger(sync) already exists:%s ", tri.getKey().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将页面配置的内容 转换成 trigger
|
||||
* @param cfg
|
||||
* @return
|
||||
*/
|
||||
public static List<Trigger> createTrigger(ScheduleCfg cfg,int expire){
|
||||
String mode = cfg.getUserRegion1().toUpperCase();//定时任务运行模式:一次,每天,每周,每月
|
||||
List<Trigger> triList = null;
|
||||
switch (mode) {
|
||||
case "ALWAYS"://单次运行,但只创建单次生效触发器
|
||||
triList = createSimpleTrigger(cfg,expire);
|
||||
break;
|
||||
case "SINGLE"://单次运行
|
||||
triList = createSimpleTrigger(cfg,expire);
|
||||
break;
|
||||
case "EVERYDAY"://每天运行 0 0 0 2/1 * ? ,不符合要求,定义每天都执行,然后在 代码判断 间隔时间
|
||||
triList = createCalendarIntervalTrigger(cfg);
|
||||
break;
|
||||
case "EVERYWEEK"://每周运行
|
||||
triList = createCalendarIntervalTrigger(cfg);
|
||||
break;
|
||||
case "EVERYMONTH"://每月运行
|
||||
triList = createEveryMonthTrigger(cfg);
|
||||
break;
|
||||
default:
|
||||
log.warn(String.format("unknown mode : %s ", mode));
|
||||
break;
|
||||
}
|
||||
return triList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将时间转换成 时分秒
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static List<Integer> parseTime(String time) {
|
||||
if(StringUtils.isNoneBlank(time)) {
|
||||
String[] split = time.split(":");
|
||||
List<Integer> tl = new ArrayList<Integer>(3);
|
||||
for(String s : split) {
|
||||
tl.add(Integer.valueOf(s));
|
||||
}
|
||||
return tl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Trigger createCronTrigger(String cron,Integer compileId,boolean isValid,ScheduleCfg cfg) {
|
||||
String triggerName = isValid ? (VALID_KEY + cron) : (INVALID_KEY + cron);
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", isValid);
|
||||
dataMap.put("cfg", cfg);
|
||||
return TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triggerName, STATUS_GROUP+compileId))
|
||||
.withSchedule(CronScheduleBuilder.cronSchedule(cron))
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建全量同步时未执行的任务,每个任务均为单词任务
|
||||
* @param cfg
|
||||
* @return
|
||||
*/
|
||||
public static List<Trigger> createSimpleTrigger(ScheduleCfg cfg,int expire){
|
||||
List<Trigger> triList = new ArrayList<Trigger>();
|
||||
Integer compileId = cfg.getCompileId();
|
||||
String cronValid = cfg.getCronValid();
|
||||
String cronInvalid = cfg.getCronInvalid();
|
||||
Date validDate = null;
|
||||
Date invalidDate = null;
|
||||
if(StringUtils.isNotBlank(cronValid)){
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.MINUTE, (expire+1));
|
||||
validDate = c.getTime();
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(cronInvalid)){
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.MINUTE, (expire+2));
|
||||
invalidDate = c.getTime();
|
||||
}
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 间隔 n 天 或 n 周执行
|
||||
* @param cfg
|
||||
* @return
|
||||
*/
|
||||
public static List<Trigger> createCalendarIntervalTrigger(ScheduleCfg cfg) {
|
||||
List<Trigger> triList = new ArrayList<Trigger>();
|
||||
Integer compileId = cfg.getCompileId();
|
||||
String cronValid = cfg.getCronValid();
|
||||
String cronInvalid = cfg.getCronInvalid();
|
||||
String dayOrWeek = cfg.getUserRegion1();
|
||||
Integer interval = Integer.valueOf(cfg.getUserRegion2());
|
||||
List<Integer> validList = parseTime(cronValid);
|
||||
List<Integer> invalidList = parseTime(cronInvalid);
|
||||
Date validStartTime = DateBuilder.todayAt(validList.get(0), validList.get(1), validList.get(2));
|
||||
Date invalidTime = DateBuilder.todayAt(invalidList.get(0), invalidList.get(1), invalidList.get(2));
|
||||
CalendarIntervalScheduleBuilder intervalBuilder = null;
|
||||
if("EVERYDAY".equalsIgnoreCase(dayOrWeek)) {
|
||||
intervalBuilder = CalendarIntervalScheduleBuilder.calendarIntervalSchedule().withIntervalInDays(interval);
|
||||
//valid
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", true);
|
||||
dataMap.put("cfg", cfg);
|
||||
String triName = VALID_KEY + dayOrWeek+"("+interval+")" + "_" + DateUtils.formatDate(validStartTime, Constants.COMMON_DATE_FORMAT);
|
||||
Trigger validTri = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(intervalBuilder)
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(validStartTime)
|
||||
.build();
|
||||
triList.add(validTri);
|
||||
//invalid
|
||||
dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", false);
|
||||
dataMap.put("cfg", cfg);
|
||||
triName = INVALID_KEY + dayOrWeek +"("+interval+")" + "_" + DateUtils.formatDate(invalidTime, Constants.COMMON_DATE_FORMAT);
|
||||
validTri = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(intervalBuilder)
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(invalidTime)
|
||||
.build();
|
||||
triList.add(validTri);
|
||||
}else if("EVERYWEEK".equalsIgnoreCase(dayOrWeek)) {
|
||||
intervalBuilder = CalendarIntervalScheduleBuilder.calendarIntervalSchedule().withIntervalInWeeks(interval);
|
||||
String[] weeks = cfg.getUserRegion3().split(",");
|
||||
for(String week : weeks) {
|
||||
if(StringUtils.isNoneBlank(week)) {
|
||||
Date temp = closestAfterWeek(validStartTime, Integer.valueOf(week));
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", true);
|
||||
dataMap.put("cfg", cfg);
|
||||
String triName = VALID_KEY + dayOrWeek +week+"("+interval+")" + "_" + DateUtils.formatDate(temp, Constants.COMMON_DATE_FORMAT);
|
||||
Trigger validTri = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(intervalBuilder)
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(temp)
|
||||
.build();
|
||||
triList.add(validTri);
|
||||
//invalid
|
||||
dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", false);
|
||||
dataMap.put("cfg", cfg);
|
||||
temp = closestAfterWeek(invalidTime, Integer.valueOf(week));
|
||||
triName = INVALID_KEY + dayOrWeek +week+"("+interval+")" + "_" + DateUtils.formatDate(temp, Constants.COMMON_DATE_FORMAT);
|
||||
validTri = TriggerBuilder.newTrigger()
|
||||
.withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId))
|
||||
.withSchedule(intervalBuilder)
|
||||
.usingJobData(dataMap)
|
||||
.forJob(STATUS_JOBDETAIL)
|
||||
.startAt(temp)
|
||||
.build();
|
||||
triList.add(validTri);
|
||||
}
|
||||
}
|
||||
}
|
||||
return triList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每月 执行
|
||||
* @param cfg
|
||||
* @return
|
||||
*/
|
||||
public static List<Trigger> createEveryMonthTrigger(ScheduleCfg cfg){
|
||||
String dayWeek = cfg.getUserRegion3();
|
||||
String cronInvalid = cfg.getCronInvalid();
|
||||
String cronValid = cfg.getCronValid();
|
||||
StringBuilder cronSb = new StringBuilder();
|
||||
Trigger trigger = null;
|
||||
List<Integer> validList = parseTime(cronValid);//time 转换
|
||||
List<Integer> invalidList = parseTime(cronInvalid);//time 转换
|
||||
List<Trigger> triList = new ArrayList<Trigger>();
|
||||
String userRegion4 = cfg.getUserRegion4().toUpperCase();
|
||||
if("day".equalsIgnoreCase(dayWeek)) {//指定天
|
||||
boolean hasL = userRegion4.contains("L");
|
||||
StringBuilder chooseSb = new StringBuilder();
|
||||
for(String str : userRegion4.split(",")) {
|
||||
if(!"L".equalsIgnoreCase(str.trim())) {
|
||||
chooseSb.append(",").append(str);
|
||||
}
|
||||
}
|
||||
chooseSb.deleteCharAt(0);
|
||||
cronSb.append(validList.get(2)).append(" ")//秒
|
||||
.append(validList.get(1)).append(" ")//分
|
||||
.append(validList.get(0)).append(" ")//小时
|
||||
.append(chooseSb.toString()).append(" ")//日
|
||||
.append(cfg.getUserRegion2()).append(" ")//月
|
||||
.append("?").append(" ");//周
|
||||
trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), true, cfg);
|
||||
triList.add(trigger);
|
||||
cronSb.setLength(0);
|
||||
cronSb.append(invalidList.get(2)).append(" ")//秒
|
||||
.append(invalidList.get(1)).append(" ")//分
|
||||
.append(invalidList.get(0)).append(" ")//小时
|
||||
.append(chooseSb.toString()).append(" ")//日
|
||||
.append(cfg.getUserRegion2()).append(" ")//月
|
||||
.append("?").append(" ");//周
|
||||
trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), false, cfg);
|
||||
triList.add(trigger);
|
||||
if(hasL) {// 月的最后一天,quartz 不支持 1,L 这种指定,所以 L单独处理一下
|
||||
cronSb.setLength(0);
|
||||
cronSb.append(validList.get(2)).append(" ")//秒
|
||||
.append(validList.get(1)).append(" ")//分
|
||||
.append(validList.get(0)).append(" ")//小时
|
||||
.append("L").append(" ")//日
|
||||
.append(cfg.getUserRegion2()).append(" ")//月
|
||||
.append("?").append(" ");//周
|
||||
trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), true, cfg);
|
||||
triList.add(trigger);
|
||||
cronSb.setLength(0);
|
||||
cronSb.append(invalidList.get(2)).append(" ")//秒
|
||||
.append(invalidList.get(1)).append(" ")//分
|
||||
.append(invalidList.get(0)).append(" ")//小时
|
||||
.append("L").append(" ")//日
|
||||
.append(cfg.getUserRegion2()).append(" ")//月
|
||||
.append("?").append(" ");//周
|
||||
trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), false, cfg);
|
||||
triList.add(trigger);
|
||||
}
|
||||
}else if ("week".equalsIgnoreCase(dayWeek)) {//指定周,1#2: 第一周的周二,4L:最后一周的周四
|
||||
for(String nthWeek : userRegion4.split(",")) {//第几周
|
||||
for(String week : cfg.getUserRegion5().split(",")) {//星期几
|
||||
cronSb.setLength(0);
|
||||
cronSb.append(validList.get(2)).append(" ")//秒
|
||||
.append(validList.get(1)).append(" ")//分
|
||||
.append(validList.get(0)).append(" ")//小时
|
||||
.append("?").append(" ")//日
|
||||
.append(cfg.getUserRegion2()).append(" ");//月
|
||||
if("L".equalsIgnoreCase(nthWeek)) {
|
||||
cronSb.append(week).append("L");//周
|
||||
}else {
|
||||
cronSb.append(week).append("#").append(nthWeek);//周
|
||||
}
|
||||
trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), true, cfg);
|
||||
triList.add(trigger);
|
||||
cronSb.setLength(0);
|
||||
cronSb.append(invalidList.get(2)).append(" ")//秒
|
||||
.append(invalidList.get(1)).append(" ")//分
|
||||
.append(invalidList.get(0)).append(" ")//小时
|
||||
.append("?").append(" ")//日
|
||||
.append(cfg.getUserRegion2()).append(" ");//月
|
||||
if("L".equalsIgnoreCase(nthWeek)) {
|
||||
cronSb.append(week).append("L");//周
|
||||
}else {
|
||||
cronSb.append(week).append("#").append(nthWeek);//周
|
||||
}
|
||||
trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), false, cfg);
|
||||
triList.add(trigger);
|
||||
}
|
||||
}
|
||||
}
|
||||
return triList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查找最近的 星期几 ,包括今天
|
||||
* @param date
|
||||
* @param w 周一开始 1 -7
|
||||
* @return
|
||||
*/
|
||||
public static Date closestAfterWeek(Date date,int w) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
int i = cal.get(Calendar.DAY_OF_WEEK);//周日开始 1-7
|
||||
i = (i==1)? 7: i-1;//转换为 周一到 周日 1-7
|
||||
cal.add(Calendar.DAY_OF_MONTH, (i>w)?(7-(i-w)) : (w-i));
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
|
||||
public static TriggerKey createTiggerKey(String name,String group) {
|
||||
TriggerKey key = new TriggerKey(name, group);
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* jquery cron 生成的cron 表达式,quartz 不能直接使用,需要做些修改
|
||||
* @param cron
|
||||
* @return
|
||||
*/
|
||||
public static String modifyCronExp(String cron) {
|
||||
String[] cronArr = cron.split("\\s");
|
||||
if("*".equals(cronArr[4])) {
|
||||
cronArr[4] = "?";
|
||||
}else {
|
||||
cronArr[3] = "*";
|
||||
cronArr[2] = "?";
|
||||
}
|
||||
return "0 " + StringUtils.join(cronArr, " ");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
CronTriggerImpl cron = new CronTriggerImpl();
|
||||
try {
|
||||
String exp = "0 0 0 ? 1,2 1#4";
|
||||
cron.setCronExpression(exp);
|
||||
System.out.println(cron);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
@@ -248,7 +248,7 @@ public class ConfigConvertUtil {
|
||||
List<Integer> regionIdList = Lists.newArrayList();
|
||||
T srcCfg = srcList.get(i);
|
||||
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
||||
BeanUtils.copyProperties(srcCfg, baseIpCfg);
|
||||
BeanUtils.copyProperties(srcCfg, baseIpCfg,new String[]{"menuNameCode"});
|
||||
regionIdList.add(baseIpCfg.getRegionId());
|
||||
IpCfg cfg = new IpCfg();
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
@@ -325,10 +325,10 @@ public class ConfigConvertUtil {
|
||||
} else if (cfgType == 4) {
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
BaseCfg baseCfg = new BaseCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
|
||||
BeanUtils.copyProperties(srcList.get(i), baseCfg,new String[]{"menuNameCode"});//拷贝公共属性
|
||||
// 一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.NumBoundaryCfg cfg = new com.nis.domain.maat.MaatCfg.NumBoundaryCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(baseCfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
@@ -344,10 +344,10 @@ public class ConfigConvertUtil {
|
||||
} else if (cfgType == 5) {
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
BaseCfg baseCfg = new BaseCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
|
||||
BeanUtils.copyProperties(srcList.get(i), baseCfg,new String[]{"menuNameCode"});//拷贝公共属性
|
||||
// 一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(baseCfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ public class ConfigServiceUtil {
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("get ids finish,cost:"+(end-start));
|
||||
} catch (Exception e) {
|
||||
logger.error("getId()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -200,6 +201,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("postMaatCfg()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -241,6 +243,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("postCallbackCfg()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -284,6 +287,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("postFileCfg()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -330,6 +334,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("delete()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -356,7 +361,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);
|
||||
@@ -378,6 +383,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("put()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -400,9 +406,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 {
|
||||
@@ -414,6 +420,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("patch()",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -451,9 +458,11 @@ 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) {
|
||||
logger.error("getFileDigest()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -463,43 +472,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,8 +507,9 @@ 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) {
|
||||
logger.error("postGroupReuseSources()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -525,7 +518,6 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* getReport(配置日志总量统计查询)
|
||||
@@ -576,6 +568,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("getReport()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -634,6 +627,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("getReport()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -696,6 +690,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("getReport()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -745,16 +740,23 @@ 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) {
|
||||
logger.error("getCGI()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -811,15 +813,16 @@ 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);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("configSyncCmd()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -856,11 +859,13 @@ 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);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("configSyncStatus()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -907,6 +912,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("configSync()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -947,6 +953,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("configStatusUpdate()",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
@@ -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", "&");
|
||||
@@ -24,7 +21,7 @@ public final class Constants {
|
||||
* MaatConfig 默认值
|
||||
*/
|
||||
public static Integer MAAT_CFG_DOLOG_DEFAULT=Configurations.getIntProperty("maat_cfg_dolog_default", 2);
|
||||
public static Integer MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT=Configurations.getIntProperty("maat_cfg_dolog_doblacklist_default", 1);
|
||||
public static Integer MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT=Configurations.getIntProperty("maat_cfg_dolog_doblacklist_default", 0);
|
||||
public static Integer MAAT_CFG_DOLOG_CONFIGPERCENT_DEFAULT=Configurations.getIntProperty("maat_cfg_dolog_configpercent_default", 100);
|
||||
public static Integer MAAT_CFG_DOLOG_CONFIGOPTION_DEFAULT=Configurations.getIntProperty("maat_cfg_dolog_configoption_default", 1);
|
||||
/**
|
||||
@@ -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);
|
||||
@@ -834,5 +828,14 @@ public final class Constants {
|
||||
/**
|
||||
* vpn cgi接口报错信息
|
||||
*/
|
||||
public static final String CGI_ERROR = Configurations.getStringProperty("cgiError","");;
|
||||
public static final String CGI_ERROR = Configurations.getStringProperty("cgiError","");
|
||||
|
||||
/**
|
||||
* 配置保护名单字典key
|
||||
*/
|
||||
public static final String CACHE_PROTECTION_LIST_DICT = "protetionListDict";
|
||||
/**
|
||||
* 管理员用户预警查询服务配置总量接口
|
||||
*/
|
||||
public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService","");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.nis.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
@@ -96,6 +98,18 @@ public class DictUtils {
|
||||
}
|
||||
return itemList;
|
||||
}
|
||||
public static Map<String,String> getDictMap(String key){
|
||||
Map dictMap=new HashMap<String,String>();
|
||||
List<SysDataDictionaryItem> itemList = getDictData().get(key);
|
||||
if (StringUtil.isEmpty(itemList)) {
|
||||
return dictMap;
|
||||
}else {
|
||||
for(SysDataDictionaryItem item:itemList) {
|
||||
dictMap.put(item.getItemCode(), item.getItemValue());
|
||||
}
|
||||
}
|
||||
return dictMap;
|
||||
}
|
||||
|
||||
public static String getDictLabels(String dictKey, String itemCodes, String defaultValue){
|
||||
|
||||
@@ -246,6 +260,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
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -18,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
@@ -75,7 +77,7 @@ public class SchedulerTaskUtil {
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public boolean updateConfigByServiceAndCompile(Integer serviceId,Integer compileId,Integer isValid,Integer isIssueContent,ConfigSynchronizationDao configSynchronizationDao) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
|
||||
public void updateConfigByServiceAndCompile(Integer serviceId,Integer compileId,Integer isValid,Integer isIssueContent,ConfigSynchronizationDao configSynchronizationDao)throws Exception{
|
||||
// SecurityManagerInit();
|
||||
// Subject subject = login("admin","zdjzsoft");
|
||||
// System.out.println(subject.getPrincipal());
|
||||
@@ -133,6 +135,8 @@ public class SchedulerTaskUtil {
|
||||
if("cfg_index_info".equals(tableName)){
|
||||
List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity);
|
||||
if(isIssueContent.equals(1)){
|
||||
//用于存储自定义域为关键字的业务,key=compileId,value=keyword.
|
||||
Map<Integer, BaseStringCfg> keywordMap=new HashMap<>();
|
||||
//查询子域配置详情
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
@@ -141,6 +145,13 @@ public class SchedulerTaskUtil {
|
||||
ipList.addAll(configSynchronizationDao.getIpPortList(regionTable, compileIds));
|
||||
}else if("2".equals(m.get("cfgType"))){
|
||||
strList.addAll(configSynchronizationDao.getStrList(regionTable,compileIds));
|
||||
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword
|
||||
if(entity.getServiceId()==512
|
||||
||entity.getServiceId()==521
|
||||
||entity.getServiceId()==514
|
||||
||entity.getServiceId()==1026) {
|
||||
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(regionTable, compileIds);
|
||||
}
|
||||
}else if("3".equals(m.get("cfgType"))){
|
||||
complexStrList.addAll(configSynchronizationDao.getComplexStrList(regionTable,compileIds));
|
||||
}else if("4".equals(m.get("cfgType"))){
|
||||
@@ -175,14 +186,14 @@ public class SchedulerTaskUtil {
|
||||
if(userRegionPosition!=null && (userRegionPosition.toString().equals("1")||userRegionPosition.toString().equals("0"))){
|
||||
//通过反射机制获取自定义域字段值
|
||||
String regionColumn = n.get("regionColumn").toString();
|
||||
String regionKey = n.get("regionKey").toString();
|
||||
Object value = "";
|
||||
Class aClass = null;
|
||||
if(userRegionPosition.toString().equals(("0"))){
|
||||
aClass = BaseCfg.class;
|
||||
}else{
|
||||
aClass = CfgIndexInfo.class;
|
||||
}
|
||||
|
||||
Object value = "";
|
||||
if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略
|
||||
String[] regionArray = regionColumn.split(",");
|
||||
for(int r=0;r<regionArray.length;r++){
|
||||
@@ -197,9 +208,22 @@ public class SchedulerTaskUtil {
|
||||
}
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
if(regionKey.equals("keyring_id") && StringUtil.isEmpty(value)){
|
||||
value = "0";
|
||||
}else if(regionKey.equals("DOMAIN_STR")) {
|
||||
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
|
||||
value = keywordMap.get(cfg.getCompileId()).getCfgKeywords();
|
||||
}
|
||||
}else if(regionKey.equals("DOMAIN_ID")) {
|
||||
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
|
||||
value = cfg.getCompileId();
|
||||
}
|
||||
|
||||
}else {
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
}
|
||||
if(!StringUtil.isEmpty(value)){
|
||||
if(StringUtil.isEmpty(n.get("regionKey"))){
|
||||
userRegion = value.toString();
|
||||
@@ -305,9 +329,6 @@ public class SchedulerTaskUtil {
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容响应信息:"+result.getMsg());
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
/*maatCfg = new MaatCfg();
|
||||
@@ -364,8 +385,8 @@ public class SchedulerTaskUtil {
|
||||
}
|
||||
}
|
||||
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号),分组复用的域配置不需要重新获取regionId,groupId
|
||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()+list.size());
|
||||
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()+list.size());
|
||||
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
|
||||
entity.setAuditTime(updateTime);
|
||||
for(int i=0;i<list.size();i++){
|
||||
@@ -384,7 +405,8 @@ public class SchedulerTaskUtil {
|
||||
areaIpRegionList = new ArrayList();
|
||||
List<DdosIpCfg> list1 = new ArrayList();
|
||||
String userRegion = "";
|
||||
//处理自定义域
|
||||
//处理自定义域【DDOS自定义域组成json结构】
|
||||
Map ddosUserRegion= new HashMap();
|
||||
if(userRegionList!=null){
|
||||
for(Map<String,Object> n:userRegionList){
|
||||
Object userRegionPosition = n.get("userRegionPosition");
|
||||
@@ -401,17 +423,23 @@ public class SchedulerTaskUtil {
|
||||
Field field = aClass.getDeclaredField(regionColumn);
|
||||
field.setAccessible(true);
|
||||
value = field.get(cfg);
|
||||
|
||||
if(!StringUtil.isEmpty(value)){
|
||||
if(StringUtil.isEmpty(n.get("regionKey"))){
|
||||
userRegion = value.toString();
|
||||
}else{
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
//userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
ddosUserRegion.put(n.get("regionKey"), value);
|
||||
}
|
||||
}else{
|
||||
ddosUserRegion.put(n.get("regionKey"), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
|
||||
userRegion = userRegion.substring(0, userRegion.length()-1);
|
||||
}else if(!StringUtil.isEmpty(ddosUserRegion)){
|
||||
userRegion = new Gson().toJson(ddosUserRegion);
|
||||
}
|
||||
}
|
||||
list1.add(cfg);
|
||||
@@ -450,9 +478,6 @@ public class SchedulerTaskUtil {
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("定时任务修改DDOS配置内容响应信息:"+result.getMsg());
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
/*maatCfg = new MaatCfg();
|
||||
@@ -591,10 +616,7 @@ public class SchedulerTaskUtil {
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("定时任务修改文件摘要类配置内容响应信息:"+result.getMsg());
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
/*maatCfg = new MaatCfg();
|
||||
maatCfg.initDefaultValue();
|
||||
@@ -753,10 +775,7 @@ public class SchedulerTaskUtil {
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("定时任务更新APP POLICY配置内容响应信息:"+result.getMsg());
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
/*maatCfg = new MaatCfg();
|
||||
maatCfg.initDefaultValue();
|
||||
@@ -795,7 +814,7 @@ public class SchedulerTaskUtil {
|
||||
|
||||
}else{//只修改配置状态
|
||||
//下发并修改配置状态的参数类
|
||||
ToUpdateMaatBeanStatus maatStatusBean = new ToUpdateMaatBeanStatus();
|
||||
/*ToUpdateMaatBeanStatus maatStatusBean = new ToUpdateMaatBeanStatus();
|
||||
UpdateMaatCfgStatus updateCfg = new UpdateMaatCfgStatus();
|
||||
List<UpdateMaatCfgStatus> configCompileStartStopList = new ArrayList();
|
||||
maatStatusBean.setVersion(Constants.MAAT_VERSION);
|
||||
@@ -841,13 +860,45 @@ public class SchedulerTaskUtil {
|
||||
String json=BaseService.gsonToJson(maatStatusBean);
|
||||
logger.info("MAAT类配置启停状态修改内容:"+json);
|
||||
//调用服务启停接口
|
||||
String result = ConfigServiceUtil.configStatusUpdate(json);
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
if(result!=null){
|
||||
logger.info("MAAT类配置启停状态修改结果:"+result);
|
||||
logger.info("MAAT类配置启停状态修改结果:"+result.getMsg());
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
/*maatCfg = new MaatCfg();
|
||||
}*/
|
||||
|
||||
//ip spoofing
|
||||
if(serviceId.equals(518)){
|
||||
entity.setCompileId(compileId);
|
||||
List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity);
|
||||
entity.setCompileId(compileId);
|
||||
for(CfgIndexInfo cfg:list){
|
||||
if(isValid==0){
|
||||
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool();
|
||||
pool.setCfgId(Long.valueOf(cfg.getUserRegion3()));
|
||||
pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId());
|
||||
List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>();
|
||||
pool.setIsValid(0);
|
||||
pool.setCompileId(pool.getCompileId());
|
||||
pool.setServiceId(pool.getServiceId());
|
||||
poolList.add(pool);
|
||||
//调用服务接口取消配置
|
||||
String json=BaseService.gsonToJson(poolList);
|
||||
logger.info("欺骗IP池配置配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("欺骗IP池配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("欺骗IP池配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
maatCfg = new MaatCfg();
|
||||
maatCfg.initDefaultValue();
|
||||
maatBean = new ToMaatBean();
|
||||
configCompileList = new ArrayList();
|
||||
@@ -857,7 +908,7 @@ public class SchedulerTaskUtil {
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setCreatorName("TaskScheduler");
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
@@ -865,7 +916,7 @@ public class SchedulerTaskUtil {
|
||||
logger.info("定时器修改配置状态:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("定时器修改配置状态响应时间:"+result.getMsg());*/
|
||||
logger.info("定时器修改配置状态响应时间:"+result.getMsg());
|
||||
}
|
||||
|
||||
}else if("2".equals(serviceType)){//回调类配置
|
||||
@@ -925,17 +976,11 @@ public class SchedulerTaskUtil {
|
||||
//调用服务接口修改回调类配置状态
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,2);
|
||||
logger.info("定时器修改回调类配置状态响应信息:"+result);
|
||||
if(result==null){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//定时器非前台业务,需要设置shiro的SecurityManager
|
||||
private void SecurityManagerInit(){
|
||||
|
||||
@@ -230,6 +230,24 @@ public class ServiceConfigTemplateUtil {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Set<String> getAllTableName(){
|
||||
//Set<String> tableName = getCompileTableName();
|
||||
Set<String> result = Sets.newHashSet();
|
||||
List<Map<String, Object>> serviceList = getServiceList();
|
||||
for (Map<String, Object> serviceNode : serviceList) {
|
||||
result.add(serviceNode.get("tableName").toString().trim());
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) serviceNode.get("cfgList");
|
||||
if(cfgList != null) {
|
||||
for (Map<String, Object> map : cfgList) {
|
||||
result.add(map.get("tableName").toString().trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
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.SysDataDictionaryItem;
|
||||
@@ -453,6 +454,19 @@ public class ExportExcel {
|
||||
}
|
||||
|
||||
}
|
||||
if("ip_group".equals(headerStr)) {
|
||||
commentStr="";
|
||||
//查询dns fake ip policyGroup列表
|
||||
List<PolicyGroupInfo> list=policyGroupInfoDao.findPolicyGroupInfosByType(5);
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
for (PolicyGroupInfo policyGroupInfo : list) {
|
||||
commentStr=commentStr+policyGroupInfo.getServiceGroupId()+"("+policyGroupInfo.getGroupName()+")\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
if("isp".equals(headerStr)) {
|
||||
commentStr="";
|
||||
List<Integer> itTypeList = new ArrayList<Integer>();
|
||||
@@ -2233,7 +2247,9 @@ public class ExportExcel {
|
||||
* @return list 数据列表
|
||||
*/
|
||||
public <E> ExportExcel setDataList(Properties msgProp, Map<String,List> dataMap, Map<Object,Object> map){
|
||||
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
|
||||
Set<String> keyList=dataMap.keySet();
|
||||
Map<String,Map<String,String>> dictMaps=Maps.newConcurrentMap();
|
||||
for (String key : keyList) {
|
||||
List<E> list=dataMap.get(key);
|
||||
for (E e : list){
|
||||
@@ -2263,7 +2279,16 @@ public class ExportExcel {
|
||||
val = getBasicInfo(ef.dictType(),map,valStr);
|
||||
}else{
|
||||
//字典数据已做国际化处理
|
||||
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, valStr);
|
||||
String dict="";
|
||||
if(dictMaps.containsKey(ef.dictType())) {
|
||||
Map<String,String> dictM=dictMaps.get(ef.dictType());
|
||||
dict=dictM.containsKey(valStr)?dictM.get(valStr):valStr;
|
||||
}else {
|
||||
Map<String,String> dictM=DictUtils.getDictMap(ef.dictType());
|
||||
dictMaps.put(ef.dictType(), dictM);
|
||||
dict=dictM.containsKey(valStr)?dictM.get(valStr):valStr;
|
||||
}
|
||||
//String dict=DictUtils.getDictLabel(ef.dictType(), valStr, valStr);
|
||||
//如果找不到字典国际化值,把字典本身作为默认值放进去,不然导出就是空了
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
//业务配置-stream 阻断类型中 阻断 改为 封堵(丢弃)
|
||||
@@ -2332,6 +2357,8 @@ public class ExportExcel {
|
||||
log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
|
||||
}
|
||||
}
|
||||
end=System.currentTimeMillis();
|
||||
log.info("setDataList cost:"+(end-start));
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -2464,6 +2491,7 @@ public class ExportExcel {
|
||||
* @return
|
||||
*/
|
||||
public ExportExcel(Properties msgProp,List<String> titleList,Map<String,String> noExportMap,Map<String, Class<?>> clsMap, int type,String titleTime, int... groups){
|
||||
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
|
||||
Map<String, List<String>> headerMap=new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
|
||||
for (String title : titleList) {
|
||||
@@ -2589,6 +2617,8 @@ public class ExportExcel {
|
||||
annotationMap.put(title, annotationList);
|
||||
}
|
||||
initializeMultiSheet(msgProp,titleList, headerMap,commentMap,titleTime);
|
||||
end=System.currentTimeMillis();
|
||||
System.err.println("ExportExcel cost:"+(end-start));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
@@ -421,19 +423,23 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
||||
throw new RuntimeException("regionDict is null!");
|
||||
}
|
||||
if(dataList.size()==0) {
|
||||
throw new ServiceException(props.getProperty("noneData", "noneData"));
|
||||
throw new ServiceException(props.getProperty("no_data", "no_data"));
|
||||
}else if(this.hasImportLimit&&dataList.size()>(Constants.IMPORT_LIMIT+1)) {
|
||||
throw new ServiceException(props.getProperty("import_limit_is", "The maximum import size is")+" "+Constants.IMPORT_LIMIT);
|
||||
}
|
||||
// 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 = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("301");
|
||||
baseStringCfg.setUserRegion1("302");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
@@ -381,45 +381,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);
|
||||
|
||||
@@ -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();
|
||||
@@ -141,20 +130,18 @@ 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);
|
||||
|
||||
// 特殊字段验证
|
||||
// packet ip ratelimit
|
||||
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
||||
if (serviceDict!=null && serviceDict.getAction().intValue() == 64 && (serviceDict.getFunctionId().intValue() == 5
|
||||
|| serviceDict.getFunctionId().intValue() == 63
|
||||
|| serviceDict.getFunctionId().intValue() == 407
|
||||
|| serviceDict.getFunctionId().intValue() == 408) ) {
|
||||
String userRegion1 = IpRateLimitTemplate.userRegion1;
|
||||
baseIpCfg.setUserRegion1(userRegion1);
|
||||
if("0".equals(userRegion1)) {
|
||||
if(StringUtils.isBlank(baseIpCfg.getUserRegion2())) {
|
||||
baseIpCfg.setUserRegion2("0.1");
|
||||
}
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();
|
||||
try {
|
||||
// Double ratelimt= Double.parseDouble(userRegion2);
|
||||
@@ -270,7 +257,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 +268,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 +284,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 +302,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -471,7 +445,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
|
||||
baseIpCfg.setUserRegion1("301");
|
||||
baseIpCfg.setUserRegion1("302");
|
||||
}
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();// 重定向URL
|
||||
@@ -955,16 +929,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);
|
||||
}
|
||||
}
|
||||
@@ -1412,16 +1376,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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("301");
|
||||
baseStringCfg.setUserRegion1("302");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.ws.rs.client.Invocation.Builder;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
@@ -37,6 +38,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.Encodes;
|
||||
@@ -236,6 +238,7 @@ public class HttpClientUtil {
|
||||
* @return 查询结果数据json
|
||||
*/
|
||||
public static String getMsg(String destUrl, Map<String, Object> params, HttpServletRequest req) throws IOException {
|
||||
long start=System.currentTimeMillis(), end=System.currentTimeMillis();
|
||||
// RequestContext requestContext = new RequestContext(req);
|
||||
|
||||
// CloseableHttpResponse response = null;
|
||||
@@ -283,6 +286,7 @@ public class HttpClientUtil {
|
||||
logger.error("获取消息失败,相应内容如下: " + result);
|
||||
throw new MaatConvertException(status+"");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("获取消息失败,相应内容如下: " + result);
|
||||
@@ -292,6 +296,8 @@ public class HttpClientUtil {
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
end=System.currentTimeMillis();
|
||||
logger.warn("getMsg cost:"+(end-start)+"ms");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -302,12 +308,14 @@ public class HttpClientUtil {
|
||||
* @return
|
||||
*/
|
||||
public static String galaxyMessageFormat(String recv){
|
||||
JSONObject jobj = JSONObject.fromObject(recv);
|
||||
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
|
||||
//JSONObject jobj = JSONObject.fromObject(recv);
|
||||
com.alibaba.fastjson.JSONObject jobj = JSON.parseObject(recv);
|
||||
Map<String, Object> parse = (Map<String, Object>)jobj;
|
||||
Map map = (Map) parse.get("data");
|
||||
List reslist=new ArrayList();
|
||||
List<Map<String,Object>> list= (List)map.get("list");
|
||||
if(list!=null&&list.size()>0){
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
for (Map<String,Object> m : list) {
|
||||
Map recvMap = new HashMap();
|
||||
Iterator<Entry<String, Object>> iterator = m.entrySet().iterator();
|
||||
@@ -316,12 +324,12 @@ public class HttpClientUtil {
|
||||
String key = next.getKey().toString();
|
||||
Object value = next.getValue();
|
||||
//处理字段为“null”情况
|
||||
if(value!=null&&"null".equals(value)){
|
||||
if("null".equals(value)){
|
||||
value="";
|
||||
}
|
||||
//处理时间字段为“0”情况
|
||||
if("foundTime".equals(key)||"recvTime".equals(key)){
|
||||
if(null!=value&&"0".equals(value)){
|
||||
if("0".equals(value)){
|
||||
value="";
|
||||
}
|
||||
}
|
||||
@@ -337,6 +345,8 @@ public class HttpClientUtil {
|
||||
parse.put("data", map);
|
||||
recv = parse.toString();
|
||||
}
|
||||
end=System.currentTimeMillis();
|
||||
logger.info("galaxyMessageFormat cost:"+(end-start));
|
||||
return recv;
|
||||
}
|
||||
|
||||
|
||||
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
@@ -29,6 +29,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.CookieUtil;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
@@ -87,6 +88,7 @@ public class LoginController extends BaseController {
|
||||
CookieUtil.addCookie(response, "LOGINED", "false");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +175,7 @@ public class LoginController extends BaseController {
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -212,6 +215,7 @@ public class LoginController extends BaseController {
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:"+request.getParameter("url");
|
||||
@@ -230,6 +234,7 @@ public class LoginController extends BaseController {
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:"+request.getParameter("url");
|
||||
|
||||
@@ -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,18 @@ 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.LogUtils;
|
||||
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,38 +100,122 @@ public class SystemController extends BaseController{
|
||||
System.out.println(menu.getParentIds());
|
||||
newList.add(menu);
|
||||
}*/
|
||||
//将帮助文档缓存到redis
|
||||
helpService.cacheAllHelpInfo();
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("help error",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
logger.info("menuSize:"+newList.size());
|
||||
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);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
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);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
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);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping("clearPolicies")
|
||||
@ResponseBody
|
||||
public boolean clearPolicies(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
systemService.clearPolicies();
|
||||
/*ArrayList<Object> list = Lists.newArrayList();
|
||||
System.out.println(list.get(6));*/
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.error("Clear Policies Error",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,8 @@ 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.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
@@ -74,7 +68,7 @@ public class AsnGroupController extends BaseController {
|
||||
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(AsnGroupInfo cfg,Model model,
|
||||
RedirectAttributes redirectAttributes,String itType) {
|
||||
RedirectAttributes redirectAttributes,String itType,HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
AsnGroupInfo asnGroup=asnGroupInfoService.getGroupIdByNameAndASNId(cfg.getOrganization().trim(), cfg.getCountry().trim(), cfg.getAsnId());
|
||||
@@ -85,13 +79,9 @@ 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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
@@ -106,19 +96,14 @@ 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,HttpServletRequest request) {
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
}
|
||||
@@ -173,15 +158,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 +175,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;
|
||||
@@ -31,6 +32,7 @@ import com.nis.exceptions.MaatConvertException;
|
||||
//import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -78,15 +80,21 @@ public class AsnIpController extends BaseController{
|
||||
public String save(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
asnIpCfgService.saveAsnIpCfg(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ASN IP配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ASN IP配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
|
||||
@@ -97,11 +105,21 @@ public class AsnIpController extends BaseController{
|
||||
try{
|
||||
|
||||
asnIpCfgService.update(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ASN IP配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ASN IP配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
|
||||
@@ -134,24 +152,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,isAudit);
|
||||
}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);
|
||||
@@ -160,30 +165,39 @@ public class AsnIpController extends BaseController{
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}*/
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"asn:ip:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
public String delete(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AsnIpCfg cfg){
|
||||
try{
|
||||
asnIpCfgService.delete(ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
asnIpCfgService.delete(ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,6 +286,7 @@ public class AsnIpController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("asnIp export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ProtectionListInfo;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* 内置配置保护名单管理
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/innerProtectionList")
|
||||
public class InnerProtectionListController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"/list", ""})
|
||||
public String policyGroupList(ProtectionListInfo cfg,HttpServletRequest request, HttpServletResponse response, Model model,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if(cfg == null)cfg=new ProtectionListInfo();
|
||||
Page<ProtectionListInfo> pageCondition = new Page<ProtectionListInfo>(request, response,"r");
|
||||
Page page = innerProtectionListService.findProtectionInfoList(pageCondition,cfg);
|
||||
|
||||
model.addAttribute("cfg", cfg);
|
||||
model.addAttribute("page", page);
|
||||
return "/basics/protectionInfoList";
|
||||
}
|
||||
|
||||
@RequestMapping(value={"/form"})
|
||||
public String form(Integer groupType,String ids,Model model,String doAction,RedirectAttributes redirectAttributes) {
|
||||
ProtectionListInfo protectionListInfo = new ProtectionListInfo();
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
protectionListInfo = innerProtectionListService.getById(Integer.parseInt(ids));
|
||||
}
|
||||
model.addAttribute("_cfg", protectionListInfo);
|
||||
return "/basics/protectionInfoForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(ProtectionListInfo cfg,Model model,String itType,Integer groupType,
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
try {
|
||||
innerProtectionListService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("新增失败",e);
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/innerProtectionList/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(RedirectAttributes redirectAttributes,String ids,int isValid,HttpServletRequest request) {
|
||||
try {
|
||||
innerProtectionListService.deldete(ids,isValid);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/innerProtectionList/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value="ajaxGetAllInfo",method=RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Map<String,List<String>> ajaxGetAllInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
return innerProtectionListService.ajaxGetAllInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验配置是否已存在
|
||||
* @param cfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/checkKeywordExist"})
|
||||
public boolean checkKeywordExist(ProtectionListInfo cfg, HttpServletRequest request, HttpServletResponse response){
|
||||
if(!StringUtil.isEmpty(cfg.getProId())){ // 修改操作
|
||||
ProtectionListInfo info = innerProtectionListService.getById(cfg.getProId());
|
||||
if(info != null && info.getKeyword().equals(cfg.getKeyword()) && info.getTargetType().equals(cfg.getTargetType())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Map<String, List<String>> map = innerProtectionListService.ajaxGetAllInfo();
|
||||
List<String> list = map.get(cfg.getTargetType());
|
||||
if(list != null) {
|
||||
if(list.contains(cfg.getKeyword())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/vpn")
|
||||
@@ -75,6 +76,7 @@ public class IpReuseIpCfgController extends BaseController{
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/vpn/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@@ -91,6 +93,7 @@ public class IpReuseIpCfgController extends BaseController{
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/vpn/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@@ -98,7 +101,7 @@ public class IpReuseIpCfgController extends BaseController{
|
||||
@RequiresPermissions(value={"asn:ip:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
,RedirectAttributes redirectAttributes,HttpServletRequest request){
|
||||
try{
|
||||
ipReuseIpCfgService.delete(isValid,ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
@@ -106,8 +109,10 @@ public class IpReuseIpCfgController extends BaseController{
|
||||
logger.error("Delete failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
@@ -71,7 +72,7 @@ public class PolicyGroupController extends BaseController {
|
||||
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(PolicyGroupInfo cfg,Model model,
|
||||
RedirectAttributes redirectAttributes,String itType,Integer groupType) {
|
||||
RedirectAttributes redirectAttributes,String itType,Integer groupType,HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
policyGroupInfoService.saveOrUpdate(cfg);
|
||||
@@ -79,6 +80,7 @@ public class PolicyGroupController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("新增失败",e);
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/policyGroup/policyGroupList?groupType="+groupType;
|
||||
@@ -93,13 +95,14 @@ public class PolicyGroupController extends BaseController {
|
||||
*/
|
||||
//@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del"},logical=Logical.OR)
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(RedirectAttributes redirectAttributes, Integer groupType,String ids,int isValid) {
|
||||
public String delete(RedirectAttributes redirectAttributes, Integer groupType,String ids,int isValid,HttpServletRequest request) {
|
||||
try {
|
||||
policyGroupInfoService.deldete(ids,isValid);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/policyGroup/policyGroupList?groupType="+groupType;
|
||||
}
|
||||
@@ -194,6 +197,7 @@ public class PolicyGroupController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("Group export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -52,7 +53,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value="requestCancleInfoAjax", method = RequestMethod.POST)
|
||||
public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable){
|
||||
public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable,HttpServletRequest request){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
@@ -61,6 +62,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("审核添加取消来函信息失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
@@ -76,7 +78,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value="requestCancleInfoNumber")
|
||||
public Map requestCancleInfoNumber(String ids,String indexTable){
|
||||
public Map requestCancleInfoNumber(String ids,String indexTable,HttpServletRequest request){
|
||||
List list = new ArrayList();
|
||||
String requestTitle="";
|
||||
Map map=new HashMap();
|
||||
@@ -94,6 +96,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("查询取消审核来函信息失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
return map;
|
||||
}
|
||||
// }
|
||||
@@ -207,7 +210,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:vpn_ip:add","basics:classification:edit","basics:attribute:edit","basics:label:edit","basics:vpn_ip:edit"},logical=Logical.OR)
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes,String itType) {
|
||||
public String saveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes,String itType,HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
serviceDictInfoService.saveOrUpdate(serviceDictInfo);
|
||||
@@ -215,6 +218,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/serviceDictInfo/list?itType="+itType;
|
||||
@@ -231,7 +235,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del","basics:vpn_ip:del"},logical=Logical.OR)
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
|
||||
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId,HttpServletRequest request) {
|
||||
try {
|
||||
String exIp="";
|
||||
String id="";
|
||||
@@ -266,6 +270,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/serviceDictInfo/list?itType="+itType;
|
||||
}
|
||||
@@ -586,6 +591,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("dict white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -151,7 +152,7 @@ public class SysDictInfoController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions(value={"basics:area:add","basics:isp:add","basics:scope:add","basics:area:edit","basics:isp:edit","basics:scope:edit"},logical=Logical.OR)
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(SysDictInfo sysDictInfo,Model model, RedirectAttributes redirectAttributes, String itType) {
|
||||
public String saveOrUpdate(SysDictInfo sysDictInfo,Model model, RedirectAttributes redirectAttributes, String itType,HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
sysDictInfoService.saveOrUpdate(sysDictInfo);
|
||||
@@ -159,6 +160,7 @@ public class SysDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/sysDictInfo/list?itType="+itType;
|
||||
@@ -172,13 +174,14 @@ public class SysDictInfoController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions(value={"basics:area:del","basics:isp:del","basics:scope:del"},logical=Logical.OR)
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
|
||||
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId,HttpServletRequest request) {
|
||||
try {
|
||||
sysDictInfoService.deleteDict(mulitId);
|
||||
addMessage(redirectAttributes,"success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/sysDictInfo/list?itType="+itType;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.TaskInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -90,6 +91,7 @@ public class TaskInfoController extends BaseController{
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/taskInfo/list?functionId="+taskInfo.getFunctionId()+"&repage";
|
||||
}
|
||||
@@ -233,6 +235,7 @@ public class TaskInfoController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import java.util.Set;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.taglibs.standard.functions.Functions;
|
||||
@@ -41,6 +42,7 @@ import com.nis.domain.configuration.AppSslCertCfg;
|
||||
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.WebsiteDomainTopic;
|
||||
@@ -54,6 +56,7 @@ import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -152,7 +155,7 @@ public class AppCfgController extends BaseController {
|
||||
public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if (cfg.getIpPortList() != null) {
|
||||
if (CollectionUtils.isNotEmpty(cfg.getIpPortList())) {
|
||||
String cfgType = null;
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
@@ -161,7 +164,7 @@ public class AppCfgController extends BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
if (CollectionUtils.isNotEmpty(cfg.getNtcSubscribeIdCfgList())) {
|
||||
String cfgType = null;
|
||||
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ntc.getCfgType().equals(cfgType)) {
|
||||
@@ -218,15 +221,21 @@ public class AppCfgController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("saveAppPolicyCfg failed", e);
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("app 协议配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("app 协议配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + entity.getFunctionId();
|
||||
@@ -254,20 +263,20 @@ public class AppCfgController extends BaseController {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app策略配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,8 +292,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -305,8 +316,28 @@ public class AppCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateAppPolicyCfgValid" })
|
||||
@RequiresPermissions(value = { "app:policy:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -346,7 +377,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);
|
||||
@@ -376,15 +406,21 @@ public class AppCfgController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppIpCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("saveAppIpCfg failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
}catch (MaatConvertException e) {
|
||||
logger.error("APP IP配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("APP IP配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + entity.getFunctionId();
|
||||
@@ -414,10 +450,7 @@ public class AppCfgController extends BaseController {
|
||||
entity = appCfgService.getAppIpCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setTableName(AppIpCfg.getTablename());
|
||||
if (dataMap.containsKey(entity.getCompileId())) {
|
||||
dataMap.get(entity.getCompileId()).add(entity);
|
||||
} else {
|
||||
@@ -435,8 +468,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("app协议IP配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,8 +487,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -474,8 +511,28 @@ public class AppCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateAppIpCfgValid" })
|
||||
@RequiresPermissions(value = { "app:ip:config" })
|
||||
public String updateAppIpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
appCfgService.updateAppIpCfgValid(isValid, ids, functionId);
|
||||
public String updateAppIpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppIpCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppIpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<AppIpCfg> searchPage = new Page<AppIpCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -552,8 +609,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("saveAppHttpCfg failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,8 +652,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("app http配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -610,8 +671,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -672,7 +735,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);
|
||||
@@ -702,14 +764,21 @@ public class AppCfgController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppDomainCfg(entity);
|
||||
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");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("APP域名配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("APP域名配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + entity.getFunctionId();
|
||||
@@ -737,19 +806,19 @@ public class AppCfgController extends BaseController {
|
||||
entity = appCfgService.getAppDomainCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
appCfgService.auditAppDomainCfg(entity, isAudit);
|
||||
appCfgService.auditAppDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app协议domain配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,8 +834,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -786,8 +857,28 @@ public class AppCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateAppDomainCfgValid" })
|
||||
@RequiresPermissions(value = { "app:domain:config" })
|
||||
public String updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
appCfgService.updateAppDomainCfgValid(isValid, ids, functionId);
|
||||
public String updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppDomainCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppDomainCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<AppDomainCfg> searchPage = new Page<AppDomainCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -862,8 +953,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("saveAppByteCfg failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -883,7 +976,7 @@ public class AppCfgController extends BaseController {
|
||||
@RequestMapping(value = { "auditAppByteCfg" })
|
||||
// @RequiresPermissions(value={"app:byte:confirm"})
|
||||
public String auditAppByteCfg(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
AppByteCfg entity = new AppByteCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
@@ -901,8 +994,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("app协议byte配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -995,8 +1090,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("saveAppSslCfg failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1035,8 +1132,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("app SSL配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1052,8 +1151,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1150,8 +1251,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("saveAppTcpCfg failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,7 +1289,7 @@ public class AppCfgController extends BaseController {
|
||||
@RequestMapping(value = { "auditAppTcpCfg" })
|
||||
@RequiresPermissions(value = { "app:tcp:confirm" })
|
||||
public String auditAppTcpCfg(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
AppTcpCfg entity = new AppTcpCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
@@ -1203,8 +1306,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("app SSL配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1282,8 +1387,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("saveAppHeaderCfg failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1303,7 +1410,7 @@ public class AppCfgController extends BaseController {
|
||||
@RequestMapping(value = { "auditAppHeaderCfg" })
|
||||
@RequiresPermissions(value = { "app:header:confirm" })
|
||||
public String auditAppHeaderCfg(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
AppHeaderCfg entity = new AppHeaderCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
@@ -1321,8 +1428,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("app Header配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1454,18 +1563,21 @@ public class AppCfgController extends BaseController {
|
||||
entity.setCfgKeywords(entity.getCfgKeywords());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppTopicDomainCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("app主题网站配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("app主题网站配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("APP主题网站配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("APP主题网站配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + entity.getFunctionId();
|
||||
@@ -1493,18 +1605,18 @@ public class AppCfgController extends BaseController {
|
||||
entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
appCfgService.auditAppTopicDomainCfg(entity, isAudit);
|
||||
appCfgService.auditAppTopicDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("app主题网站配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1520,8 +1632,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1541,21 +1655,28 @@ public class AppCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateAppTopicDomainCfgValid" })
|
||||
@RequiresPermissions(value = { "app:topic:config" })
|
||||
public String updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppTopicDomainCfg cfg) {
|
||||
try {
|
||||
appCfgService.updateAppTopicDomainCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppTopicDomainCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("app主题网站删除失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + functionId;
|
||||
@@ -1622,8 +1743,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("appBuiltinFeatureFileSaveOrUpdate failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1654,7 +1777,7 @@ public class AppCfgController extends BaseController {
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "app:built_in_file:confirm" })
|
||||
public String audit(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -1667,8 +1790,10 @@ public class AppCfgController extends BaseController {
|
||||
logger.error("appBuiltinFeature audit failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1830,6 +1955,7 @@ public class AppCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -1902,6 +2028,7 @@ public class AppCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("top export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -1968,6 +2095,7 @@ public class AppCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("appIp export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -2042,6 +2170,7 @@ public class AppCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -2114,6 +2243,7 @@ public class AppCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("Domain export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -2187,6 +2317,7 @@ public class AppCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("App ssl export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -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,53 @@ 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.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -82,27 +111,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";
|
||||
}
|
||||
|
||||
@@ -126,14 +143,21 @@ public class AppFeatureCfgController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appMultiFeatureCfgService.saveOrUpdateAppFeatureCfg(entity);
|
||||
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");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("APP 特征配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("APP 特征配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + entity.getFunctionId();
|
||||
@@ -160,20 +184,20 @@ public class AppFeatureCfgController extends BaseController {
|
||||
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit);
|
||||
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app 特征配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app 特征配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -188,8 +212,10 @@ public class AppFeatureCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -209,8 +235,28 @@ public class AppFeatureCfgController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "updateAppFeatureCfgValid" })
|
||||
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId);
|
||||
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppFeatureIndex cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<AppFeatureIndex> searchPage = new Page<AppFeatureIndex>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -253,26 +299,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");
|
||||
@@ -417,6 +445,7 @@ public class AppFeatureCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("Appfeature export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -158,18 +159,25 @@ public class BasicProtocolController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("基础协议信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
// addMessage(redirectAttributes,e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("基础协议配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (CallExternalProceduresException e) {
|
||||
logger.error("调用外部程序出错:",e);
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("基础协议配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + entity.getFunctionId();
|
||||
@@ -197,12 +205,10 @@ public class BasicProtocolController extends BaseController {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -210,10 +216,12 @@ public class BasicProtocolController extends BaseController {
|
||||
logger.info("app策略配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("app策略配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -230,8 +238,10 @@ public class BasicProtocolController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -251,21 +261,26 @@ public class BasicProtocolController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("基础协议信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + functionId;
|
||||
@@ -392,6 +407,7 @@ public class BasicProtocolController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.service.BaseService;
|
||||
@@ -51,10 +52,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();
|
||||
@@ -71,13 +73,22 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
dictService.updateDictItem(item);
|
||||
//删除字典缓存
|
||||
CacheUtils.remove(Constants.CACHE_DICT_MAP);
|
||||
|
||||
//全量同步之前等待一段时间,避免定时任务还未扫描到当前的同步状态。
|
||||
try{
|
||||
Thread.sleep(60000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
send(model,request,response);
|
||||
send(serviceId,model,request,response);
|
||||
}else if(cmd.equals(0)){//取消
|
||||
|
||||
}
|
||||
}
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
return "/sys/configSyncInfo";
|
||||
}
|
||||
|
||||
@@ -85,26 +96,33 @@ 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();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}catch(MaatConvertException e){
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
status = -1;
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}finally{
|
||||
if(status!=1){
|
||||
SysDataDictionaryName sysDictName = new SysDataDictionaryName();
|
||||
@@ -129,6 +147,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)){
|
||||
@@ -162,6 +181,7 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
Thread.sleep(60000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +200,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");
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.Set;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -26,6 +27,7 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
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.specific.SpecificServiceCfg;
|
||||
@@ -33,6 +35,7 @@ import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -111,7 +114,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if (cfg.getIpPortList() != null) {
|
||||
if (CollectionUtils.isNotEmpty(cfg.getIpPortList())) {
|
||||
String cfgType = null;
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
@@ -120,7 +123,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
if (CollectionUtils.isNotEmpty(cfg.getNtcSubscribeIdCfgList())) {
|
||||
String cfgType = null;
|
||||
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ntc.getCfgType().equals(cfgType)) {
|
||||
@@ -177,17 +180,25 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("加密隧道信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("加密隧道行为配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (CallExternalProceduresException e) {
|
||||
logger.error("调用外部程序出错:",e);
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("加密隧道行为配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + entity.getFunctionId();
|
||||
@@ -220,7 +231,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -228,10 +239,12 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
logger.info("加密隧道配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("加密隧道配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,8 +261,10 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -270,18 +285,28 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("加密隧道协议保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + functionId;
|
||||
@@ -429,6 +454,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("TunnelBehavior export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -16,6 +17,7 @@ import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.GroupAreaInfo;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.service.configuration.GroupAreaService;
|
||||
@@ -65,7 +67,7 @@ public class GroupAreaController extends BaseController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(GroupAreaInfo cfg,Model model,RedirectAttributes redirectAttributes) {
|
||||
public String saveOrUpdate(GroupAreaInfo cfg,Model model,RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
try {
|
||||
groupAreaService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
@@ -73,23 +75,27 @@ public class GroupAreaController extends BaseController {
|
||||
logger.error("新增失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/groupArea/groupAreaList";
|
||||
}
|
||||
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(RedirectAttributes redirectAttributes, String ids,int isValid) {
|
||||
public String delete(RedirectAttributes redirectAttributes, String ids,int isValid,HttpServletRequest request) {
|
||||
try {
|
||||
groupAreaService.deldete(ids,isValid);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/groupArea/groupAreaList";
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -73,7 +74,7 @@ public class LogSearchController extends BaseController{
|
||||
|
||||
@RequestMapping(value="actionLogTrend")
|
||||
@ResponseBody
|
||||
public List actionTrans(String cfgId,String beginDate,String endDate,String serviceId){
|
||||
public List actionTrans(String cfgId,String beginDate,String endDate,String serviceId,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List resultList = new ArrayList();
|
||||
String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT;
|
||||
@@ -96,6 +97,7 @@ public class LogSearchController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.nis.domain.configuration.TaskInfo;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -124,6 +125,7 @@ public class RequestInfoController extends BaseController{
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
addMessage(model,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/request/list?functionId="+requestInfo.getFunctionId()+"&repage";
|
||||
}
|
||||
@@ -286,6 +288,7 @@ public class RequestInfoController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -69,7 +70,7 @@ public class DnsIpCfgController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "initSpoofingIp" })
|
||||
public String initSpoofingIp() {
|
||||
public String initSpoofingIp(HttpServletRequest request) {
|
||||
Properties msg = getMsgProp();
|
||||
try {
|
||||
DnsIpCfg entity = new DnsIpCfg();
|
||||
@@ -84,8 +85,10 @@ public class DnsIpCfgController extends BaseController {
|
||||
logger.error("初始化Spoofing ip失败", e);
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
return msg.getProperty("request_service_failed");
|
||||
} else {
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
return msg.getProperty("save_failed");
|
||||
}
|
||||
}
|
||||
@@ -98,15 +101,21 @@ public class DnsIpCfgController extends BaseController {
|
||||
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
dnsIpCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("DNS欺骗ip配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("DNS欺骗ip配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + cfg.getFunctionId();
|
||||
@@ -114,9 +123,28 @@ public class DnsIpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
dnsIpCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DnsIpCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
dnsIpCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<DnsIpCfg> searchPage = new Page<DnsIpCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -136,10 +164,12 @@ public class DnsIpCfgController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -156,8 +186,10 @@ public class DnsIpCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -250,8 +282,10 @@ public class DnsIpCfgController extends BaseController {
|
||||
logger.error("DnsIp export failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -80,11 +81,21 @@ public class DnsResStrategyController extends BaseController {
|
||||
|
||||
dnsResStrategyService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("DNS响应策略配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("DNS响应策略配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + cfg.getFunctionId();
|
||||
@@ -103,12 +114,28 @@ public class DnsResStrategyController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")DnsResStrategy cfg,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
dnsResStrategyService.delete(isAudit, isValid, ids, functionId);
|
||||
}
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
dnsResStrategyService.delete(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<DnsResStrategy> searchPage = new Page<DnsResStrategy>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -126,8 +153,10 @@ public class DnsResStrategyController extends BaseController {
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,8 +172,10 @@ public class DnsResStrategyController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -228,8 +259,10 @@ public class DnsResStrategyController extends BaseController {
|
||||
logger.error("Dns export failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.nis.domain.configuration.IpAddrPoolCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -81,8 +82,10 @@ public class IpAddrPoolController extends BaseController{
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +94,7 @@ public class IpAddrPoolController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"/snatAudit"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:confirm"})
|
||||
public String snataudit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
public String snataudit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
@@ -104,8 +107,10 @@ public class IpAddrPoolController extends BaseController{
|
||||
logger.error("SNAT地址池配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,6 +143,7 @@ public class IpAddrPoolController extends BaseController{
|
||||
}catch(Exception e){
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}
|
||||
@@ -282,6 +288,7 @@ public class IpAddrPoolController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.nis.domain.configuration.IpMultiplexPoolCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.service.basics.SysDictInfoService;
|
||||
@@ -72,8 +73,10 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +106,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + functionId;
|
||||
}
|
||||
@@ -110,7 +114,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:confirm" })
|
||||
public String audit(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -126,6 +130,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.info("IP复用地址池配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,6 +314,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -370,6 +376,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -110,10 +111,12 @@ public class UserManageController extends BaseController{
|
||||
} catch (MaatConvertException e) {
|
||||
message=msgProp.getProperty("user")+" "+user.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("delete_failed");
|
||||
logger.error("用户vpn新增失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}catch (Exception e) {
|
||||
message=msgProp.getProperty("user")+" "+user.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("delete_failed");
|
||||
logger.error("用户vpn新增失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -134,8 +137,10 @@ public class UserManageController extends BaseController{
|
||||
}
|
||||
if(!StringUtil.isEmpty(e.getMessage())) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,13 +186,16 @@ public class UserManageController extends BaseController{
|
||||
} catch (MaatConvertException e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
|
||||
logger.error("用户vpn新增失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}catch (Exception e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
|
||||
logger.error("用户vpn新增失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}else{
|
||||
entity.setEditTime(createTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
@@ -207,10 +215,12 @@ public class UserManageController extends BaseController{
|
||||
} catch (MaatConvertException e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+msgProp.getProperty("password")+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("update_failed");
|
||||
logger.error("用户vpn密码修改失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}catch (Exception e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+msgProp.getProperty("password")+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("update_failed");
|
||||
logger.error("用户vpn密码修改失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -242,10 +252,12 @@ public class UserManageController extends BaseController{
|
||||
} catch (MaatConvertException e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
|
||||
logger.error("用户vpn新增失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}catch (Exception e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
|
||||
logger.error("用户vpn新增失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -262,29 +274,35 @@ public class UserManageController extends BaseController{
|
||||
} catch (MaatConvertException e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
|
||||
logger.error("用户vpn删除失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}catch (Exception e) {
|
||||
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
|
||||
logger.error("用户vpn删除失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addMessage(redirectAttributes,"success","update_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
if(!StringUtil.isEmpty(e.getMessage())) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else{
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/userManage/list";
|
||||
} catch (Exception e) {
|
||||
if(!StringUtil.isEmpty(e.getMessage())) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else{
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/userManage/list";
|
||||
}
|
||||
@@ -374,6 +392,7 @@ public class UserManageController extends BaseController{
|
||||
message+=","+ip;
|
||||
}
|
||||
logger.error("查询失败", e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
mess.put("message", message);
|
||||
@@ -449,6 +468,7 @@ public class UserManageController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("user export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -57,6 +58,12 @@ public class DdosCfgController extends BaseController {
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids), null);
|
||||
if(cfg.getBpsThreadshold()==0){
|
||||
cfg.setBpsThreadshold(null);
|
||||
};
|
||||
if(cfg.getPpsThreadshold()==0){
|
||||
cfg.setPpsThreadshold(null);
|
||||
};
|
||||
initUpdateFormCondition(model, cfg);
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
@@ -71,15 +78,21 @@ public class DdosCfgController extends BaseController {
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
ddosCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("DDOS配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("DDOS配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
|
||||
@@ -87,8 +100,28 @@ public class DdosCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
ddosCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DdosIpCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ddosCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<DdosIpCfg> searchPage = new Page<DdosIpCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -102,16 +135,18 @@ public class DdosCfgController extends BaseController {
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,8 +162,10 @@ public class DdosCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -240,6 +277,7 @@ public class DdosCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ddos export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.service.configuration.IpMultiplexService;
|
||||
@@ -202,8 +203,10 @@ public class IpMultiplexController extends CommonController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +226,7 @@ public class IpMultiplexController extends CommonController {
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
|
||||
@@ -231,7 +235,7 @@ public class IpMultiplexController extends CommonController {
|
||||
@RequestMapping(value = { "/auditSnat" })
|
||||
@RequiresPermissions("snat_policy:confirm")
|
||||
public String auditSnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
@@ -245,8 +249,10 @@ public class IpMultiplexController extends CommonController {
|
||||
logger.error("SNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,8 +394,10 @@ public class IpMultiplexController extends CommonController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + cfg.getFunctionId();
|
||||
@@ -397,7 +405,7 @@ public class IpMultiplexController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "/dnatDelete" })
|
||||
@RequiresPermissions("dnat_policy:config")
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
// this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try {
|
||||
@@ -408,6 +416,7 @@ public class IpMultiplexController extends CommonController {
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
|
||||
@@ -416,7 +425,7 @@ public class IpMultiplexController extends CommonController {
|
||||
@RequestMapping(value = { "/auditDnat" })
|
||||
@RequiresPermissions("dnat_policy:confirm")
|
||||
public String auditDnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
// this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
@@ -431,8 +440,10 @@ public class IpMultiplexController extends CommonController {
|
||||
logger.error("DNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -484,13 +495,15 @@ public class IpMultiplexController extends CommonController {
|
||||
for (Integer id : set) {
|
||||
serviceIds.append(id+",");
|
||||
}
|
||||
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
|
||||
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
|
||||
//获取日志总量
|
||||
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
|
||||
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||
logTotals.addAll(logs);
|
||||
}
|
||||
if(serviceIds.length()>1&&compileIds.length()>1){
|
||||
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
|
||||
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
|
||||
//获取日志总量
|
||||
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
|
||||
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||
logTotals.addAll(logs);
|
||||
}
|
||||
}
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
for (IpReusePolicyCfg ipReusePolicyCfg : ipLists) {
|
||||
if(ipReusePolicyCfg.getAddrPoolId()!=null){
|
||||
@@ -549,6 +562,7 @@ public class IpMultiplexController extends CommonController {
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -604,12 +618,15 @@ public class IpMultiplexController extends CommonController {
|
||||
for (Integer id : set) {
|
||||
serviceIds.append(id+",");
|
||||
}
|
||||
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
|
||||
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
|
||||
//获取日志总量
|
||||
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
|
||||
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||
logTotals.addAll(logs);
|
||||
|
||||
if(serviceIds.length()>1&&compileIds.length()>1){
|
||||
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
|
||||
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
|
||||
//获取日志总量
|
||||
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
|
||||
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||
logTotals.addAll(logs);
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpReuseDnatPolicyCfg.class);
|
||||
@@ -652,6 +669,7 @@ public class IpMultiplexController extends CommonController {
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -61,8 +62,10 @@ public class AsnPolicyCfgController extends BaseController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,11 @@ import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 处理音视频文本业务
|
||||
@@ -90,16 +92,24 @@ public class AvContentController extends BaseController {
|
||||
CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
avContentCfgService.saveOrUpdateAvVoip(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.error("voip 信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("voip 信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/voipList?functionId=" + cfg.getFunctionId();
|
||||
@@ -152,20 +162,26 @@ public class AvContentController extends BaseController {
|
||||
// 修改VOIP IP配置状态
|
||||
@RequestMapping(value = { "/updateAvVoipValid" })
|
||||
@RequiresPermissions(value = { "avVoip:config" })
|
||||
public String updateVoipValid(Integer isAudit, String compileIds, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateVoipValid(Integer isAudit, String compileIds, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
avContentCfgService.updateAvVoipValid(isAudit, isValid, compileIds, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
avContentCfgService.updateAvVoipValid(isAudit, isValid, compileIds, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.error("voip 信息审核失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("voip 信息审核失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/voipList?functionId=" + functionId;
|
||||
@@ -199,7 +215,15 @@ public class AvContentController extends BaseController {
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
avContentCfgService.auditAvVoip(isAudit, isValid, functionId, id, auditTime);
|
||||
CfgIndexInfo entity=new CfgIndexInfo();
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity = avContentCfgService.getCfgIndexInfo(entity);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
avContentCfgService.auditAvVoip(entity,isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -207,10 +231,12 @@ public class AvContentController extends BaseController {
|
||||
logger.error("VOIP配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("VOIP配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -228,8 +254,10 @@ public class AvContentController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -379,8 +407,10 @@ public class AvContentController extends BaseController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +430,7 @@ public class AvContentController extends BaseController {
|
||||
@RequestMapping(value = { "/auditAvContIp" })
|
||||
@RequiresPermissions(value = { "avContIp:confirm" })
|
||||
public String auditContIp(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(compileIds)) {
|
||||
String[] idArray = compileIds.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -411,9 +441,11 @@ public class AvContentController extends BaseController {
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("Cont Ip配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("Cont Ip配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -488,8 +520,10 @@ public class AvContentController extends BaseController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,10 +540,19 @@ public class AvContentController extends BaseController {
|
||||
}
|
||||
|
||||
// 修改CONTIP配置审核
|
||||
/**
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param compileIds
|
||||
* @param functionId
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "/auditPicIp" })
|
||||
@RequiresPermissions(value = { "avPicIp:confirm" })
|
||||
public String auditPicIp(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(compileIds)) {
|
||||
String[] idArray = compileIds.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -521,10 +564,12 @@ public class AvContentController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("Pic Ip配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Pic Ip配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,16 +654,24 @@ public class AvContentController extends BaseController {
|
||||
CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
avContentCfgService.saveOrUpdateContUrl(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.error("Stream Media 信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("Stream Media 信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/contUrlList?functionId=" + cfg.getFunctionId();
|
||||
@@ -627,9 +680,28 @@ public class AvContentController extends BaseController {
|
||||
// 修改CONTUrl例配置状态
|
||||
@RequestMapping(value = { "/updateAvContUrlValid" })
|
||||
@RequiresPermissions(value = { "avContUrl:config" })
|
||||
public String updateAvContUrlValid(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
avContentCfgService.updateContUrlValid(isAudit, isValid, ids, functionId);
|
||||
public String updateAvContUrlValid(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
avContentCfgService.updateContUrlValid(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/contUrlList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -641,18 +713,27 @@ public class AvContentController extends BaseController {
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
avContentCfgService.auditContUrl(isAudit, isValid, functionId, id, auditTime);
|
||||
CfgIndexInfo entity=new CfgIndexInfo();
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity = avContentCfgService.getCfgIndexInfo(entity);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
avContentCfgService.auditContUrl(entity,isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("Cont Url配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -669,8 +750,10 @@ public class AvContentController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -764,8 +847,10 @@ public class AvContentController extends BaseController {
|
||||
logger.error("信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,7 +870,7 @@ public class AvContentController extends BaseController {
|
||||
@RequestMapping(value = { "/auditAvPicUrl" })
|
||||
@RequiresPermissions(value = { "avPicUrl:confirm" })
|
||||
public String auditPicUrl(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(compileIds)) {
|
||||
String[] idArray = compileIds.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -798,8 +883,10 @@ public class AvContentController extends BaseController {
|
||||
logger.info("Pic Url配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -908,6 +995,7 @@ public class AvContentController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/ntc/av/picUrlList?functionId=" + entity.getFunctionId();
|
||||
@@ -1040,6 +1128,7 @@ public class AvContentController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("stream export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -1173,6 +1262,7 @@ public class AvContentController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("voip export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -59,6 +59,7 @@ import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -301,7 +302,8 @@ public class AvController extends BaseController {
|
||||
addMessage(redirectAttributes, "error", "exceeds_duration_limit");
|
||||
logger.error("The duration of uploaded files exceeds the limit(" + Constants.AV_DURATION_LIMIT
|
||||
+ "s).");
|
||||
throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit"));
|
||||
throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit")+"("+ Constants.AV_DURATION_LIMIT
|
||||
+ "s)");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -315,12 +317,16 @@ public class AvController extends BaseController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,10 +345,13 @@ public class AvController extends BaseController {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/sample/audioSignSampleList?functionId=" + entity.getFunctionId();
|
||||
@@ -350,10 +359,28 @@ public class AvController extends BaseController {
|
||||
|
||||
// 修改文件样例配置状态
|
||||
@RequestMapping(value = { "/sample/updateAvFileSampleValid" })
|
||||
public String updateAvFileSampleValid(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
avCfgService.updateAvFileSampleValid(isAudit, isValid, ids);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
public String updateAvFileSampleValid(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AvFileSampleCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
avCfgService.updateAvFileSampleValid(isAudit, isValid, ids);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<AvFileSampleCfg> searchPage = new Page<AvFileSampleCfg>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/av/sample/fileSampleList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -379,8 +406,6 @@ public class AvController extends BaseController {
|
||||
entity = avCfgService.getAvFileSampleById(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
// String oldSrcUrl = entity.getSrcPath();
|
||||
// String oldSampleUrl = entity.getSamplePath();
|
||||
try {
|
||||
@@ -439,9 +464,11 @@ public class AvController extends BaseController {
|
||||
if (e instanceof MaatConvertException) {
|
||||
logger.info("音视频文件样例配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
logger.error("auditAvFileSample failed", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,8 +484,10 @@ public class AvController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -487,7 +516,7 @@ public class AvController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "/sample/auditAvAudioSignSample" })
|
||||
public String auditAvAudioSignSample(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
// avCfgService.auditAvSignSample(isAudit,isValid,ids);
|
||||
AvSignSampleCfg entity = new AvSignSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
@@ -495,8 +524,7 @@ public class AvController extends BaseController {
|
||||
entity = avCfgService.getAvSignSampleById(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
|
||||
try {
|
||||
avCfgService.audioAuditAvSignSample(entity, isAudit, false);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
@@ -505,9 +533,11 @@ public class AvController extends BaseController {
|
||||
if (e instanceof MaatConvertException) {
|
||||
logger.error("音视频标识样例配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
logger.error("auditAvAudioSignSample failed", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -526,7 +556,7 @@ public class AvController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "/sample/auditAvSignSample" })
|
||||
public String auditAvSignSample(Integer preset, AvSignSampleCfgModel cfg, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
// 预置配置
|
||||
try {
|
||||
if (preset != null && 1 == preset) {// 预置信息需要在数据库中插入一条记录
|
||||
@@ -540,9 +570,11 @@ public class AvController extends BaseController {
|
||||
if (e1 instanceof MaatConvertException) {
|
||||
logger.error("预置失败", e1);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e1, null);
|
||||
} else {
|
||||
logger.error("auditAvSignSample failed", e1);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e1, null);
|
||||
}
|
||||
}
|
||||
// 修改下发配置
|
||||
@@ -565,9 +597,11 @@ public class AvController extends BaseController {
|
||||
if (e instanceof MaatConvertException) {
|
||||
logger.error("下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
logger.error("auditAvSignSample failed", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,6 +707,7 @@ public class AvController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ysp export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -712,7 +747,7 @@ public class AvController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "/sample/videoToPicture" })
|
||||
public Map videoToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile srcFile) {
|
||||
public Map videoToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile srcFile,HttpServletRequest request) {
|
||||
|
||||
String sep = System.getProperty("file.separator");
|
||||
String random = UUID.randomUUID() + "";
|
||||
@@ -783,14 +818,17 @@ public class AvController extends BaseController {
|
||||
e.printStackTrace();
|
||||
map.put("status", 0);
|
||||
map.put("msg", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (InputFormatException e) {
|
||||
e.printStackTrace();
|
||||
map.put("status", 0);
|
||||
map.put("msg", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (EncoderException e) {
|
||||
e.printStackTrace();
|
||||
map.put("status", 0);
|
||||
map.put("msg", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -806,7 +844,7 @@ public class AvController extends BaseController {
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "/sample/faceToPicture" })
|
||||
public Map faceToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile[] srcFile,
|
||||
@RequestParam("faceFilePath") String faceFilePath) {
|
||||
@RequestParam("faceFilePath") String faceFilePath,HttpServletRequest request) {
|
||||
String sep = System.getProperty("file.separator");
|
||||
String random = UUID.randomUUID() + "";
|
||||
// String srcFilePath =
|
||||
@@ -829,6 +867,7 @@ public class AvController extends BaseController {
|
||||
} catch (IOException e) {
|
||||
logger.error(e);
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.nis.domain.configuration.NtcBgpAsCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -72,7 +73,24 @@ public class BgpCfgController extends BaseController {
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String saveBgpCfg(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.saveBgpCfg(entity);
|
||||
try {
|
||||
bgpCfgService.saveBgpCfg(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip白名单配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip白名单配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -122,9 +140,28 @@ public class BgpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateBgpCfgValid" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.updateBgpCfgValid(isValid, ids, functionId);
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
bgpCfgService.updateBgpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -140,20 +177,22 @@ public class BgpCfgController extends BaseController {
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
/*entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());*/
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
bgpCfgService.auditBgpCfg(entity, isAudit);
|
||||
bgpCfgService.auditBgpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("bgp配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("bgp配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -168,8 +207,10 @@ public class BgpCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -308,6 +349,7 @@ public class BgpCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("bgp export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -87,16 +88,24 @@ public class FileTransferCfgController extends BaseController {
|
||||
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
fileTransferCfgService.saveFtpCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.error("ftp信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("ftp信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/ftpList?functionId=" + entity.getFunctionId();
|
||||
@@ -150,21 +159,26 @@ public class FileTransferCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateFtpCfgValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:ftp:config" })
|
||||
public String updateFtpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateFtpCfgValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
fileTransferCfgService.updateFtpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
fileTransferCfgService.updateFtpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("ftp配置删除失败:" + e.getMessage());
|
||||
;
|
||||
logger.error("ftp配置删除失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("ftp配置删除失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/ftpList?functionId=" + functionId;
|
||||
@@ -182,11 +196,11 @@ public class FileTransferCfgController extends BaseController {
|
||||
entity = fileTransferCfgService.getFtpCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
// entity.setAuditorId(UserUtils.getUser().getId());
|
||||
// entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
fileTransferCfgService.auditFtpCfg(entity, isAudit);
|
||||
fileTransferCfgService.auditFtpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -194,10 +208,12 @@ public class FileTransferCfgController extends BaseController {
|
||||
logger.error("ftp配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("ftp配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,8 +229,10 @@ public class FileTransferCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -290,22 +308,43 @@ public class FileTransferCfgController extends BaseController {
|
||||
}
|
||||
fileTransferCfgService.saveOrUpdateFileDigestCfg(entity, result, areaCfgIds);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("文件摘要配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
logger.error("文件摘要配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "updateFileDigestValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:fileDigest:config" })
|
||||
public String updateFileDigestValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
fileTransferCfgService.updateFileDigestCfgValid(isValid, ids, functionId);
|
||||
public String updateFileDigestValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")FileDigestCfg cfg) {
|
||||
try {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
fileTransferCfgService.updateFileDigestCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
logger.error("文件摘要配置删除失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
logger.error("文件摘要配置删除失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -316,20 +355,22 @@ public class FileTransferCfgController extends BaseController {
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
fileTransferCfgService.auditFileDigestCfg(isAudit, isValid, functionId, id, auditTime);
|
||||
fileTransferCfgService.auditFileDigestCfg(isAudit, isValid, functionId, id,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("File Digest配置下发失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -347,8 +388,10 @@ public class FileTransferCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -356,7 +399,7 @@ public class FileTransferCfgController extends BaseController {
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = { "ajaxFileDigestSubIdList" })
|
||||
public String ajaxFileDigestSubIdList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
FileDigestCfg cfg = fileTransferCfgService.getFileDigestSubIdCfg(cfgId, compileId);
|
||||
@@ -466,16 +509,24 @@ public class FileTransferCfgController extends BaseController {
|
||||
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
fileTransferCfgService.saveP2pCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.error("P2P信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("P2P信息保存失败", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/p2pList?functionId=" + entity.getFunctionId();
|
||||
@@ -483,21 +534,26 @@ public class FileTransferCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateP2pCfgValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:p2p:config" })
|
||||
public String updateP2pCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateP2pCfgValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
fileTransferCfgService.updateP2pCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
fileTransferCfgService.updateP2pCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("P2P配置删除失败:" + e.getMessage());
|
||||
;
|
||||
logger.error("P2P配置删除失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("P2P配置删除失败", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/fileTransfer/p2pList?functionId=" + functionId;
|
||||
@@ -561,22 +617,25 @@ public class FileTransferCfgController extends BaseController {
|
||||
entity = fileTransferCfgService.getP2pCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
// entity.setAuditorId(UserUtils.getUser().getId());
|
||||
// entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
fileTransferCfgService.auditP2pCfg(entity, isAudit);
|
||||
fileTransferCfgService.auditP2pCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("p2p配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -592,8 +651,10 @@ public class FileTransferCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -737,6 +798,7 @@ public class FileTransferCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ftp export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -881,6 +943,7 @@ public class FileTransferCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("p2p export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -980,6 +1043,7 @@ public class FileTransferCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("file export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -66,11 +66,11 @@ 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.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -109,7 +109,24 @@ public class IpController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
public String saveOrUpdate(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
ipCfgService.saveIpCfg(entity);
|
||||
try {
|
||||
ipCfgService.saveIpCfg(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(model, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(model, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip地址配置下发失败:",e);
|
||||
addMessage(model, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip地址配置保存失败:",e);
|
||||
addMessage(model, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ajaxSubList"})
|
||||
@@ -152,8 +169,29 @@ public class IpController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"updateValid"})
|
||||
@RequiresPermissions("iplist:config")
|
||||
public String updateIpPortCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
public String updateIpPortCfgValid(Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
|
||||
}
|
||||
/**
|
||||
@@ -195,15 +233,17 @@ public class IpController extends BaseController{
|
||||
/*if(StringUtils.isNoneBlank(entity.getUserRegion4())) {
|
||||
ipCfgService.auditAsnCfg(entity, isAudit);
|
||||
}else {*/
|
||||
ipCfgService.auditIpCfg(entity,isAudit);
|
||||
ipCfgService.auditIpCfg(entity,isAudit,Constants.INSERT_ACTION);
|
||||
/*}*/
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.info("ip配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -220,8 +260,10 @@ public class IpController extends BaseController{
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -306,6 +348,7 @@ public class IpController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("export_failed", e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -430,6 +473,11 @@ 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(63)|| regionDict.getFunctionId().equals(407) || regionDict.getFunctionId().equals(408)) && serviceDict.getAction().equals(64)){// Policies -> Stream
|
||||
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);
|
||||
@@ -491,11 +539,6 @@ 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);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2);
|
||||
@@ -684,6 +727,7 @@ public class IpController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -107,15 +108,23 @@ public class MailCfgController extends BaseController {
|
||||
logger.info("获取文件摘要响应信息:" + result);
|
||||
}
|
||||
mailCfgService.saveMailCfg(entity, result);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,8 +179,28 @@ public class MailCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateMailCfgValid" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
mailCfgService.updateMailCfgValid(isValid, ids, functionId);
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
mailCfgService.updateMailCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -187,22 +216,25 @@ public class MailCfgController extends BaseController {
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
/*entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());*/
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
mailCfgService.auditMailCfg(entity, isAudit);
|
||||
mailCfgService.auditMailCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("mail配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,8 +250,10 @@ public class MailCfgController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -373,6 +407,7 @@ public class MailCfgController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("mail export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
@@ -46,6 +45,7 @@ import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -193,9 +193,27 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "saveHttpCfg" })
|
||||
@RequiresPermissions(value = { "website:http:config" })
|
||||
public String saveHttpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
websiteCfgService.saveHttpCfg(entity);
|
||||
public String saveHttpCfg( HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
websiteCfgService.saveHttpCfg(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip白名单配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip白名单配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -209,8 +227,28 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateHttpCfgValid" })
|
||||
@RequiresPermissions(value = { "website:http:config" })
|
||||
public String updateHttpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
websiteCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
public String updateHttpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
websiteCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -226,18 +264,20 @@ public class WebsiteController extends BaseController {
|
||||
entity = websiteCfgService.getHttpCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
/*entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());*/
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
websiteCfgService.auditHttpCfg(entity, isAudit);
|
||||
websiteCfgService.auditHttpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("http配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("http配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
} else {// 条件下所有配置审核
|
||||
@@ -252,8 +292,10 @@ public class WebsiteController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -289,9 +331,26 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "saveSslCfg" })
|
||||
@RequiresPermissions(value = { "website:ssl:config" })
|
||||
public String saveSslCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
websiteCfgService.saveSslCfg(entity);
|
||||
public String saveSslCfg(HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
websiteCfgService.saveSslCfg(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip白名单配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip白名单配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -339,8 +398,28 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateSslCfgValid" })
|
||||
@RequiresPermissions(value = { "website:ssl:config" })
|
||||
public String updateSslCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
websiteCfgService.updateSslCfgValid(isValid, ids, functionId);
|
||||
public String updateSslCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
websiteCfgService.updateSslCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -356,22 +435,25 @@ public class WebsiteController extends BaseController {
|
||||
entity = websiteCfgService.getSslCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
// entity.setAuditorId(UserUtils.getUser().getId());
|
||||
// entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
websiteCfgService.auditSslCfg(entity, isAudit);
|
||||
websiteCfgService.auditSslCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("ssl配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,8 +469,10 @@ public class WebsiteController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -403,12 +487,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);
|
||||
}
|
||||
// 获取所有响应策略信息
|
||||
@@ -421,8 +501,25 @@ public class WebsiteController extends BaseController {
|
||||
@RequestMapping(value = { "saveDnsCfg" })
|
||||
@RequiresPermissions(value = { "website:dns:config" })
|
||||
public String saveDnsCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
websiteCfgService.saveDnsCfg(entity);
|
||||
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
websiteCfgService.saveDnsCfg(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip白名单配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip白名单配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -457,8 +554,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);
|
||||
@@ -467,8 +562,28 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateDnsCfgValid" })
|
||||
@RequiresPermissions(value = { "website:dns:config" })
|
||||
public String updateDnsCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
websiteCfgService.updateDnsCfgValid(isValid, ids, functionId);
|
||||
public String updateDnsCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
websiteCfgService.updateDnsCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -484,20 +599,22 @@ public class WebsiteController extends BaseController {
|
||||
entity = websiteCfgService.getDnsCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
// entity.setAuditorId(UserUtils.getUser().getId());
|
||||
// entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
websiteCfgService.auditDnsCfg(entity, isAudit);
|
||||
websiteCfgService.auditDnsCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
} else {// 条件下所有配置审核
|
||||
@@ -512,8 +629,10 @@ public class WebsiteController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -790,6 +909,7 @@ public class WebsiteController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
@@ -938,6 +1058,7 @@ public class WebsiteController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("dns export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -1084,6 +1205,7 @@ public class WebsiteController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
@@ -30,6 +29,7 @@ import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.WhiteListIpTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -98,9 +98,26 @@ public class WhiteListController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "ip/save" })
|
||||
public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
public String saveIpCfg(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
ipCfgService.saveIpCfg(entity);
|
||||
try {
|
||||
ipCfgService.saveIpCfg(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip白名单配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip白名单配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -116,18 +133,18 @@ public class WhiteListController extends CommonController {
|
||||
entity = ipCfgService.getIpPortCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
ipCfgService.auditIpCfg(entity, isAudit);
|
||||
ipCfgService.auditIpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
logger.error("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
logger.error("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -142,8 +159,10 @@ public class WhiteListController extends CommonController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -155,8 +174,30 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "updateIpValid" })
|
||||
@RequiresPermissions(value = { "whitelist:ip:config" })
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
//addMessage(redirectAttributes, "success", "delete_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -173,9 +214,8 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "saveHttpUrlCfgs" })
|
||||
public String saveHttpUrlCfgs(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
CfgIndexInfo entity) {
|
||||
CfgIndexInfo entity) throws Exception {
|
||||
if (!StringUtil.isEmpty(entity) && !StringUtil.isEmpty(entity.getHttpUrlList())) {
|
||||
|
||||
CfgIndexInfo sourceCfg = websiteCfgService
|
||||
.getCfgIndexInfo(entity.getHttpUrlList().get(0).getSourceCompileId());
|
||||
for (HttpUrlCfg httpUrlCfg : entity.getHttpUrlList()) {
|
||||
@@ -185,7 +225,7 @@ public class WhiteListController extends CommonController {
|
||||
BeanUtils.copyProperties(httpUrlCfg, cfg);
|
||||
httpList.add(httpUrlCfg);
|
||||
cfg.setHttpUrlList(httpList);
|
||||
websiteCfgService.saveHttpCfg(cfg);
|
||||
websiteCfgService.saveHttpCfg(cfg);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
|
||||
@@ -202,8 +242,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 +250,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);
|
||||
@@ -221,9 +257,26 @@ public class WhiteListController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "domain/save" })
|
||||
public String saveOrUpdateDomain(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
public String saveOrUpdateDomain(RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
domainService.saveDomainCfg(entity);
|
||||
try {
|
||||
domainService.saveDomainCfg(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip白名单配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip白名单配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -249,8 +302,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);
|
||||
@@ -259,20 +310,41 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "domain/updateValid" })
|
||||
@RequiresPermissions(value = { "whitelist:domain:config" })
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId) {
|
||||
domainService.updateDomainCfgValid(isValid, ids, functionId);
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
domainService.updateDomainCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "domain/delete" })
|
||||
@RequiresPermissions("whitelist:domain:config")
|
||||
public String deleteDomain(String ids, Integer functionId, RedirectAttributes model) {
|
||||
public String deleteDomain(String ids, Integer functionId, RedirectAttributes model,HttpServletRequest request) {
|
||||
try {
|
||||
domainService.deleteWhiteDomain(ids);
|
||||
addMessage(model, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
@@ -289,20 +361,22 @@ public class WhiteListController extends CommonController {
|
||||
entity = domainService.getDomainCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
/*entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());*/
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
domainService.auditDomainCfg(entity, isAudit);
|
||||
domainService.auditDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("domain配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("domain配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
} else {// 条件下所有配置审核
|
||||
@@ -317,8 +391,10 @@ public class WhiteListController extends CommonController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -460,6 +536,7 @@ public class WhiteListController extends CommonController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -570,6 +647,7 @@ public class WhiteListController extends CommonController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -29,6 +29,7 @@ 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.util.LogUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -72,7 +73,7 @@ public class XmppController extends BaseController {
|
||||
}
|
||||
@RequestMapping(value = {"auditXmppCfg"})
|
||||
@RequiresPermissions(value={"other:xmpp:confirm"})
|
||||
public String auditXmppCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
public String auditXmppCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
@@ -90,8 +91,10 @@ public class XmppController extends BaseController {
|
||||
logger.info("http配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -106,14 +107,21 @@ public class CachePolicyController extends BaseController{
|
||||
}
|
||||
}
|
||||
cachePolicyService.saveCachePolicy(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,8 +165,28 @@ public class CachePolicyController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"cache:policy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
cachePolicyService.updateCachePolicyValid(isValid,ids,functionId);
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg){
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cachePolicyService.updateCachePolicyValid(isValid,ids,functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/cache/list?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"audit"})
|
||||
@@ -183,15 +211,17 @@ public class CachePolicyController extends BaseController{
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
cachePolicyService.auditCachePolicy(entity,isAudit);
|
||||
cachePolicyService.auditCachePolicy(entity,isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("代理缓存策略下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,8 +237,10 @@ public class CachePolicyController extends BaseController{
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -304,6 +336,7 @@ public class CachePolicyController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.nis.web.controller.configuration.proxy;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -24,6 +25,7 @@ import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -67,16 +69,23 @@ public class ControlPolicyController extends BaseController{
|
||||
@ModelAttribute("cfg")HttpBodyCfg cfg,
|
||||
@ModelAttribute("areaCfgIds")String areaCfgIds
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
try {
|
||||
controlPolicyService.saveOrUpdate(cfg,areaCfgIds);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("HTTPS配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("HTTPS配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/control/httpReqReplace/list?functionId="+cfg.getFunctionId();
|
||||
@@ -92,20 +101,22 @@ public class ControlPolicyController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"httpReqReplace/audit"})
|
||||
public String reqAudit(Integer isAudit,Integer isValid,String ids
|
||||
,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_REQ_KEY_VALUE);
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_REQ_KEY_VALUE,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
logger.error("配置下发失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,8 +162,10 @@ public class ControlPolicyController extends BaseController{
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,21 +182,23 @@ public class ControlPolicyController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"httpResReplace/audit"})
|
||||
public String resAudit(Integer isAudit,Integer isValid,String ids
|
||||
,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_RES_KEY_VALUE);
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_RES_KEY_VALUE,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("配置下发失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
|
||||
@@ -122,8 +123,10 @@ public class FileStrategyController extends CommonController {
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}finally {
|
||||
if(file != null) {
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -188,14 +189,22 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
httpRedirectCfgService.saveHttpCfg(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
logger.error("save_failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,8 +224,28 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
httpRedirectCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
httpRedirectCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -238,15 +267,17 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit);
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("http重定向配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,8 +293,10 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -493,6 +526,7 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
/*
|
||||
* return "redirect:" + adminPath
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -110,13 +111,22 @@ public class InterceptController extends CommonController {
|
||||
HttpServletResponse response, String ids, CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptCfg(entity);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("save_failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + entity.getFunctionId();
|
||||
@@ -175,14 +185,16 @@ public class InterceptController extends CommonController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
interceptCfgService.auditInterceptIpCfg(entity, isAudit);
|
||||
interceptCfgService.auditInterceptIpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("intercept ip audit failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,8 +209,10 @@ public class InterceptController extends CommonController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -209,14 +223,20 @@ public class InterceptController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "updateInterceptIpValid", "updateInterceptDomainValid", "updateInterceptIpPayloadValid" })
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
interceptCfgService.updatInterceptValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
interceptCfgService.updatInterceptValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("intercept ip delete failed", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + functionId;
|
||||
}
|
||||
@@ -437,6 +457,7 @@ public class InterceptController extends CommonController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -101,8 +102,8 @@ public class PxyObjKeyringController extends BaseController {
|
||||
boolean validFlag = true;
|
||||
try {
|
||||
Properties msgProp = this.getMsgProp();
|
||||
boolean publicKeyFileflag = validCertFileContent(publicKeyFileI, "-incert");
|
||||
boolean privateKeyFileflag = validCertFileContent(privateKeyFileI, "-inkey");
|
||||
boolean publicKeyFileflag = validCertFileContent(publicKeyFileI,null, "-incert");
|
||||
boolean privateKeyFileflag = validCertFileContent(privateKeyFileI,null, "-inkey");
|
||||
if (!publicKeyFileflag && !privateKeyFileflag) {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
logger.error(publicKeyFileI.getOriginalFilename() + " and " + privateKeyFileI.getOriginalFilename()
|
||||
@@ -117,15 +118,28 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error(privateKeyFileI.getOriginalFilename() + " file non private key file format ");
|
||||
throw new MultiPartNewException(msgProp.getProperty("private_file_error"));
|
||||
}
|
||||
|
||||
//证书对校验
|
||||
if(publicKeyFileflag && privateKeyFileflag){
|
||||
boolean keyRingFileflag = validCertFileContent(publicKeyFileI,privateKeyFileI, "-incheck");
|
||||
if (!keyRingFileflag) {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
logger.error(" 公私钥不匹配 ");
|
||||
throw new MultiPartNewException(msgProp.getProperty("public_private_file_error"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
validFlag = false;
|
||||
logger.error("证书文件校验失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof MaatConvertException) {
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,10 +195,13 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error("证书文件校验失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -238,20 +255,29 @@ public class PxyObjKeyringController extends BaseController {
|
||||
}
|
||||
}
|
||||
pxyObjKeyringService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (MultiPartNewException e) {
|
||||
logger.error("证书文件上传失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("拦截策略配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("证书上传失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
logger.error("拦截策略配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
|
||||
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -265,7 +291,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean validCertFileContent(MultipartFile file, String validateType) throws Exception {
|
||||
public boolean validCertFileContent(MultipartFile file,MultipartFile privateFile, String validateType) throws Exception {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (!os.contains("windows") && file != null) {
|
||||
// 证书文件临时保存路径
|
||||
@@ -273,8 +299,16 @@ public class PxyObjKeyringController extends BaseController {
|
||||
FileUtils.createDirectory(certFilePath);
|
||||
String filePath = certFilePath + File.separator + UUID.randomUUID()
|
||||
+ FileUtils.getSuffix(file.getOriginalFilename(), true);
|
||||
String privateFilePath="";
|
||||
File uploadFile = new File(filePath);
|
||||
FileCopyUtils.copy(file.getBytes(), uploadFile);
|
||||
|
||||
if(!StringUtil.isEmpty(privateFile)){
|
||||
privateFilePath=certFilePath + File.separator + UUID.randomUUID()
|
||||
+ FileUtils.getSuffix(privateFile.getOriginalFilename(), true);
|
||||
File privateUploadFile = new File(privateFilePath);
|
||||
FileCopyUtils.copy(privateFile.getBytes(), privateUploadFile);
|
||||
}
|
||||
// 加载x509脚本
|
||||
String x509Shell = Thread.currentThread().getContextClassLoader()
|
||||
.getResource(File.separator + "shell" + File.separator + Constants.CERT_VALIDATE_FILE).getPath();
|
||||
@@ -283,8 +317,8 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.info("x509 chmod +x :" + resultMap1.get("out").toString());
|
||||
logger.info("x509脚本分配可执行权限:" + "chmod" + " " + "+x" + " " + x509Shell);
|
||||
// 验证文件
|
||||
logger.info(x509Shell + " " + validateType + " " + filePath);
|
||||
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath);
|
||||
logger.info(x509Shell + " " + validateType + " " + filePath+ " " + privateFilePath);
|
||||
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath, privateFilePath);
|
||||
|
||||
if (resultMap == null || StringUtil.isEmpty(resultMap.get("out"))) {
|
||||
// 临时文件删除
|
||||
@@ -328,10 +362,27 @@ public class PxyObjKeyringController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "proxy:intercept:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")PxyObjKeyring cfg,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
pxyObjKeyringService.delete(isAudit, isValid, ids, functionId);
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
pxyObjKeyringService.delete(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<PxyObjKeyring> searchPage = new Page<PxyObjKeyring>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + functionId;
|
||||
@@ -352,9 +403,11 @@ public class PxyObjKeyringController extends BaseController {
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,8 +423,10 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -453,6 +508,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("pxyObjKeyring export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -518,6 +574,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("pxyObjKeyring export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
@@ -561,7 +618,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
File file = null;
|
||||
boolean validFlag = true;
|
||||
try {
|
||||
boolean certFileflag = validCertFileContent(certFileI, "-incert");
|
||||
boolean certFileflag = validCertFileContent(certFileI,null, "-incert");
|
||||
if (!certFileflag) {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
logger.error(certFileI.getOriginalFilename() + " file non Certificate file format ");
|
||||
@@ -572,8 +629,13 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error("证书文件校验失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,6 +658,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
validFlag = false;
|
||||
logger.error("证书信息获取失败", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
try {
|
||||
if (validFlag) {
|
||||
@@ -624,18 +687,27 @@ public class PxyObjKeyringController extends BaseController {
|
||||
}
|
||||
}
|
||||
pxyObjKeyringService.trustedCertsaveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (MultiPartNewException e) {
|
||||
logger.error("可信证书上传失败:",e);
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("可信证书单配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("证书上传失败", e);
|
||||
if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
} else if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
logger.error("可信证书配置保存失败:",e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
|
||||
@@ -653,7 +725,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
boolean validFlag = true;
|
||||
try {
|
||||
if (crlFileI != null) {
|
||||
boolean certFileflag = validCertFileContent(crlFileI, "-incrl");
|
||||
boolean certFileflag = validCertFileContent(crlFileI,null, "-incrl");
|
||||
if (!certFileflag) {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
logger.error(crlFileI.getOriginalFilename() + " file non crl file format ");
|
||||
@@ -665,10 +737,13 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error("证书文件校验失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,8 +775,10 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error("crl issuer比对失败", e);
|
||||
if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -738,10 +815,13 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error("crl上传失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,11 +940,27 @@ public class PxyObjKeyringController extends BaseController {
|
||||
@RequestMapping(value = { "/trustedCertDelete" })
|
||||
@RequiresPermissions(value = { "proxy:trustedCert:config" })
|
||||
public String trustedCertDelete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
pxyObjKeyringService.trustedCertDelete(isAudit, isValid, ids, functionId);
|
||||
}
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes, @ModelAttribute PxyObjTrustedCaCert cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
pxyObjKeyringService.trustedCertDelete(isAudit, isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
}else {
|
||||
// 批量删除
|
||||
Page<PxyObjKeyring> searchPage = new Page<PxyObjKeyring>(request, response, "a");
|
||||
deleteAll(searchPage, functionId, cfg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("配置删除失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@@ -883,10 +979,12 @@ public class PxyObjKeyringController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,8 +1000,10 @@ public class PxyObjKeyringController extends BaseController {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -119,8 +120,10 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,9 +174,11 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +260,7 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.nis.util.CodeDicUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
@@ -80,7 +81,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="portActive")
|
||||
@ResponseBody
|
||||
public List portActive(){
|
||||
public List portActive(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -94,6 +95,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("活跃端口数据错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -103,7 +105,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="portActiveChart")
|
||||
@ResponseBody
|
||||
public List portActiveChart(String beginDate,String endDate){
|
||||
public List portActiveChart(String beginDate,String endDate,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -120,6 +122,7 @@ public class DashboardController extends BaseController{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("活跃端口详情界面数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -145,7 +148,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="ipActive")
|
||||
@ResponseBody
|
||||
public List ipActive(String beginDate,String endDate){
|
||||
public List ipActive(String beginDate,String endDate,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -161,6 +164,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -169,7 +173,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="ipActiveMinuteList")
|
||||
@ResponseBody
|
||||
public List ipActiveMinuteList(String beginDate,String endDate,Integer entranceId){
|
||||
public List ipActiveMinuteList(String beginDate,String endDate,Integer entranceId,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -188,6 +192,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP数据获取错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -238,6 +243,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP统计错误"+e);
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "/dashboard/trafficIpActiveList";
|
||||
@@ -247,7 +253,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="ajaxIpActiveList")
|
||||
@ResponseBody
|
||||
public List ajaxIpActiveList(String beginDate,String endDate,Integer entranceId){
|
||||
public List ajaxIpActiveList(String beginDate,String endDate,Integer entranceId,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<TrafficIpActiveStatistic> list = new ArrayList<TrafficIpActiveStatistic>();
|
||||
try {
|
||||
@@ -294,6 +300,7 @@ public class DashboardController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("活跃IP数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
//list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
}
|
||||
return list;
|
||||
@@ -341,6 +348,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("IPActive export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
// return "/dashboard/trafficIpActiveList";
|
||||
}
|
||||
@@ -349,7 +357,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="protocol")
|
||||
@ResponseBody
|
||||
public List protocolChart(){
|
||||
public List protocolChart(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -389,6 +397,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("协议统计错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -397,7 +406,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="app")
|
||||
@ResponseBody
|
||||
public List appChart(){
|
||||
public List appChart(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -428,6 +437,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("app流量分析错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -436,7 +446,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="osList")
|
||||
@ResponseBody
|
||||
public List osList(){
|
||||
public List osList(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -467,6 +477,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取操作系统列表错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -475,7 +486,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="browserChart")
|
||||
@ResponseBody
|
||||
public List browserChart(@RequestParam("osType") String osType){
|
||||
public List browserChart(@RequestParam("osType") String osType,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -524,6 +535,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取操作系统下浏览器类型错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -532,7 +544,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="bsList")
|
||||
@ResponseBody
|
||||
public List bsList(){
|
||||
public List bsList(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -563,6 +575,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取浏览器列表错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -571,7 +584,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="systemChart")
|
||||
@ResponseBody
|
||||
public List systemChart(@RequestParam("bsType") String bsType){
|
||||
public List systemChart(@RequestParam("bsType") String bsType,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -620,6 +633,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("终端用户-获取浏览器下操作系统类型错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -628,7 +642,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="websiteList")
|
||||
@ResponseBody
|
||||
public List websiteList(){
|
||||
public List websiteList(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -665,6 +679,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("http网站流量分析数据错误:"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -673,7 +688,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="webTypeChart")
|
||||
@ResponseBody
|
||||
public List webTypeChart(@RequestParam("websiteServiceId") String websiteServiceId){
|
||||
public List webTypeChart(@RequestParam("websiteServiceId") String websiteServiceId,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -715,6 +730,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("http某个网站子域名流量统计错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -724,7 +740,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="topicAndDomainList")
|
||||
@ResponseBody
|
||||
public List topicAndDomainList(){
|
||||
public List topicAndDomainList(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -782,6 +798,7 @@ public class DashboardController extends BaseController{
|
||||
e.printStackTrace();
|
||||
logger.error("http网站主题流量分析数据错误:"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtil;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
@@ -64,7 +65,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="info")
|
||||
@ResponseBody
|
||||
public Map ipActive(){
|
||||
public Map ipActive(HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
HashMap<String, Object> m = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
@@ -114,6 +115,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("统计流量信息数据错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
@@ -149,7 +151,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="actionEntranceTrans")
|
||||
@ResponseBody
|
||||
public List actionTrans(String beginDate,String endDate,@RequestParam("searchAction")String searchAction){
|
||||
public List actionTrans(String beginDate,String endDate,@RequestParam("searchAction")String searchAction,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List resultList = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.NTC_ACTION_ENTRANCE_REPORT;
|
||||
@@ -165,6 +167,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error(searchAction+"动作详情数据获取错误"+e);
|
||||
resultList.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -196,7 +199,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="bandwidthTrans")
|
||||
@ResponseBody
|
||||
public Map bandwidthTrans(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType){
|
||||
public Map bandwidthTrans(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS;
|
||||
@@ -221,6 +224,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("带宽详情数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -229,7 +233,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="bandwidthTransTwo")
|
||||
@ResponseBody
|
||||
public Map bandwidthTransTwo(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType){
|
||||
public Map bandwidthTransTwo(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
|
||||
@@ -254,6 +258,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("带宽详情数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -262,7 +267,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="bandwidthTransThree")
|
||||
@ResponseBody
|
||||
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType,String searchDirection,Model model){
|
||||
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType,String searchDirection,Model model,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
//String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
|
||||
@@ -285,6 +290,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("带宽详情数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -307,7 +313,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="protocolList")
|
||||
@ResponseBody
|
||||
public List protocolList(Model model,Integer entranceId,Integer[] protoType,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,@RequestParam(required=false)String searchDirection){
|
||||
public List protocolList(Model model,Integer entranceId,Integer[] protoType,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,@RequestParam(required=false)String searchDirection,HttpServletRequest request){
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
@@ -377,6 +383,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("协议详情数据获取错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -399,7 +406,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="appList")
|
||||
@ResponseBody
|
||||
public List appList(Integer entranceId,@RequestParam(value="appType",required=false)Integer[] appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
|
||||
public List appList(Integer entranceId,@RequestParam(value="appType",required=false)Integer[] appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_LIST;
|
||||
@@ -457,6 +464,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("app详情数据获取错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -464,7 +472,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 +480,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);
|
||||
@@ -481,7 +503,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
@RequestMapping("ajaxAppTrend")
|
||||
@ResponseBody
|
||||
public Map ajaxAppTrend(String beginDate,String endDate,Integer appType,Integer entranceId,String searchQuotaType,Integer[] searchIspCode,Model model){
|
||||
public Map ajaxAppTrend(String beginDate,String endDate,Integer appType,Integer entranceId,String searchQuotaType,Integer[] searchIspCode,Model model,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map list = new HashMap();
|
||||
try {
|
||||
@@ -519,12 +541,13 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("app趋势图数据获取错误"+e);
|
||||
list.put("error","request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@RequestMapping("ajaxAppTopList")
|
||||
@ResponseBody
|
||||
public List ajaxAppTopList(String beginDate,String endDate,Integer appType,Integer entranceId,Integer searchQuota,Integer[] searchIspCode,Model model){
|
||||
public List ajaxAppTopList(String beginDate,String endDate,Integer appType,Integer entranceId,Integer searchQuota,Integer[] searchIspCode,Model model,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
try {
|
||||
@@ -570,6 +593,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("app列表Top100"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -602,7 +626,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
@RequestMapping("ajaxDomainTrans")
|
||||
@ResponseBody
|
||||
public List ajaxDomainTrans(String beginDate,String endDate,Integer domain,Integer entranceId,Model model){
|
||||
public List ajaxDomainTrans(String beginDate,String endDate,Integer domain,Integer entranceId,Model model,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -624,6 +648,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("活跃域名数据获取错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -632,7 +657,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="websiteList")
|
||||
@ResponseBody
|
||||
public List websiteList(Integer entranceId,Integer[] domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
public List websiteList(Integer entranceId,Integer[] domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST_NOTIME;
|
||||
@@ -728,6 +753,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("网站域名数据获取错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -737,7 +763,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="statisticList")
|
||||
@ResponseBody
|
||||
public List statisticList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
public List statisticList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_TOPICLIST;
|
||||
@@ -802,6 +828,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.error("协议详情数据获取错误"+e);
|
||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -822,7 +849,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
@RequestMapping("ajaxNtcTotalReportDetail")
|
||||
@ResponseBody
|
||||
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction){
|
||||
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction,HttpServletRequest request){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
try {
|
||||
@@ -868,6 +895,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("动作详情统计一小时数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.nis.domain.dashboard.PageDashboard;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -203,6 +204,7 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "/dashboard/trafficUserBehavior";
|
||||
}
|
||||
@@ -283,6 +285,7 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -503,6 +506,7 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user