Compare commits
6 Commits
develop_20
...
feature-im
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4157f58ab9 | ||
|
|
d27ba7ec93 | ||
|
|
bd29b40573 | ||
|
|
298eeef5e4 | ||
|
|
873b3333af | ||
|
|
068d2e859c |
@@ -1,3 +1 @@
|
||||
610功能升级:
|
||||
系统需要支持对 生效中的配置 进行修改的功能;
|
||||
统计的时间修改为一个月,性能是否可以;
|
||||
在公共分组功能逻辑完善之前,此分支为ntc界面系统的全集上线升级分支合并版。
|
||||
6
pom.xml
6
pom.xml
@@ -727,10 +727,6 @@
|
||||
<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,8 +14,6 @@ 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;
|
||||
}
|
||||
@@ -40,17 +38,6 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -20,14 +20,12 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
|
||||
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=6)
|
||||
@SerializedName("ipType")
|
||||
private Integer ipType;
|
||||
private Integer srcIpPattern;
|
||||
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=8)
|
||||
private Integer destIpPattern;
|
||||
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=8)
|
||||
private Integer ipPattern;
|
||||
private String srcIpAddress;
|
||||
@ExcelField(title="ip",sort=7)
|
||||
private String destIpAddress;
|
||||
private Integer srcPortPattern;
|
||||
private Integer destPortPattern;
|
||||
private Integer portPattern;
|
||||
private String srcPort;
|
||||
private String destPort;
|
||||
//@ExcelField(title="group",sort=2)
|
||||
@@ -119,30 +117,11 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
|
||||
public void setIpType(Integer ipType) {
|
||||
this.ipType = ipType;
|
||||
}
|
||||
|
||||
public Integer getSrcIpPattern() {
|
||||
return srcIpPattern;
|
||||
public Integer getIpPattern() {
|
||||
return ipPattern;
|
||||
}
|
||||
public void setSrcIpPattern(Integer srcIpPattern) {
|
||||
this.srcIpPattern = srcIpPattern;
|
||||
}
|
||||
public Integer getDestIpPattern() {
|
||||
return destIpPattern;
|
||||
}
|
||||
public void setDestIpPattern(Integer destIpPattern) {
|
||||
this.destIpPattern = destIpPattern;
|
||||
}
|
||||
public Integer getSrcPortPattern() {
|
||||
return srcPortPattern;
|
||||
}
|
||||
public void setSrcPortPattern(Integer srcPortPattern) {
|
||||
this.srcPortPattern = srcPortPattern;
|
||||
}
|
||||
public Integer getDestPortPattern() {
|
||||
return destPortPattern;
|
||||
}
|
||||
public void setDestPortPattern(Integer destPortPattern) {
|
||||
this.destPortPattern = destPortPattern;
|
||||
public void setIpPattern(Integer ipPattern) {
|
||||
this.ipPattern = ipPattern;
|
||||
}
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
@@ -156,6 +135,12 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
public Integer getPortPattern() {
|
||||
return portPattern;
|
||||
}
|
||||
public void setPortPattern(Integer portPattern) {
|
||||
this.portPattern = portPattern;
|
||||
}
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
@@ -191,10 +176,9 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AsnIpCfg [regionId=" + regionId + ", ratelimit=" + ratelimit + ", ipType=" + ipType + ", srcIpPattern="
|
||||
+ srcIpPattern + ", destIpPattern="+ destIpPattern+ ", srcIpAddress=" + srcIpAddress + ", destIpAddress="
|
||||
+ destIpAddress + ", srcPortPattern="+ srcPortPattern+", destPortPattern="+ destPortPattern + ", srcPort="
|
||||
+ srcPort + ", destPort=" + destPort + ", asnIpGroupName=" + asnIpGroupName
|
||||
return "AsnIpCfg [regionId=" + regionId + ", ratelimit=" + ratelimit + ", ipType=" + ipType + ", ipPattern="
|
||||
+ ipPattern + ", srcIpAddress=" + srcIpAddress + ", destIpAddress=" + destIpAddress + ", portPattern="
|
||||
+ portPattern + ", srcPort=" + srcPort + ", destPort=" + destPort + ", asnIpGroupName=" + asnIpGroupName
|
||||
+ ", asnIpGroup=" + asnIpGroup + ", direction=" + direction + ", protocol=" + protocol + ", protocolId="
|
||||
+ protocolId + ", compileId=" + compileId + ", isValid=" + isValid + ", userRegion1=" + userRegion1
|
||||
+ ", userRegion2=" + userRegion2 + ", userRegion3=" + userRegion3 + ", userRegion4=" + userRegion4
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
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,6 +1,8 @@
|
||||
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
@@ -32,13 +34,11 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
|
||||
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=3)
|
||||
@SerializedName("ipType")
|
||||
protected Integer ipType;
|
||||
protected Integer srcIpPattern;
|
||||
protected Integer destIpPattern;
|
||||
protected Integer ipPattern;
|
||||
protected String srcIpAddress;
|
||||
@ExcelField(title="server_ip",sort=4)
|
||||
protected String destIpAddress;
|
||||
protected Integer srcPortPattern;
|
||||
protected Integer destPortPattern;
|
||||
protected Integer portPattern;
|
||||
protected String srcPort;
|
||||
@ExcelField(title="server_port",sort=5)
|
||||
protected String destPort;
|
||||
@@ -121,7 +121,34 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
|
||||
// this.protocolId = protocolId;
|
||||
// }
|
||||
|
||||
/**
|
||||
* ipPattern
|
||||
* @return ipPattern
|
||||
*/
|
||||
|
||||
public Integer getIpPattern() {
|
||||
return ipPattern;
|
||||
}
|
||||
/**
|
||||
* @param ipPattern the ipPattern to set
|
||||
*/
|
||||
public void setIpPattern(Integer ipPattern) {
|
||||
this.ipPattern = ipPattern;
|
||||
}
|
||||
/**
|
||||
* portPattern
|
||||
* @return portPattern
|
||||
*/
|
||||
|
||||
public Integer getPortPattern() {
|
||||
return portPattern;
|
||||
}
|
||||
/**
|
||||
* @param portPattern the portPattern to set
|
||||
*/
|
||||
public void setPortPattern(Integer portPattern) {
|
||||
this.portPattern = portPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* srcIpAddress
|
||||
@@ -131,30 +158,6 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
}
|
||||
public Integer getSrcIpPattern() {
|
||||
return srcIpPattern;
|
||||
}
|
||||
public void setSrcIpPattern(Integer srcIpPattern) {
|
||||
this.srcIpPattern = srcIpPattern;
|
||||
}
|
||||
public Integer getDestIpPattern() {
|
||||
return destIpPattern;
|
||||
}
|
||||
public void setDestIpPattern(Integer destIpPattern) {
|
||||
this.destIpPattern = destIpPattern;
|
||||
}
|
||||
public Integer getSrcPortPattern() {
|
||||
return srcPortPattern;
|
||||
}
|
||||
public void setSrcPortPattern(Integer srcPortPattern) {
|
||||
this.srcPortPattern = srcPortPattern;
|
||||
}
|
||||
public Integer getDestPortPattern() {
|
||||
return destPortPattern;
|
||||
}
|
||||
public void setDestPortPattern(Integer destPortPattern) {
|
||||
this.destPortPattern = destPortPattern;
|
||||
}
|
||||
/**
|
||||
* @param srcIpAddress the srcIpAddress to set
|
||||
*/
|
||||
@@ -254,10 +257,16 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
|
||||
public String toString() {
|
||||
return "AppIpCfg [compileId=" + compileId + ", ratelimit=" + ratelimit + ", appCode=" + appCode + ", behavCode="
|
||||
+ behavCode + ", specServiceId=" + specServiceId + ", appName=" + appName + ", ipType=" + ipType
|
||||
+ ", srcIpPattern=" + srcIpPattern + ", destIpPattern=" + destIpPattern + ", srcIpAddress="
|
||||
+ srcIpAddress + ", destIpAddress=" + destIpAddress + ", srcPortPattern=" + srcPortPattern
|
||||
+ ", destPortPattern=" + destPortPattern + ", srcPort=" + srcPort + ", destPort=" + destPort
|
||||
+ ", direction=" + direction + ", protocol=" + protocol + "]";
|
||||
+ ", ipPattern=" + ipPattern + ", srcIpAddress=" + srcIpAddress + ", destIpAddress=" + destIpAddress
|
||||
+ ", portPattern=" + portPattern + ", srcPort=" + srcPort + ", destPort=" + destPort + ", direction="
|
||||
+ direction + ", protocol=" + protocol + ", userRegion1=" + userRegion1 + ", userRegion2=" + userRegion2
|
||||
+ ", userRegion3=" + userRegion3 + ", userRegion4=" + userRegion4 + ", userRegion5=" + userRegion5
|
||||
+ ", cfgId=" + cfgId + ", cfgDesc=" + cfgDesc + ", action=" + action + ", isValid=" + isValid
|
||||
+ ", isAudit=" + isAudit + ", creatorId=" + creatorId + ", createTime=" + createTime + ", editorId="
|
||||
+ editorId + ", editTime=" + editTime + ", auditorId=" + auditorId + ", auditTime=" + auditTime
|
||||
+ ", serviceId=" + serviceId + ", requestId=" + requestId + ", cancelRequestId=" + cancelRequestId
|
||||
+ ", isAreaEffective=" + isAreaEffective + ", classify=" + classify + ", attribute=" + attribute
|
||||
+ ", lable=" + lable + ", areaEffectiveIds=" + areaEffectiveIds + ", cfgRegionCode=" + cfgRegionCode
|
||||
+ ", cfgType=" + cfgType + ", functionId=" + functionId + ", doLog=" + doLog + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ public class AreaIpCfg extends BaseIpCfg {
|
||||
this.cfgType=Constants.AREA_REGION;
|
||||
this.cfgRegionCode=1;
|
||||
this.protocol=0;
|
||||
this.srcPortPattern=1;
|
||||
this.destPortPattern=1;
|
||||
this.portPattern=1;
|
||||
this.srcPort="0";
|
||||
this.destPort="0";
|
||||
this.direction=0;
|
||||
|
||||
@@ -9,18 +9,8 @@ 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,13 +61,6 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
protected Integer compileIsIssued;
|
||||
protected String exType;//导出类型
|
||||
protected String hColumns;//导出隐藏列
|
||||
|
||||
protected String compileIdNew;// 查询 配置ID 范围
|
||||
|
||||
//批量操作时,记录isAudit和isValid检索条件
|
||||
protected String batchAuditValue;
|
||||
protected String batchValidValue;
|
||||
|
||||
/**
|
||||
* 定时任务信息
|
||||
*/
|
||||
@@ -114,12 +107,6 @@ 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
|
||||
@@ -1008,17 +995,6 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
public void setSchedule(ScheduleCfg schedule) {
|
||||
this.schedule = schedule;
|
||||
}
|
||||
public String getBatchAuditValue() {
|
||||
return batchAuditValue;
|
||||
}
|
||||
public String getBatchValidValue() {
|
||||
return batchValidValue;
|
||||
}
|
||||
public void setBatchAuditValue(String batchAuditValue) {
|
||||
this.batchAuditValue = batchAuditValue;
|
||||
}
|
||||
public void setBatchValidValue(String batchValidValue) {
|
||||
this.batchValidValue = batchValidValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -45,18 +45,14 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
@SerializedName("ipType")
|
||||
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=50)
|
||||
protected Integer ipType;
|
||||
@ExcelField(title="src_ip_pattern",dictType="IP_PATTERN",sort=51)
|
||||
protected Integer srcIpPattern;
|
||||
@ExcelField(title="client_ip",sort=52)
|
||||
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=51)
|
||||
protected Integer ipPattern;
|
||||
@ExcelField(title="client_ip",sort=53)
|
||||
protected String srcIpAddress;
|
||||
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=53)
|
||||
protected Integer destIpPattern;
|
||||
@ExcelField(title="server_ip",sort=54)
|
||||
@ExcelField(title="server_ip",sort=52)
|
||||
protected String destIpAddress;
|
||||
@ExcelField(title="src_port_pattern",dictType="PORT_PATTERN",sort=54)
|
||||
protected Integer srcPortPattern;
|
||||
@ExcelField(title="dest_port_pattern",dictType="PORT_PATTERN",sort=54)
|
||||
protected Integer destPortPattern;
|
||||
@ExcelField(title="port_pattern",dictType="PORT_PATTERN",sort=54)
|
||||
protected Integer portPattern;
|
||||
@ExcelField(title="client_port",sort=55)
|
||||
protected String srcPort;
|
||||
@ExcelField(title="server_port",sort=56)
|
||||
@@ -273,31 +269,35 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
this.protocolId = protocolId;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipPattern
|
||||
* @return ipPattern
|
||||
*/
|
||||
|
||||
public Integer getSrcIpPattern() {
|
||||
return srcIpPattern;
|
||||
public Integer getIpPattern() {
|
||||
return ipPattern;
|
||||
}
|
||||
public void setSrcIpPattern(Integer srcIpPattern) {
|
||||
this.srcIpPattern = srcIpPattern;
|
||||
/**
|
||||
* @param ipPattern the ipPattern to set
|
||||
*/
|
||||
public void setIpPattern(Integer ipPattern) {
|
||||
this.ipPattern = ipPattern;
|
||||
}
|
||||
public Integer getDestIpPattern() {
|
||||
return destIpPattern;
|
||||
/**
|
||||
* portPattern
|
||||
* @return portPattern
|
||||
*/
|
||||
|
||||
public Integer getPortPattern() {
|
||||
return portPattern;
|
||||
}
|
||||
public void setDestIpPattern(Integer destIpPattern) {
|
||||
this.destIpPattern = destIpPattern;
|
||||
}
|
||||
public Integer getSrcPortPattern() {
|
||||
return srcPortPattern;
|
||||
}
|
||||
public void setSrcPortPattern(Integer srcPortPattern) {
|
||||
this.srcPortPattern = srcPortPattern;
|
||||
}
|
||||
public Integer getDestPortPattern() {
|
||||
return destPortPattern;
|
||||
}
|
||||
public void setDestPortPattern(Integer destPortPattern) {
|
||||
this.destPortPattern = destPortPattern;
|
||||
/**
|
||||
* @param portPattern the portPattern to set
|
||||
*/
|
||||
public void setPortPattern(Integer portPattern) {
|
||||
this.portPattern = portPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* srcIpAddress
|
||||
* @return srcIpAddress
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListComplexStringTemplate extends ComplexStringAllTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=3)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListIPTemplate extends IpAllTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=3)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListP2pHashStringTemplate extends P2pHashStringTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=4)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListP2pIpTemplate extends P2pIpTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=4)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BlackListStringTemplate extends StringAllTemplate {
|
||||
private Integer doBlackList;
|
||||
@ExcelField(title="doBlacklist",align=2,sort=3)
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class DnsStringTemplate extends StringAllTemplate {
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
private Integer dnsStrategyId;
|
||||
|
||||
@ExcelField(title="policy_name",align=2,sort=3)
|
||||
public Integer getDnsStrategyId() {
|
||||
return dnsStrategyId;
|
||||
}
|
||||
public void setDnsStrategyId(Integer dnsStrategyId) {
|
||||
this.dnsStrategyId = dnsStrategyId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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=12)
|
||||
@ExcelField(title="intercept_intensity",dictType="INTERCEPT_DOMAIN_INTENSITY",align=2,sort=2)
|
||||
public String getUserRegion5() {
|
||||
return userRegion5;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpAddrTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
/**
|
||||
*@Title: BaseStringConfig.java
|
||||
*@Package com.nis.domain.restful
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年2月5日 下午5:26:02
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @Description: excel导入IP类配置
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpCfgTemplate {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
private Long cfgId;
|
||||
private Integer ipType;//1
|
||||
private Integer ipPattern;//2
|
||||
private String srcIpAddress; //3
|
||||
private String destIpAddress; //4
|
||||
private Integer portPattern; //5
|
||||
private String srcPort; //6
|
||||
private String destPort;//7
|
||||
private Integer protocol;//8
|
||||
protected Integer direction;//9
|
||||
private String cfgDesc;//10
|
||||
private Integer requestId;//11
|
||||
private String requestName;//12
|
||||
private Integer isAreaEffective;//13
|
||||
private String classify;//14
|
||||
private String attribute;//15
|
||||
private String lable;//16
|
||||
private String classifyName;//17
|
||||
private String attributeName;//18
|
||||
private String lableName;//19
|
||||
private String areaEffectiveIds;//20
|
||||
private String ratelimit;//21
|
||||
private Integer dnsStrategyId;//22
|
||||
private Integer irType;//23
|
||||
private String userRegion1;//77
|
||||
private String userRegion2;//78
|
||||
private String userRegion3;//79
|
||||
private String userRegion4;//80
|
||||
private String userRegion5;//81
|
||||
|
||||
/**
|
||||
* userRegion1
|
||||
* @return userRegion1
|
||||
*/
|
||||
// @ExcelField(title="userregion1",align=2,sort=77)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
/**
|
||||
* @param userRegion1 the userRegion1 to set
|
||||
*/
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
/**
|
||||
* userRegion2
|
||||
* @return userRegion2
|
||||
*/
|
||||
// @ExcelField(title="userregion2",align=2,sort=78)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
/**
|
||||
* @param userRegion2 the userRegion2 to set
|
||||
*/
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
/**
|
||||
* userRegion3
|
||||
* @return userRegion3
|
||||
*/
|
||||
// @ExcelField(title="userregion3",align=2,sort=79)
|
||||
public String getUserRegion3() {
|
||||
return userRegion3;
|
||||
}
|
||||
/**
|
||||
* @param userRegion3 the userRegion3 to set
|
||||
*/
|
||||
public void setUserRegion3(String userRegion3) {
|
||||
this.userRegion3 = userRegion3;
|
||||
}
|
||||
/**
|
||||
* userRegion4
|
||||
* @return userRegion4
|
||||
*/
|
||||
// @ExcelField(title="userregion4",align=2,sort=80)
|
||||
public String getUserRegion4() {
|
||||
return userRegion4;
|
||||
}
|
||||
/**
|
||||
* @param userRegion4 the userRegion4 to set
|
||||
*/
|
||||
public void setUserRegion4(String userRegion4) {
|
||||
this.userRegion4 = userRegion4;
|
||||
}
|
||||
/**
|
||||
* userRegion5
|
||||
* @return userRegion5
|
||||
*/
|
||||
// @ExcelField(title="userregion5",align=2,sort=81)
|
||||
public String getUserRegion5() {
|
||||
return userRegion5;
|
||||
}
|
||||
/**
|
||||
* @param userRegion5 the userRegion5 to set
|
||||
*/
|
||||
public void setUserRegion5(String userRegion5) {
|
||||
this.userRegion5 = userRegion5;
|
||||
}
|
||||
/**
|
||||
* ratelimit
|
||||
* @return ratelimit
|
||||
*/
|
||||
@ExcelField(title="ratelimit",align=2,sort=74)
|
||||
public String getRatelimit() {
|
||||
return ratelimit;
|
||||
}
|
||||
/**
|
||||
* @param ratelimit the ratelimit to set
|
||||
*/
|
||||
public void setRatelimit(String ratelimit) {
|
||||
this.ratelimit = ratelimit;
|
||||
}
|
||||
/**
|
||||
* irType
|
||||
* @return irType
|
||||
*/
|
||||
@ExcelField(title="ir_type",align=2,sort=76)
|
||||
public Integer getIrType() {
|
||||
return irType;
|
||||
}
|
||||
/**
|
||||
* @param irType the irType to set
|
||||
*/
|
||||
public void setIrType(Integer irType) {
|
||||
this.irType = irType;
|
||||
}
|
||||
/**
|
||||
* dnsStrategyId
|
||||
* @return dnsStrategyId
|
||||
*/
|
||||
@ExcelField(title="dns_strategy_id",align=2,sort=75)
|
||||
public Integer getDnsStrategyId() {
|
||||
return dnsStrategyId;
|
||||
}
|
||||
/**
|
||||
* @param dnsStrategyId the dnsStrategyId to set
|
||||
*/
|
||||
public void setDnsStrategyId(Integer dnsStrategyId) {
|
||||
this.dnsStrategyId = dnsStrategyId;
|
||||
}
|
||||
@ExcelField(title="ip_type",align=2,sort=1)
|
||||
public Integer getIpType() {
|
||||
return ipType;
|
||||
}
|
||||
public void setIpType(Integer ipType) {
|
||||
this.ipType = ipType;
|
||||
}
|
||||
@ExcelField(title="ip_pattern",align=2,sort=2)
|
||||
public Integer getIpPattern() {
|
||||
return ipPattern;
|
||||
}
|
||||
public void setIpPattern(Integer ipPattern) {
|
||||
this.ipPattern = ipPattern;
|
||||
}
|
||||
@ExcelField(title="client_ip",align=2,sort=3)
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
}
|
||||
public void setSrcIpAddress(String srcIpAddress) {
|
||||
this.srcIpAddress = srcIpAddress;
|
||||
}
|
||||
@ExcelField(title="server_ip",align=2,sort=4)
|
||||
public String getDestIpAddress() {
|
||||
return destIpAddress;
|
||||
}
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
@ExcelField(title="port_pattern",align=2,sort=5)
|
||||
public Integer getPortPattern() {
|
||||
return portPattern;
|
||||
}
|
||||
public void setPortPattern(Integer portPattern) {
|
||||
this.portPattern = portPattern;
|
||||
}
|
||||
@ExcelField(title="client_port",align=2,sort=6)
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
public void setSrcPort(String srcPort) {
|
||||
this.srcPort = srcPort;
|
||||
}
|
||||
@ExcelField(title="server_port",align=2,sort=7)
|
||||
public String getDestPort() {
|
||||
return destPort;
|
||||
}
|
||||
public void setDestPort(String destPort) {
|
||||
this.destPort = destPort;
|
||||
}
|
||||
public Long getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Long cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
@ExcelField(title="direction",align=2,sort=8)
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
@ExcelField(title="config_describe",align=2,sort=11)
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}
|
||||
@ExcelField(title="letter",align=2,sort=13)
|
||||
public Integer getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
public void setRequestId(Integer requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
public String getRequestName() {
|
||||
return requestName;
|
||||
}
|
||||
public void setRequestName(String requestName) {
|
||||
this.requestName = requestName;
|
||||
}
|
||||
public Integer getIsAreaEffective() {
|
||||
return isAreaEffective;
|
||||
}
|
||||
public void setIsAreaEffective(Integer isAreaEffective) {
|
||||
this.isAreaEffective = isAreaEffective;
|
||||
}
|
||||
@ExcelField(title="classification",align=2,sort=71)
|
||||
public String getClassify() {
|
||||
return classify;
|
||||
}
|
||||
public void setClassify(String classify) {
|
||||
this.classify = classify;
|
||||
}
|
||||
@ExcelField(title="attribute",align=2,sort=72)
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
@ExcelField(title="label",align=2,sort=73)
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getClassifyName() {
|
||||
return classifyName;
|
||||
}
|
||||
public void setClassifyName(String classifyName) {
|
||||
this.classifyName = classifyName;
|
||||
}
|
||||
public String getAttributeName() {
|
||||
return attributeName;
|
||||
}
|
||||
public void setAttributeName(String attributeName) {
|
||||
this.attributeName = attributeName;
|
||||
}
|
||||
public String getLableName() {
|
||||
return lableName;
|
||||
}
|
||||
public void setLableName(String lableName) {
|
||||
this.lableName = lableName;
|
||||
}
|
||||
// @ExcelField(title="area_effective",align=2,sort=70)
|
||||
public String getAreaEffectiveIds() {
|
||||
return areaEffectiveIds;
|
||||
}
|
||||
public void setAreaEffectiveIds(String areaEffectiveIds) {
|
||||
this.areaEffectiveIds = areaEffectiveIds;
|
||||
}
|
||||
@ExcelField(title="protocol",align=2,sort=9)
|
||||
public Integer getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
public void setProtocol(Integer protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpMultiplexPolicyTemplate extends IpCfgTemplate {
|
||||
@Override
|
||||
@ExcelField(title="IP",align=2,sort=3)
|
||||
public String getSrcIpAddress() {
|
||||
return super.getSrcIpAddress();
|
||||
}
|
||||
@ExcelField(title="port",align=2,sort=6)
|
||||
@Override
|
||||
public String getSrcPort() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getSrcPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ExcelField(title="group_name",align=2,sort=75)
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
@Override
|
||||
public String getDestPort() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDestPort();
|
||||
}
|
||||
@Override
|
||||
public String getDestIpAddress() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDestIpAddress();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpsecTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import com.nis.util.excel.ExcelField;
|
||||
public class P2pHashStringTemplate extends StringAllTemplate {
|
||||
private String userRegion1;
|
||||
|
||||
@ExcelField(title="p2p_hash_type",dictType="P2P_HASH_TYPE",align=2,sort=2)
|
||||
@ExcelField(title="p2p_hash_type",dictType="P2P_HASH_TYPE",align=2,sort=3)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public class P2pIpTemplate extends IpAllTemplate {
|
||||
|
||||
private String userRegion2;
|
||||
|
||||
@ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=5)
|
||||
@ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class TunnelIpTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getProtocol() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class WhiteListIpTemplate extends IpCfgTemplate {
|
||||
|
||||
@Override
|
||||
public Integer getDirection() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getProtocol() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getRequestId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRequestId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassify() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getClassify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttribute() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getAttribute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLable() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getLable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,15 +30,13 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
|
||||
@Expose
|
||||
private Integer protocol; //protocol 协议 int N 6表示tcp,17表示udp,0表示任意
|
||||
@Expose
|
||||
private Integer srcIpPattern; //ip格式
|
||||
private Integer destIpPattern; //ip格式
|
||||
private Integer ipPattern; //ip格式
|
||||
@Expose
|
||||
private String srcIpAddress; //源(客户端)IP地址
|
||||
@Expose
|
||||
private String destIpAddress; //目的(服务器)IP地址
|
||||
@Expose
|
||||
private Integer srcPortPattern; //端口格式
|
||||
private Integer destPortPattern; //端口格式
|
||||
private Integer portPattern; //端口格式
|
||||
@Expose
|
||||
private String srcPort; //源(客户端)端口
|
||||
@Expose
|
||||
@@ -116,33 +114,19 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
|
||||
public void setDestPort(String destPort) {
|
||||
this.destPort = destPort;
|
||||
}
|
||||
@ExcelField(title="src_ip_pattern",align=2,sort=21,fieldType=Integer.class)
|
||||
public Integer getSrcIpPattern() {
|
||||
return srcIpPattern;
|
||||
@ExcelField(title="ip_pattern",align=2,sort=21,fieldType=Integer.class)
|
||||
public Integer getIpPattern() {
|
||||
return ipPattern;
|
||||
}
|
||||
public void setSrcIpPattern(Integer srcIpPattern) {
|
||||
this.srcIpPattern = srcIpPattern;
|
||||
public void setIpPattern(Integer ipPattern) {
|
||||
this.ipPattern = ipPattern;
|
||||
}
|
||||
@ExcelField(title="dest_ip_pattern",align=2,sort=22,fieldType=Integer.class)
|
||||
public Integer getDestIpPattern() {
|
||||
return destIpPattern;
|
||||
@ExcelField(title="port_pattern",align=2,sort=40,fieldType=Integer.class)
|
||||
public Integer getPortPattern() {
|
||||
return portPattern;
|
||||
}
|
||||
public void setDestIpPattern(Integer destIpPattern) {
|
||||
this.destIpPattern = destIpPattern;
|
||||
}
|
||||
@ExcelField(title="src_port_pattern",align=2,sort=40,fieldType=Integer.class)
|
||||
public Integer getSrcPortPattern() {
|
||||
return srcPortPattern;
|
||||
}
|
||||
public void setSrcPortPattern(Integer srcPortPattern) {
|
||||
this.srcPortPattern = srcPortPattern;
|
||||
}
|
||||
@ExcelField(title="dest_port_pattern",align=2,sort=41,fieldType=Integer.class)
|
||||
public Integer getDestPortPattern() {
|
||||
return destPortPattern;
|
||||
}
|
||||
public void setDestPortPattern(Integer destPortPattern) {
|
||||
this.destPortPattern = destPortPattern;
|
||||
public void setPortPattern(Integer portPattern) {
|
||||
this.portPattern = portPattern;
|
||||
}
|
||||
@ExcelField(title="direction",align=2,sort=110)
|
||||
public Integer getDirection() {
|
||||
|
||||
@@ -71,7 +71,6 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{
|
||||
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 字段名
|
||||
@@ -162,11 +161,10 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +199,6 @@ 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");
|
||||
@@ -278,7 +275,6 @@ 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
|
||||
@@ -335,7 +331,6 @@ 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,21 +82,15 @@ 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 ? Constants.MAAT_JSON_SEND_SIZE:dataMap.getLong("limit");
|
||||
long limit = dataMap.get("limit") == null ? 1000:dataMap.getLong("limit");
|
||||
log.info(String.format("定时配置任务开始执行,scheduleCfgId:%s,limit:%s",scheduleCfgId,limit ));
|
||||
List<ScheduleCfg> allNewlySche = null;
|
||||
List<ScheduleCfg> newlyCfg = null;
|
||||
int totalNum = 0;
|
||||
do {
|
||||
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);
|
||||
}
|
||||
newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit);
|
||||
if(newlyCfg != null && newlyCfg.size() > 0) {
|
||||
totalNum += newlyCfg.size();
|
||||
for(ScheduleCfg cfg : newlyCfg) {//先取消之前的定时配置
|
||||
Integer compileId = cfg.getCompileId();
|
||||
try {
|
||||
//取消之前所有的 trigger
|
||||
@@ -112,7 +106,7 @@ public class ScheduleCfgJob implements Job {
|
||||
log.error(String.format("定时任务取消异常,compileId:%s", compileId),e);
|
||||
}
|
||||
}
|
||||
for(ScheduleCfg cfg : allAddSche) {
|
||||
for(ScheduleCfg cfg : newlyCfg) {
|
||||
Integer compileId = cfg.getCompileId();
|
||||
try {
|
||||
//判断状态,重新添加最新的 trigger
|
||||
@@ -129,12 +123,12 @@ public class ScheduleCfgJob implements Job {
|
||||
}
|
||||
}
|
||||
//最后 保存此次 最后的id
|
||||
ScheduleCfg lastCfg = allNewlySche.get(allNewlySche.size() -1);
|
||||
ScheduleCfg lastCfg = newlyCfg.get(newlyCfg.size() -1);
|
||||
scheduleCfgId = lastCfg.getId();
|
||||
dataMap.put("scheduleCfgId", scheduleCfgId);
|
||||
log.info(String.format("加载定时任务,total num :%s", allNewlySche.size()));
|
||||
log.info(String.format("加载定时任务,total num :%s", newlyCfg.size()));
|
||||
}
|
||||
} while (allNewlySche != null && allNewlySche.size() > 0);
|
||||
} while (newlyCfg != null && newlyCfg.size() > 0);
|
||||
log.info(String.format("定时配置任务结束执行,total num:%s",totalNum));
|
||||
}
|
||||
|
||||
@@ -321,34 +315,6 @@ 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=invalidCal.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();
|
||||
@@ -363,7 +329,6 @@ public class ScheduleCfgJob implements Job {
|
||||
.startAt(validStartTime)
|
||||
.build();
|
||||
triList.add(validTri);
|
||||
|
||||
//invalid
|
||||
dataMap = new JobDataMap();
|
||||
dataMap.put("isValid", false);
|
||||
@@ -513,25 +478,14 @@ 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));
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
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,20 +1,12 @@
|
||||
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;
|
||||
|
||||
@@ -31,33 +23,6 @@ public class ScheduleStatusJob implements Job{
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
//全量同步状态
|
||||
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");
|
||||
@@ -66,17 +31,8 @@ public class ScheduleStatusJob implements Job{
|
||||
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 ));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid ));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,548 +0,0 @@
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,new String[]{"menuNameCode"});
|
||||
BeanUtils.copyProperties(srcCfg, baseIpCfg);
|
||||
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,new String[]{"menuNameCode"});//拷贝公共属性
|
||||
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
|
||||
// 一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.NumBoundaryCfg cfg = new com.nis.domain.maat.MaatCfg.NumBoundaryCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
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,new String[]{"menuNameCode"});//拷贝公共属性
|
||||
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
|
||||
// 一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
GroupCfg group = new GroupCfg();
|
||||
group.setGroupId(baseCfg.getGroupId());
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
@@ -395,10 +395,13 @@ public class ConfigConvertUtil {
|
||||
*/
|
||||
public static List<IpCfg> ipConvert(IpCfg dstIp, BaseIpCfg srcIp) {
|
||||
List<IpCfg> ipConvertList = Lists.newArrayList();
|
||||
boolean isRange = ((srcIp.getIpPattern() != null && srcIp.getIpPattern() == 2)
|
||||
|| (srcIp.getSrcIpAddress() != null && srcIp.getSrcIpAddress().indexOf("-") > -1)
|
||||
|| (srcIp.getDestIpAddress() != null && srcIp.getDestIpAddress().indexOf("-") > -1));
|
||||
if (isRange) {
|
||||
List<IpCfg> tempList = Lists.newArrayList();
|
||||
List<IpCfg> tempList1 = Lists.newArrayList();
|
||||
if (srcIp.getIpType().equals(4)) {// IP V4
|
||||
if(srcIp.getSrcIpPattern().equals(2)) {//源IP范围
|
||||
if (srcIp.getIpType().intValue() == 4) {
|
||||
if (srcIp.getSrcIpAddress() != null) {
|
||||
String startIpPart = srcIp.getSrcIpAddress().split("-")[0];
|
||||
String endIpPart = srcIp.getSrcIpAddress().split("-")[1];
|
||||
@@ -411,29 +414,12 @@ public class ConfigConvertUtil {
|
||||
tempIp.setSrcIpMask("255.255.255.255");
|
||||
tempList.add(tempIp);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
dstIp.setSrcIp("0.0.0.0");
|
||||
dstIp.setSrcIpMask("255.255.255.255");
|
||||
tempList.add(dstIp);
|
||||
}
|
||||
}else if(srcIp.getSrcIpPattern().equals(1)){
|
||||
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
|
||||
if (srcMaskNum == 0) {
|
||||
dstIp.setSrcIpMask("0.0.0.0");
|
||||
} else {
|
||||
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
|
||||
}
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
|
||||
tempList.add(dstIp);
|
||||
}else if(srcIp.getSrcIpPattern().equals(3)){
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("255.255.255.255");
|
||||
tempList.add(dstIp);
|
||||
}else {
|
||||
throw new RuntimeException("Unsupported IP Pattern " + srcIp.getSrcIpPattern());
|
||||
}
|
||||
if (srcIp.getDestIpAddress() != null) {
|
||||
if(srcIp.getDestIpPattern().equals(2)) {
|
||||
String startIpPart = srcIp.getDestIpAddress().split("-")[0];
|
||||
String endIpPart = srcIp.getDestIpAddress().split("-")[1];
|
||||
Integer startNum = Integer.parseInt(startIpPart.split("\\.")[3]);
|
||||
@@ -453,39 +439,7 @@ public class ConfigConvertUtil {
|
||||
}
|
||||
}
|
||||
tempList.clear();
|
||||
}else if(srcIp.getDestIpPattern().equals(1)) {
|
||||
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
|
||||
for (IpCfg _cfg : tempList) {
|
||||
IpCfg tempIp = new IpCfg();
|
||||
BeanUtils.copyProperties(_cfg, tempIp);
|
||||
if (dstMaskNum == 0) {
|
||||
tempIp.setDstIpMask("0.0.0.0");
|
||||
} else {
|
||||
tempIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
|
||||
}
|
||||
tempIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
|
||||
if (!tempIp.getSrcIp().equals(tempIp.getDstIp())) {
|
||||
// 处理
|
||||
convertPortValues(tempIp, srcIp);
|
||||
tempList1.add(tempIp);
|
||||
}
|
||||
}
|
||||
tempList.clear();
|
||||
}else {
|
||||
for (IpCfg _cfg : tempList) {
|
||||
IpCfg tempIp = new IpCfg();
|
||||
BeanUtils.copyProperties(_cfg, tempIp);
|
||||
tempIp.setDstIp(srcIp.getDestIpAddress());
|
||||
if (!tempIp.getSrcIp().equals(tempIp.getDstIp())) {
|
||||
tempIp.setDstIpMask("255.255.255.255");
|
||||
// 处理
|
||||
convertPortValues(tempIp, srcIp);
|
||||
tempList1.add(tempIp);
|
||||
}
|
||||
}
|
||||
tempList.clear();
|
||||
}
|
||||
}else {
|
||||
for (IpCfg _cfg : tempList) {
|
||||
_cfg.setDstIp("0.0.0.0");
|
||||
_cfg.setSrcIpMask("255.255.255.255");
|
||||
@@ -497,50 +451,206 @@ public class ConfigConvertUtil {
|
||||
} else {
|
||||
ipConvertList.addAll(tempList);
|
||||
}
|
||||
}else if(srcIp.getIpType().equals(6)){// IP V6
|
||||
} else if (srcIp.getIpType().intValue() == 6) {
|
||||
if (srcIp.getSrcIpAddress() != null) {
|
||||
if(srcIp.getSrcIpPattern().equals(2)) {
|
||||
IPv6Address address1 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[0]);
|
||||
IPv6Address address2 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[1]);
|
||||
IPv6Network network = IPv6Network.fromTwoAddresses(address1, address2);
|
||||
dstIp.setSrcIp(address1.toString());
|
||||
dstIp.setSrcIpMask(network.getNetmask().asAddress().toString());
|
||||
}else if(srcIp.getSrcIpPattern().equals(1)){// IP/掩码
|
||||
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
|
||||
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
|
||||
}else {// IP
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
} else {
|
||||
dstIp.setSrcIp("::");
|
||||
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
if (srcIp.getDestIpAddress() != null) {
|
||||
if(srcIp.getDestIpPattern().equals(2)) {
|
||||
IPv6Address address1 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[0]);
|
||||
IPv6Address address2 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[1]);
|
||||
IPv6Network network = IPv6Network.fromTwoAddresses(address1, address2);
|
||||
dstIp.setDstIp(address1.toString());
|
||||
dstIp.setDstIpMask(network.getNetmask().asAddress().toString());
|
||||
}else if(srcIp.getDestIpPattern().equals(1)) {// IP/掩码
|
||||
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
|
||||
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
|
||||
}else {// IP
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
} else {
|
||||
dstIp.setDstIp("::");
|
||||
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
convertPortValues(dstIp, srcIp);
|
||||
|
||||
ipConvertList.add(dstIp);
|
||||
}else {
|
||||
} else {
|
||||
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
|
||||
}
|
||||
} else {
|
||||
if (srcIp.getSrcIpAddress() != null) {
|
||||
if (srcIp.getSrcIpAddress().indexOf("/") != -1) {
|
||||
if (srcIp.getIpType() == 4 /* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4,目的ip为ipv6
|
||||
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
|
||||
if (srcMaskNum == 0) {
|
||||
dstIp.setSrcIpMask("0.0.0.0");
|
||||
} else {
|
||||
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
|
||||
}
|
||||
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
|
||||
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6,目的ip为ipv4
|
||||
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
|
||||
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
|
||||
} /*
|
||||
* else { Pattern
|
||||
* patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern
|
||||
* patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher
|
||||
* matchernV4Subnet=patternV4Subnet.matcher(srcIp.getSrcIpAddress()); Matcher
|
||||
* matcherV6Subnet=patternV6Subnet.matcher(srcIp.getSrcIpAddress());
|
||||
* if(matchernV4Subnet.matches()) { Integer srcMaskNum =
|
||||
* Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]); if(srcMaskNum==0){
|
||||
* dstIp.setSrcIpMask("0.0.0.0"); }else{
|
||||
* dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum)); }
|
||||
* dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]); }else
|
||||
* if(matcherV6Subnet.matches()){ IPv6Network strangeNetwork =
|
||||
* IPv6Network.fromString(srcIp.getSrcIpAddress());
|
||||
* dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
|
||||
* dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString()); }else
|
||||
* { throw new RuntimeException("Invalid IP/subnet mask format"); } }
|
||||
*/
|
||||
else {
|
||||
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
|
||||
}
|
||||
} else {
|
||||
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4,目的ip为ipv6
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("255.255.255.255");
|
||||
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6,目的ip为ipv4
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
} /*
|
||||
* else {//all Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
|
||||
* Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher
|
||||
* matcherV4=patternV4.matcher(srcIp.getSrcIpAddress()); Matcher
|
||||
* matcherV6=patternV6.matcher(srcIp.getSrcIpAddress()); if(matcherV4.matches())
|
||||
* { dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
* dstIp.setSrcIpMask("255.255.255.255"); }else if(matcherV6.matches()) {
|
||||
* dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
* dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); }else { throw
|
||||
* new RuntimeException("Invalid IP format"); } }
|
||||
*/
|
||||
else {
|
||||
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4,目的ip为ipv6
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("255.255.255.255");
|
||||
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6,目的ip为ipv4
|
||||
dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
} /*
|
||||
* else {//all dstIp.setSrcIp(srcIp.getSrcIpAddress());
|
||||
* dstIp.setSrcIpMask("255.255.255.255"); }
|
||||
*/
|
||||
else {
|
||||
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
|
||||
}
|
||||
}
|
||||
if (srcIp.getDestIpAddress() != null) {
|
||||
if (srcIp.getDestIpAddress().indexOf("/") != -1) {
|
||||
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6,目的ip为ipv4
|
||||
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
|
||||
if (dstMaskNum == 0) {
|
||||
dstIp.setDstIpMask("0.0.0.0");
|
||||
} else {
|
||||
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
|
||||
;
|
||||
}
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
|
||||
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4,目的ip为ipv6
|
||||
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
|
||||
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
|
||||
} /*
|
||||
* else { Pattern
|
||||
* patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern
|
||||
* patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher
|
||||
* matchernV4Subnet=patternV4Subnet.matcher(srcIp.getDestIpAddress()); Matcher
|
||||
* matcherV6Subnet=patternV6Subnet.matcher(srcIp.getDestIpAddress());
|
||||
* if(matchernV4Subnet.matches()) { Integer dstMaskNum =
|
||||
* Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]); if(dstMaskNum==0){
|
||||
* dstIp.setDstIpMask("0.0.0.0"); }else{
|
||||
* dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));; }
|
||||
* dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]); }else
|
||||
* if(matcherV6Subnet.matches()){ IPv6Network strangeNetwork =
|
||||
* IPv6Network.fromString(srcIp.getDestIpAddress());
|
||||
* dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
|
||||
* dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString()); }else
|
||||
* { throw new RuntimeException("Invalid IP/subnet mask format"); } }
|
||||
*/
|
||||
else {
|
||||
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
|
||||
}
|
||||
|
||||
} else {
|
||||
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6,目的ip为ipv4
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("255.255.255.255");
|
||||
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4,目的ip为ipv6
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
} /*
|
||||
* else {//all Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
|
||||
* Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher
|
||||
* matcherV4=patternV4.matcher(srcIp.getDestIpAddress()); Matcher
|
||||
* matcherV6=patternV6.matcher(srcIp.getDestIpAddress());
|
||||
* if(matcherV4.matches()) { dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
* dstIp.setDstIpMask("255.255.255.255"); }else if(matcherV6.matches()) {
|
||||
* dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
* dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); }else { throw
|
||||
* new RuntimeException("invalid ip format"); } }
|
||||
*/
|
||||
else {
|
||||
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6,目的ip为ipv4
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("255.255.255.255");
|
||||
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4,目的ip为ipv6
|
||||
dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
} /*
|
||||
* else {//all dstIp.setDstIp(srcIp.getDestIpAddress());
|
||||
* dstIp.setDstIpMask("255.255.255.255"); }
|
||||
*/
|
||||
else {
|
||||
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
|
||||
}
|
||||
}
|
||||
if (srcIp.getSrcPort() != null) {
|
||||
if (srcIp.getSrcPort().indexOf("/") != -1) {
|
||||
String srcMaskNum = srcIp.getSrcPort().split("/")[1];
|
||||
dstIp.setSrcPortMask(srcMaskNum);
|
||||
dstIp.setSrcPort(srcIp.getSrcPort().split("/")[0]);
|
||||
} else {
|
||||
dstIp.setSrcPort(srcIp.getSrcPort());
|
||||
dstIp.setSrcPortMask("65535");
|
||||
}
|
||||
} else {
|
||||
dstIp.setSrcPort("0");
|
||||
dstIp.setSrcPortMask("65535");
|
||||
}
|
||||
if (srcIp.getDestPort() != null) {
|
||||
if (srcIp.getDestPort().indexOf("/") != -1) {
|
||||
String dstMaskNum = srcIp.getDestPort().split("/")[1];
|
||||
dstIp.setDstPortMask(dstMaskNum);
|
||||
dstIp.setDstPort(srcIp.getDestPort().split("/")[0]);
|
||||
} else {
|
||||
dstIp.setDstPort(srcIp.getDestPort());
|
||||
dstIp.setDstPortMask("65535");
|
||||
}
|
||||
} else {
|
||||
dstIp.setDstPort("0");
|
||||
dstIp.setDstPortMask("65535");
|
||||
}
|
||||
ipConvertList.add(dstIp);
|
||||
}
|
||||
return ipConvertList;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -133,7 +133,6 @@ public class ConfigServiceUtil {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("request_service_failed",e);
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response != null && response.getStatus() == 200){
|
||||
@@ -158,7 +157,6 @@ 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) {
|
||||
@@ -190,7 +188,6 @@ public class ConfigServiceUtil {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response != null && response.getStatus() == 200){
|
||||
@@ -203,7 +200,6 @@ 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) {
|
||||
@@ -236,7 +232,6 @@ public class ConfigServiceUtil {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response != null && response.getStatus() == 200){
|
||||
@@ -246,8 +241,6 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("postCallbackCfg()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -282,7 +275,6 @@ public class ConfigServiceUtil {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response != null && response.getStatus() == 200){
|
||||
@@ -292,7 +284,6 @@ 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,7 +321,6 @@ public class ConfigServiceUtil {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response != null && response.getStatus() == 200){
|
||||
@@ -340,7 +330,6 @@ 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) {
|
||||
@@ -380,7 +369,6 @@ public class ConfigServiceUtil {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response !=null && response.getStatus() == 200){
|
||||
@@ -390,7 +378,6 @@ 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) {
|
||||
@@ -424,11 +411,9 @@ public class ConfigServiceUtil {
|
||||
// bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||
//获取响应结果
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("patch()",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -459,7 +444,6 @@ public class ConfigServiceUtil {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response !=null && response.getStatus() == 200){
|
||||
@@ -471,7 +455,6 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("getFileDigest()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -518,7 +501,6 @@ public class ConfigServiceUtil {
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("postGroupReuseSources end,cost:"+(end-start));
|
||||
} catch (Exception e) {
|
||||
logger.error("postGroupReuseSources()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -577,7 +559,6 @@ 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) {
|
||||
@@ -636,7 +617,6 @@ 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) {
|
||||
@@ -699,7 +679,6 @@ 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) {
|
||||
@@ -765,7 +744,6 @@ public class ConfigServiceUtil {
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("getCGI()",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
@@ -831,7 +809,7 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("configSyncCmd()",e);
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -874,7 +852,6 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("configSyncStatus()",e);
|
||||
throw e;
|
||||
}finally {
|
||||
if (response != null) {
|
||||
@@ -921,7 +898,6 @@ 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) {
|
||||
@@ -962,7 +938,6 @@ public class ConfigServiceUtil {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("configStatusUpdate()",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,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", 0);
|
||||
public static Integer MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT=Configurations.getIntProperty("maat_cfg_dolog_doblacklist_default", 1);
|
||||
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);
|
||||
/**
|
||||
@@ -322,18 +322,56 @@ public final class Constants {
|
||||
// public static final boolean IS_USE_HIVE_DB =
|
||||
// Configurations.getBooleanProperty("isUseHiveDb", true);
|
||||
|
||||
/**
|
||||
* 是否获取数据中心查询记录的总条数
|
||||
*/
|
||||
|
||||
public static final boolean IS_GET_HIVECOUNT = Configurations.getBooleanProperty("isGetHiveCount", true);
|
||||
/**
|
||||
* 是否获取数据中心[神通]查询记录的总条数
|
||||
*/
|
||||
|
||||
public static final boolean IS_SELECT_CLUSTER = Configurations.getBooleanProperty("isSelectCluster", false);
|
||||
|
||||
/**
|
||||
* 神通数据库A的数据最早时间
|
||||
*/
|
||||
public static final Long CLUSTER_A_START_TIME = Configurations.getLongProperty("clusterAStartTime", new Date().getTime());
|
||||
|
||||
/**
|
||||
* 神通数据库B的数据最早时间
|
||||
*/
|
||||
public static final Long CLUSTER_B_START_TIME = Configurations.getLongProperty("clusterBStartTime", new Date().getTime());
|
||||
|
||||
/**
|
||||
* 每次获取数据中心多少条数据,咱们在对获取的数据进行分页处理
|
||||
*/
|
||||
public static final Long EVERY_GETHIVEDATANUM = Configurations.getLongProperty("everyGetHiveDataNum", 10000);
|
||||
|
||||
/**
|
||||
* 是否开启基础校验
|
||||
*/
|
||||
public static final boolean BASE_VALIDATE = Configurations.getBooleanProperty("baseValidate", true);
|
||||
|
||||
public static final Long DATACENTER_TIME = Configurations.getLongProperty("dataCenterTime", 48);
|
||||
|
||||
/**
|
||||
* 是否开启业务校验
|
||||
*/
|
||||
public static final boolean SERVICE_VALIDATE = Configurations.getBooleanProperty("serviceValidate", true);
|
||||
/**
|
||||
* 日志本地存储时间
|
||||
*/
|
||||
public static final Long LOG_LOCAL_TIME = Configurations.getLongProperty("logLocalTime", 48);
|
||||
/**
|
||||
* 实时统计默认时间
|
||||
*/
|
||||
public static final Long REPORT_LOCAL_TIME = Configurations.getLongProperty("reportLocalTime", 1);
|
||||
|
||||
/**
|
||||
* 日志是否从hive中查询
|
||||
*/
|
||||
public static final boolean SEL_FROM_HIVE = Configurations.getBooleanProperty("selFromHive", true);
|
||||
public static final boolean ONLY_SEL_FROM_HIVE = Configurations.getBooleanProperty("onlySelFromHive", true);
|
||||
|
||||
/**
|
||||
@@ -347,6 +385,12 @@ public final class Constants {
|
||||
*/
|
||||
public static final String SEARCH_DATEFORMAT = Configurations.getStringProperty("search.dateformat",
|
||||
"yyyy-MM-dd HH:mm:ss");
|
||||
public static final String SEARCH_ES_HOSTANDPORT_A = Configurations.getStringProperty("search.eshostandport_A",
|
||||
null);
|
||||
public static final String SEARCH_ES_HOSTANDPORT_B = Configurations.getStringProperty("search.eshostandport_B",
|
||||
null);
|
||||
public static final String SEARCH_ES_HOSTANDPORT_C = Configurations.getStringProperty("search.eshostandport_C",
|
||||
null);
|
||||
/**
|
||||
* 数据中心A版数据库名称,程序中每次查询时使用的数据库名称 use HIVEADBNAME
|
||||
*/
|
||||
@@ -363,7 +407,6 @@ public final class Constants {
|
||||
public static final String FILE_UPLOAD_CFG = Configurations.getStringProperty("fileUploadCfg","fileUploadSources");
|
||||
public static final String FILE_DIGEST_CFG=Configurations.getStringProperty("fileDigestCfg","fileDigestSources");
|
||||
public static final String CONFIG_ID_SOURCES=Configurations.getStringProperty("configIdSources","configPzIdSources");
|
||||
public static final String DEL_ALL_CFG=Configurations.getStringProperty("delAllCfg","delAllConfig");
|
||||
//日志查询接口URL
|
||||
public static final String LOG_BASE_URL = Configurations.getStringProperty("logBaseUrl","");
|
||||
public static final String NTC_SERVICE_REPORT=Configurations.getStringProperty("ntcServiceReport","ntcServiceReport");
|
||||
@@ -785,14 +828,5 @@ public final class Constants {
|
||||
/**
|
||||
* vpn cgi接口报错信息
|
||||
*/
|
||||
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","");
|
||||
public static final String CGI_ERROR = Configurations.getStringProperty("cgiError","");;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.nis.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -98,18 +97,6 @@ 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){
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ 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;
|
||||
|
||||
@@ -19,7 +18,6 @@ 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;
|
||||
@@ -77,7 +75,7 @@ public class SchedulerTaskUtil {
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public void updateConfigByServiceAndCompile(Integer serviceId,Integer compileId,Integer isValid,Integer isIssueContent,ConfigSynchronizationDao configSynchronizationDao)throws Exception{
|
||||
public boolean updateConfigByServiceAndCompile(Integer serviceId,Integer compileId,Integer isValid,Integer isIssueContent,ConfigSynchronizationDao configSynchronizationDao) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
|
||||
// SecurityManagerInit();
|
||||
// Subject subject = login("admin","zdjzsoft");
|
||||
// System.out.println(subject.getPrincipal());
|
||||
@@ -135,8 +133,6 @@ 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){
|
||||
@@ -145,13 +141,6 @@ 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"))){
|
||||
@@ -186,14 +175,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++){
|
||||
@@ -208,22 +197,9 @@ public class SchedulerTaskUtil {
|
||||
}
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
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();
|
||||
@@ -329,6 +305,9 @@ 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();
|
||||
@@ -385,8 +364,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.size());
|
||||
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()+list.size());
|
||||
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());
|
||||
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
|
||||
entity.setAuditTime(updateTime);
|
||||
for(int i=0;i<list.size();i++){
|
||||
@@ -405,8 +384,7 @@ 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");
|
||||
@@ -423,23 +401,17 @@ 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;
|
||||
ddosUserRegion.put(n.get("regionKey"), value);
|
||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
}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);
|
||||
@@ -478,6 +450,9 @@ 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();
|
||||
@@ -616,6 +591,9 @@ public class SchedulerTaskUtil {
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("定时任务修改文件摘要类配置内容响应信息:"+result.getMsg());
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
/*maatCfg = new MaatCfg();
|
||||
@@ -775,6 +753,9 @@ 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();
|
||||
@@ -814,7 +795,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);
|
||||
@@ -860,45 +841,13 @@ public class SchedulerTaskUtil {
|
||||
String json=BaseService.gsonToJson(maatStatusBean);
|
||||
logger.info("MAAT类配置启停状态修改内容:"+json);
|
||||
//调用服务启停接口
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
String result = ConfigServiceUtil.configStatusUpdate(json);
|
||||
if(result!=null){
|
||||
logger.info("MAAT类配置启停状态修改结果:"+result.getMsg());
|
||||
logger.info("MAAT类配置启停状态修改结果:"+result);
|
||||
}else{
|
||||
return false;
|
||||
}*/
|
||||
|
||||
//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 = new MaatCfg();
|
||||
maatCfg.initDefaultValue();
|
||||
maatBean = new ToMaatBean();
|
||||
configCompileList = new ArrayList();
|
||||
@@ -908,7 +857,7 @@ public class SchedulerTaskUtil {
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName("TaskScheduler");
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
@@ -916,7 +865,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)){//回调类配置
|
||||
@@ -976,11 +925,17 @@ 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,24 +230,6 @@ 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();
|
||||
|
||||
@@ -306,13 +306,6 @@ public class ExcelCsv {
|
||||
dict="block_drop";
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
}
|
||||
if ("action".equals(ef.title()) && dict.equals("action_reject")
|
||||
&& (Reflections.invokeGetter(e, "service").toString().equals("35")
|
||||
|| Reflections.invokeGetter(e, "service").toString().equals("33")
|
||||
|| Reflections.invokeGetter(e, "service").toString().equals("36"))) {
|
||||
dict="block_drop";
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
}
|
||||
//ip spoofing redirect动作修改为Spoofing
|
||||
if(ef.title().equals("block_type")
|
||||
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("518"))) {
|
||||
|
||||
@@ -39,10 +39,8 @@ import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
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;
|
||||
@@ -266,9 +264,6 @@ public class ExportExcel {
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("https_url_format_tip")+"\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
}
|
||||
@@ -458,19 +453,6 @@ 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>();
|
||||
@@ -554,6 +536,29 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
//doBlackList
|
||||
if("doBlacklist".equals(headerStr)) {
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
commentStr=commentStr+itemCode+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue = String.valueOf(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
if(!StringUtil.isEmpty(defaultValue)){
|
||||
//1、默认值说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/** Ip Spoofing **/
|
||||
if("spoofing".equals(headerStr) && (region.getFunctionId().equals(214))){
|
||||
@@ -601,28 +606,25 @@ public class ExportExcel {
|
||||
commentStr="";
|
||||
}
|
||||
}else{
|
||||
String[] ipPatterns=region.getConfigIpPattern().split(";");
|
||||
if("client_ip".equals(headerStr)){
|
||||
Assert.isTrue(ipPatterns.length==2);
|
||||
String srcIpPattern=ipPatterns[0];
|
||||
if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) ){
|
||||
commentStr="";
|
||||
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
|
||||
if((","+srcIpPattern+",").indexOf(",3,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"(IPv4)"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+srcIpPattern+",").indexOf(",2,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv4_range_tip")+")"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+srcIpPattern+",").indexOf(",1,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_subnet_tip")+")"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE;
|
||||
@@ -631,21 +633,21 @@ public class ExportExcel {
|
||||
}
|
||||
}
|
||||
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
|
||||
if((","+srcIpPattern+",").indexOf(",3,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"(IPv6)"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+srcIpPattern+",").indexOf(",2,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv6_range_tip")+")"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+srcIpPattern+",").indexOf(",1,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_subnet_tip")+")"+"\n\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE;
|
||||
@@ -694,12 +696,12 @@ public class ExportExcel {
|
||||
,msgProp.getProperty("serverip"))+"\n";
|
||||
index++;
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+String.format(msgProp.getProperty("the_same_ip_type"))+"\n";
|
||||
commentStr=commentStr+"▶"+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
//4、IP Range 开始IP和结束IP必须在同一网段
|
||||
if(((","+srcIpPattern+",").indexOf(",2,") > -1)){
|
||||
if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
|
||||
index++;
|
||||
index++;
|
||||
@@ -710,7 +712,7 @@ public class ExportExcel {
|
||||
}
|
||||
|
||||
//6、IPv4 Mask 掩码范围16-32
|
||||
if(((","+srcIpPattern+",").indexOf(",1,") > -1)){
|
||||
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
|
||||
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
|
||||
index++;
|
||||
@@ -726,25 +728,24 @@ public class ExportExcel {
|
||||
|
||||
}
|
||||
if("server_ip".equals(headerStr)){
|
||||
String destIpPattern=ipPatterns[1];
|
||||
if((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1){
|
||||
commentStr="";
|
||||
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
|
||||
if((","+destIpPattern+",").indexOf(",3,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"(IPv4)"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+destIpPattern+",").indexOf(",2,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv4_range_tip")+")"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+destIpPattern+",").indexOf(",1,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_subnet_tip")+")"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE;
|
||||
@@ -753,21 +754,21 @@ public class ExportExcel {
|
||||
}
|
||||
}
|
||||
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
|
||||
if((","+destIpPattern+",").indexOf(",3,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"(IPv6)"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+destIpPattern+",").indexOf(",2,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv6_range_tip")+")"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+destIpPattern+",").indexOf(",1,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_subnet_tip")+")"+"\n\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE;
|
||||
@@ -800,12 +801,12 @@ public class ExportExcel {
|
||||
,msgProp.getProperty("serverip"))+"\n";
|
||||
index++;
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+String.format(msgProp.getProperty("the_same_ip_type"))+"\n";
|
||||
commentStr=commentStr+"▶"+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
//4、IP Range 开始IP和结束IP必须在同一网段
|
||||
if(((","+destIpPattern+",").indexOf(",2,") > -1)){
|
||||
if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
|
||||
index++;
|
||||
index++;
|
||||
@@ -816,7 +817,7 @@ public class ExportExcel {
|
||||
}
|
||||
|
||||
//6、IPv4 Mask 掩码范围16-32
|
||||
if(((","+destIpPattern+",").indexOf(",1,") > -1)){
|
||||
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
|
||||
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
|
||||
index++;
|
||||
@@ -842,20 +843,17 @@ public class ExportExcel {
|
||||
}else{
|
||||
protocol=region.getConfigProtocol();
|
||||
}
|
||||
String[] portPatterns=region.getConfigPortPattern().split(";");
|
||||
Assert.isTrue(portPatterns.length==2);
|
||||
if("client_port".equals(headerStr)){
|
||||
String srcPortPattern=portPatterns[0];
|
||||
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){
|
||||
commentStr="";
|
||||
if((","+srcPortPattern+",").indexOf(",1,") > -1){
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.PORT_DEFAULT+"(Port)"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.PORT_DEFAULT;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+srcPortPattern+",").indexOf(",2,") > -1){
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.PORT_MASK_DEFAULT;
|
||||
@@ -881,11 +879,11 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
//2、源端口、目的端口格式必须一致
|
||||
// if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
|
||||
// commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
|
||||
// index++;
|
||||
// index++;
|
||||
// }
|
||||
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
//3、端口和端口掩码范围0-65535
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("port_mask_comment_tip")+"\n";
|
||||
index++;
|
||||
@@ -920,17 +918,16 @@ public class ExportExcel {
|
||||
}
|
||||
}
|
||||
if("server_port".equals(headerStr)){
|
||||
String destPortPattern=portPatterns[1];
|
||||
if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){
|
||||
commentStr="";
|
||||
if((","+destPortPattern+",").indexOf(",1,") > -1){
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+Constants.PORT_DEFAULT+"(Port)"+"\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.PORT_DEFAULT;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if((","+destPortPattern+",").indexOf(",2,") > -1){
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n\n";
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue=Constants.PORT_MASK_DEFAULT;
|
||||
@@ -956,11 +953,11 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
//2、源端口、目的端口格式必须一致
|
||||
// if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
|
||||
// commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
|
||||
// index++;
|
||||
// index++;
|
||||
// }
|
||||
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
//3、端口和端口掩码范围0-65535
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("port_mask_comment_tip")+"\n";
|
||||
index++;
|
||||
@@ -2259,9 +2256,7 @@ 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){
|
||||
@@ -2291,16 +2286,7 @@ public class ExportExcel {
|
||||
val = getBasicInfo(ef.dictType(),map,valStr);
|
||||
}else{
|
||||
//字典数据已做国际化处理
|
||||
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);
|
||||
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, valStr);
|
||||
//如果找不到字典国际化值,把字典本身作为默认值放进去,不然导出就是空了
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
//业务配置-stream 阻断类型中 阻断 改为 封堵(丢弃)
|
||||
@@ -2311,13 +2297,6 @@ public class ExportExcel {
|
||||
dict="block_drop";
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
}
|
||||
if ("action".equals(ef.title()) && dict.equals("action_reject")
|
||||
&& (Reflections.invokeGetter(e, "service").toString().equals("35")
|
||||
|| Reflections.invokeGetter(e, "service").toString().equals("33")
|
||||
|| Reflections.invokeGetter(e, "service").toString().equals("36"))) {
|
||||
dict="block_drop";
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
}
|
||||
//ip spoofing redirect动作修改为Spoofing
|
||||
if(ef.title().equals("block_type")
|
||||
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("518"))) {
|
||||
@@ -2376,8 +2355,6 @@ public class ExportExcel {
|
||||
log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
|
||||
}
|
||||
}
|
||||
end=System.currentTimeMillis();
|
||||
System.err.println("setDataList cost:"+(end-start));
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -2510,7 +2487,6 @@ 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) {
|
||||
@@ -2636,8 +2612,6 @@ public class ExportExcel {
|
||||
annotationMap.put(title, annotationList);
|
||||
}
|
||||
initializeMultiSheet(msgProp,titleList, headerMap,commentMap,titleTime);
|
||||
end=System.currentTimeMillis();
|
||||
System.err.println("ExportExcel cost:"+(end-start));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -423,7 +423,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
||||
throw new RuntimeException("regionDict is null!");
|
||||
}
|
||||
if(dataList.size()==0) {
|
||||
throw new ServiceException(props.getProperty("no_data", "no_data"));
|
||||
throw new ServiceException(props.getProperty("noneData", "noneData"));
|
||||
}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);
|
||||
}
|
||||
@@ -488,11 +488,11 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
|
||||
if (valType == String.class){
|
||||
String s = String.valueOf(val.toString().trim());
|
||||
//0.0.0.0表示任意IP的含义
|
||||
// if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
|
||||
// val = StringUtils.substringBefore(s, ".0");
|
||||
// }else{
|
||||
if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
|
||||
val = StringUtils.substringBefore(s, ".0");
|
||||
}else{
|
||||
val=val == null ? "" : StringEscapeUtils.escapeHtml4(val.toString().trim());
|
||||
// }
|
||||
}
|
||||
}else if (valType == Integer.class){
|
||||
val = Double.valueOf(val.toString().trim()).intValue();
|
||||
}else if (valType == Long.class){
|
||||
|
||||
@@ -111,7 +111,8 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseStringCfg,errInfo);
|
||||
|
||||
//doBlackList属性检验
|
||||
this.validDoBlackList(baseStringCfg, errInfo);
|
||||
if (regionDict.getRegionType().equals(3)) {
|
||||
if (regionDict.getFunctionId().equals(7)) {
|
||||
Long dnsStrategyId = baseStringCfg.getDnsStrategyId();
|
||||
@@ -155,7 +156,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("302");
|
||||
baseStringCfg.setUserRegion1("301");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
@@ -466,11 +467,44 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
}
|
||||
Integer doLog = baseStringCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
if(configDoLog.startsWith("0")) {
|
||||
baseStringCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* doBlackList属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoBlackList(ComplexkeywordCfg baseStringCfg, StringBuffer errInfo) {
|
||||
if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(6)||
|
||||
regionDict.getFunctionId().equals(635)||regionDict.getFunctionId().equals(8)
|
||||
)&&serviceDict.getAction().equals(16)
|
||||
) {
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(baseStringCfg.getDoBlackList()==null) {
|
||||
baseStringCfg.setDoBlackList(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
String dobalcklistVals=new String();
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
dobalcklistVals+=itemCode+",";
|
||||
}
|
||||
}
|
||||
Integer doBlackList = baseStringCfg.getDoBlackList();
|
||||
if(!dobalcklistVals.contains(doBlackList+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_blacklist"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
@@ -28,7 +27,6 @@ import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
//import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.IPUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
|
||||
public class CheckIpFormatThread implements Callable<String>{
|
||||
@@ -94,20 +92,14 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
boolean canIPv4 = ipType.indexOf("4") > -1;
|
||||
boolean canIPv6 = ipType.indexOf("6") > -1;
|
||||
String[] ipPattern = regionDict.getConfigIpPattern().split(";");
|
||||
Assert.isTrue(ipPattern!=null&&ipPattern.length==2);
|
||||
String srcIpPattern = ipPattern[0];
|
||||
String destIpPattern = ipPattern[1];
|
||||
if (StringUtils.isBlank(srcIpPattern)||StringUtils.isBlank(destIpPattern)) {
|
||||
String ipPattern = regionDict.getConfigIpPattern();
|
||||
if (StringUtils.isBlank(ipPattern)) {
|
||||
throw new RuntimeException("Found IP region,but ipPattern is Empty");
|
||||
}
|
||||
boolean canIPFormat = ipType.indexOf("3") > -1;
|
||||
boolean canIPSubnetFormat = ipType.indexOf("1") > -1;
|
||||
boolean canIPRangeFormat = ipType.indexOf("2") > -1;
|
||||
String[] portPattern = regionDict.getConfigPortPattern().split(";");
|
||||
Assert.isTrue(ipPattern!=null&&ipPattern.length==2);
|
||||
String srcPortPattern=portPattern[0];
|
||||
String destPortPattern=portPattern[1];
|
||||
String portPattern = regionDict.getConfigPortPattern();
|
||||
String protocol = regionDict.getConfigProtocol();
|
||||
String direction = regionDict.getConfigDirection();
|
||||
StringBuffer errTip = new StringBuffer();
|
||||
@@ -137,20 +129,13 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseIpCfg,errInfo);
|
||||
|
||||
|
||||
this.validDoBlackList(baseIpCfg, errInfo);
|
||||
// 特殊字段验证
|
||||
// packet ip ratelimit
|
||||
if (serviceDict!=null && serviceDict.getAction().intValue() == 64 && (serviceDict.getFunctionId().intValue() == 5
|
||||
|| serviceDict.getFunctionId().intValue() == 63
|
||||
|| serviceDict.getFunctionId().intValue() == 407
|
||||
|| serviceDict.getFunctionId().intValue() == 408) ) {
|
||||
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
||||
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);
|
||||
@@ -454,7 +439,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
|
||||
baseIpCfg.setUserRegion1("302");
|
||||
baseIpCfg.setUserRegion1("301");
|
||||
}
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();// 重定向URL
|
||||
@@ -595,23 +580,6 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
String subfix=baseIpCfg.getSrcIpAddress().split("-")[1];
|
||||
baseIpCfg.setSrcIpAddress(prefix+"-"+prefix.substring(0, prefix.lastIndexOf(".")+1)+subfix);
|
||||
}
|
||||
//Tip:判断业务是否只展示源IP列,如果是,判断源IP是否是默认值,如果是默认值,提示源IP不能是默认值
|
||||
if (configIpPortShow.indexOf("1") > -1 && configIpPortShow.indexOf("3") == -1) {// 源IP必填
|
||||
String srcIpAddress = baseIpCfg.getSrcIpAddress();
|
||||
Pattern ip4 = Constants.IPV4_IP_PATTERN;
|
||||
Pattern ip6 = Constants.IPV6_IP_PATTERN;
|
||||
Matcher ip4Matcher = ip4.matcher(srcIpAddress);
|
||||
Matcher ip6Matcher = ip6.matcher(srcIpAddress);
|
||||
if (ip4Matcher.matches() && srcIpAddress.startsWith("0.0.0.0")) {
|
||||
errInfo.append(prop.getProperty("client_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)
|
||||
+ ";");
|
||||
} else if (ip6Matcher.matches() && srcIpAddress.startsWith("::")) {
|
||||
errInfo.append(prop.getProperty("client_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(baseIpCfg.getDestIpAddress())) {
|
||||
destIpEmpty = true;
|
||||
@@ -623,23 +591,6 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
String subfix=baseIpCfg.getDestIpAddress().split("-")[1];
|
||||
baseIpCfg.setDestIpAddress(prefix+"-"+prefix.substring(0, prefix.lastIndexOf(".")+1)+subfix);
|
||||
}
|
||||
//Tip:判断业务是否只展示目的IP列,如果是,判断目的IP是否是默认值,如果是默认值,提示目的IP不能是默认值
|
||||
if (configIpPortShow.indexOf("3") > -1 && configIpPortShow.indexOf("1") == -1) {// 目的IP必填
|
||||
String destIpAddress = baseIpCfg.getDestIpAddress();
|
||||
Pattern ip4 = Constants.IPV4_IP_PATTERN;
|
||||
Pattern ip6 = Constants.IPV6_IP_PATTERN;
|
||||
Matcher ip4Matcher = ip4.matcher(destIpAddress);
|
||||
Matcher ip6Matcher = ip6.matcher(destIpAddress);
|
||||
if (ip4Matcher.matches() && destIpAddress.startsWith("0.0.0.0")) {
|
||||
errInfo.append(prop.getProperty("server_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)
|
||||
+ ";");
|
||||
} else if (ip6Matcher.matches() && destIpAddress.startsWith("::")) {
|
||||
errInfo.append(prop.getProperty("server_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(baseIpCfg.getSrcPort())) {
|
||||
srcPortEmpty = true;
|
||||
@@ -664,49 +615,77 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
prop.getProperty("server_ip", "Server IP")) + ";");
|
||||
} else if (configIpPortShow.indexOf("1") > -1) {
|
||||
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(),
|
||||
ipType, srcIpPattern);
|
||||
//设置源IP pattern
|
||||
if (matchType.endsWith("RANGE")) {
|
||||
baseIpCfg.setSrcIpPattern(2);
|
||||
} else if (matchType.endsWith("SUBNET")) {
|
||||
baseIpCfg.setSrcIpPattern(1);
|
||||
}else {
|
||||
baseIpCfg.setSrcIpPattern(3);
|
||||
}
|
||||
ipType, ipPattern);
|
||||
if (matchType.startsWith("IPV6")) {
|
||||
//设置dest ip值
|
||||
if(destIpPattern.indexOf("3")>-1) {//优先设置IP类型,因为拆分的IP较少
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setDestIpPattern(3);
|
||||
}else if(destIpPattern.indexOf("1")>-1) {
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setDestIpPattern(1);
|
||||
}else {
|
||||
if (matchType.endsWith("RANGE")) {
|
||||
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
|
||||
baseIpCfg.setDestIpPattern(2);
|
||||
baseIpCfg.setIpPattern(2);
|
||||
if (baseIpCfg.getSrcIpAddress()
|
||||
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
|
||||
errInfo.append(prop.getProperty("client_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else if (matchType.endsWith("SUBNET")) {
|
||||
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setIpPattern(1);
|
||||
if (baseIpCfg.getSrcIpAddress()
|
||||
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
|
||||
errInfo.append(
|
||||
prop.getProperty("client_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else {
|
||||
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setIpPattern(3);
|
||||
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
|
||||
errInfo.append(prop.getProperty("client_ip")+" " + String.format(
|
||||
prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";");
|
||||
}
|
||||
}
|
||||
//设置IP类型
|
||||
baseIpCfg.setIpType(6);
|
||||
} else {
|
||||
//设置dest ip值
|
||||
if(destIpPattern.indexOf("3")>-1) {//优先设置IP类型,因为拆分的IP较少
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setDestIpPattern(3);
|
||||
}else if(destIpPattern.indexOf("1")>-1) {
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setDestIpPattern(1);
|
||||
}else {
|
||||
if (matchType.endsWith("RANGE")) {
|
||||
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
|
||||
// baseIpCfg.setSrcIpAddress("0.0.0.0-"+baseIpCfg.getSrcIpAddress().split("-")[0].substring(0,baseIpCfg.getSrcIpAddress().indexOf("-")+1)+baseIpCfg.getSrcIpAddress().split("-")[1]);
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
|
||||
baseIpCfg.setDestIpPattern(2);
|
||||
baseIpCfg.setIpPattern(2);
|
||||
if (baseIpCfg.getSrcIpAddress()
|
||||
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
|
||||
errInfo.append(prop.getProperty("client_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else if (matchType.endsWith("SUBNET")) {
|
||||
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setIpPattern(1);
|
||||
if (baseIpCfg.getSrcIpAddress()
|
||||
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
|
||||
errInfo.append(
|
||||
prop.getProperty("client_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else {
|
||||
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setIpPattern(3);
|
||||
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
|
||||
errInfo.append(prop.getProperty("client_ip")+" " + String.format(
|
||||
prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";");
|
||||
}
|
||||
}
|
||||
baseIpCfg.setIpType(4);
|
||||
}
|
||||
//Tip:增加源IP和目的IP是否相等,如果相等,提示目的IP不能为空
|
||||
if ((configIpPortShow.indexOf("3") > -1 && configIpPortShow.indexOf("1") > -1)
|
||||
&& (baseIpCfg.getDestIpAddress().equals(baseIpCfg.getSrcIpAddress()))) {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"),
|
||||
prop.getProperty("server_ip", "Server IP")) + ";");
|
||||
}
|
||||
}
|
||||
|
||||
} else if (srcIpEmpty) {// 源IP为空
|
||||
@@ -715,175 +694,166 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
prop.getProperty("client_ip", "Client IP")) + ";");
|
||||
} else if (configIpPortShow.indexOf("3") > -1) {
|
||||
String matchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(),
|
||||
ipType, destIpPattern);
|
||||
if (matchType.endsWith("RANGE")) {
|
||||
baseIpCfg.setDestIpPattern(2);
|
||||
} else if (matchType.endsWith("SUBNET")) {
|
||||
baseIpCfg.setDestIpPattern(1);
|
||||
}else {
|
||||
baseIpCfg.setDestIpPattern(3);
|
||||
}
|
||||
ipType, ipPattern);
|
||||
if (matchType.startsWith("IPV6")) {
|
||||
if(srcIpPattern.indexOf("3")>-1) {
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setSrcIpPattern(3);
|
||||
}else if(srcIpPattern.indexOf("1")>-1) {
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setSrcIpPattern(1);
|
||||
}else {
|
||||
if (matchType.endsWith("RANGE")) {
|
||||
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
|
||||
baseIpCfg.setSrcIpPattern(2);
|
||||
baseIpCfg.setIpPattern(2);
|
||||
if (baseIpCfg.getDestIpAddress()
|
||||
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
|
||||
errInfo.append(prop.getProperty("server_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else if (matchType.endsWith("SUBNET")) {
|
||||
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setIpPattern(1);
|
||||
if (baseIpCfg.getDestIpAddress()
|
||||
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
|
||||
errInfo.append(
|
||||
prop.getProperty("server_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else {
|
||||
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setIpPattern(3);
|
||||
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
|
||||
errInfo.append(prop.getProperty("server_ip")+" " + String.format(
|
||||
prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";");
|
||||
}
|
||||
}
|
||||
baseIpCfg.setIpType(6);
|
||||
} else {
|
||||
if(srcIpPattern.indexOf("3")>-1) {
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setSrcIpPattern(3);
|
||||
}else if(srcIpPattern.indexOf("1")>-1) {
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setSrcIpPattern(1);
|
||||
}else {
|
||||
if (matchType.endsWith("RANGE")) {
|
||||
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
|
||||
// baseIpCfg.setDestIpAddress("0.0.0.0-"+baseIpCfg.getDestIpAddress().split("-")[0]
|
||||
// .substring(0,baseIpCfg.getDestIpAddress().indexOf("-")+1)
|
||||
// +baseIpCfg.getDestIpAddress().split("-")[1]);
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
|
||||
baseIpCfg.setSrcIpPattern(2);
|
||||
baseIpCfg.setIpPattern(2);
|
||||
if (baseIpCfg.getDestIpAddress()
|
||||
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
|
||||
errInfo.append(prop.getProperty("server_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else if (matchType.endsWith("SUBNET")) {
|
||||
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
|
||||
baseIpCfg.setIpPattern(1);
|
||||
if (baseIpCfg.getDestIpAddress()
|
||||
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
|
||||
errInfo.append(
|
||||
prop.getProperty("server_ip")+" "
|
||||
+ String.format(prop.getProperty("can_not_be"),
|
||||
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
|
||||
+ ";");
|
||||
}
|
||||
} else {
|
||||
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
|
||||
baseIpCfg.setIpPattern(3);
|
||||
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
|
||||
errInfo.append(prop.getProperty("server_ip")+" " + String.format(
|
||||
prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";");
|
||||
}
|
||||
}
|
||||
baseIpCfg.setIpType(4);
|
||||
}
|
||||
//Tip:增加源IP和目的IP是否相等,如果相等,提示源的IP不能为空
|
||||
if ((configIpPortShow.indexOf("3") > -1 && configIpPortShow.indexOf("1") > -1)
|
||||
&& (baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress()))) {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"),
|
||||
prop.getProperty("client_ip", "Client IP")) + ";");
|
||||
}
|
||||
}
|
||||
} else {// 全不为空
|
||||
String srcMatchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType,
|
||||
srcIpPattern);
|
||||
String destMatchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType,
|
||||
destIpPattern);
|
||||
if (StringUtils.isNotBlank(srcMatchType) && StringUtils.isNotBlank(destMatchType)
|
||||
&& ((srcMatchType.startsWith("IPV6")&&destMatchType.startsWith("IPV4"))
|
||||
||(srcMatchType.startsWith("IPV4")&&destMatchType.startsWith("IPV6")))) {
|
||||
errInfo.append(prop.get("the_same_ip_type") + ";");
|
||||
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType,
|
||||
ipPattern);
|
||||
String matchType1 = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType,
|
||||
ipPattern);
|
||||
if (StringUtils.isNotBlank(matchType) && StringUtils.isNotBlank(matchType1)
|
||||
&& !matchType.equals(matchType1)) {
|
||||
errInfo.append(prop.get("the_same_ip_type_pattern") + ";");
|
||||
}
|
||||
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
if (srcMatchType.startsWith("IPV6")) {
|
||||
if (matchType.startsWith("IPV6")) {
|
||||
baseIpCfg.setIpType(6);
|
||||
} else {
|
||||
baseIpCfg.setIpType(4);
|
||||
}
|
||||
if (srcMatchType.endsWith("RANGE")) {
|
||||
baseIpCfg.setSrcIpPattern(2);
|
||||
}else if(srcMatchType.endsWith("SUBNET")) {
|
||||
baseIpCfg.setSrcIpPattern(1);
|
||||
}else {
|
||||
baseIpCfg.setSrcIpPattern(3);
|
||||
}
|
||||
if (destMatchType.endsWith("RANGE")) {
|
||||
baseIpCfg.setDestIpPattern(2);
|
||||
}else if(destMatchType.endsWith("SUBNET")) {
|
||||
baseIpCfg.setDestIpPattern(1);
|
||||
}else {
|
||||
baseIpCfg.setDestIpPattern(3);
|
||||
}
|
||||
if(baseIpCfg.getIpType().equals(4)) {
|
||||
if (srcMatchType.endsWith("RANGE")) {
|
||||
if (matchType.endsWith("RANGE")) {
|
||||
if (matchType.startsWith("IPV4")) {
|
||||
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
|
||||
}
|
||||
if (destMatchType.endsWith("RANGE")) {
|
||||
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
|
||||
}
|
||||
//验证Ip范围
|
||||
if(StringUtils.isEmpty(errInfo)&&(srcMatchType.endsWith("RANGE")||destMatchType.endsWith("RANGE"))) {
|
||||
this.ValidateRangeCross(baseIpCfg.getSrcIpAddress(),baseIpCfg.getDestIpAddress(), errInfo);
|
||||
}
|
||||
}
|
||||
boolean same=false;
|
||||
if(baseIpCfg.getSrcIpAddress().indexOf("-")>-1) {
|
||||
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
|
||||
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
|
||||
same=true;
|
||||
}
|
||||
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
|
||||
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
|
||||
same=true;
|
||||
}
|
||||
}else {
|
||||
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress())) {
|
||||
same=true;
|
||||
}
|
||||
}
|
||||
}else if(baseIpCfg.getSrcIpAddress().indexOf("/")>-1){
|
||||
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
|
||||
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
|
||||
same=true;
|
||||
}
|
||||
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
|
||||
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
|
||||
same=true;
|
||||
}
|
||||
}else {
|
||||
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress())) {
|
||||
same=true;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
|
||||
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
|
||||
same=true;
|
||||
}
|
||||
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
|
||||
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
|
||||
same=true;
|
||||
}
|
||||
}else {
|
||||
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
|
||||
same=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(same) {
|
||||
|
||||
if (baseIpCfg.getSrcIpAddress().split("-")[0]
|
||||
.equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
|
||||
errInfo.append(String.format(prop.getProperty("are_the_same"),
|
||||
baseIpCfg.getSrcIpAddress().split("-")[0],
|
||||
baseIpCfg.getDestIpAddress().split("-")[0]) + ";");
|
||||
}
|
||||
baseIpCfg.setIpPattern(2);
|
||||
} else if (matchType.endsWith("SUBNET")) {
|
||||
if (baseIpCfg.getSrcIpAddress().split("/")[0]
|
||||
.equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
|
||||
errInfo.append(String.format(prop.getProperty("are_the_same"),
|
||||
baseIpCfg.getSrcIpAddress().split("/")[0],
|
||||
baseIpCfg.getDestIpAddress().split("/")[0]) + ";");
|
||||
}
|
||||
baseIpCfg.setIpPattern(1);
|
||||
} else {
|
||||
if (baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
|
||||
errInfo.append(String.format(prop.getProperty("are_the_same"),
|
||||
prop.getProperty("client_ip"), prop.getProperty("server_ip")) + ";");
|
||||
}
|
||||
baseIpCfg.setIpPattern(3);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 判断源IP和目的IP的值
|
||||
// TODO 判断源IP和目的IP格式
|
||||
if (destPortEmpty) {
|
||||
if (srcPortEmpty) {
|
||||
if(srcPortPattern.indexOf("1")>-1) {
|
||||
baseIpCfg.setSrcPort("0");
|
||||
baseIpCfg.setSrcPortPattern(1);
|
||||
}else {
|
||||
baseIpCfg.setSrcPort("0/0");
|
||||
baseIpCfg.setSrcPortPattern(2);
|
||||
}
|
||||
}else if(baseIpCfg.getSrcPort().indexOf("/")>-1) {
|
||||
baseIpCfg.setSrcPortPattern(2);
|
||||
}else {
|
||||
baseIpCfg.setSrcPortPattern(1);
|
||||
baseIpCfg.setDestPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
} else {
|
||||
if (baseIpCfg.getSrcPort().indexOf("/") > -1) {
|
||||
baseIpCfg.setDestPort("0/0");
|
||||
baseIpCfg.setPortPattern(2);
|
||||
} else {
|
||||
baseIpCfg.setDestPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
|
||||
boolean validSrcPort = this.validPort(errInfo, baseIpCfg.getSrcPort(),
|
||||
srcPortPattern,"client_port");
|
||||
if (destPortEmpty) {
|
||||
if(destPortPattern.indexOf("1")>-1) {
|
||||
baseIpCfg.setDestPort("0");
|
||||
baseIpCfg.setDestPortPattern(1);
|
||||
}else {
|
||||
baseIpCfg.setDestPort("0/0");
|
||||
baseIpCfg.setDestPortPattern(2);
|
||||
}
|
||||
}else if(baseIpCfg.getDestPort().indexOf("/")>-1) {
|
||||
baseIpCfg.setDestPortPattern(2);
|
||||
}else {
|
||||
baseIpCfg.setDestPortPattern(1);
|
||||
} else {
|
||||
if (srcPortEmpty) {
|
||||
if (baseIpCfg.getDestPort().indexOf("/") > -1) {
|
||||
baseIpCfg.setSrcPort("0/0");
|
||||
baseIpCfg.setPortPattern(2);
|
||||
} else {
|
||||
baseIpCfg.setSrcPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
} else {
|
||||
if (baseIpCfg.getSrcPort().indexOf("/") > -1) {
|
||||
baseIpCfg.setPortPattern(2);
|
||||
} else {
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
|
||||
}
|
||||
baseIpCfg.setDestPort(baseIpCfg.getDestPort().trim());
|
||||
boolean validDestPort = this.validPort(errInfo, baseIpCfg.getDestPort(),
|
||||
srcPortPattern,"server_port");
|
||||
|
||||
}
|
||||
// TODO 判断源端口和目的端口格式
|
||||
// TODO 判断源和目的端口的值
|
||||
boolean validPort = this.validPort(errInfo, baseIpCfg.getSrcPort(), baseIpCfg.getDestPort(),
|
||||
portPattern);
|
||||
if (baseIpCfg.getProtocol()==null) {
|
||||
//packet ip reject
|
||||
if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) {
|
||||
@@ -925,7 +895,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
boolean validProtocol = this.validProtocol(errInfo, baseIpCfg.getProtocol(), protocol);
|
||||
// 验证protocol与port是否符合逻辑
|
||||
if (validProtocol && validSrcPort&&validDestPort) {
|
||||
if (validProtocol && validPort) {
|
||||
validProtocolAndPort(errInfo, baseIpCfg.getProtocol(), baseIpCfg.getSrcPort(),
|
||||
baseIpCfg.getDestPort());
|
||||
}
|
||||
@@ -948,10 +918,6 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// TODO 判断Direction的值
|
||||
this.validDirection(errInfo, baseIpCfg.getDirection(), direction);
|
||||
}
|
||||
|
||||
//IP校验
|
||||
// this.validSrcAndDescIp(baseIpCfg.getSrcIpAddress(), baseIpCfg.getDestIpAddress(), configIpPortShow,errInfo);
|
||||
|
||||
if (errInfo.toString().length() > 0) {//
|
||||
errTip.append(String.format(prop.getProperty("line"), baseIpCfg.getIndex()) + ",");
|
||||
errTip.append(errInfo);
|
||||
@@ -1058,85 +1024,153 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
* @param portPattern
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public boolean validPort(StringBuffer errInfo, String portStr, String portPattern,String portName)
|
||||
public boolean validPort(StringBuffer errInfo, String srcPortStr, String destPortStr, String portPattern)
|
||||
throws ServiceException {
|
||||
boolean valid = true;
|
||||
if (portPattern.equals("1")) {
|
||||
try {
|
||||
Integer srcPort = Integer.parseInt(portStr);
|
||||
Integer srcPort = Integer.parseInt(srcPortStr);
|
||||
if (srcPort < 0 || srcPort > 65535) {
|
||||
errInfo.append(prop.getProperty(portName)
|
||||
errInfo.append(prop.getProperty("client_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty(portName)) + ";");
|
||||
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("client_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
try {
|
||||
Integer destPort = Integer.parseInt(destPortStr);
|
||||
if (destPort < 0 || destPort > 65535) {
|
||||
errInfo.append(prop.getProperty("server_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("server_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
} else if (portPattern.equals("2")) {
|
||||
Pattern p = Constants.PORT_MASK_PATTERN;
|
||||
Matcher m = p.matcher(portStr);
|
||||
Matcher m = p.matcher(srcPortStr);
|
||||
if (!m.matches()) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty(portName)) + ";");
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
Integer port = Integer.parseInt(portStr.split("/")[0]);
|
||||
Integer portMask = Integer.parseInt(portStr.split("/")[1]);
|
||||
|
||||
if (port < 0 || port > 65535) {
|
||||
errInfo.append(prop.getProperty(portName)
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
m = p.matcher(destPortStr);
|
||||
if (!m.matches()) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (portMask < 0 || portMask > 65535) {
|
||||
errInfo.append(prop.getProperty(portName+"_mask")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
} else if (portPattern.indexOf("1") > -1 && portPattern.indexOf("2") > -1) {
|
||||
Pattern p = Constants.PORT_MASK_PATTERN;
|
||||
Pattern p1 = Constants.PORT_PATTERN;
|
||||
Matcher m = p.matcher(portStr);// 源端口是端口掩码格式
|
||||
Matcher m2 = p1.matcher(portStr);// 源端口是端口格式
|
||||
if (m.matches()) {
|
||||
Integer srcPort = Integer.parseInt(portStr.split("/")[0]);
|
||||
Integer srcPortMask = Integer.parseInt(portStr.split("/")[1]);
|
||||
Integer srcPort = Integer.parseInt(srcPortStr.split("/")[0]);
|
||||
Integer srcPortMask = Integer.parseInt(srcPortStr.split("/")[1]);
|
||||
Integer destPort = Integer.parseInt(destPortStr.split("/")[0]);
|
||||
Integer destPortMask = Integer.parseInt(destPortStr.split("/")[1]);
|
||||
if (srcPort < 0 || srcPort > 65535) {
|
||||
errInfo.append(prop.getProperty(portName)
|
||||
errInfo.append(prop.getProperty("client_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (srcPortMask < 0 || srcPortMask > 65535) {
|
||||
errInfo.append(prop.getProperty(portName+"_mask")
|
||||
errInfo.append(prop.getProperty("client_port_mask")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (destPort < 0 || destPort > 65535) {
|
||||
errInfo.append(prop.getProperty("server_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (destPortMask < 0 || destPortMask > 65535) {
|
||||
errInfo.append(prop.getProperty("server_port_mask")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
} else if (portPattern.indexOf("1") > -1 && portPattern.indexOf("2") > -1) {
|
||||
Pattern p = Constants.PORT_MASK_PATTERN;
|
||||
Pattern p1 = Constants.PORT_PATTERN;
|
||||
Matcher m = p.matcher(srcPortStr);// 源端口是端口掩码格式
|
||||
Matcher m1 = p.matcher(destPortStr);// 目的端口是端口掩码格式
|
||||
Matcher m2 = p1.matcher(srcPortStr);// 源端口是端口格式
|
||||
Matcher m3 = p1.matcher(destPortStr);// 目的端口是端口格式
|
||||
if (m.matches()) {
|
||||
Integer srcPort = Integer.parseInt(srcPortStr.split("/")[0]);
|
||||
Integer srcPortMask = Integer.parseInt(srcPortStr.split("/")[1]);
|
||||
if (srcPort < 0 || srcPort > 65535) {
|
||||
errInfo.append(prop.getProperty("client_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (srcPortMask < 0 || srcPortMask > 65535) {
|
||||
errInfo.append(prop.getProperty("client_port_mask")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
if (m1.matches()) {
|
||||
Integer destPort = Integer.parseInt(destPortStr.split("/")[0]);
|
||||
Integer destPortMask = Integer.parseInt(destPortStr.split("/")[1]);
|
||||
|
||||
if (destPort < 0 || destPort > 65535) {
|
||||
errInfo.append(prop.getProperty("server_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (destPortMask < 0 || destPortMask > 65535) {
|
||||
errInfo.append(prop.getProperty("server_port_mask")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
if (m2.matches()) {
|
||||
try {
|
||||
Integer srcPort = Integer.parseInt(portStr);
|
||||
Integer srcPort = Integer.parseInt(srcPortStr);
|
||||
if (srcPort < 0 || srcPort > 65535) {
|
||||
errInfo.append(prop.getProperty(portName)
|
||||
errInfo.append(prop.getProperty("client_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("not_number"), prop.getProperty(portName)) + ";");
|
||||
String.format(prop.getProperty("not_number"), prop.getProperty("client_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
if (m3.matches()) {
|
||||
try {
|
||||
Integer destPort = Integer.parseInt(destPortStr);
|
||||
if (destPort < 0 || destPort > 65535) {
|
||||
errInfo.append(prop.getProperty("server_port")
|
||||
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
|
||||
valid = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("not_number"), prop.getProperty("server_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
if ((m.matches() && m3.matches()) || (m2.matches() && m1.matches())) {
|
||||
errInfo.append(prop.getProperty("the_same_port_pattern") + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (!m.matches() && !m2.matches()) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty(portName)) + ";");
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
if (!m1.matches() && !m3.matches()) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) + ";");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
@@ -1188,14 +1222,45 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
Integer doLog = baseIpCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
if(configDoLog.startsWith("0")) {
|
||||
baseIpCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* doBlackList属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoBlackList(IpPortCfg baseIpCfg, StringBuffer errInfo) {
|
||||
if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(8)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(510))&&serviceDict.getAction().equals(16)) {
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(baseIpCfg.getDoBlackList()==null) {
|
||||
baseIpCfg.setDoBlackList(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
String dobalcklistVals=new String();
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
dobalcklistVals+=itemCode+",";
|
||||
}
|
||||
}
|
||||
Integer doBlackList = baseIpCfg.getDoBlackList();
|
||||
if(!dobalcklistVals.contains(doBlackList+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_blacklist"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 根据位运算把 byte[] -> int
|
||||
*
|
||||
@@ -1329,44 +1394,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
return matchType;
|
||||
}
|
||||
public void ValidateRangeCross(String srcIp,String destIp,StringBuffer errInfo) {
|
||||
long srcStart=0l,srcEnd=0,srcNum=0l,destStart=0l,destEnd=0l,destNum=0l;
|
||||
if(srcIp.indexOf("-")>-1) {
|
||||
String[] srcArr=srcIp.split("\\-");
|
||||
srcStart=IPUtil.getIpHostDesimal(srcArr[0]);
|
||||
srcEnd=IPUtil.getIpHostDesimal(srcArr[1]);
|
||||
}else if(srcIp.indexOf("/")>-1) {
|
||||
srcNum=IPUtil.getIpHostDesimal(srcIp.split("/")[0]);
|
||||
}else {
|
||||
srcNum=IPUtil.getIpHostDesimal(srcIp);
|
||||
}
|
||||
if(destIp.indexOf("-")>-1) {
|
||||
String[] destArr=destIp.split("\\-");
|
||||
destStart=IPUtil.getIpHostDesimal(destArr[0]);
|
||||
destEnd=IPUtil.getIpHostDesimal(destArr[1]);
|
||||
}else if(destIp.indexOf("/")>-1) {
|
||||
destNum=IPUtil.getIpHostDesimal(destIp.split("/")[0]);
|
||||
}else {
|
||||
destNum=IPUtil.getIpHostDesimal(destIp);
|
||||
}
|
||||
if(srcNum==0l) {
|
||||
if(destNum==0l) {
|
||||
if(!(destEnd<srcStart||srcEnd<destStart)) {
|
||||
errInfo.append(prop.getProperty("range_cross")+";");
|
||||
}
|
||||
}else {
|
||||
if(destNum>=srcStart&&destNum<=srcEnd) {
|
||||
errInfo.append(prop.getProperty("range_cross")+";");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(destNum==0l) {
|
||||
if(srcNum>=destStart&&srcNum<=destEnd) {
|
||||
errInfo.append(prop.getProperty("range_cross")+";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map<Long, AsnGroupInfo>> getAsnNoMaps() {
|
||||
return asnNoMaps;
|
||||
}
|
||||
@@ -1379,4 +1407,5 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
public void setAsnGroupInfos(Map<Long, AsnGroupInfo> asnGroupInfos) {
|
||||
this.asnGroupInfos = asnGroupInfos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
|
||||
@@ -111,7 +110,8 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseStringCfg,errInfo);
|
||||
|
||||
// doBlackList校验
|
||||
this.validDoBlackList(baseStringCfg,errInfo);
|
||||
if (regionDict.getRegionType().equals(2)) {
|
||||
if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();
|
||||
@@ -205,7 +205,7 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("302");
|
||||
baseStringCfg.setUserRegion1("301");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
@@ -518,7 +518,6 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoLog(BaseStringCfg baseStringCfg, StringBuffer errInfo) {
|
||||
|
||||
String configDoLog = serviceDict.getConfigDoLog();
|
||||
if(StringUtils.isNotBlank(configDoLog)) {
|
||||
String defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
|
||||
@@ -528,11 +527,45 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
Integer doLog = baseStringCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
if(configDoLog.startsWith("0")) {
|
||||
baseStringCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* doBlackList属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoBlackList(BaseStringCfg baseStringCfg, StringBuffer errInfo) {
|
||||
if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(6)||
|
||||
regionDict.getFunctionId().equals(635)||regionDict.getFunctionId().equals(8)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(510))
|
||||
&&serviceDict.getAction().equals(16)) {
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_BLACKLIST");
|
||||
if(baseStringCfg.getDoBlackList()==null) {
|
||||
baseStringCfg.setDoBlackList(Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT);
|
||||
}
|
||||
String dobalcklistVals=new String();
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
dobalcklistVals+=itemCode+",";
|
||||
}
|
||||
}
|
||||
Integer doBlackList = baseStringCfg.getDoBlackList();
|
||||
if(!dobalcklistVals.contains(doBlackList+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_blacklist"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ 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;
|
||||
@@ -38,7 +37,6 @@ 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;
|
||||
@@ -238,7 +236,6 @@ 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;
|
||||
@@ -286,7 +283,6 @@ public class HttpClientUtil {
|
||||
logger.error("获取消息失败,相应内容如下: " + result);
|
||||
throw new MaatConvertException(status+"");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("获取消息失败,相应内容如下: " + result);
|
||||
@@ -296,8 +292,6 @@ public class HttpClientUtil {
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
end=System.currentTimeMillis();
|
||||
logger.warn("getMsg cost:"+(end-start)+"ms");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -308,14 +302,12 @@ public class HttpClientUtil {
|
||||
* @return
|
||||
*/
|
||||
public static String galaxyMessageFormat(String recv){
|
||||
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
|
||||
//JSONObject jobj = JSONObject.fromObject(recv);
|
||||
com.alibaba.fastjson.JSONObject jobj = JSON.parseObject(recv);
|
||||
JSONObject jobj = JSONObject.fromObject(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(CollectionUtils.isNotEmpty(list)){
|
||||
if(list!=null&&list.size()>0){
|
||||
for (Map<String,Object> m : list) {
|
||||
Map recvMap = new HashMap();
|
||||
Iterator<Entry<String, Object>> iterator = m.entrySet().iterator();
|
||||
@@ -324,12 +316,12 @@ public class HttpClientUtil {
|
||||
String key = next.getKey().toString();
|
||||
Object value = next.getValue();
|
||||
//处理字段为“null”情况
|
||||
if("null".equals(value)){
|
||||
if(value!=null&&"null".equals(value)){
|
||||
value="";
|
||||
}
|
||||
//处理时间字段为“0”情况
|
||||
if("foundTime".equals(key)||"recvTime".equals(key)){
|
||||
if("0".equals(value)){
|
||||
if(null!=value&&"0".equals(value)){
|
||||
value="";
|
||||
}
|
||||
}
|
||||
@@ -345,8 +337,6 @@ public class HttpClientUtil {
|
||||
parse.put("data", map);
|
||||
recv = parse.toString();
|
||||
}
|
||||
end=System.currentTimeMillis();
|
||||
logger.info("galaxyMessageFormat cost:"+(end-start));
|
||||
return recv;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,6 @@ 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;
|
||||
@@ -88,7 +87,6 @@ public class LoginController extends BaseController {
|
||||
CookieUtil.addCookie(response, "LOGINED", "false");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +173,6 @@ public class LoginController extends BaseController {
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +212,6 @@ public class LoginController extends BaseController {
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:"+request.getParameter("url");
|
||||
@@ -234,7 +230,6 @@ public class LoginController extends BaseController {
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:"+request.getParameter("url");
|
||||
|
||||
@@ -16,7 +16,6 @@ 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;
|
||||
@@ -107,7 +106,6 @@ public class SystemController extends BaseController{
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("help error",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
logger.info("menuSize:"+newList.size());
|
||||
model.addAttribute("menuList",newList);
|
||||
@@ -141,7 +139,6 @@ public class SystemController extends BaseController{
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("save helpInfo error",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -170,7 +167,6 @@ public class SystemController extends BaseController{
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("view helpInfo error",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -199,21 +195,7 @@ public class SystemController extends BaseController{
|
||||
}
|
||||
} 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();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.error("Clear Policies Error",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
@@ -68,7 +67,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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes,String itType) {
|
||||
|
||||
try {
|
||||
AsnGroupInfo asnGroup=asnGroupInfoService.getGroupIdByNameAndASNId(cfg.getOrganization().trim(), cfg.getCountry().trim(), cfg.getAsnId());
|
||||
@@ -81,7 +80,6 @@ public class AsnGroupController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("新增失败",e);
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
@@ -96,14 +94,13 @@ public class AsnGroupController extends BaseController {
|
||||
*/
|
||||
//@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del"},logical=Logical.OR)
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(RedirectAttributes redirectAttributes,String ids,String asnIds,HttpServletRequest request) {
|
||||
public String delete(RedirectAttributes redirectAttributes,String ids,String asnIds) {
|
||||
try {
|
||||
asnGroupInfoService.delete(ids,asnIds);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ 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;
|
||||
@@ -80,21 +79,15 @@ public class AsnIpController extends BaseController{
|
||||
public String save(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
asnIpCfgService.saveAsnIpCfg(cfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
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, "success", "audit_success");
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
} 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();
|
||||
@@ -105,21 +98,11 @@ public class AsnIpController extends BaseController{
|
||||
try{
|
||||
|
||||
asnIpCfgService.update(cfg);
|
||||
//配置仅保存
|
||||
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);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
|
||||
@@ -152,7 +135,7 @@ public class AsnIpController extends BaseController{
|
||||
asnIpMap.put(Long.parseLong(asnIpCfg.getUserRegion1()), _asnIps);
|
||||
}
|
||||
}
|
||||
asnIpCfgService.auditIpBatch(asnIpMap,isAudit);
|
||||
asnIpCfgService.auditIpBatch(asnIpMap,isValid);
|
||||
}else {
|
||||
//条件下所有配置审核
|
||||
Page<AsnIpCfg> searchPage=new Page<AsnIpCfg>(request,response,"r");
|
||||
@@ -165,10 +148,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -179,25 +160,18 @@ public class AsnIpController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"asn:ip:config"})
|
||||
public String delete(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AsnIpCfg cfg){
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +260,6 @@ 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,110 +0,0 @@
|
||||
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,7 +20,6 @@ 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")
|
||||
@@ -76,7 +75,6 @@ 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();
|
||||
}
|
||||
@@ -93,7 +91,6 @@ 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();
|
||||
}
|
||||
@@ -101,7 +98,7 @@ public class IpReuseIpCfgController extends BaseController{
|
||||
@RequiresPermissions(value={"asn:ip:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes,HttpServletRequest request){
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
ipReuseIpCfgService.delete(isValid,ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
@@ -109,10 +106,8 @@ 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,7 +21,6 @@ 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;
|
||||
/**
|
||||
@@ -72,7 +71,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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes,String itType,Integer groupType) {
|
||||
|
||||
try {
|
||||
policyGroupInfoService.saveOrUpdate(cfg);
|
||||
@@ -80,7 +79,6 @@ 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;
|
||||
@@ -95,14 +93,13 @@ 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,HttpServletRequest request) {
|
||||
public String delete(RedirectAttributes redirectAttributes, Integer groupType,String ids,int isValid) {
|
||||
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;
|
||||
}
|
||||
@@ -197,7 +194,6 @@ 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,7 +29,6 @@ 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;
|
||||
@@ -53,7 +52,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value="requestCancleInfoAjax", method = RequestMethod.POST)
|
||||
public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable,HttpServletRequest request){
|
||||
public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
@@ -62,7 +61,6 @@ public class ServiceDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("审核添加取消来函信息失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
@@ -78,7 +76,7 @@ public class ServiceDictInfoController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value="requestCancleInfoNumber")
|
||||
public Map requestCancleInfoNumber(String ids,String indexTable,HttpServletRequest request){
|
||||
public Map requestCancleInfoNumber(String ids,String indexTable){
|
||||
List list = new ArrayList();
|
||||
String requestTitle="";
|
||||
Map map=new HashMap();
|
||||
@@ -96,7 +94,6 @@ public class ServiceDictInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("查询取消审核来函信息失败",e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
return map;
|
||||
}
|
||||
// }
|
||||
@@ -210,7 +207,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,HttpServletRequest request) {
|
||||
public String saveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes,String itType) {
|
||||
|
||||
try {
|
||||
serviceDictInfoService.saveOrUpdate(serviceDictInfo);
|
||||
@@ -218,7 +215,6 @@ 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;
|
||||
@@ -235,7 +231,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,HttpServletRequest request) {
|
||||
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
|
||||
try {
|
||||
String exIp="";
|
||||
String id="";
|
||||
@@ -270,7 +266,6 @@ 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;
|
||||
}
|
||||
@@ -591,7 +586,6 @@ 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,7 +25,6 @@ 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;
|
||||
@@ -152,7 +151,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,HttpServletRequest request) {
|
||||
public String saveOrUpdate(SysDictInfo sysDictInfo,Model model, RedirectAttributes redirectAttributes, String itType) {
|
||||
|
||||
try {
|
||||
sysDictInfoService.saveOrUpdate(sysDictInfo);
|
||||
@@ -160,7 +159,6 @@ 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;
|
||||
@@ -174,14 +172,13 @@ 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,HttpServletRequest request) {
|
||||
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
|
||||
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,7 +24,6 @@ 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;
|
||||
@@ -91,7 +90,6 @@ 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";
|
||||
}
|
||||
@@ -235,7 +233,6 @@ 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();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -58,7 +58,6 @@ 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;
|
||||
@@ -87,23 +86,9 @@ public class AppFeatureCfgController extends BaseController {
|
||||
Page<AppFeatureIndex> searchPage = new Page<AppFeatureIndex>(request, response, "r");
|
||||
Page<AppFeatureIndex> page = appMultiFeatureCfgService.findAppFeatureIndexList(searchPage, cfg);
|
||||
for (AppFeatureIndex entity : page.getList()) {
|
||||
// 查找社交应用的所有有效一级特定服务
|
||||
SpecificServiceCfg appSpec = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) {
|
||||
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
appSpec.setIsValid(Constants.VALID_YES);
|
||||
appSpec.setIsLeaf(0);
|
||||
appSpec.setSpecServiceCode(entity.getAppCode());
|
||||
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
|
||||
if (!StringUtil.isEmpty(appList)) {
|
||||
SpecificServiceCfg app = appList.get(0);
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
entity.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/app/appMultiFeatureCfgList";
|
||||
@@ -129,24 +114,6 @@ public class AppFeatureCfgController extends BaseController {
|
||||
entity.getFunctionId(), null));
|
||||
entity.setNumCfgList(
|
||||
appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(), null));
|
||||
|
||||
// 查找社交应用的所有有效一级特定服务
|
||||
SpecificServiceCfg appSpec = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) {
|
||||
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
appSpec.setIsValid(Constants.VALID_YES);
|
||||
appSpec.setIsLeaf(0);
|
||||
appSpec.setSpecServiceCode(entity.getAppCode());
|
||||
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
|
||||
if (!StringUtil.isEmpty(appList)) {
|
||||
SpecificServiceCfg app = appList.get(0);
|
||||
entity.setSpecServiceId(app.getSpecServiceId());
|
||||
}
|
||||
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
@@ -175,21 +142,14 @@ public class AppFeatureCfgController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appMultiFeatureCfgService.saveOrUpdateAppFeatureCfg(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("APP 特征配置下发失败:",e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("APP 特征配置保存失败:",e);
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + entity.getFunctionId();
|
||||
@@ -216,20 +176,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,Constants.INSERT_ACTION);
|
||||
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit);
|
||||
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 {
|
||||
@@ -244,10 +204,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -267,28 +225,8 @@ public class AppFeatureCfgController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "updateAppFeatureCfgValid" })
|
||||
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppFeatureIndex cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -383,23 +321,9 @@ public class AppFeatureCfgController extends BaseController {
|
||||
}
|
||||
|
||||
for (AppFeatureIndex feature : ipLists) {
|
||||
// 查找社交应用的所有有效一级特定服务
|
||||
SpecificServiceCfg appSpec = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) {
|
||||
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
appSpec.setIsValid(Constants.VALID_YES);
|
||||
appSpec.setIsLeaf(0);
|
||||
appSpec.setSpecServiceCode(feature.getAppCode());
|
||||
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
|
||||
if (!StringUtil.isEmpty(appList)) {
|
||||
SpecificServiceCfg app = appList.get(0);
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(feature.getSpecServiceId());
|
||||
feature.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
}
|
||||
String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_type,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String appComplexNoExport = ",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
@@ -408,7 +332,7 @@ public class AppFeatureCfgController extends BaseController {
|
||||
String ipPortInfoNoExport = ",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,client_ip,src_ip_pattern,client_port,src_port_pattern,";
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
@@ -491,7 +415,6 @@ 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();
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -21,32 +18,24 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.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.report.NtcPzReport;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import net.sf.json.JsonConfig;
|
||||
|
||||
/**
|
||||
* 基础协议控制类
|
||||
*
|
||||
@@ -132,25 +121,6 @@ public class BasicProtocolController extends BaseController {
|
||||
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
|
||||
|
||||
|
||||
// 查找社交应用的所有有效一级特定服务
|
||||
SpecificServiceCfg appSpec = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equals(dict.getItemValue())) {
|
||||
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
appSpec.setIsValid(Constants.VALID_YES);
|
||||
appSpec.setIsLeaf(0);
|
||||
appSpec.setSpecServiceCode(entity.getAppCode());
|
||||
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
|
||||
if (!StringUtil.isEmpty(appList)) {
|
||||
SpecificServiceCfg app = appList.get(0);
|
||||
entity.setSpecServiceId(app.getSpecServiceId());
|
||||
}
|
||||
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
@@ -180,25 +150,18 @@ public class BasicProtocolController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(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("基础协议配置下发失败:",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);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + entity.getFunctionId();
|
||||
@@ -226,10 +189,12 @@ 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,Constants.INSERT_ACTION);
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -237,12 +202,10 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -259,10 +222,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -282,26 +243,21 @@ public class BasicProtocolController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
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) {
|
||||
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;
|
||||
@@ -344,20 +300,8 @@ public class BasicProtocolController extends BaseController {
|
||||
logTotal.put("sum",0L);
|
||||
logTotals.add(logTotal);
|
||||
}
|
||||
// 查找社交应用的所有有效一级特定服务 TODO
|
||||
SpecificServiceCfg appSpec = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equals(dict.getItemValue())) {
|
||||
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
appSpec.setIsValid(Constants.VALID_YES);
|
||||
appSpec.setIsLeaf(0);
|
||||
appSpec.setSpecServiceCode(policy.getAppCode());
|
||||
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
|
||||
if (!StringUtil.isEmpty(appList)) {
|
||||
SpecificServiceCfg app = appList.get(0);
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if (app != null) {
|
||||
policy.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
|
||||
@@ -440,10 +384,17 @@ 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();
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importAppPolicyList(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, @RequestParam("files")MultipartFile[] files, Integer serviceDictId, Integer requestId,
|
||||
String attribute, String classify, String regionDictIds, String importPath) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.importAppPolicyList(request, response, redirectAttributes, files, serviceDictId, requestId, attribute,
|
||||
classify, regionDictIds, importPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
*/
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -17,22 +19,38 @@ import java.util.Properties;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.axis2.databinding.types.soapencoding.Array;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* @ClassName: CommonController.java
|
||||
@@ -270,7 +288,15 @@ public class CommonController extends BaseController {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
||||
}
|
||||
@Deprecated
|
||||
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode,Class clazz) {
|
||||
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,clazz);
|
||||
}
|
||||
//ip配置导出
|
||||
public void _exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
|
||||
@@ -29,7 +29,6 @@ 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;
|
||||
@@ -73,14 +72,6 @@ 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(serviceId,model,request,response);
|
||||
@@ -103,26 +94,19 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
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();
|
||||
@@ -181,7 +165,6 @@ public class ConfigSynchronizationController extends BaseController {
|
||||
Thread.sleep(60000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ 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;
|
||||
@@ -20,14 +19,15 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
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;
|
||||
@@ -35,7 +35,6 @@ 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;
|
||||
@@ -114,7 +113,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 (CollectionUtils.isNotEmpty(cfg.getIpPortList())) {
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
@@ -123,7 +122,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(cfg.getNtcSubscribeIdCfgList())) {
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ntc.getCfgType().equals(cfgType)) {
|
||||
@@ -151,24 +150,6 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
|
||||
|
||||
// 查找社交应用的所有有效一级特定服务
|
||||
SpecificServiceCfg appSpec = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
appSpec.setIsValid(Constants.VALID_YES);
|
||||
appSpec.setIsLeaf(0);
|
||||
appSpec.setSpecServiceCode(entity.getAppCode());
|
||||
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
|
||||
if (!StringUtil.isEmpty(appList)) {
|
||||
SpecificServiceCfg app = appList.get(0);
|
||||
entity.setSpecServiceId(app.getSpecServiceId());
|
||||
}
|
||||
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
@@ -198,25 +179,17 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(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("加密隧道行为配置下发失败:",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);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + entity.getFunctionId();
|
||||
@@ -249,7 +222,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -257,12 +230,10 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,10 +250,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -303,28 +272,18 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppPolicyCfg cfg) {
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
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 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;
|
||||
@@ -365,20 +324,8 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
logTotal.put("sum",0L);
|
||||
logTotals.add(logTotal);
|
||||
}
|
||||
// 查找社交应用的所有有效一级特定服务 TODO
|
||||
SpecificServiceCfg appSpec = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
appSpec.setIsValid(Constants.VALID_YES);
|
||||
appSpec.setIsLeaf(0);
|
||||
appSpec.setSpecServiceCode(policy.getAppCode());
|
||||
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
|
||||
if (!StringUtil.isEmpty(appList)) {
|
||||
SpecificServiceCfg app = appList.get(0);
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if (app != null) {
|
||||
policy.setBehaviorName(app.getSpecServiceName());
|
||||
}
|
||||
}
|
||||
@@ -484,10 +431,19 @@ 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();
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping(value = { "import" })
|
||||
public String importAppPolicyList(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, @RequestParam("files")MultipartFile[] files, Integer serviceDictId, Integer requestId,
|
||||
String attribute, String classify, String regionDictIds, String importPath) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.importAppPolicyList(request, response, redirectAttributes, files, serviceDictId, requestId, attribute,
|
||||
classify, regionDictIds, importPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -17,7 +16,6 @@ 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;
|
||||
@@ -67,7 +65,7 @@ public class GroupAreaController extends BaseController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(GroupAreaInfo cfg,Model model,RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
public String saveOrUpdate(GroupAreaInfo cfg,Model model,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
groupAreaService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
@@ -75,27 +73,23 @@ 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,HttpServletRequest request) {
|
||||
public String delete(RedirectAttributes redirectAttributes, String ids,int isValid) {
|
||||
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,7 +23,6 @@ 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;
|
||||
@@ -74,7 +73,7 @@ public class LogSearchController extends BaseController{
|
||||
|
||||
@RequestMapping(value="actionLogTrend")
|
||||
@ResponseBody
|
||||
public List actionTrans(String cfgId,String beginDate,String endDate,String serviceId,HttpServletRequest request){
|
||||
public List actionTrans(String cfgId,String beginDate,String endDate,String serviceId){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List resultList = new ArrayList();
|
||||
String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT;
|
||||
@@ -97,7 +96,6 @@ 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,7 +26,6 @@ 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;
|
||||
@@ -125,7 +124,6 @@ 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";
|
||||
}
|
||||
@@ -288,7 +286,6 @@ 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,7 +24,6 @@ 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;
|
||||
|
||||
@@ -70,7 +69,7 @@ public class DnsIpCfgController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "initSpoofingIp" })
|
||||
public String initSpoofingIp(HttpServletRequest request) {
|
||||
public String initSpoofingIp() {
|
||||
Properties msg = getMsgProp();
|
||||
try {
|
||||
DnsIpCfg entity = new DnsIpCfg();
|
||||
@@ -85,10 +84,8 @@ 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");
|
||||
}
|
||||
}
|
||||
@@ -101,21 +98,15 @@ public class DnsIpCfgController extends BaseController {
|
||||
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
dnsIpCfgService.saveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
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);
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + cfg.getFunctionId();
|
||||
@@ -123,28 +114,9 @@ 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,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DnsIpCfg cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -164,12 +136,10 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -186,10 +156,8 @@ 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,7 +218,7 @@ public class DnsIpCfgController extends BaseController {
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
|
||||
String cfgIndexInfoNoExport = ",log_total,whether_area_block,client_ip,src_ip_pattern,src_port_pattern,dest_port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String cfgIndexInfoNoExport = ",log_total,whether_area_block,client_ip,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
@@ -282,10 +250,8 @@ 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,7 +28,6 @@ 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;
|
||||
|
||||
@@ -81,21 +80,11 @@ public class DnsResStrategyController extends BaseController {
|
||||
|
||||
dnsResStrategyService.saveOrUpdate(cfg);
|
||||
|
||||
//配置仅保存
|
||||
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();
|
||||
@@ -114,28 +103,12 @@ 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, @ModelAttribute("cfg")DnsResStrategy cfg,
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -153,10 +126,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,10 +143,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -259,10 +228,8 @@ 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,7 +24,6 @@ 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;
|
||||
@@ -82,10 +81,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +91,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,HttpServletRequest request) {
|
||||
public String snataudit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
@@ -107,10 +104,8 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,7 +138,6 @@ 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;
|
||||
}
|
||||
@@ -288,7 +282,6 @@ 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,7 +24,6 @@ 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;
|
||||
@@ -73,10 +72,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +103,6 @@ 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;
|
||||
}
|
||||
@@ -114,7 +110,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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -130,7 +126,6 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
e.printStackTrace();
|
||||
logger.info("IP复用地址池配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +309,6 @@ 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();
|
||||
@@ -376,7 +370,6 @@ 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,7 +30,6 @@ 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;
|
||||
@@ -111,12 +110,10 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -137,10 +134,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,12 +181,10 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -215,12 +208,10 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -252,12 +243,10 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -274,12 +263,10 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -290,19 +277,15 @@ public class UserManageController extends BaseController{
|
||||
} 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";
|
||||
}
|
||||
@@ -392,7 +375,6 @@ public class UserManageController extends BaseController{
|
||||
message+=","+ip;
|
||||
}
|
||||
logger.error("查询失败", e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
mess.put("message", message);
|
||||
@@ -468,7 +450,6 @@ 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();
|
||||
|
||||
@@ -6,36 +6,40 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.cxf.common.util.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -58,12 +62,6 @@ 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);
|
||||
@@ -78,21 +76,15 @@ public class DdosCfgController extends BaseController {
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
ddosCfgService.saveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
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);
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
|
||||
@@ -100,28 +92,8 @@ public class DdosCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
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)) {
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -135,18 +107,16 @@ public class DdosCfgController extends BaseController {
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime,Constants.INSERT_ACTION);
|
||||
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -162,10 +132,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -277,7 +245,6 @@ 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();
|
||||
@@ -304,4 +271,156 @@ public class DdosCfgController extends BaseController {
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/ddosSubList";
|
||||
}
|
||||
@RequestMapping(value = {"import"}, method=RequestMethod.POST)
|
||||
public String importCfg(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
//加载模板
|
||||
ei.loadInitParams(DdosIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
org.springframework.beans.BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ddosCfgService.saveAndSend(regionDict, _ipPortCfgs, isSend.equals("1"));
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
|
||||
import com.nis.domain.configuration.IpReusePolicyCfg;
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.domain.configuration.template.IpMultiplexPolicyTemplate;
|
||||
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;
|
||||
@@ -120,6 +120,26 @@ public class IpMultiplexController extends CommonController {
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
// ip配置导入
|
||||
/*
|
||||
* @RequestMapping(value = "/import", method=RequestMethod.POST) public
|
||||
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
*
|
||||
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
* this._importIp(cfgName,redirectAttributes,
|
||||
* file,cfg,IpMultiplexPolicyTemplate.class);
|
||||
* redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex")
|
||||
* ; redirectAttributes.addAttribute("requiresPermissionPrefix",
|
||||
* "ip:mulitiplex"); return "redirect:" + adminPath
|
||||
* +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId(); }
|
||||
*/
|
||||
// ip模板下载
|
||||
@RequestMapping(value = "import/template")
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
IpMultiplexPolicyTemplate.class);
|
||||
}
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "export")
|
||||
@@ -182,10 +202,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +223,6 @@ 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;
|
||||
@@ -214,7 +231,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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
@@ -228,10 +245,8 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,10 +388,8 @@ 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();
|
||||
@@ -384,7 +397,7 @@ public class IpMultiplexController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "/dnatDelete" })
|
||||
@RequiresPermissions("dnat_policy:config")
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try {
|
||||
@@ -395,7 +408,6 @@ 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;
|
||||
@@ -404,7 +416,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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
// this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
@@ -419,10 +431,8 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -474,7 +484,6 @@ public class IpMultiplexController extends CommonController {
|
||||
for (Integer id : set) {
|
||||
serviceIds.append(id+",");
|
||||
}
|
||||
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);
|
||||
//获取日志总量
|
||||
@@ -482,7 +491,6 @@ public class IpMultiplexController extends CommonController {
|
||||
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){
|
||||
@@ -541,7 +549,6 @@ 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();
|
||||
@@ -597,8 +604,6 @@ public class IpMultiplexController extends CommonController {
|
||||
for (Integer id : set) {
|
||||
serviceIds.append(id+",");
|
||||
}
|
||||
|
||||
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);
|
||||
//获取日志总量
|
||||
@@ -606,7 +611,6 @@ public class IpMultiplexController extends CommonController {
|
||||
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
|
||||
logTotals.addAll(logs);
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpReuseDnatPolicyCfg.class);
|
||||
String snatNoExport = ",group_name,block_type,direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
@@ -648,7 +652,6 @@ 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();
|
||||
|
||||
@@ -112,7 +112,20 @@ public class RatelimitController extends CommonController {
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","domain:ratelimit");
|
||||
return "redirect:" + adminPath +"/manipulation/ratelimit/domain/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
//ip配置导入
|
||||
/*@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpRateLimitTemplate.class);
|
||||
redirectAttributes.addAttribute("urlPrefix","/manipulation/ratelimit/ip");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:ratelimit");
|
||||
return "redirect:" + adminPath +"/manipulation/ratelimit/ip/list?functionId="+cfg.getFunctionId();
|
||||
}*/
|
||||
@RequestMapping(value = "/ip/import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpRateLimitTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "/ip/export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
|
||||
@@ -17,7 +17,6 @@ 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;
|
||||
|
||||
@@ -62,10 +61,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,20 +8,28 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
@@ -29,18 +37,27 @@ import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.AvContUrlCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.domain.configuration.AvVoipIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -92,24 +109,16 @@ public class AvContentController extends BaseController {
|
||||
CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
avContentCfgService.saveOrUpdateAvVoip(cfg);
|
||||
//配置仅保存
|
||||
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();
|
||||
@@ -162,26 +171,20 @@ 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,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
public String updateVoipValid(Integer isAudit, String compileIds, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
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;
|
||||
@@ -215,15 +218,7 @@ public class AvContentController extends BaseController {
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
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);
|
||||
avContentCfgService.auditAvVoip(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -231,12 +226,10 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -254,10 +247,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -407,10 +398,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +419,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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(compileIds)) {
|
||||
String[] idArray = compileIds.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -441,11 +430,9 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -520,10 +507,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,19 +525,10 @@ 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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(compileIds)) {
|
||||
String[] idArray = compileIds.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -564,12 +540,10 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,24 +628,16 @@ public class AvContentController extends BaseController {
|
||||
CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
avContentCfgService.saveOrUpdateContUrl(cfg);
|
||||
//配置仅保存
|
||||
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();
|
||||
@@ -680,28 +646,9 @@ 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,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateAvContUrlValid(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -713,27 +660,18 @@ public class AvContentController extends BaseController {
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
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);
|
||||
avContentCfgService.auditContUrl(isAudit, isValid, functionId, id, auditTime);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -750,10 +688,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -847,10 +783,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +804,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,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(compileIds)) {
|
||||
String[] idArray = compileIds.split(",");
|
||||
Date auditTime = new Date();
|
||||
@@ -883,10 +817,8 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -995,7 +927,6 @@ 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();
|
||||
@@ -1128,7 +1059,6 @@ 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();
|
||||
@@ -1262,9 +1192,322 @@ 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();
|
||||
}
|
||||
@RequestMapping(value = {"contUrlImport","voipImport"}, method=RequestMethod.POST)
|
||||
public String importCfg(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if((regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
avContentCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
avContentCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
avContentCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ 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;
|
||||
@@ -302,8 +301,7 @@ 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")+"("+ Constants.AV_DURATION_LIMIT
|
||||
+ "s)");
|
||||
throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -311,28 +309,18 @@ public class AvController extends BaseController {
|
||||
}
|
||||
|
||||
avCfgService.saveOrUpdateAvFileSample(entity, srcFile);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.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 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,25 +333,16 @@ public class AvController extends BaseController {
|
||||
RedirectAttributes redirectAttributes, String ids, AvSignSampleCfg entity) {
|
||||
try {
|
||||
avCfgService.saveOrUpdateAvSignSample(entity);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("saveAudioSignSample failed", e);
|
||||
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();
|
||||
@@ -371,28 +350,10 @@ public class AvController extends BaseController {
|
||||
|
||||
// 修改文件样例配置状态
|
||||
@RequestMapping(value = { "/sample/updateAvFileSampleValid" })
|
||||
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)) {
|
||||
public String updateAvFileSampleValid(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -418,6 +379,8 @@ 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 {
|
||||
@@ -476,11 +439,9 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -496,10 +457,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -528,7 +487,7 @@ public class AvController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "/sample/auditAvAudioSignSample" })
|
||||
public String auditAvAudioSignSample(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
// avCfgService.auditAvSignSample(isAudit,isValid,ids);
|
||||
AvSignSampleCfg entity = new AvSignSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
@@ -536,7 +495,8 @@ 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");
|
||||
@@ -545,11 +505,9 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -568,7 +526,7 @@ public class AvController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "/sample/auditAvSignSample" })
|
||||
public String auditAvSignSample(Integer preset, AvSignSampleCfgModel cfg, Integer functionId,
|
||||
RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
RedirectAttributes redirectAttributes) {
|
||||
// 预置配置
|
||||
try {
|
||||
if (preset != null && 1 == preset) {// 预置信息需要在数据库中插入一条记录
|
||||
@@ -582,11 +540,9 @@ 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);
|
||||
}
|
||||
}
|
||||
// 修改下发配置
|
||||
@@ -603,23 +559,15 @@ public class AvController extends BaseController {
|
||||
// if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){
|
||||
try {
|
||||
avCfgService.auditAvSignSample(avSignSampleCfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(avSignSampleCfg.getIsValid()) || avSignSampleCfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -725,7 +673,6 @@ 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();
|
||||
@@ -765,7 +712,7 @@ public class AvController extends BaseController {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "/sample/videoToPicture" })
|
||||
public Map videoToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile srcFile,HttpServletRequest request) {
|
||||
public Map videoToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile srcFile) {
|
||||
|
||||
String sep = System.getProperty("file.separator");
|
||||
String random = UUID.randomUUID() + "";
|
||||
@@ -836,17 +783,14 @@ 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;
|
||||
}
|
||||
@@ -862,7 +806,7 @@ public class AvController extends BaseController {
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "/sample/faceToPicture" })
|
||||
public Map faceToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile[] srcFile,
|
||||
@RequestParam("faceFilePath") String faceFilePath,HttpServletRequest request) {
|
||||
@RequestParam("faceFilePath") String faceFilePath) {
|
||||
String sep = System.getProperty("file.separator");
|
||||
String random = UUID.randomUUID() + "";
|
||||
// String srcFilePath =
|
||||
@@ -885,7 +829,6 @@ public class AvController extends BaseController {
|
||||
} catch (IOException e) {
|
||||
logger.error(e);
|
||||
e.printStackTrace();
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +1,48 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcBgpAsCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -73,24 +84,7 @@ 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) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -140,28 +134,9 @@ public class BgpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateBgpCfgValid" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -177,22 +152,20 @@ 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,Constants.INSERT_ACTION);
|
||||
bgpCfgService.auditBgpCfg(entity, isAudit);
|
||||
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 {
|
||||
@@ -207,10 +180,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -349,10 +320,214 @@ 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();
|
||||
}
|
||||
@RequestMapping(value = "bgpImport")
|
||||
public String bgpImport(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
Properties properties=this.getMsgProp();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if (regionDict.getRegionType().equals(2)) {// 字符串类
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
bgpCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(2)) {
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
bgpCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -19,33 +21,54 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.taglibs.standard.functions.Functions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.P2pHashCfg;
|
||||
import com.nis.domain.configuration.P2pKeywordCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -88,24 +111,16 @@ public class FileTransferCfgController extends BaseController {
|
||||
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
fileTransferCfgService.saveFtpCfg(entity);
|
||||
//配置仅保存
|
||||
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();
|
||||
@@ -159,26 +174,21 @@ public class FileTransferCfgController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value = { "updateFtpCfgValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:ftp:config" })
|
||||
public String updateFtpCfgValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
public String updateFtpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
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) {
|
||||
logger.error("ftp配置删除失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
logger.info("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;
|
||||
@@ -196,11 +206,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,Constants.INSERT_ACTION);
|
||||
fileTransferCfgService.auditFtpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -208,12 +218,10 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,10 +237,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -308,43 +314,22 @@ 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) {
|
||||
logger.error("文件摘要配置保存失败:",e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
|
||||
} else {
|
||||
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,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")FileDigestCfg cfg) {
|
||||
try {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
public String updateFileDigestValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -355,22 +340,20 @@ 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,Constants.INSERT_ACTION);
|
||||
fileTransferCfgService.auditFileDigestCfg(isAudit, isValid, functionId, id, auditTime);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -388,10 +371,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -509,24 +490,16 @@ public class FileTransferCfgController extends BaseController {
|
||||
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
fileTransferCfgService.saveP2pCfg(entity);
|
||||
//配置仅保存
|
||||
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();
|
||||
@@ -534,26 +507,21 @@ public class FileTransferCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateP2pCfgValid" })
|
||||
@RequiresPermissions(value = { "fileTransfer:p2p:config" })
|
||||
public String updateP2pCfgValid(Integer isValid, String ids, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
public String updateP2pCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
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) {
|
||||
logger.error("P2P配置删除失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
logger.info("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;
|
||||
@@ -617,25 +585,22 @@ 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,Constants.INSERT_ACTION);
|
||||
fileTransferCfgService.auditP2pCfg(entity, isAudit);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -651,10 +616,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -798,7 +761,6 @@ 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();
|
||||
@@ -943,7 +905,6 @@ 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();
|
||||
@@ -1043,9 +1004,344 @@ 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();
|
||||
}
|
||||
@RequestMapping(value = {"ftpImport","p2pImport"}, method=RequestMethod.POST)
|
||||
public String importDns(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
if("p2p_ip".equals(regionDict.getConfigServiceType())) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListP2pIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListP2pIpTemplate> list = ei.getDataList(BlackListP2pIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
|
||||
}else if("p2p_ip".equals(regionDict.getConfigServiceType())) { // P2p IP
|
||||
ei.loadInitParams(P2pIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<P2pIpTemplate> list = ei.getDataList(P2pIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
if("p2p_hash".equals(regionDict.getConfigServiceType())) {
|
||||
ei.loadInitParams(BlackListP2pHashStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListP2pHashStringTemplate> list = ei.getDataList(BlackListP2pHashStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}else if("p2p_hash".equals(regionDict.getConfigServiceType())) { // P2p hash
|
||||
ei.loadInitParams(P2pHashStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<P2pHashStringTemplate> list = ei.getDataList(P2pHashStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if((regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
fileTransferCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
fileTransferCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
fileTransferCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -8,12 +10,18 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -23,17 +31,33 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.AsnKeywordCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.AppDomainTemplate;
|
||||
import com.nis.domain.configuration.template.AppPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
@@ -66,14 +90,17 @@ import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.configuration.template.TopicWebsiteTemplate;
|
||||
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.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
* @author dell
|
||||
@@ -107,24 +134,7 @@ public class IpController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
public String saveOrUpdate(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo 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"})
|
||||
@@ -167,29 +177,8 @@ public class IpController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"updateValid"})
|
||||
@RequiresPermissions("iplist:config")
|
||||
public String updateIpPortCfgValid(Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateIpPortCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
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;
|
||||
}
|
||||
/**
|
||||
@@ -231,17 +220,15 @@ public class IpController extends BaseController{
|
||||
/*if(StringUtils.isNoneBlank(entity.getUserRegion4())) {
|
||||
ipCfgService.auditAsnCfg(entity, isAudit);
|
||||
}else {*/
|
||||
ipCfgService.auditIpCfg(entity,isAudit,Constants.INSERT_ACTION);
|
||||
ipCfgService.auditIpCfg(entity,isAudit);
|
||||
/*}*/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -258,10 +245,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -346,7 +331,6 @@ public class IpController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("export_failed", e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -404,10 +388,17 @@ public class IpController extends BaseController{
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(510) && "p2p_ip".equals(regionDict.getConfigServiceType())){ //P2p IP
|
||||
if(serviceDict!=null&&serviceDict.getAction().equals(16)) {
|
||||
List<BlackListP2pIpTemplate> classList=new ArrayList<BlackListP2pIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListP2pIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else {
|
||||
List<P2pIpTemplate> classList=new ArrayList<P2pIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, P2pIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}else if(regionDict.getFunctionId().equals(600)){ //asnip
|
||||
List<AsnIpTemplate> classList=new ArrayList<AsnIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, AsnIpTemplate.class, 2);
|
||||
@@ -471,7 +462,13 @@ 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
|
||||
}else if((regionDict.getFunctionId().equals(34)||regionDict.getFunctionId().equals(8)||regionDict.getFunctionId().equals(35)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(22)||regionDict.getFunctionId().equals(24))&&serviceDict.getAction().equals(16)) {//SSL , HTTP ADVANCED URL mail,FTP,Steaming Media 的BLOCK
|
||||
List<BlackListIPTemplate> classList=new ArrayList<BlackListIPTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, BlackListIPTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if((regionDict.getFunctionId().equals(63)||regionDict.getFunctionId().equals(407)||regionDict.getFunctionId().equals(408)) && serviceDict.getAction().equals(64)){// APP Policy限速
|
||||
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
@@ -485,7 +482,12 @@ public class IpController extends BaseController{
|
||||
}
|
||||
//str类模板
|
||||
if(regionDict.getRegionType().equals(2)){
|
||||
if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())){ //P2p hash
|
||||
if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())&&serviceDict!=null&&serviceDict.getAction().equals(16)){ //P2p hash block
|
||||
List<BlackListP2pHashStringTemplate> classList=new ArrayList<BlackListP2pHashStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListP2pHashStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())){ //P2p hash
|
||||
List<P2pHashStringTemplate> classList=new ArrayList<P2pHashStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, P2pHashStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
@@ -537,6 +539,24 @@ 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(34)&&serviceDict.getAction().equals(16)) {//SSL BLOCK
|
||||
List<BlackListStringTemplate> classList=new ArrayList<BlackListStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, BlackListStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if((regionDict.getFunctionId().equals(6)||regionDict.getFunctionId().equals(635)||regionDict.getFunctionId().equals(8)
|
||||
||regionDict.getFunctionId().equals(51)||regionDict.getFunctionId().equals(510)||regionDict.getFunctionId().equals(22)
|
||||
||regionDict.getFunctionId().equals(24)
|
||||
)&&serviceDict.getAction().equals(16)) {//URL, Advanced Website Keyword FTP Steaming Media BLOCK
|
||||
List<BlackListStringTemplate> classList=new ArrayList<BlackListStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, BlackListStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(6)&&serviceDict.getAction().equals(128)) {//URL WHITELIST
|
||||
List<StringAllNotDoLogTemplate> classList=new ArrayList<StringAllNotDoLogTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllNotDoLogTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2);
|
||||
@@ -582,6 +602,21 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if((regionDict.getFunctionId().equals(8))&&serviceDict.getAction().equals(16)) {// request header response header
|
||||
List<BlackListComplexStringTemplate> classList=new ArrayList<BlackListComplexStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListComplexStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(37)&&serviceDict!=null&&serviceDict.getAction().intValue()==128) {//mail whiltelist
|
||||
List<ComplexStringAllNotDoLogTemplate> classList=new ArrayList<ComplexStringAllNotDoLogTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(37)&&serviceDict!=null&&serviceDict.getAction().intValue()==16) {//mail Block
|
||||
List<BlackListComplexStringTemplate> classList=new ArrayList<BlackListComplexStringTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, BlackListComplexStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<ComplexStringAllTemplate> classList=new ArrayList<ComplexStringAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, ComplexStringAllTemplate.class, 2);
|
||||
@@ -600,7 +635,8 @@ public class IpController extends BaseController{
|
||||
}
|
||||
|
||||
//ip配置导入
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
@Deprecated
|
||||
// @RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
@@ -612,6 +648,160 @@ public class IpController extends BaseController{
|
||||
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify);
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIPList(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
ImportBigExcel ei=null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
try {
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
//------------------------------------check format start----------------------------
|
||||
if (serviceDict!=null&&serviceDict.getAction().equals(64)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpRateLimitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class
|
||||
);
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
} else if(serviceDict!=null&&serviceDict.getAction().equals(32)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllNotDoLogTemplate> list = ei.getDataList(IpAllNotDoLogTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
} else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("获取编译ID出错",e);
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(405)&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setUserRegion1(regionIds.get(ind).toString());
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSendIPList(regionDict, serviceDict, _ipPortCfgs, cfgIndexInfos,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@@ -725,7 +915,6 @@ 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();
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -17,31 +19,50 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -108,23 +129,15 @@ public class MailCfgController extends BaseController {
|
||||
logger.info("获取文件摘要响应信息:" + result);
|
||||
}
|
||||
mailCfgService.saveMailCfg(entity, result);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,28 +192,8 @@ public class MailCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateMailCfgValid" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -216,25 +209,22 @@ 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,Constants.INSERT_ACTION);
|
||||
mailCfgService.auditMailCfg(entity, isAudit);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,10 +240,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -407,10 +395,326 @@ 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();
|
||||
}
|
||||
@RequestMapping(value = {"mailImport"}, method=RequestMethod.POST)
|
||||
public String importMail(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if(serviceDict.getAction().intValue()==128) {
|
||||
ei.loadInitParams(ComplexStringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllNotDoLogTemplate> list = ei.getDataList(ComplexStringAllNotDoLogTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
mailCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
mailCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
mailCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,21 +8,29 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
@@ -33,12 +41,22 @@ import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -184,27 +202,9 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "saveHttpCfg" })
|
||||
@RequiresPermissions(value = { "website:http:config" })
|
||||
public String saveHttpCfg( HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
|
||||
|
||||
try {
|
||||
public String saveHttpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -218,28 +218,8 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateHttpCfgValid" })
|
||||
@RequiresPermissions(value = { "website:http:config" })
|
||||
public String updateHttpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateHttpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -255,20 +235,18 @@ 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,Constants.INSERT_ACTION);
|
||||
websiteCfgService.auditHttpCfg(entity, isAudit);
|
||||
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 {// 条件下所有配置审核
|
||||
@@ -283,10 +261,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -322,26 +298,9 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "saveSslCfg" })
|
||||
@RequiresPermissions(value = { "website:ssl:config" })
|
||||
public String saveSslCfg(HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
public String saveSslCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -389,28 +348,8 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateSslCfgValid" })
|
||||
@RequiresPermissions(value = { "website:ssl:config" })
|
||||
public String updateSslCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateSslCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -426,25 +365,22 @@ 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,Constants.INSERT_ACTION);
|
||||
websiteCfgService.auditSslCfg(entity, isAudit);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -460,10 +396,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -492,25 +426,8 @@ 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,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
String ids, CfgIndexInfo entity) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -553,28 +470,8 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "updateDnsCfgValid" })
|
||||
@RequiresPermissions(value = { "website:dns:config" })
|
||||
public String updateDnsCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateDnsCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -590,22 +487,20 @@ 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,Constants.INSERT_ACTION);
|
||||
websiteCfgService.auditDnsCfg(entity, isAudit);
|
||||
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 {// 条件下所有配置审核
|
||||
@@ -620,10 +515,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -633,6 +526,13 @@ public class WebsiteController extends BaseController {
|
||||
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
// 下载导入模板
|
||||
@RequestMapping(value = "import/template")
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
||||
}
|
||||
// http配置导入
|
||||
/*
|
||||
* @RequestMapping(value = "importHttp", method=RequestMethod.POST) public
|
||||
@@ -893,7 +793,6 @@ 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();
|
||||
@@ -1042,7 +941,6 @@ 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();
|
||||
@@ -1189,9 +1087,335 @@ 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();
|
||||
}
|
||||
@RequestMapping(value = {"dnsImport","sslImport","httpImport"}, method=RequestMethod.POST)
|
||||
public String importDns(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(regionDict.getFunctionId().intValue()==7&&serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(DnsIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DnsIpTemplate> list = ei.getDataList(DnsIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if((regionDict.getFunctionId().intValue()==34||regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
//加载模板
|
||||
ei.loadInitParams(BlackListIPTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListIPTemplate> list = ei.getDataList(BlackListIPTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(regionDict.getFunctionId().intValue()==7&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(DnsStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DnsStringTemplate> list = ei.getDataList(DnsStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if((regionDict.getFunctionId().intValue()==34||regionDict.getFunctionId().intValue()==635||regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if(regionDict.getFunctionId().equals(7)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(DnsComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DnsComplexStringTemplate> list = ei.getDataList(DnsComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if((regionDict.getFunctionId().intValue()==8)&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListComplexStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListComplexStringTemplate> list = ei.getDataList(BlackListComplexStringTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
websiteCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
websiteCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
websiteCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,61 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpWhitelistTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.configuration.template.WhiteListIpTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 白名单
|
||||
@@ -95,26 +121,9 @@ public class WhiteListController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "ip/save" })
|
||||
public String saveIpCfg(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes,
|
||||
public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo 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();
|
||||
}
|
||||
|
||||
@@ -130,18 +139,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,Constants.INSERT_ACTION);
|
||||
ipCfgService.auditIpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("ip配置下发失败:" + e.getMessage());
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip配置下发失败:" + e.getMessage());
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -156,10 +165,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -171,30 +178,8 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "updateIpValid" })
|
||||
@RequiresPermissions(value = { "whitelist:ip:config" })
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -211,8 +196,9 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "saveHttpUrlCfgs" })
|
||||
public String saveHttpUrlCfgs(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
CfgIndexInfo entity) throws Exception {
|
||||
CfgIndexInfo entity) {
|
||||
if (!StringUtil.isEmpty(entity) && !StringUtil.isEmpty(entity.getHttpUrlList())) {
|
||||
|
||||
CfgIndexInfo sourceCfg = websiteCfgService
|
||||
.getCfgIndexInfo(entity.getHttpUrlList().get(0).getSourceCompileId());
|
||||
for (HttpUrlCfg httpUrlCfg : entity.getHttpUrlList()) {
|
||||
@@ -254,26 +240,9 @@ public class WhiteListController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "domain/save" })
|
||||
public String saveOrUpdateDomain(RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response,
|
||||
public String saveOrUpdateDomain(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo 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();
|
||||
}
|
||||
|
||||
@@ -307,41 +276,20 @@ public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "domain/updateValid" })
|
||||
@RequiresPermissions(value = { "whitelist:domain:config" })
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId) {
|
||||
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,HttpServletRequest request) {
|
||||
public String deleteDomain(String ids, Integer functionId, RedirectAttributes model) {
|
||||
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;
|
||||
}
|
||||
@@ -358,22 +306,20 @@ 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,Constants.INSERT_ACTION);
|
||||
domainService.auditDomainCfg(entity, isAudit);
|
||||
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 {// 条件下所有配置审核
|
||||
@@ -388,10 +334,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -401,6 +345,164 @@ public class WhiteListController extends CommonController {
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
// ip配置导入
|
||||
/*
|
||||
* @RequestMapping(value = "ip/import", method=RequestMethod.POST) public
|
||||
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
*
|
||||
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
* this._importIp(cfgName,redirectAttributes,
|
||||
* file,cfg,WhiteListIpTemplate.class); return "redirect:" + adminPath
|
||||
* +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId(); }
|
||||
*/
|
||||
// ip模板下载
|
||||
@RequestMapping(value = "ip/import/template")
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
WhiteListIpTemplate.class);
|
||||
}
|
||||
@RequestMapping(value = "ip/import", method=RequestMethod.POST)
|
||||
public String importIPWhiteList(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
ImportBigExcel ei=null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
try {
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//加载模板
|
||||
ei.loadInitParams(IpWhitelistTemplate.class, properties, regionDict, serviceDict);
|
||||
//------------------------------------check format start----------------------------
|
||||
BlockingQueue<IpWhitelistTemplate> list = ei.getDataList(IpWhitelistTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("获取编译ID出错",e);
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(405)&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setUserRegion1(regionIds.get(ind).toString());
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSendIPList(regionDict, serviceDict, _ipPortCfgs, cfgIndexInfos,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "ip/export")
|
||||
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@@ -515,7 +617,6 @@ 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();
|
||||
@@ -626,10 +727,143 @@ 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();
|
||||
}
|
||||
@RequestMapping(value = "domain/import", method=RequestMethod.POST)
|
||||
public String importDomain(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(2)) {
|
||||
if(serviceDict.getAction().intValue()==128) {
|
||||
ei.loadInitParams(StringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllNotDoLogTemplate> list = ei.getDataList(StringAllNotDoLogTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(BlackListStringTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<BlackListStringTemplate> list = ei.getDataList(BlackListStringTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
domainService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ 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;
|
||||
|
||||
@@ -73,7 +72,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,HttpServletRequest request) {
|
||||
public String auditXmppCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
@@ -91,10 +90,8 @@ 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,7 +27,6 @@ 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;
|
||||
@@ -107,21 +106,14 @@ public class CachePolicyController extends BaseController{
|
||||
}
|
||||
}
|
||||
cachePolicyService.saveCachePolicy(cfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
addMessage(redirectAttributes,"success","save_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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,28 +157,8 @@ public class CachePolicyController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"cache:policy:config"})
|
||||
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)) {
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
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"})
|
||||
@@ -211,17 +183,15 @@ public class CachePolicyController extends BaseController{
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
cachePolicyService.auditCachePolicy(entity,isAudit,Constants.INSERT_ACTION);
|
||||
cachePolicyService.auditCachePolicy(entity,isAudit);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,10 +207,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -336,7 +304,6 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,11 @@ public class ControlController extends CommonController {
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","control:ip");
|
||||
return "redirect:" + adminPath +"/proxy/control/ip/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = "/ip/import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "/ip/export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
|
||||
@@ -3,7 +3,6 @@ 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;
|
||||
|
||||
@@ -25,7 +24,6 @@ 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;
|
||||
|
||||
@@ -69,23 +67,16 @@ public class ControlPolicyController extends BaseController{
|
||||
@ModelAttribute("cfg")HttpBodyCfg cfg,
|
||||
@ModelAttribute("areaCfgIds")String areaCfgIds
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
try{
|
||||
controlPolicyService.saveOrUpdate(cfg,areaCfgIds);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
} 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();
|
||||
@@ -101,22 +92,20 @@ public class ControlPolicyController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"httpReqReplace/audit"})
|
||||
public String reqAudit(Integer isAudit,Integer isValid,String ids
|
||||
,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
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,Constants.INSERT_ACTION);
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_REQ_KEY_VALUE);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,21 +146,13 @@ public class ControlPolicyController extends BaseController{
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
controlPolicyService.saveOrUpdate(cfg,areaCfgIds);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
addMessage(redirectAttributes,"success","save_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","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,23 +169,21 @@ public class ControlPolicyController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"httpResReplace/audit"})
|
||||
public String resAudit(Integer isAudit,Integer isValid,String ids
|
||||
,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
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,Constants.INSERT_ACTION);
|
||||
controlPolicyService.audit(isAudit,isValid,functionId,id,auditTime,Constants.REPLACE_RES_KEY_VALUE);
|
||||
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,7 +32,6 @@ 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;
|
||||
|
||||
@@ -118,21 +117,13 @@ public class FileStrategyController extends CommonController {
|
||||
cfg.setContentLength(file.length());//文件长度
|
||||
}
|
||||
proxyFileStrategyService.saveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
addMessage(redirectAttributes,"success","save_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","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}finally {
|
||||
if(file != null) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -15,17 +16,22 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
@@ -35,11 +41,27 @@ import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -189,22 +211,14 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
httpRedirectCfgService.saveHttpCfg(cfg);
|
||||
//配置仅保存
|
||||
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
}else {
|
||||
//配置直接生效
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("save_failed", 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,28 +238,8 @@ 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, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -267,17 +261,15 @@ public class HttpRedirectPolicyController extends BaseController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,10 +285,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -526,11 +516,373 @@ 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
|
||||
* +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
*/
|
||||
}
|
||||
@RequestMapping(value = {"import"}, method=RequestMethod.POST)
|
||||
public String importDns(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
ImportBigExcel ei=null;
|
||||
try {
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRejectIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRejectIpTemplate> list = ei.getDataList(HttpsRejectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRedirectIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRedirectIpTemplate> list = ei.getDataList(HttpsRedirectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsReplaceIpTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsReplaceIpTemplate> list = ei.getDataList(HttpsReplaceIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllNotDoLogTemplate> list = ei.getDataList(IpAllNotDoLogTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {
|
||||
if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRejectTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRejectTemplate> list = ei.getDataList(HttpsRejectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRedirectTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRedirectTemplate> list = ei.getDataList(HttpsRedirectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsReplaceTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsReplaceTemplate> list = ei.getDataList(HttpsReplaceTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(StringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllNotDoLogTemplate> list = ei.getDataList(StringAllNotDoLogTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(StringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(3)) {
|
||||
if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRejectComplexTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRejectComplexTemplate> list = ei.getDataList(HttpsRejectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsRedirectComplexTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsRedirectComplexTemplate> list = ei.getDataList(HttpsRedirectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
//加载模板
|
||||
ei.loadInitParams(HttpsReplaceComplexTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<HttpsReplaceComplexTemplate> list = ei.getDataList(HttpsReplaceComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(ComplexStringAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllNotDoLogTemplate> list = ei.getDataList(ComplexStringAllNotDoLogTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
List<BaseIpCfg> _ipPortCfgs=com.beust.jcommander.internal.Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取域ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
|
||||
httpRedirectCfgService.saveAndSend(regionDict, cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if (regionDict.getRegionType().equals(2)) {//账号
|
||||
List<BaseStringCfg<?>> _stringCfgs=com.beust.jcommander.internal.Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
httpRedirectCfgService.saveAndSend(regionDict, cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {//dns
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=com.beust.jcommander.internal.Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
if(cfg.getDnsStrategyId()!=null) {
|
||||
cfgIndexInfo.setDnsStrategyId(Long.parseLong(cfg.getDnsStrategyId().toString()));
|
||||
}
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
httpRedirectCfgService.saveAndSend(regionDict, cfgIndexInfos, _complexkeywordCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,32 +8,59 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.InterceptPktBin;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
import com.nis.domain.configuration.template.BlackListComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListIPTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListP2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.BlackListStringTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.IpSpoofingTemplate;
|
||||
import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -111,22 +138,13 @@ public class InterceptController extends CommonController {
|
||||
HttpServletResponse response, String ids, CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptCfg(entity);
|
||||
//配置仅保存
|
||||
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();
|
||||
@@ -185,16 +203,14 @@ public class InterceptController extends CommonController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
interceptCfgService.auditInterceptIpCfg(entity, isAudit,Constants.INSERT_ACTION);
|
||||
interceptCfgService.auditInterceptIpCfg(entity, isAudit);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,10 +225,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -223,20 +237,14 @@ public class InterceptController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "updateInterceptIpValid", "updateInterceptDomainValid", "updateInterceptIpPayloadValid" })
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
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;
|
||||
}
|
||||
@@ -270,7 +278,248 @@ public class InterceptController extends CommonController {
|
||||
* redirectAttributes){ this._exportIp(columns,model, request, response,
|
||||
* entity, ids, redirectAttributes); }
|
||||
*/
|
||||
|
||||
@RequestMapping(value = {"/ippayload/import","/ip/import","/domain/import"}, method=RequestMethod.POST)
|
||||
public String importIPList(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String attribute
|
||||
,String classify
|
||||
,String regionDictIds
|
||||
,String importPath) {
|
||||
logger.warn("import start...");
|
||||
long start=System.currentTimeMillis();
|
||||
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
StringBuffer errTip=new StringBuffer();
|
||||
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
ImportBigExcel ei=null;
|
||||
Properties properties=this.getMsgProp();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
FunctionRegionDict regionDict = DictUtils
|
||||
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
try {
|
||||
ei = new ImportBigExcel(file, 0, 1);
|
||||
//------------------------------------check format start----------------------------
|
||||
if (regionDict.getFunctionId().equals(212)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpPayloadTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpPayloadTemplate> list = ei.getDataList(IpPayloadTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
|
||||
} else if(regionDict.getFunctionId().equals(214)) { // IpSpoofing
|
||||
//加载模板
|
||||
ei.loadInitParams(IpSpoofingTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpSpoofingTemplate> list = ei.getDataList(IpSpoofingTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
} else if(regionDict.getFunctionId().equals(200)) {//Intercept Policy
|
||||
if(regionDict.getDictId().equals(53)) {
|
||||
if(serviceDict.getAction().equals(64)) {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpRateLimitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
}else {
|
||||
//加载模板
|
||||
ei.loadInitParams(IpAllNotDoLogTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<IpAllNotDoLogTemplate> list = ei.getDataList(IpAllNotDoLogTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,null, list);
|
||||
}
|
||||
}
|
||||
if(regionDict.getDictId().equals(56)) {
|
||||
if(serviceDict.getAction().equals(1)){// 监测
|
||||
//加载模板
|
||||
ei.loadInitParams(DomainInterceptMonitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DomainInterceptMonitTemplate> list = ei.getDataList(DomainInterceptMonitTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(serviceDict.getAction().equals(64)){// 限速
|
||||
//加载模板
|
||||
ei.loadInitParams(DomainInterceptRateLimitTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DomainInterceptRateLimitTemplate> list = ei.getDataList(DomainInterceptRateLimitTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else{// 白名单
|
||||
//加载模板
|
||||
ei.loadInitParams(DomainInterceptTemplate.class, properties, regionDict, serviceDict);
|
||||
BlockingQueue<DomainInterceptTemplate> list = ei.getDataList(DomainInterceptTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------check format end----------------------------
|
||||
//删除文件
|
||||
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
Date date = new Date();
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
if (regionDict.getRegionType().equals(1)) {// IP
|
||||
while(!ipPortCfgs.isEmpty()) {
|
||||
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_ipPortCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseIpCfg cfg : _ipPortCfgs) {
|
||||
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
if(compileIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(212)||regionDict.getFunctionId().equals(200)) {// IP Payload ,Intercept Policy
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
if(serviceDict.getFunctionId().equals(214)) {// IpSpoofing
|
||||
interceptCfgService.saveAndSendSpoofingIpPool(_ipPortCfgs, cfgIndexInfos,isSend.equals("1"));
|
||||
}else {
|
||||
interceptCfgService.saveAndSend(regionDict,cfgIndexInfos, _ipPortCfgs, isSend.equals("1"));
|
||||
}
|
||||
cfgIndexInfos.clear();
|
||||
_ipPortCfgs.clear();
|
||||
}
|
||||
}else if(regionDict.getRegionType().equals(2)){//String
|
||||
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
//cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
ind++;
|
||||
}
|
||||
interceptCfgService.saveAndSend(regionDict,cfgIndexInfos, _stringCfgs, isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
}
|
||||
if(errTip.toString().length()>0) {
|
||||
addMessage(redirectAttributes,"error", errTip.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if(ei!=null) {
|
||||
if(ei.getUploadFile().exists()) {
|
||||
ei.getUploadFile().delete();
|
||||
}
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else if(e instanceof ServiceException) {
|
||||
addMessage(redirectAttributes,"error", e.getMessage());
|
||||
}else if(e instanceof IndexOutOfBoundsException){
|
||||
addMessage(redirectAttributes,"error", "template_error");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "import_failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@@ -399,15 +648,6 @@ public class InterceptController extends CommonController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (214==entity.getFunctionId()) {
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
if (!StringUtil.isBlank(cfg.getUserRegion1())) {
|
||||
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList);
|
||||
httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
@@ -466,7 +706,6 @@ 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,7 +57,6 @@ 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;
|
||||
|
||||
@@ -102,8 +101,8 @@ public class PxyObjKeyringController extends BaseController {
|
||||
boolean validFlag = true;
|
||||
try {
|
||||
Properties msgProp = this.getMsgProp();
|
||||
boolean publicKeyFileflag = validCertFileContent(publicKeyFileI,null, "-incert");
|
||||
boolean privateKeyFileflag = validCertFileContent(privateKeyFileI,null, "-inkey");
|
||||
boolean publicKeyFileflag = validCertFileContent(publicKeyFileI, "-incert");
|
||||
boolean privateKeyFileflag = validCertFileContent(privateKeyFileI, "-inkey");
|
||||
if (!publicKeyFileflag && !privateKeyFileflag) {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
logger.error(publicKeyFileI.getOriginalFilename() + " and " + privateKeyFileI.getOriginalFilename()
|
||||
@@ -118,28 +117,15 @@ 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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else if (e instanceof MultiPartNewException) {
|
||||
} else if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,13 +181,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 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 {
|
||||
@@ -255,27 +238,18 @@ public class PxyObjKeyringController extends BaseController {
|
||||
}
|
||||
}
|
||||
pxyObjKeyringService.saveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
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);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId();
|
||||
@@ -291,7 +265,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean validCertFileContent(MultipartFile file,MultipartFile privateFile, String validateType) throws Exception {
|
||||
public boolean validCertFileContent(MultipartFile file, String validateType) throws Exception {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (!os.contains("windows") && file != null) {
|
||||
// 证书文件临时保存路径
|
||||
@@ -299,16 +273,8 @@ 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();
|
||||
@@ -317,8 +283,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+ " " + privateFilePath);
|
||||
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath, privateFilePath);
|
||||
logger.info(x509Shell + " " + validateType + " " + filePath);
|
||||
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath);
|
||||
|
||||
if (resultMap == null || StringUtil.isEmpty(resultMap.get("out"))) {
|
||||
// 临时文件删除
|
||||
@@ -362,27 +328,10 @@ 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, @ModelAttribute("cfg")PxyObjKeyring cfg,
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
@@ -403,11 +352,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,10 +370,8 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -508,7 +453,6 @@ 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();
|
||||
@@ -574,7 +518,6 @@ 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();
|
||||
@@ -618,7 +561,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
File file = null;
|
||||
boolean validFlag = true;
|
||||
try {
|
||||
boolean certFileflag = validCertFileContent(certFileI,null, "-incert");
|
||||
boolean certFileflag = validCertFileContent(certFileI, "-incert");
|
||||
if (!certFileflag) {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
logger.error(certFileI.getOriginalFilename() + " file non Certificate file format ");
|
||||
@@ -629,13 +572,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,7 +596,6 @@ public class PxyObjKeyringController extends BaseController {
|
||||
validFlag = false;
|
||||
logger.error("证书信息获取失败", e);
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
try {
|
||||
if (validFlag) {
|
||||
@@ -687,27 +624,18 @@ public class PxyObjKeyringController extends BaseController {
|
||||
}
|
||||
}
|
||||
pxyObjKeyringService.trustedCertsaveOrUpdate(cfg);
|
||||
//配置仅保存
|
||||
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);
|
||||
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");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
|
||||
@@ -725,7 +653,7 @@ public class PxyObjKeyringController extends BaseController {
|
||||
boolean validFlag = true;
|
||||
try {
|
||||
if (crlFileI != null) {
|
||||
boolean certFileflag = validCertFileContent(crlFileI,null, "-incrl");
|
||||
boolean certFileflag = validCertFileContent(crlFileI, "-incrl");
|
||||
if (!certFileflag) {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
logger.error(crlFileI.getOriginalFilename() + " file non crl file format ");
|
||||
@@ -737,13 +665,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 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,10 +700,8 @@ 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 {
|
||||
@@ -815,13 +738,10 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,27 +860,11 @@ 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, @ModelAttribute PxyObjTrustedCaCert cfg) {
|
||||
try {
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -979,12 +883,10 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1000,10 +902,8 @@ 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,7 +56,6 @@ 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;
|
||||
|
||||
@@ -120,10 +119,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,11 +171,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +255,6 @@ 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,7 +45,6 @@ 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;
|
||||
@@ -81,7 +80,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="portActive")
|
||||
@ResponseBody
|
||||
public List portActive(HttpServletRequest request){
|
||||
public List portActive(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -95,7 +94,6 @@ 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;
|
||||
}
|
||||
@@ -105,7 +103,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="portActiveChart")
|
||||
@ResponseBody
|
||||
public List portActiveChart(String beginDate,String endDate,HttpServletRequest request){
|
||||
public List portActiveChart(String beginDate,String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -122,7 +120,6 @@ public class DashboardController extends BaseController{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("活跃端口详情界面数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -148,7 +145,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="ipActive")
|
||||
@ResponseBody
|
||||
public List ipActive(String beginDate,String endDate,HttpServletRequest request){
|
||||
public List ipActive(String beginDate,String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -164,7 +161,6 @@ 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;
|
||||
}
|
||||
@@ -173,7 +169,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="ipActiveMinuteList")
|
||||
@ResponseBody
|
||||
public List ipActiveMinuteList(String beginDate,String endDate,Integer entranceId,HttpServletRequest request){
|
||||
public List ipActiveMinuteList(String beginDate,String endDate,Integer entranceId){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -192,7 +188,6 @@ 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;
|
||||
}
|
||||
@@ -243,7 +238,6 @@ 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";
|
||||
@@ -253,7 +247,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="ajaxIpActiveList")
|
||||
@ResponseBody
|
||||
public List ajaxIpActiveList(String beginDate,String endDate,Integer entranceId,HttpServletRequest request){
|
||||
public List ajaxIpActiveList(String beginDate,String endDate,Integer entranceId){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<TrafficIpActiveStatistic> list = new ArrayList<TrafficIpActiveStatistic>();
|
||||
try {
|
||||
@@ -300,7 +294,6 @@ 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;
|
||||
@@ -348,7 +341,6 @@ 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";
|
||||
}
|
||||
@@ -357,7 +349,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="protocol")
|
||||
@ResponseBody
|
||||
public List protocolChart(HttpServletRequest request){
|
||||
public List protocolChart(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -397,7 +389,6 @@ 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;
|
||||
}
|
||||
@@ -406,7 +397,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="app")
|
||||
@ResponseBody
|
||||
public List appChart(HttpServletRequest request){
|
||||
public List appChart(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -437,7 +428,6 @@ 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;
|
||||
}
|
||||
@@ -446,7 +436,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="osList")
|
||||
@ResponseBody
|
||||
public List osList(HttpServletRequest request){
|
||||
public List osList(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -477,7 +467,6 @@ 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;
|
||||
}
|
||||
@@ -486,7 +475,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="browserChart")
|
||||
@ResponseBody
|
||||
public List browserChart(@RequestParam("osType") String osType,HttpServletRequest request){
|
||||
public List browserChart(@RequestParam("osType") String osType){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -535,7 +524,6 @@ 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;
|
||||
}
|
||||
@@ -544,7 +532,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="bsList")
|
||||
@ResponseBody
|
||||
public List bsList(HttpServletRequest request){
|
||||
public List bsList(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -575,7 +563,6 @@ 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;
|
||||
}
|
||||
@@ -584,7 +571,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="systemChart")
|
||||
@ResponseBody
|
||||
public List systemChart(@RequestParam("bsType") String bsType,HttpServletRequest request){
|
||||
public List systemChart(@RequestParam("bsType") String bsType){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -633,7 +620,6 @@ 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;
|
||||
}
|
||||
@@ -642,7 +628,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="websiteList")
|
||||
@ResponseBody
|
||||
public List websiteList(HttpServletRequest request){
|
||||
public List websiteList(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -679,7 +665,6 @@ 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;
|
||||
}
|
||||
@@ -688,7 +673,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="webTypeChart")
|
||||
@ResponseBody
|
||||
public List webTypeChart(@RequestParam("websiteServiceId") String websiteServiceId,HttpServletRequest request){
|
||||
public List webTypeChart(@RequestParam("websiteServiceId") String websiteServiceId){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -730,7 +715,6 @@ 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;
|
||||
}
|
||||
@@ -740,7 +724,7 @@ public class DashboardController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="topicAndDomainList")
|
||||
@ResponseBody
|
||||
public List topicAndDomainList(HttpServletRequest request){
|
||||
public List topicAndDomainList(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
@@ -798,7 +782,6 @@ 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,7 +46,6 @@ 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;
|
||||
@@ -65,7 +64,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="info")
|
||||
@ResponseBody
|
||||
public Map ipActive(HttpServletRequest request){
|
||||
public Map ipActive(){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
HashMap<String, Object> m = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
@@ -115,7 +114,6 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("统计流量信息数据错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
@@ -151,7 +149,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="actionEntranceTrans")
|
||||
@ResponseBody
|
||||
public List actionTrans(String beginDate,String endDate,@RequestParam("searchAction")String searchAction,HttpServletRequest request){
|
||||
public List actionTrans(String beginDate,String endDate,@RequestParam("searchAction")String searchAction){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List resultList = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.NTC_ACTION_ENTRANCE_REPORT;
|
||||
@@ -167,7 +165,6 @@ 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;
|
||||
}
|
||||
@@ -199,7 +196,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,HttpServletRequest request){
|
||||
public Map bandwidthTrans(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS;
|
||||
@@ -224,7 +221,6 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("带宽详情数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -233,7 +229,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,HttpServletRequest request){
|
||||
public Map bandwidthTransTwo(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
|
||||
@@ -258,7 +254,6 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("带宽详情数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -267,7 +262,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="bandwidthTransThree")
|
||||
@ResponseBody
|
||||
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType,String searchDirection,Model model,HttpServletRequest request){
|
||||
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType,String searchDirection,Model model){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
//String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
|
||||
@@ -290,7 +285,6 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("带宽详情数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -313,7 +307,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,HttpServletRequest request){
|
||||
public List protocolList(Model model,Integer entranceId,Integer[] protoType,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,@RequestParam(required=false)String searchDirection){
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
@@ -383,7 +377,6 @@ 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;
|
||||
}
|
||||
@@ -406,7 +399,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,HttpServletRequest request){
|
||||
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){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_LIST;
|
||||
@@ -464,7 +457,6 @@ 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;
|
||||
}
|
||||
@@ -503,7 +495,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,HttpServletRequest request){
|
||||
public Map ajaxAppTrend(String beginDate,String endDate,Integer appType,Integer entranceId,String searchQuotaType,Integer[] searchIspCode,Model model){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map list = new HashMap();
|
||||
try {
|
||||
@@ -541,13 +533,12 @@ 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,HttpServletRequest request){
|
||||
public List ajaxAppTopList(String beginDate,String endDate,Integer appType,Integer entranceId,Integer searchQuota,Integer[] searchIspCode,Model model){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
try {
|
||||
@@ -593,7 +584,6 @@ 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;
|
||||
}
|
||||
@@ -626,7 +616,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
@RequestMapping("ajaxDomainTrans")
|
||||
@ResponseBody
|
||||
public List ajaxDomainTrans(String beginDate,String endDate,Integer domain,Integer entranceId,Model model,HttpServletRequest request){
|
||||
public List ajaxDomainTrans(String beginDate,String endDate,Integer domain,Integer entranceId,Model model){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
@@ -648,7 +638,6 @@ 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;
|
||||
}
|
||||
@@ -657,7 +646,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,HttpServletRequest request){
|
||||
public List websiteList(Integer entranceId,Integer[] domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST_NOTIME;
|
||||
@@ -753,7 +742,6 @@ 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;
|
||||
}
|
||||
@@ -763,7 +751,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,HttpServletRequest request){
|
||||
public List statisticList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_TOPICLIST;
|
||||
@@ -828,7 +816,6 @@ 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;
|
||||
}
|
||||
@@ -849,7 +836,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
@RequestMapping("ajaxNtcTotalReportDetail")
|
||||
@ResponseBody
|
||||
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction,HttpServletRequest request){
|
||||
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
try {
|
||||
@@ -895,7 +882,6 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("动作详情统计一小时数据获取错误"+e);
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ 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;
|
||||
@@ -204,7 +203,6 @@ 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";
|
||||
}
|
||||
@@ -285,7 +283,6 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -506,7 +503,6 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.CodeDicUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -108,7 +107,6 @@ public class DkBehaviorLogController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("查询行为识别日志失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "/log/manipulation/dkBehaviorList";
|
||||
}
|
||||
@@ -210,7 +208,6 @@ public class DkBehaviorLogController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error(name +" export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.CodeDicUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.dashboard.codedic.CodeResult;
|
||||
@@ -91,7 +90,6 @@ public class AppLogController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
logger.error("查询App日志失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "/log/ntc/appList";
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.nis.domain.log.NtcCollectRadiusLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -77,7 +76,6 @@ public class BgpLogController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "/log/ntc/bgpList";
|
||||
@@ -148,7 +146,6 @@ public class BgpLogController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("bgp_control export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ 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.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.dashboard.codedic.CodeResult;
|
||||
@@ -169,7 +168,6 @@ public class CollectVoipLogController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("查询VoIP泛收日志失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
return "/log/ntc/collectVoipList";
|
||||
}
|
||||
@@ -295,7 +293,6 @@ public class CollectVoipLogController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("collect_voip export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_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