Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop
This commit is contained in:
@@ -167,7 +167,7 @@ public class SysUser extends BaseEntity<SysUser> {
|
||||
}
|
||||
|
||||
public static boolean isAdmin(String loginId){
|
||||
return loginId != null && "admin".equals(loginId);
|
||||
return loginId != null && "ceiec".equals(loginId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Date;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @ClassName: PolicyGroupInfo.java
|
||||
@@ -18,9 +19,12 @@ public class PolicyGroupInfo extends BaseCfg<PolicyGroupInfo> implements Seriali
|
||||
private static final long serialVersionUID = 7931466570918016654L;
|
||||
|
||||
private Integer groupId;
|
||||
@ExcelField(title="group_name",sort=1)
|
||||
private String groupName;
|
||||
@ExcelField(title="group_type",dictType="GROUP_TYPE",sort=2)
|
||||
private Integer groupType;
|
||||
private Integer serviceGroupId;
|
||||
@ExcelField(title="desc",sort=4)
|
||||
private String description;
|
||||
private Long asnNo;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.nis.domain.SysMenu;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
/**
|
||||
* 业务辅助表-业务字典信息表
|
||||
* @author zsl
|
||||
@@ -21,16 +22,24 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
|
||||
private static final long serialVersionUID = 4680466118906894338L;
|
||||
|
||||
private Integer serviceDictId; //service_dict_id 字典ID int N 主键,自增
|
||||
@ExcelField(title="item_type",dictType="SERVICE_DICT_ITM_TYPE",sort=3)
|
||||
private Integer itemType; //item_type 数据类型 int N 1:分类 2:性质 3:标签
|
||||
private String itemCode; //item_code编码 varchar(64) N
|
||||
private String itemCode; //item_code编码 varchar(64) N
|
||||
@ExcelField(title="config_content",sort=1)
|
||||
private String itemValue; //item_value 编码对应值 varchar2(64) N
|
||||
@ExcelField(title="desc",sort=2)
|
||||
private String itemDesc; //item_desc 描述信息 varcahr2(128) Y
|
||||
private ServiceDictInfo parent; //parent_id 父ID number(9) N 无父属性,默认填0
|
||||
@ExcelField(title="is_leaf",dictType="INT_YES_NO",sort=4)
|
||||
private Integer isLeaf; //is_leaf 是否叶子节点 int N 0-否 1-是;只有一级填0;
|
||||
private Integer isValid; //is_valid 有效标志 int N 1-有效 0-无效
|
||||
|
||||
private SysUser serviceDictCreator; //creator_id 创建人员 int N 取自sys_user.id
|
||||
@ExcelField(title="create_time",sort=6)
|
||||
private Date createTime; //create_time 配置时间 date N
|
||||
|
||||
private SysUser serviceDictEditor; //editor_id 修改人员 int Y 取自sys_user.id
|
||||
@ExcelField(title="edit_time",sort=8)
|
||||
private Date editTime; //edit_time 修改时间 date Y
|
||||
private Integer levelNo; //层级
|
||||
private List<ServiceDictInfo> childrenList = new ArrayList<ServiceDictInfo>();//子列表
|
||||
@@ -41,6 +50,11 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
|
||||
private Date editEndDate; // 修改结束日期
|
||||
|
||||
private String showSequence; //显示序号
|
||||
@ExcelField(title="creator",sort=5)
|
||||
private String creatorName;
|
||||
@ExcelField(title="editor",sort=7)
|
||||
private String editorName;
|
||||
|
||||
|
||||
private String pNames;//父节点名称
|
||||
/**
|
||||
@@ -49,6 +63,20 @@ public class ServiceDictInfo extends BaseEntity<ServiceDictInfo>{
|
||||
*/
|
||||
private List<Integer> conditionType;
|
||||
|
||||
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
public String getEditorName() {
|
||||
return editorName;
|
||||
}
|
||||
public void setEditorName(String editorName) {
|
||||
this.editorName = editorName;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getpNames() {
|
||||
return pNames;
|
||||
|
||||
@@ -43,6 +43,19 @@ public class AppComplexFeatureCfg extends BaseCfg<AppComplexFeatureCfg> {
|
||||
private String appName;
|
||||
private List<AppIpCfg> ipPortList = new ArrayList();
|
||||
private String cfgRegionCode1;
|
||||
//以下参数为APP PAYLOAD L3_HEADER的特殊属性(使用偏移表达式处理)
|
||||
private String ver;
|
||||
private String ihl;
|
||||
private String tos;
|
||||
private String totalLength;
|
||||
private String flags;
|
||||
private String fragmentOffset;
|
||||
private String protocol;
|
||||
private String icmpType;
|
||||
private String icmpCode;
|
||||
private String icmpIdentifier;
|
||||
private String headerType;
|
||||
|
||||
public String getCfgRegionCode1() {
|
||||
return cfgRegionCode1;
|
||||
}
|
||||
@@ -197,5 +210,94 @@ public class AppComplexFeatureCfg extends BaseCfg<AppComplexFeatureCfg> {
|
||||
public void setIpPortList(List<AppIpCfg> ipPortList) {
|
||||
this.ipPortList = ipPortList;
|
||||
}
|
||||
|
||||
public String getVer() {
|
||||
return ver;
|
||||
}
|
||||
|
||||
public void setVer(String ver) {
|
||||
this.ver = ver;
|
||||
}
|
||||
|
||||
public String getIhl() {
|
||||
return ihl;
|
||||
}
|
||||
|
||||
public void setIhl(String ihl) {
|
||||
this.ihl = ihl;
|
||||
}
|
||||
|
||||
public String getTos() {
|
||||
return tos;
|
||||
}
|
||||
|
||||
public void setTos(String tos) {
|
||||
this.tos = tos;
|
||||
}
|
||||
|
||||
public String getTotalLength() {
|
||||
return totalLength;
|
||||
}
|
||||
|
||||
public void setTotalLength(String totalLength) {
|
||||
this.totalLength = totalLength;
|
||||
}
|
||||
|
||||
public String getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
public void setFlags(String flags) {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
public String getFragmentOffset() {
|
||||
return fragmentOffset;
|
||||
}
|
||||
|
||||
public void setFragmentOffset(String fragmentOffset) {
|
||||
this.fragmentOffset = fragmentOffset;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpType(String icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public String getIcmpCode() {
|
||||
return icmpCode;
|
||||
}
|
||||
|
||||
public void setIcmpCode(String icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
}
|
||||
|
||||
public String getIcmpIdentifier() {
|
||||
return icmpIdentifier;
|
||||
}
|
||||
|
||||
public void setIcmpIdentifier(String icmpIdentifier) {
|
||||
this.icmpIdentifier = icmpIdentifier;
|
||||
}
|
||||
|
||||
public String getHeaderType() {
|
||||
return headerType;
|
||||
}
|
||||
|
||||
public void setHeaderType(String headerType) {
|
||||
this.headerType = headerType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ public class AvFileSampleCfg extends BaseCfg<AvFileSampleCfg> {
|
||||
private String indexTable="av_file_sample_cfg";
|
||||
@Expose
|
||||
@SerializedName("srcFile")
|
||||
@ExcelField(title="src_file",sort=2)
|
||||
@ExcelField(title="src_file",sort=3)
|
||||
private String srcUrl;
|
||||
@Expose
|
||||
@SerializedName("dstFile")
|
||||
@ExcelField(title="sample_file",sort=3)
|
||||
@ExcelField(title="sample_file",sort=4)
|
||||
private String sampleUrl;
|
||||
@Expose
|
||||
@SerializedName("srcFileMd5")
|
||||
|
||||
@@ -261,18 +261,20 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
*/
|
||||
@ExcelField(title="do_log",dictType="DO_LOG",sort=30)
|
||||
protected Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
|
||||
@ExcelField(title="do_blacklist",dictType="DO_BLACKLIST",sort=31)
|
||||
protected Integer doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
|
||||
|
||||
protected Integer groupId;//仅用于copy属性使用
|
||||
protected Integer regionId;//仅用于copy属性使用
|
||||
// protected Integer numberRegionGroupId;//仅用于copy属性使用
|
||||
protected Integer numberRegionGroupId;//仅用于copy属性使用
|
||||
protected Integer numberRegionRegionId;//仅用于copy属性使用
|
||||
|
||||
// public Integer getNumberRegionGroupId() {
|
||||
// return numberRegionGroupId;
|
||||
// }
|
||||
// public void setNumberRegionGroupId(Integer numberRegionGroupId) {
|
||||
// this.numberRegionGroupId = numberRegionGroupId;
|
||||
// }
|
||||
public Integer getNumberRegionGroupId() {
|
||||
return numberRegionGroupId;
|
||||
}
|
||||
public void setNumberRegionGroupId(Integer numberRegionGroupId) {
|
||||
this.numberRegionGroupId = numberRegionGroupId;
|
||||
}
|
||||
public Integer getNumberRegionRegionId() {
|
||||
return numberRegionRegionId;
|
||||
}
|
||||
@@ -964,5 +966,11 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
public void setCancelRequestId(Integer cancelRequestId) {
|
||||
this.cancelRequestId = cancelRequestId;
|
||||
}
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,28 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
protected Integer appCode;//仅用于copy属性使用
|
||||
protected Integer behavCode;//仅用于copy属性使用
|
||||
protected Integer specServiceId;//仅用于copy属性使用
|
||||
protected String antiddosProtocol;//仅用于copy属性使用
|
||||
protected Long bpsThreadshold;//仅用于copy属性使用
|
||||
protected Long ppsThreadshold;//仅用于copy属性使用
|
||||
|
||||
public String getAntiddosProtocol() {
|
||||
return antiddosProtocol;
|
||||
}
|
||||
public void setAntiddosProtocol(String antiddosProtocol) {
|
||||
this.antiddosProtocol = antiddosProtocol;
|
||||
}
|
||||
public Long getBpsThreadshold() {
|
||||
return bpsThreadshold;
|
||||
}
|
||||
public void setBpsThreadshold(Long bpsThreadshold) {
|
||||
this.bpsThreadshold = bpsThreadshold;
|
||||
}
|
||||
public Long getPpsThreadshold() {
|
||||
return ppsThreadshold;
|
||||
}
|
||||
public void setPpsThreadshold(Long ppsThreadshold) {
|
||||
this.ppsThreadshold = ppsThreadshold;
|
||||
}
|
||||
public Integer getAppCode() {
|
||||
return appCode;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,14 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
|
||||
protected Integer behavCode;//仅用于copy属性使用
|
||||
protected Integer specServiceId;//仅用于copy属性使用
|
||||
protected String domain;//仅用于copy属性使用
|
||||
protected Integer dnsStrategyId;//仅用作复制属性使用
|
||||
|
||||
public Integer getDnsStrategyId() {
|
||||
return dnsStrategyId;
|
||||
}
|
||||
public void setDnsStrategyId(Integer dnsStrategyId) {
|
||||
this.dnsStrategyId = dnsStrategyId;
|
||||
}
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
*@Title: HttpDomainConfig.java
|
||||
*@Package com.nis.domain.restful
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年2月5日 下午5:33:05
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @ClassName: HttpDomainConfig.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年2月5日 下午5:33:05
|
||||
* @version V1.0
|
||||
*/
|
||||
public class CachePolicyUserRegion extends BaseCfg<CachePolicyUserRegion> {
|
||||
|
||||
private static final long serialVersionUID = -1741829305216502322L;
|
||||
|
||||
@ExcelField(title="cache_cookied_cont",dictType="CACHE_COOKIED_CONT",sort=7)
|
||||
private String cache_cookied_cont;
|
||||
@ExcelField(title="cache_dyn_url",dictType="CACHE_DYN_URL",sort=6)
|
||||
private String cache_dyn_url;
|
||||
@ExcelField(title="force_caching",dictType="FORCE_CACHING",sort=10)
|
||||
private String force_caching;
|
||||
@ExcelField(title="ignore_req_nocache",dictType="IGNORE_REQ_NOCACHE",sort=8)
|
||||
private String ignore_req_nocache;
|
||||
@ExcelField(title="ignore_res_nocache",dictType="IGNORE_RES_NOCACHE",sort=9)
|
||||
private String ignore_res_nocache;
|
||||
@ExcelField(title="inactive_time",sort=14)
|
||||
private String inactive_time;
|
||||
@ExcelField(title="max_cache_obj_size",sort=15)
|
||||
private String max_cache_obj_size;
|
||||
@ExcelField(title="max_cache_size",sort=13)
|
||||
private String max_cache_size;
|
||||
@ExcelField(title="min_use",sort=11)
|
||||
private String min_use;
|
||||
@ExcelField(title="no_revalidate",dictType="CACHE_NO_REVALIDATE",sort=5)
|
||||
private String no_revalidate;
|
||||
@ExcelField(title="pinning_time",dictType="",sort=12)
|
||||
private String pinning_time;
|
||||
@ExcelField(title="ignore_query_string",sort=3)
|
||||
private String ignore_qs;
|
||||
@ExcelField(title="include_cookie",sort=4)
|
||||
private String cookie;
|
||||
|
||||
private Map<String,String> cache_key;
|
||||
|
||||
private BaseStringCfg strCfg;
|
||||
|
||||
@ExcelField(title="action",sort=2)
|
||||
protected String actionCode;
|
||||
|
||||
|
||||
public String getActionCode() {
|
||||
return actionCode;
|
||||
}
|
||||
public void setActionCode(String actionCode) {
|
||||
this.actionCode = actionCode;
|
||||
}
|
||||
public BaseStringCfg getStrCfg() {
|
||||
return strCfg;
|
||||
}
|
||||
public void setStrCfg(BaseStringCfg strCfg) {
|
||||
this.strCfg = strCfg;
|
||||
}
|
||||
public Map<String, String> getCache_key() {
|
||||
return cache_key;
|
||||
}
|
||||
public void setCache_key(Map<String, String> cache_key) {
|
||||
this.cache_key = cache_key;
|
||||
}
|
||||
public String getIgnore_res_nocache() {
|
||||
return ignore_res_nocache;
|
||||
}
|
||||
public void setIgnore_res_nocache(String ignore_res_nocache) {
|
||||
this.ignore_res_nocache = ignore_res_nocache;
|
||||
}
|
||||
public String getCache_cookied_cont() {
|
||||
return cache_cookied_cont;
|
||||
}
|
||||
public void setCache_cookied_cont(String cache_cookied_cont) {
|
||||
this.cache_cookied_cont = cache_cookied_cont;
|
||||
}
|
||||
public String getCache_dyn_url() {
|
||||
return cache_dyn_url;
|
||||
}
|
||||
public void setCache_dyn_url(String cache_dyn_url) {
|
||||
this.cache_dyn_url = cache_dyn_url;
|
||||
}
|
||||
public String getForce_caching() {
|
||||
return force_caching;
|
||||
}
|
||||
public void setForce_caching(String force_caching) {
|
||||
this.force_caching = force_caching;
|
||||
}
|
||||
public String getIgnore_req_nocache() {
|
||||
return ignore_req_nocache;
|
||||
}
|
||||
public void setIgnore_req_nocache(String ignore_req_nocache) {
|
||||
this.ignore_req_nocache = ignore_req_nocache;
|
||||
}
|
||||
public String getInactive_time() {
|
||||
return inactive_time;
|
||||
}
|
||||
public void setInactive_time(String inactive_time) {
|
||||
this.inactive_time = inactive_time;
|
||||
}
|
||||
public String getMax_cache_obj_size() {
|
||||
return max_cache_obj_size;
|
||||
}
|
||||
public void setMax_cache_obj_size(String max_cache_obj_size) {
|
||||
this.max_cache_obj_size = max_cache_obj_size;
|
||||
}
|
||||
public String getMax_cache_size() {
|
||||
return max_cache_size;
|
||||
}
|
||||
public void setMax_cache_size(String max_cache_size) {
|
||||
this.max_cache_size = max_cache_size;
|
||||
}
|
||||
public String getMin_use() {
|
||||
return min_use;
|
||||
}
|
||||
public void setMin_use(String min_use) {
|
||||
this.min_use = min_use;
|
||||
}
|
||||
public String getNo_revalidate() {
|
||||
return no_revalidate;
|
||||
}
|
||||
public void setNo_revalidate(String no_revalidate) {
|
||||
this.no_revalidate = no_revalidate;
|
||||
}
|
||||
public String getPinning_time() {
|
||||
return pinning_time;
|
||||
}
|
||||
public void setPinning_time(String pinning_time) {
|
||||
this.pinning_time = pinning_time;
|
||||
}
|
||||
public String getIgnore_qs() {
|
||||
return ignore_qs;
|
||||
}
|
||||
public void setIgnore_qs(String ignore_qs) {
|
||||
this.ignore_qs = ignore_qs;
|
||||
}
|
||||
public String getCookie() {
|
||||
return cookie;
|
||||
}
|
||||
public void setCookie(String cookie) {
|
||||
this.cookie = cookie;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class DnsResStrategy extends BaseCfg<DnsResStrategy> {
|
||||
private static final long serialVersionUID = -2720862431960415564L;
|
||||
private String indexTable="dns_res_strategy";
|
||||
private Integer resGroup1Id;
|
||||
@ExcelField(title="res_group_num",sort=3)
|
||||
@ExcelField(title="res_group_num",sort=4)
|
||||
private Integer resGroup1Num;
|
||||
private Integer resGroup2Id;
|
||||
private Integer resGroup2Num;
|
||||
@@ -28,9 +28,9 @@ public class DnsResStrategy extends BaseCfg<DnsResStrategy> {
|
||||
private Integer resGroup5Num;
|
||||
private Integer minTtl;
|
||||
private Integer maxTtl;
|
||||
@ExcelField(title="group",sort=2)
|
||||
@ExcelField(title="group",sort=3)
|
||||
private String group1Name;
|
||||
@ExcelField(title="min_ttl",sort=4)
|
||||
@ExcelField(title="min_ttl",sort=5)
|
||||
private String miTtlmax;
|
||||
//仅作导入使用
|
||||
private String ttl;
|
||||
|
||||
@@ -29,13 +29,13 @@ public class FileDigestCfg extends BaseCfg<FileDigestCfg> {
|
||||
private static final long serialVersionUID = 2796500715438264119L;
|
||||
private static final String tableName="file_digest_cfg";
|
||||
private String indexTable="file_digest_cfg";
|
||||
@ExcelField(title="raw_len",sort=3)
|
||||
@ExcelField(title="raw_len",sort=4)
|
||||
private Long rawLen;
|
||||
@ExcelField(title="digest",sort=2)
|
||||
@ExcelField(title="digest",sort=3)
|
||||
private String digest;
|
||||
@ExcelField(title="cfds_level",sort=4)
|
||||
@ExcelField(title="harm_level",sort=5)
|
||||
private Integer cfdsLevel;
|
||||
@ExcelField(title="file_url",sort=5)
|
||||
@ExcelField(title="file_url",sort=6)
|
||||
private String fileUrl;
|
||||
|
||||
private NtcSubscribeIdCfg ntcSubscribeIdCfg;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.nis.domain.configuration;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* IP复用地址池实体
|
||||
@@ -13,15 +14,16 @@ public class IpAddrPoolCfg extends BaseCfg<IpAddrPoolCfg>{
|
||||
|
||||
private static final long serialVersionUID = 1392197458744667669L;
|
||||
private String indexTable="ip_reuse_addr_pool";
|
||||
|
||||
@ExcelField(title="address_pool",sort=2)
|
||||
private String addrPoolName; // 地址池名称
|
||||
@ExcelField(title="ip_total",sort=3)
|
||||
private Integer ipTotal; // IP总数
|
||||
private Integer availableIpTotal; // 可用IP总数
|
||||
private String description; // 描述信息
|
||||
|
||||
private List<BaseIpCfg> ipCfgs; // 地址池IP信息
|
||||
|
||||
@SerializedName("cfgId")
|
||||
@ExcelField(title="address_pool_id",sort=0)
|
||||
private Integer compileId;
|
||||
|
||||
public String getIndexTable() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.nis.domain.configuration;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* IP复用DNAT策略实体
|
||||
@@ -16,6 +17,7 @@ public class IpReuseDnatPolicyCfg extends IpPortCfg{
|
||||
|
||||
@Expose
|
||||
@SerializedName("configId")
|
||||
@ExcelField(title="cfg_id",sort=0)
|
||||
private Integer compileId;
|
||||
|
||||
@Expose
|
||||
@@ -24,22 +26,26 @@ public class IpReuseDnatPolicyCfg extends IpPortCfg{
|
||||
|
||||
@Expose
|
||||
@SerializedName("originalDestIp")
|
||||
@ExcelField(title="original_dest_ip",sort=4)
|
||||
private String srcIpAddress;
|
||||
|
||||
@Expose
|
||||
@SerializedName("originalDestPort")
|
||||
@ExcelField(title="original_dest_port",sort=5)
|
||||
private String srcPort;
|
||||
|
||||
@Expose
|
||||
@SerializedName("originalProtocol")
|
||||
@ExcelField(title="protocol",dictType="PROTOCOL",sort=8)
|
||||
private Integer protocol;
|
||||
|
||||
@Expose
|
||||
@SerializedName("translatedDestIp")
|
||||
@ExcelField(title="translated_dest_ip",sort=6)
|
||||
private String destIpAddress;
|
||||
|
||||
@Expose
|
||||
@SerializedName("translatedDestPort")
|
||||
@ExcelField(title="translated_dest_port",sort=7)
|
||||
private String destPort;
|
||||
|
||||
@Expose
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.nis.domain.configuration;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* IP复用策略
|
||||
@@ -20,6 +21,7 @@ public class IpReusePolicyCfg extends BaseCfg<IpReusePolicyCfg>{
|
||||
|
||||
private Integer userId; // 用户标识
|
||||
@Expose
|
||||
@ExcelField(title="user_type",dictType="USER_TYPE",sort=4)
|
||||
protected String userType; // 用户类型
|
||||
@Expose
|
||||
protected Integer addrPoolId; // 地址池ID
|
||||
@@ -27,11 +29,14 @@ public class IpReusePolicyCfg extends BaseCfg<IpReusePolicyCfg>{
|
||||
protected String translateParam; // 地址翻译参数
|
||||
@Expose
|
||||
@SerializedName("userId")
|
||||
@ExcelField(title="user",sort=5)
|
||||
private String userName;
|
||||
@ExcelField(title="address_pool",sort=3)
|
||||
private String addrPoolName; // 仅用于列表条件检索
|
||||
|
||||
private Integer ipType;
|
||||
private Integer ipPattern;
|
||||
@ExcelField(title="ip",sort=6)
|
||||
private String srcIpAddress;
|
||||
private String destIpAddress;
|
||||
@Expose
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
@@ -23,10 +21,13 @@ public class PxyObjSpoofingIpPool extends BaseIpCfg{
|
||||
private String port;
|
||||
@Expose
|
||||
@SerializedName("addrType")
|
||||
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=4)
|
||||
private Integer ipType;
|
||||
@Expose
|
||||
@SerializedName("ip")
|
||||
@ExcelField(title="IP",sort=5)
|
||||
private String ipAddress;
|
||||
@ExcelField(title="group",sort=3)
|
||||
private String groupName;//欺骗IP池(IP组)名称
|
||||
@Expose
|
||||
@SerializedName("policyGroup")
|
||||
@@ -36,6 +37,7 @@ public class PxyObjSpoofingIpPool extends BaseIpCfg{
|
||||
private Integer location;//位置,无意义,固定为0
|
||||
@Expose
|
||||
@SerializedName("cfgId")
|
||||
@ExcelField(title="cfg_id",sort=0)
|
||||
private Integer compileId;
|
||||
@Expose
|
||||
@SerializedName("userRegion")
|
||||
@@ -50,6 +52,9 @@ public class PxyObjSpoofingIpPool extends BaseIpCfg{
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
public Integer getGroupId() {
|
||||
if((groupId==null || groupId==0) && cfgId!=null){
|
||||
groupId=cfgId.intValue();
|
||||
}
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupId(Integer groupId) {
|
||||
|
||||
@@ -3,25 +3,33 @@ package com.nis.domain.configuration;
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class UserManage extends BaseEntity<UserManage>{
|
||||
|
||||
private static final long serialVersionUID = -2749633756272829982L;
|
||||
|
||||
private static final String tableName="user_manage";
|
||||
@ExcelField(title="user_name",sort=1)
|
||||
private String userName;
|
||||
private String userPwd;
|
||||
@ExcelField(title="vpn_ip",sort=2)
|
||||
private String serverIp;
|
||||
private String authMethod;
|
||||
private Integer numLogins;
|
||||
private String lastLogin;
|
||||
private String transferBytes;
|
||||
private String transferPackets;
|
||||
|
||||
private Long creatorId;
|
||||
@ExcelField(title="config_time",sort=5)
|
||||
private Date createTime;
|
||||
|
||||
private Long editorId;
|
||||
@ExcelField(title="edit_time",sort=7)
|
||||
private Date editTime;
|
||||
private Integer isValid;
|
||||
@ExcelField(title="desc",sort=3)
|
||||
private String remarks;
|
||||
private String userType;
|
||||
|
||||
@@ -39,8 +47,9 @@ public class UserManage extends BaseEntity<UserManage>{
|
||||
private String incomingBroadcastPackets;
|
||||
private String incomingBroadcastTotalSize;
|
||||
private Integer numberOfLogins;*/
|
||||
|
||||
@ExcelField(title="creator",sort=4)
|
||||
private String creatorName;
|
||||
@ExcelField(title="editor",sort=6)
|
||||
private String editorName;
|
||||
private Date search_create_time_start;
|
||||
private Date search_create_time_end;
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* APP Payload 导入模板类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class AppPayloadTemplate extends ComplexStringAllTemplate{
|
||||
|
||||
// APP PAYLOAD L3_HEADER的特殊属性
|
||||
private String ver;
|
||||
private String ihl;
|
||||
private String tos;
|
||||
private String totalLength;
|
||||
private String flags;
|
||||
private String fragmentOffset;
|
||||
private String protocol;
|
||||
private String icmpType;
|
||||
private String icmpCode;
|
||||
private String icmpIdentifier;
|
||||
private String headerType;
|
||||
|
||||
@ExcelField(title="headerType",align=2,sort=17)
|
||||
public String getHeaderType() {
|
||||
return headerType;
|
||||
}
|
||||
public void setHeaderType(String headerType) {
|
||||
this.headerType = headerType;
|
||||
}
|
||||
|
||||
@ExcelField(title="VER",align=2,sort=18)
|
||||
public String getVer() {
|
||||
return ver;
|
||||
}
|
||||
public void setVer(String ver) {
|
||||
this.ver = ver;
|
||||
}
|
||||
|
||||
@ExcelField(title="IHL",align=2,sort=19)
|
||||
public String getIhl() {
|
||||
return ihl;
|
||||
}
|
||||
public void setIhl(String ihl) {
|
||||
this.ihl = ihl;
|
||||
}
|
||||
|
||||
@ExcelField(title="TOS",align=2,sort=20)
|
||||
public String getTos() {
|
||||
return tos;
|
||||
}
|
||||
public void setTos(String tos) {
|
||||
this.tos = tos;
|
||||
}
|
||||
|
||||
@ExcelField(title="Total Length",align=2,sort=21)
|
||||
public String getTotalLength() {
|
||||
return totalLength;
|
||||
}
|
||||
public void setTotalLength(String totalLength) {
|
||||
this.totalLength = totalLength;
|
||||
}
|
||||
|
||||
@ExcelField(title="Flags",align=2,sort=22)
|
||||
public String getFlags() {
|
||||
return flags;
|
||||
}
|
||||
public void setFlags(String flags) {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
@ExcelField(title="fragment offset",align=2,sort=23)
|
||||
public String getFragmentOffset() {
|
||||
return fragmentOffset;
|
||||
}
|
||||
public void setFragmentOffset(String fragmentOffset) {
|
||||
this.fragmentOffset = fragmentOffset;
|
||||
}
|
||||
|
||||
@ExcelField(title="Protocol",align=2,sort=24)
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
@ExcelField(title="ICMP type",align=2,sort=25)
|
||||
public String getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
public void setIcmpType(String icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
@ExcelField(title="ICMP code",align=2,sort=26)
|
||||
public String getIcmpCode() {
|
||||
return icmpCode;
|
||||
}
|
||||
public void setIcmpCode(String icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
}
|
||||
|
||||
@ExcelField(title="ICMP identifier",align=2,sort=27)
|
||||
public String getIcmpIdentifier() {
|
||||
return icmpIdentifier;
|
||||
}
|
||||
public void setIcmpIdentifier(String icmpIdentifier) {
|
||||
this.icmpIdentifier = icmpIdentifier;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)重定向 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsRedirectComplexTemplate extends ComplexStringAllTemplate{
|
||||
|
||||
private String userRegion1;// 重定向应答码
|
||||
private String userRegion2;// 重定向URL
|
||||
|
||||
@ExcelField(title="redirect_response_code",dictType="REDIRECT_RESPONSE_CODE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="redirect_url",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)重定向 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsRedirectIpTemplate extends IpAllTemplate{
|
||||
|
||||
private String userRegion1;// 重定向应答码
|
||||
private String userRegion2;// 重定向URL
|
||||
|
||||
@ExcelField(title="redirect_response_code",dictType="REDIRECT_RESPONSE_CODE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="redirect_url",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)重定向 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsRedirectTemplate extends StringAllTemplate{
|
||||
|
||||
private String userRegion1;// 重定向应答码
|
||||
private String userRegion2;// 重定向URL
|
||||
|
||||
@ExcelField(title="redirect_response_code",dictType="REDIRECT_RESPONSE_CODE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="redirect_url",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)阻断 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsRejectComplexTemplate extends ComplexStringAllTemplate{
|
||||
|
||||
private String userRegion1;// 应答码
|
||||
private String userRegion2;// 响应内容
|
||||
|
||||
@ExcelField(title="response_code",dictType="RESPONSE_CODE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="response_content",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)阻断 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsRejectIpTemplate extends IpAllTemplate{
|
||||
|
||||
private String userRegion1;// 应答码
|
||||
private String userRegion2;// 响应内容
|
||||
|
||||
@ExcelField(title="response_code",dictType="RESPONSE_CODE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="response_content",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)阻断 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsRejectTemplate extends StringAllTemplate{
|
||||
|
||||
private String userRegion1;// 应答码
|
||||
private String userRegion2;// 响应内容
|
||||
|
||||
@ExcelField(title="response_code",dictType="RESPONSE_CODE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="response_content",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)替换 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsReplaceComplexTemplate extends ComplexStringAllTemplate{
|
||||
|
||||
private String userRegion1;// 搜索区域
|
||||
private String userRegion2;// 发现内容
|
||||
private String userRegion3;// 替换内容
|
||||
|
||||
@ExcelField(title="replace_zone",dictType="CONTROL_REPLACE_ZONE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="replaced_content",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
|
||||
@ExcelField(title="replace_content",align=2,sort=4)
|
||||
public String getUserRegion3() {
|
||||
return userRegion3;
|
||||
}
|
||||
|
||||
public void setUserRegion3(String userRegion3) {
|
||||
this.userRegion3 = userRegion3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)替换 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsReplaceIpTemplate extends IpAllTemplate{
|
||||
|
||||
private String userRegion1;// 搜索区域
|
||||
private String userRegion2;// 发现内容
|
||||
private String userRegion3;// 替换内容
|
||||
|
||||
@ExcelField(title="replace_zone",dictType="CONTROL_REPLACE_ZONE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="replaced_content",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
|
||||
@ExcelField(title="replace_content",align=2,sort=4)
|
||||
public String getUserRegion3() {
|
||||
return userRegion3;
|
||||
}
|
||||
|
||||
public void setUserRegion3(String userRegion3) {
|
||||
this.userRegion3 = userRegion3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL HTTP(s)替换 导入模板
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class HttpsReplaceTemplate extends StringAllTemplate{
|
||||
|
||||
private String userRegion1;// 搜索区域
|
||||
private String userRegion2;// 发现内容
|
||||
private String userRegion3;// 替换内容
|
||||
|
||||
@ExcelField(title="replace_zone",dictType="CONTROL_REPLACE_ZONE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
@ExcelField(title="replaced_content",align=2,sort=3)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
|
||||
@ExcelField(title="replace_content",align=2,sort=4)
|
||||
public String getUserRegion3() {
|
||||
return userRegion3;
|
||||
}
|
||||
|
||||
public void setUserRegion3(String userRegion3) {
|
||||
this.userRegion3 = userRegion3;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@ public class IpWhitelistTemplate extends BasicTemplate{
|
||||
private String destIpAddress;
|
||||
private String srcPort;
|
||||
private String destPort;
|
||||
private Integer protocol;
|
||||
private Integer direction;
|
||||
|
||||
@ExcelField(title="config_describe",align=2,sort=1)
|
||||
public String getCfgDesc() {
|
||||
@@ -66,4 +68,20 @@ public class IpWhitelistTemplate extends BasicTemplate{
|
||||
this.destPort = destPort;
|
||||
}
|
||||
|
||||
@ExcelField(title="protocol",align=2,sort=15)
|
||||
public Integer getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
public void setProtocol(Integer protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
@ExcelField(title="direction",align=2,sort=16)
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
package com.nis.domain.dashboard;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class NtcRadiusReport implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 7635016645942704971L;
|
||||
@JsonInclude(value = Include.NON_NULL)
|
||||
@ApiModelProperty(value = "接入IP", required = true)
|
||||
public class NtcRadiusReport {
|
||||
|
||||
// @JsonInclude(value = Include.NON_NULL)
|
||||
// @ApiModelProperty(value = "接入IP", required = true)
|
||||
@ExcelField(title = "ip_address_control", sort = 2)
|
||||
protected String nasIp;
|
||||
@JsonInclude(value = Include.NON_NULL)
|
||||
@ApiModelProperty(value = "用户名", required = true)
|
||||
// @JsonInclude(value = Include.NON_NULL)
|
||||
// @ApiModelProperty(value = "用户名", required = true)
|
||||
@ExcelField(title = "account", sort = 1)
|
||||
protected String account;
|
||||
@JsonInclude(value = Include.NON_NULL)
|
||||
@ApiModelProperty(value = "次数", required = true)
|
||||
// @JsonInclude(value = Include.NON_NULL)
|
||||
// @ApiModelProperty(value = "次数", required = true)
|
||||
@ExcelField(title = "visits", sort = 3)
|
||||
protected Long num;
|
||||
@JsonInclude(value = Include.NON_NULL)
|
||||
@ApiModelProperty(value = "统计时间", required = true)
|
||||
// @JsonInclude(value = Include.NON_NULL)
|
||||
// @ApiModelProperty(value = "统计时间", required = true)
|
||||
@ExcelField(title = "stat_time", sort = 4)
|
||||
protected String reportTime;
|
||||
|
||||
/**
|
||||
@@ -67,6 +69,16 @@ public class NtcRadiusReport implements Serializable{
|
||||
return reportTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NtcRadiusReport [nasIp=" + nasIp + ", account=" + account + ", num=" + num + ", reportTime="
|
||||
+ reportTime + ", searchBusinessType=" + searchBusinessType + ", searchFoundStartTime="
|
||||
+ searchFoundStartTime + ", searchFoundEndTime=" + searchFoundEndTime
|
||||
+ ", searchReportStartTimeCluster=" + searchReportStartTimeCluster + ", searchReportEndTimeCluster="
|
||||
+ searchReportEndTimeCluster + ", searchNasIp=" + searchNasIp + ", searchAccount=" + searchAccount
|
||||
+ ", groupType=" + groupType + "]";
|
||||
}
|
||||
|
||||
public void setReportTime(String reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
@@ -74,11 +86,11 @@ public class NtcRadiusReport implements Serializable{
|
||||
public String getSearchBusinessType() {
|
||||
return searchBusinessType;
|
||||
}
|
||||
@JsonIgnore
|
||||
|
||||
public void setSearchBusinessType(String searchBusinessType) {
|
||||
this.searchBusinessType = searchBusinessType;
|
||||
}
|
||||
@JsonIgnore
|
||||
|
||||
public String getSearchFoundStartTime() {
|
||||
return searchFoundStartTime;
|
||||
}
|
||||
@@ -86,7 +98,7 @@ public class NtcRadiusReport implements Serializable{
|
||||
public void setSearchFoundStartTime(String searchFoundStartTime) {
|
||||
this.searchFoundStartTime = searchFoundStartTime;
|
||||
}
|
||||
@JsonIgnore
|
||||
|
||||
public String getSearchFoundEndTime() {
|
||||
return searchFoundEndTime;
|
||||
}
|
||||
@@ -95,16 +107,14 @@ public class NtcRadiusReport implements Serializable{
|
||||
this.searchFoundEndTime = searchFoundEndTime;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Long getSearchReportStartTimeCluster() {
|
||||
return searchReportStartTimeCluster;
|
||||
}
|
||||
|
||||
public void setSearchReportStartTimeCluster(
|
||||
Long searchReportStartTimeCluster) {
|
||||
public void setSearchReportStartTimeCluster(Long searchReportStartTimeCluster) {
|
||||
this.searchReportStartTimeCluster = searchReportStartTimeCluster;
|
||||
}
|
||||
@JsonIgnore
|
||||
|
||||
public Long getSearchReportEndTimeCluster() {
|
||||
return searchReportEndTimeCluster;
|
||||
}
|
||||
@@ -112,7 +122,7 @@ public class NtcRadiusReport implements Serializable{
|
||||
public void setSearchReportEndTimeCluster(Long searchReportEndTimeCluster) {
|
||||
this.searchReportEndTimeCluster = searchReportEndTimeCluster;
|
||||
}
|
||||
@JsonIgnore
|
||||
|
||||
public String getSearchNasIp() {
|
||||
return searchNasIp;
|
||||
}
|
||||
@@ -120,7 +130,7 @@ public class NtcRadiusReport implements Serializable{
|
||||
public void setSearchNasIp(String searchNasIp) {
|
||||
this.searchNasIp = searchNasIp;
|
||||
}
|
||||
@JsonIgnore
|
||||
|
||||
public String getSearchAccount() {
|
||||
return searchAccount;
|
||||
}
|
||||
@@ -128,11 +138,11 @@ public class NtcRadiusReport implements Serializable{
|
||||
public void setSearchAccount(String searchAccount) {
|
||||
this.searchAccount = searchAccount;
|
||||
}
|
||||
@JsonIgnore
|
||||
|
||||
public String getGroupType() {
|
||||
return groupType;
|
||||
}
|
||||
|
||||
|
||||
public void setGroupType(String groupType) {
|
||||
this.groupType = groupType;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class IrDnatLog extends BaseLogEntity<IrDnatLog> {
|
||||
|
||||
private static final long serialVersionUID = 5860838446015457328L;
|
||||
|
||||
@ExcelField(title = "user", sort = 8)
|
||||
protected String userId;// 用户名
|
||||
@ExcelField(title = "nat_ip", sort = 9)
|
||||
protected String natIp;// 复用的ip地址
|
||||
@ExcelField(title = "creat_time", sort = 10)
|
||||
protected String creatTime;// 链接建立时间
|
||||
@ExcelField(title = "close_time", sort = 11)
|
||||
protected String closeTime;// 链接结束时间
|
||||
protected String c2sPktNum;// c2s包数
|
||||
protected String s2cPktNum;// s2c包数
|
||||
protected String c2sByteNum;// c2s字节数
|
||||
protected String s2cByteNum;// s2c字节数
|
||||
|
||||
|
||||
@ExcelField(title = "c2s_pkt_num", sort = 12)
|
||||
protected String c2sPktNum;
|
||||
@ExcelField(title = "s2c_pkt_num", sort = 13)
|
||||
protected String s2cPktNum;
|
||||
@ExcelField(title = "c2s_byte_num", sort = 14)
|
||||
protected String c2sByteNum;
|
||||
@ExcelField(title = "s2c_byte_num", sort = 15)
|
||||
protected String s2cByteNum;
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class IrSnatLog extends BaseLogEntity<IrSnatLog> {
|
||||
|
||||
private static final long serialVersionUID = 5860838446015457328L;
|
||||
|
||||
@ExcelField(title = "nat_ip", sort = 9)
|
||||
protected String natIp;// 复用的ip地址
|
||||
@ExcelField(title = "creat_time", sort = 10)
|
||||
protected String creatTime;// 链接建立时间
|
||||
@ExcelField(title = "close_time", sort = 11)
|
||||
protected String closeTime;// 链接结束时间
|
||||
protected String c2sPktNum;// c2s包数
|
||||
protected String s2cPktNum;// s2c包数
|
||||
protected String c2sByteNum;// c2s字节数
|
||||
protected String s2cByteNum;// s2c字节数
|
||||
|
||||
@ExcelField(title = "c2s_pkt_num", sort = 12)
|
||||
protected String c2sPktNum;
|
||||
@ExcelField(title = "s2c_pkt_num", sort = 13)
|
||||
protected String s2cPktNum;
|
||||
@ExcelField(title = "c2s_byte_num", sort = 14)
|
||||
protected String c2sByteNum;
|
||||
@ExcelField(title = "s2c_byte_num", sort = 15)
|
||||
protected String s2cByteNum;
|
||||
|
||||
public String getNatIp() {
|
||||
return natIp;
|
||||
|
||||
@@ -561,6 +561,9 @@ public class MaatCfg implements Serializable {
|
||||
this.areaEffectiveIds = areaEffectiveIds;
|
||||
}
|
||||
public Integer getDoBlackList() {
|
||||
if(doBlackList==null){
|
||||
doBlackList = 1;
|
||||
}
|
||||
return doBlackList;
|
||||
}
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
@@ -678,7 +681,7 @@ public class MaatCfg implements Serializable {
|
||||
}
|
||||
public void initDefaultValue() {
|
||||
this.doLog=Constants.MAAT_CFG_DOLOG_DEFAULT;
|
||||
this.doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
|
||||
// this.doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
|
||||
this.configPercent=Constants.MAAT_CFG_DOLOG_CONFIGPERCENT_DEFAULT;
|
||||
this.configOption=Constants.MAAT_CFG_DOLOG_CONFIGOPTION_DEFAULT;
|
||||
this.startTime=new Date();
|
||||
|
||||
122
src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java
Normal file
122
src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java
Normal file
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
*@Title: ToMaatBean.java
|
||||
*@Package com.nis.domain.configuration
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年2月28日 下午2:03:08
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.maat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 修改maat类配置状态
|
||||
* @ClassName: ToUpdateStatusMaatBean.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2019年1月2日 下午3:08:08
|
||||
* @version V1.0
|
||||
*/
|
||||
public class ToUpdateMaatBeanStatus implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3468862666445104490L;
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(转换为maat格式的java bean)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Expose
|
||||
private String version;
|
||||
@Expose
|
||||
@SerializedName("operator")
|
||||
private String creatorName;
|
||||
@Expose
|
||||
@SerializedName("opTime")
|
||||
private Date auditTime;
|
||||
@Expose
|
||||
private Integer opAction;
|
||||
@Expose
|
||||
private List<UpdateMaatCfgStatus> configCompileStartStopList;
|
||||
|
||||
public static class UpdateMaatCfgStatus{
|
||||
@Expose
|
||||
private Integer compileId;
|
||||
@Expose
|
||||
private Integer isValid;
|
||||
@Expose
|
||||
@SerializedName("opTime")
|
||||
private Date auditTime;
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getAuditTime() {
|
||||
return auditTime;
|
||||
}
|
||||
public void setAuditTime(Date auditTime) {
|
||||
this.auditTime = auditTime;
|
||||
}
|
||||
|
||||
}
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
|
||||
public Date getAuditTime() {
|
||||
return auditTime;
|
||||
}
|
||||
|
||||
public void setAuditTime(Date auditTime) {
|
||||
this.auditTime = auditTime;
|
||||
}
|
||||
|
||||
public List<UpdateMaatCfgStatus> getConfigCompileStartStopList() {
|
||||
return configCompileStartStopList;
|
||||
}
|
||||
|
||||
public void setConfigCompileStartStopList(List<UpdateMaatCfgStatus> configCompileStartStopList) {
|
||||
this.configCompileStartStopList = configCompileStartStopList;
|
||||
}
|
||||
|
||||
public Integer getOpAction() {
|
||||
return opAction;
|
||||
}
|
||||
|
||||
public void setOpAction(Integer opAction) {
|
||||
this.opAction = opAction;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,11 @@ public class NtcAsnRecord extends BaseLogEntity<NtcAsnRecord>{
|
||||
|
||||
private static final long serialVersionUID = -4947912502754359817L;
|
||||
|
||||
@ExcelField(title="bps",sort=8)
|
||||
@ExcelField(title="bps",sort=10)
|
||||
protected String bps;
|
||||
@ExcelField(title="pps",sort=9)
|
||||
protected String pps;
|
||||
@ExcelField(title="asn",sort=10)
|
||||
@ExcelField(title="asn",sort=8)
|
||||
protected String asn;
|
||||
public String getAsn() {
|
||||
return asn;
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.nis.domain.report;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* 重点保障事件实体对象
|
||||
*
|
||||
* @author A.Chen
|
||||
*
|
||||
*/
|
||||
public class NtcEventKeyProtectionReport extends BaseEntity<NtcEventKeyProtectionReport> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@ExcelField(title = "task_id", sort = 1)
|
||||
private String taskIds;
|
||||
|
||||
@ExcelField(title = "task_name", sort = 2)
|
||||
private String taskName;
|
||||
|
||||
@ExcelField(title = "letter_num", sort = 3)
|
||||
private long letterNum;
|
||||
|
||||
@ExcelField(title = "config_num", sort = 4)
|
||||
private long configNum;
|
||||
|
||||
@ExcelField(title = "monitor_num", sort = 5)
|
||||
private long monitorNum;
|
||||
|
||||
@ExcelField(title = "control_num", sort = 6)
|
||||
private long controlNum;
|
||||
|
||||
@ExcelField(title = "task_time", sort = 7)
|
||||
private String taskTime;
|
||||
|
||||
@ExcelField(title = "stat_time", sort = 8)
|
||||
private String reportTime;
|
||||
|
||||
private String searchReportStartTime;
|
||||
private String searchReportEndTime;
|
||||
private String searchTaskStartTime;
|
||||
private String searchTaskEndTime;
|
||||
|
||||
public String getTaskTime() {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
public void setTaskTime(String taskTime) {
|
||||
this.taskTime = taskTime;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public long getLetterNum() {
|
||||
return letterNum;
|
||||
}
|
||||
|
||||
public void setLetterNum(long letterNum) {
|
||||
this.letterNum = letterNum;
|
||||
}
|
||||
|
||||
public long getConfigNum() {
|
||||
return configNum;
|
||||
}
|
||||
|
||||
public void setConfigNum(long configNum) {
|
||||
this.configNum = configNum;
|
||||
}
|
||||
|
||||
public long getMonitorNum() {
|
||||
return monitorNum;
|
||||
}
|
||||
|
||||
public void setMonitorNum(long monitorNum) {
|
||||
this.monitorNum = monitorNum;
|
||||
}
|
||||
|
||||
public long getControlNum() {
|
||||
return controlNum;
|
||||
}
|
||||
|
||||
public void setControlNum(long controlNum) {
|
||||
this.controlNum = controlNum;
|
||||
}
|
||||
|
||||
public String getSearchReportStartTime() {
|
||||
return searchReportStartTime;
|
||||
}
|
||||
|
||||
public void setSearchReportStartTime(String searchReportStartTime) {
|
||||
this.searchReportStartTime = searchReportStartTime;
|
||||
}
|
||||
|
||||
public String getSearchReportEndTime() {
|
||||
return searchReportEndTime;
|
||||
}
|
||||
|
||||
public void setSearchReportEndTime(String searchReportEndTime) {
|
||||
this.searchReportEndTime = searchReportEndTime;
|
||||
}
|
||||
|
||||
public String getSearchTaskStartTime() {
|
||||
return searchTaskStartTime;
|
||||
}
|
||||
|
||||
public void setSearchTaskStartTime(String searchTaskStartTime) {
|
||||
this.searchTaskStartTime = searchTaskStartTime;
|
||||
}
|
||||
|
||||
public String getSearchTaskEndTime() {
|
||||
return searchTaskEndTime;
|
||||
}
|
||||
|
||||
public void setSearchTaskEndTime(String searchTaskEndTime) {
|
||||
this.searchTaskEndTime = searchTaskEndTime;
|
||||
}
|
||||
|
||||
public String getTaskIds() {
|
||||
return taskIds;
|
||||
}
|
||||
|
||||
public void setTaskIds(String taskIds) {
|
||||
this.taskIds = taskIds;
|
||||
}
|
||||
|
||||
public String getReportTime() {
|
||||
return reportTime;
|
||||
}
|
||||
|
||||
public void setReportTime(String reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NtcEventKeyProtectionReport [taskIds=" + taskIds + ", taskName=" + taskName + ", letterNum=" + letterNum
|
||||
+ ", configNum=" + configNum + ", monitorNum=" + monitorNum + ", controlNum=" + controlNum
|
||||
+ ", taskTime=" + taskTime + ", reportTime=" + reportTime + ", searchReportStartTime="
|
||||
+ searchReportStartTime + ", searchReportEndTime=" + searchReportEndTime + ", searchTaskStartTime="
|
||||
+ searchTaskStartTime + ", searchTaskEndTime=" + searchTaskEndTime + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.nis.domain.report;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* 监测事件和封堵事件实体对象
|
||||
*
|
||||
* @author A.Chen
|
||||
*
|
||||
*/
|
||||
public class NtcEventMonitorOrBlockReport extends BaseEntity<NtcEventMonitorOrBlockReport> {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4523581081780227829L;
|
||||
|
||||
@ExcelField(title = "task_time", sort = 8)
|
||||
private String taskTime;// 审核时间
|
||||
|
||||
@ExcelField(title = "task_name", sort = 2)
|
||||
private String taskName;// 事件名称
|
||||
|
||||
@ExcelField(title = "ip_count", sort = 3)
|
||||
private long ipNum;// ip数量
|
||||
|
||||
@ExcelField(title = "http_num", sort = 4)
|
||||
private long httpNum;// http数量
|
||||
|
||||
@ExcelField(title = "mail_num", sort = 5)
|
||||
private long mailNum;// 邮件数量
|
||||
|
||||
@ExcelField(title = "vedio_count", sort = 6)
|
||||
private long vedioNum;// 视频次数
|
||||
|
||||
@ExcelField(title = "agent_count", sort = 7)
|
||||
private long agentNum;// 代理次数
|
||||
|
||||
@ExcelField(title = "task_id", sort = 1)
|
||||
private String taskIds;// 审核ID
|
||||
|
||||
@ExcelField(title = "stat_time", sort = 9)
|
||||
private String reportTime;// 统计时间
|
||||
|
||||
//
|
||||
private String searchReportStartTime;// 统计开始时间
|
||||
private String searchReportEndTime;// 统计结束时间
|
||||
private String searchTaskStartTime;// 审核开始时间
|
||||
private String searchTaskEndTime;// 审核结束时间
|
||||
private int reportType;// 查询类型 1.封堵 2.监测
|
||||
|
||||
public String getReportTime() {
|
||||
return reportTime;
|
||||
}
|
||||
|
||||
public void setReportTime(String reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
|
||||
public String getTaskTime() {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
public void setTaskTime(String taskTime) {
|
||||
this.taskTime = taskTime;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public long getIpNum() {
|
||||
return ipNum;
|
||||
}
|
||||
|
||||
public void setIpNum(long ipNum) {
|
||||
this.ipNum = ipNum;
|
||||
}
|
||||
|
||||
public long getHttpNum() {
|
||||
return httpNum;
|
||||
}
|
||||
|
||||
public void setHttpNum(long httpNum) {
|
||||
this.httpNum = httpNum;
|
||||
}
|
||||
|
||||
public long getMailNum() {
|
||||
return mailNum;
|
||||
}
|
||||
|
||||
public void setMailNum(long mailNum) {
|
||||
this.mailNum = mailNum;
|
||||
}
|
||||
|
||||
public long getVedioNum() {
|
||||
return vedioNum;
|
||||
}
|
||||
|
||||
public void setVedioNum(long vedioNum) {
|
||||
this.vedioNum = vedioNum;
|
||||
}
|
||||
|
||||
public long getAgentNum() {
|
||||
return agentNum;
|
||||
}
|
||||
|
||||
public void setAgentNum(long agentNum) {
|
||||
this.agentNum = agentNum;
|
||||
}
|
||||
|
||||
public String getSearchReportStartTime() {
|
||||
return searchReportStartTime;
|
||||
}
|
||||
|
||||
public void setSearchReportStartTime(String searchReportStartTime) {
|
||||
this.searchReportStartTime = searchReportStartTime;
|
||||
}
|
||||
|
||||
public String getSearchReportEndTime() {
|
||||
return searchReportEndTime;
|
||||
}
|
||||
|
||||
public void setSearchReportEndTime(String searchReportEndTime) {
|
||||
this.searchReportEndTime = searchReportEndTime;
|
||||
}
|
||||
|
||||
public String getSearchTaskStartTime() {
|
||||
return searchTaskStartTime;
|
||||
}
|
||||
|
||||
public void setSearchTaskStartTime(String searchTaskStartTime) {
|
||||
this.searchTaskStartTime = searchTaskStartTime;
|
||||
}
|
||||
|
||||
public String getSearchTaskEndTime() {
|
||||
return searchTaskEndTime;
|
||||
}
|
||||
|
||||
public void setSearchTaskEndTime(String searchTaskEndTime) {
|
||||
this.searchTaskEndTime = searchTaskEndTime;
|
||||
}
|
||||
|
||||
public int getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
|
||||
public void setReportType(int reportType) {
|
||||
this.reportType = reportType;
|
||||
}
|
||||
|
||||
public String getTaskIds() {
|
||||
return taskIds;
|
||||
}
|
||||
|
||||
public void setTaskIds(String taskIds) {
|
||||
this.taskIds = taskIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NtcEventMonitorOrBlockReport [taskTime=" + taskTime + ", taskName=" + taskName + ", ipNum=" + ipNum
|
||||
+ ", httpNum=" + httpNum + ", mailNum=" + mailNum + ", vedioNum=" + vedioNum + ", agentNum=" + agentNum
|
||||
+ ", taskIds=" + taskIds + ", reportTime=" + reportTime + ", searchReportStartTime="
|
||||
+ searchReportStartTime + ", searchReportEndTime=" + searchReportEndTime + ", searchTaskStartTime="
|
||||
+ searchTaskStartTime + ", searchTaskEndTime=" + searchTaskEndTime + ", reportType=" + reportType + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* 系统特定服务信息表-记录特定服务信息(specific_service_cfg)
|
||||
@@ -17,19 +18,25 @@ public class SpecificServiceCfg extends BaseEntity<SpecificServiceCfg>{
|
||||
private static final long serialVersionUID = -1133644323636425766L;
|
||||
|
||||
private Integer specServiceId; //spec_service_id 协议ID int N 主键,初始化
|
||||
@ExcelField(title="app_code",sort=2)
|
||||
private Integer specServiceCode; //协议编码 int N 暂定,以后可扩展 1000:微信 , 1001:QQ
|
||||
@ExcelField(title="app_name",sort=3)
|
||||
private String specServiceName; //spec_service_name 协议名称 varchar(64) N
|
||||
@ExcelField(title="app_desc",sort=4)
|
||||
private String specServiceDesc; //spec_service_desc 协议描述 varchar2(64) N
|
||||
private Integer isValid; //is_valid 有效标志 int N 1-有效 0-无效
|
||||
@ExcelField(title="operate_time",sort=6)
|
||||
private Date opTime; //op_time 操作时间 date N
|
||||
private SpecificServiceCfg parent; //parent_id 父节点id int N 0表示一级节点
|
||||
private Integer isLeaf; //is_leaf 是否是叶子节点 int N 0否,1是,只有一级填0
|
||||
private Integer groupId; //group_id maat端配置分组id int N 缺省0,表示未与maat分组同步
|
||||
@ExcelField(title="cfg_type",dictType="SPECIFIC_SERVICE_CFG_TYPE",sort=5)
|
||||
private Integer cfgType;//配置类型,1,app;2,加密隧道;3,基础协议
|
||||
private Integer parentType;//父配置类型
|
||||
private Date beginDate; // 开始日期
|
||||
private Date endDate; // 结束日期
|
||||
private String showSequence; //显示序号
|
||||
@ExcelField(title="business_type",sort=1)
|
||||
private String businessType;
|
||||
private Integer addFlag;//app界面添加标记
|
||||
|
||||
|
||||
@@ -814,6 +814,42 @@ public class ConfigServiceUtil {
|
||||
|
||||
return bean;
|
||||
}
|
||||
/**
|
||||
* maat配置停启用
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public static String configStatusUpdate(String params) throws MaatConvertException{
|
||||
String result = null;
|
||||
ToMaatResult bean = null;
|
||||
Response response=null;
|
||||
try {
|
||||
String url = Constants.SERVICE_URL+Constants.CONFIG_START_STOP_UPDATE;
|
||||
//创建连接
|
||||
WebTarget wt = ClientUtil.getWebTarger(url);
|
||||
logger.info("put url:"+url);
|
||||
//获取响应结果
|
||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
||||
try {
|
||||
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||
if(response != null) {
|
||||
result=response.readEntity(String.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
if(response !=null && response.getStatus() == 200){
|
||||
JSONObject resObject = JSONObject.fromObject(result);
|
||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// getId(1,1);
|
||||
|
||||
@@ -714,6 +714,8 @@ public final class Constants {
|
||||
public static final String TRAFFIC_WEBSITELIST_NOTIME=Configurations.getStringProperty("trafficWebsiteListNoTime","trafficWebsiteListNoTime");
|
||||
public static final String TRAFFIC_TOPICLIST=Configurations.getStringProperty("trafficTopicList","trafficTopicList");
|
||||
public static final String TRAFFIC_DOMAIN_TRANS=Configurations.getStringProperty("trafficDomainTrans","trafficDomainTrans");
|
||||
public static final String TRAFFIC_PORTACTIVE_FIVEMINUTE=Configurations.getStringProperty("trafficPortActiveFiveMinute","trafficPortActiveFiveMinute");
|
||||
public static final String TREND_TOTAL_REPORT=Configurations.getStringProperty("trendTotalReport","trendTotalReport");
|
||||
/**
|
||||
* httpclient 工具超时时间设置
|
||||
*/
|
||||
@@ -790,4 +792,14 @@ public final class Constants {
|
||||
*/
|
||||
public static final int MAX_LOG_EXPORT_SIZE = Configurations.getIntProperty("maxLogExportSize", 100000);
|
||||
|
||||
|
||||
/**
|
||||
* 监测事件,封堵事件,重点保障事件查询接口URL
|
||||
*/
|
||||
public static final String NTC_EVENT_MONITOR_OR_BLOCK_Report =Configurations.getStringProperty("ntcEventsMonitorOrBlock","");
|
||||
|
||||
public static final String NTC_EVENT_KEYPROTECTION_Report =Configurations.getStringProperty("ntcEventKeyProtection","");
|
||||
|
||||
//配置启停服务接口方法
|
||||
public static final String CONFIG_START_STOP_UPDATE=Configurations.getStringProperty("configStartStop", "configStartStop");
|
||||
}
|
||||
|
||||
345
src/main/java/com/nis/util/SchedulerTaskUtil.java
Normal file
345
src/main/java/com/nis/util/SchedulerTaskUtil.java
Normal file
@@ -0,0 +1,345 @@
|
||||
package com.nis.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToUpdateMaatBeanStatus;
|
||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.domain.maat.ToUpdateMaatBeanStatus.UpdateMaatCfgStatus;
|
||||
import com.nis.web.dao.configuration.ConfigSynchronizationDao;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* 配置任务调度通用类
|
||||
* 定时任务调用,处理界面配置状态修改,以及下发综合服务处理
|
||||
* @author ThinkPad
|
||||
*
|
||||
*/
|
||||
public class SchedulerTaskUtil {
|
||||
|
||||
//调度任务的配置信息,复用配置同步DAO
|
||||
private static ConfigSynchronizationDao configSynchronizationDao = SpringContextHolder.getBean(ConfigSynchronizationDao.class);
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
/**
|
||||
* 根据业务与编译ID查询配置,修改失效或生效状态,并下发至综合服务
|
||||
* @param serviceId 不可空
|
||||
* @param compileId 不可空
|
||||
* @param oldIsValid 配置当前状态 0无效,1有效,可空
|
||||
* @param newIsValid 配置最新修改状态 0无效,1有效,不可空
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean updateConfigByServiceAndCompile(Integer serviceId,Integer compileId,Integer oldIsValid,Integer newIsValid){
|
||||
//根据业务查询配置文件,获取该业务的配置域表信息
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByServiceId(serviceId);
|
||||
//根据编译ID查询配置表中的配置信息
|
||||
for(Map<String,Object> service:serviceList){
|
||||
String tableName = service.get("tableName").toString();
|
||||
String serviceType = service.get("serviceType").toString();
|
||||
String className = service.get("className").toString();
|
||||
BaseCfg entity = new BaseCfg();
|
||||
entity.setServiceId(serviceId);
|
||||
entity.setTableName(tableName);
|
||||
List list = Lists.newArrayList();
|
||||
List callBackCfgList = Lists.newArrayList();
|
||||
boolean isUpdateContent = false;
|
||||
/**
|
||||
* 根据编译ID查询配置,如果配置当前审核状态为未审核(is_audit=0),并且newIsValid=1需要查询详细的域配置信息,下发配置详细内容,
|
||||
* 如果已审核(is_audit=1),则只查询配置主表,更新配置状态即可,
|
||||
* 如果审核取消(is_audit=3)则删除定时任务,表示配置已最终删除,此状态处理原则上在配置修改拦截器中处理
|
||||
*/
|
||||
if("1".equals(serviceType)){//maat类配置
|
||||
Date updateTime = new Date();
|
||||
//下发并修改配置状态的参数类
|
||||
ToUpdateMaatBeanStatus maatStatusBean = new ToUpdateMaatBeanStatus();
|
||||
UpdateMaatCfgStatus updateCfg = new UpdateMaatCfgStatus();
|
||||
List<UpdateMaatCfgStatus> configCompileStartStopList = new ArrayList();
|
||||
maatStatusBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatStatusBean.setOpAction(Constants.INSERT_ACTION);
|
||||
maatStatusBean.setAuditTime(updateTime);
|
||||
maatStatusBean.setCreatorName("TaskScheduler");//任务调度定时修改状态
|
||||
|
||||
//下发带有配置内容的参数对象
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
// for(Integer compileId:compileIds){
|
||||
entity.setCompileId(compileId);
|
||||
//查询配置
|
||||
if("cfg_index_info".equals(tableName)){
|
||||
list = configSynchronizationDao.getCfgIndexList(entity);
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
for(int i=0;i<list.size();i++){
|
||||
CfgIndexInfo cfg = (CfgIndexInfo) list.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
if(newIsValid==1){
|
||||
//需要查询详细的域配置信息,下发配置内容,并修改数据库is_valid=1,is_audit=1
|
||||
|
||||
}else{
|
||||
logger.debug("配置修改状态与当前配置状态不符合业务逻辑!");
|
||||
}
|
||||
}else{//修改各个配置域的配置状态
|
||||
BaseCfg config = new BaseCfg();
|
||||
config.setIsValid(newIsValid);
|
||||
config.setEditTime(updateTime);
|
||||
config.setCompileId(cfg.getCompileId());
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
String regionTableName = m.get("tableName").toString();
|
||||
config.setTableName(regionTableName);
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if("file_digest_cfg".equals(tableName)){
|
||||
list = configSynchronizationDao.getFileDigestListByService(entity);
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
for(int i=0;i<list.size();i++){
|
||||
FileDigestCfg cfg = (FileDigestCfg) list.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
if(newIsValid==1){
|
||||
//需要查询详细的域配置信息,下发配置内容,并修改数据库is_valid=1,is_audit=1
|
||||
|
||||
}else{
|
||||
logger.debug("配置修改状态与当前配置状态不符合业务逻辑!");
|
||||
}
|
||||
}else{//修改各个配置域的配置状态
|
||||
BaseCfg config = new BaseCfg();
|
||||
config.setIsValid(newIsValid);
|
||||
config.setEditTime(updateTime);
|
||||
config.setCompileId(cfg.getCompileId());
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
String regionTableName = m.get("tableName").toString();
|
||||
config.setTableName(regionTableName);
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else if("app_policy_cfg".equals(tableName)){
|
||||
list = configSynchronizationDao.getAppPolicyList(entity);
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
for(int i=0;i<list.size();i++){
|
||||
AppPolicyCfg cfg = (AppPolicyCfg) list.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
if(newIsValid==1){
|
||||
//需要查询详细的域配置信息,下发配置内容,并修改数据库is_valid=1,is_audit=1
|
||||
|
||||
}else{
|
||||
logger.debug("配置修改状态与当前配置状态不符合业务逻辑!");
|
||||
}
|
||||
}else{//修改各个配置域的配置状态
|
||||
BaseCfg config = new BaseCfg();
|
||||
config.setIsValid(newIsValid);
|
||||
config.setEditTime(updateTime);
|
||||
config.setCompileId(cfg.getCompileId());
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
if(cfgList!=null){
|
||||
for(Map<String,Object> m:cfgList){
|
||||
String regionTableName = m.get("tableName").toString();
|
||||
config.setTableName(regionTableName);
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(!isUpdateContent){
|
||||
updateCfg.setIsValid(newIsValid);
|
||||
updateCfg.setCompileId(compileId);
|
||||
updateCfg.setAuditTime(updateTime);
|
||||
configCompileStartStopList.add(updateCfg);
|
||||
}
|
||||
// }
|
||||
if(isUpdateContent){//修改配置内容以及状态
|
||||
//下发配置内容
|
||||
|
||||
}else{//只修改配置状态
|
||||
maatStatusBean.setConfigCompileStartStopList(configCompileStartStopList);
|
||||
String json=BaseService.gsonToJson(maatBean);
|
||||
//调用服务启停接口
|
||||
String result = ConfigServiceUtil.configStatusUpdate(json);
|
||||
logger.debug("MAAT类配置启停状态修改结果:"+result);
|
||||
}
|
||||
|
||||
}else if("2".equals(serviceType)){//回调类配置
|
||||
List ids = Lists.newArrayList();
|
||||
// for(Integer compileId:compileIds){
|
||||
entity.setCompileId(compileId);
|
||||
//查询配置
|
||||
if(entity.getServiceId().equals(3)){//ip drop回调类配置用了主表和子表关系
|
||||
list = configSynchronizationDao.getCfgIndexList(entity);
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
List<Integer> compileIdArray = Lists.newArrayList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
CfgIndexInfo cfg = (CfgIndexInfo) list.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
Date updateTime = new Date();
|
||||
cfg.setIsAudit(1);
|
||||
cfg.setAuditTime(updateTime);
|
||||
cfg.setTableName(tableName);
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
}
|
||||
compileIdArray.add(cfg.getCompileId());
|
||||
}
|
||||
List subList = configSynchronizationDao.getIpDropList("ip_port_cfg", compileIdArray);
|
||||
for(int i=0;i<subList.size();i++){
|
||||
IpPortCfg cfg = (IpPortCfg) subList.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
cfg.setIsValid(newIsValid);
|
||||
if(newIsValid==1){
|
||||
Date updateTime = new Date();
|
||||
cfg.setIsAudit(1);
|
||||
cfg.setAuditTime(updateTime);
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
callBackCfgList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
|
||||
}else{
|
||||
logger.debug("配置修改与配置当前状态不符合业务逻辑");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
if(className.equals("AvFileSampleCfg")){
|
||||
list = configSynchronizationDao.getAvFileCfgList(entity);
|
||||
for(int i=0;i<list.size();i++){
|
||||
AvFileSampleCfg cfg = (AvFileSampleCfg) list.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
cfg.setIsValid(newIsValid);
|
||||
if(newIsValid==1){
|
||||
Date updateTime = new Date();
|
||||
cfg.setIsAudit(1);
|
||||
cfg.setAuditTime(updateTime);
|
||||
cfg.setTableName(tableName);
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
callBackCfgList.add(cfg);
|
||||
}else{
|
||||
logger.debug("配置修改与配置当前状态不符合业务逻辑");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else if(className.equals("AvSignSampleCfg")){//音视频场景配置
|
||||
list = configSynchronizationDao.getAvSignCfgList(entity);
|
||||
for(int i=0;i<list.size();i++){
|
||||
AvSignSampleCfg cfg = (AvSignSampleCfg) list.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
cfg.setIsValid(newIsValid);
|
||||
if(newIsValid==1){
|
||||
Date updateTime = new Date();
|
||||
cfg.setIsAudit(1);
|
||||
cfg.setAuditTime(updateTime);
|
||||
cfg.setTableName(tableName);
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
callBackCfgList.add(cfg);
|
||||
}else{
|
||||
logger.debug("配置修改与配置当前状态不符合业务逻辑");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(className.equals("IpPortCfg")){
|
||||
list = configSynchronizationDao.getIpPortListByService(entity);
|
||||
for(int i=0;i<list.size();i++){
|
||||
IpPortCfg cfg = (IpPortCfg) list.get(i);
|
||||
if(cfg.getIsAudit()==0){
|
||||
isUpdateContent = true;
|
||||
cfg.setIsValid(newIsValid);
|
||||
if(newIsValid==1){
|
||||
Date updateTime = new Date();
|
||||
cfg.setIsAudit(1);
|
||||
cfg.setAuditTime(updateTime);
|
||||
cfg.setTableName(tableName);
|
||||
configSynchronizationDao.updateCfgStatus(cfg);//修改界面数据库配置状态
|
||||
callBackCfgList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
|
||||
}else{
|
||||
logger.debug("配置修改与配置当前状态不符合业务逻辑");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isUpdateContent){//如果没有内容修改,则只更新状态
|
||||
Date updateTime = new Date();
|
||||
BaseCfg updateCfg = new BaseCfg();
|
||||
updateCfg.setIsValid(newIsValid);
|
||||
updateCfg.setCompileId(compileId);
|
||||
updateCfg.setServiceId(serviceId);
|
||||
updateCfg.setAuditTime(updateTime);
|
||||
updateCfg.setEditTime(updateTime);
|
||||
updateCfg.setCreatorName("TaskScheduler");
|
||||
configSynchronizationDao.updateCfgStatus(updateCfg);//修改界面数据库配置状态
|
||||
callBackCfgList.add(updateCfg);
|
||||
}
|
||||
// }
|
||||
if(!StringUtil.isEmpty(callBackCfgList)){
|
||||
//调用服务接口下发配置数据
|
||||
String json=BaseService.gsonToJson(callBackCfgList);
|
||||
//调用服务接口修改回调类配置状态
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,2);
|
||||
logger.debug("回调类配置启停状态修改结果:"+result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -66,10 +66,9 @@ public class ServiceConfigTemplateUtil {
|
||||
/**
|
||||
*
|
||||
* @param functionId
|
||||
* @param serviceId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> getServiceList(Integer functionId){
|
||||
public List<Map<String,Object>> getServiceListByFunctionId(Integer functionId){
|
||||
List<Map<String,Object>> list =new ArrayList();
|
||||
if(!StringUtil.isEmpty(functionId)) {
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(functionId);
|
||||
@@ -97,6 +96,34 @@ public class ServiceConfigTemplateUtil {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param serviceId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> getServiceListByServiceId(Integer serviceId){
|
||||
List<Map<String,Object>> list =new ArrayList();
|
||||
if(!StringUtil.isEmpty(serviceId)) {
|
||||
List<Element> elements = root.selectNodes("service");
|
||||
for(Element element:elements){
|
||||
String serviceIdC=element.attributeValue("id");
|
||||
if(!StringUtil.isEmpty(serviceIdC)
|
||||
&& String.valueOf(serviceId).equals(serviceIdC)) {
|
||||
Map<String,Object> map = new HashMap();
|
||||
for(int i=0;i<element.attributes().size();i++){
|
||||
String attributeName = element.attribute(i).getName();
|
||||
map.put(attributeName, element.attributeValue(attributeName));
|
||||
}
|
||||
map.put("cfgList", getServiceCfgList(element));
|
||||
map.put("userRegionList",getUserRegionList(element));
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -151,7 +178,7 @@ public class ServiceConfigTemplateUtil {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
List<Map<String,Object>> list = serviceTemplate.getServiceList(5);
|
||||
List<Map<String,Object>> list = serviceTemplate.getServiceListByServiceId(518);
|
||||
for(Map<String,Object> map :list){
|
||||
System.out.println("业务配置:"+map.get("id")+","+map.get("functionId")+","+map.get("serviceType")+","+map.get("tableName"));
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) map.get("cfgList");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -130,6 +130,9 @@ public class ExcelCsv {
|
||||
Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
|
||||
for (String title : titleList) {
|
||||
String noExportField=noExportMap.get(title);
|
||||
if(noExportField.contains("do_log")){
|
||||
noExportField=",do_blacklist,"+noExportField;
|
||||
}
|
||||
List<Object[]> annotationList = Lists.newArrayList();
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
@@ -216,7 +219,14 @@ public class ExcelCsv {
|
||||
}
|
||||
if(!StringUtil.isEmpty(titleStr)){
|
||||
//去掉不需要展示的header
|
||||
if(!(noExportField.indexOf(","+titleStr+",") > -1)){
|
||||
//去掉不需要展示的header
|
||||
String noExport="";
|
||||
if(noExportField.contains("&")){
|
||||
noExport=noExportField.substring(0,noExportField.indexOf("&"));
|
||||
}else{
|
||||
noExport=noExportField;
|
||||
}
|
||||
if(!(noExport.indexOf(","+titleStr+",") > -1)){
|
||||
//需要替换的header
|
||||
boolean flag=true;
|
||||
if(noExportField.contains("&")){
|
||||
@@ -225,14 +235,14 @@ public class ExcelCsv {
|
||||
for (int i = 0; i < replaceStr.length; i++) {
|
||||
String [] fields=replaceStr[i].split(":");
|
||||
if(fields[0].equals(titleStr)){
|
||||
titleStr=msgProp.getProperty(fields[1]);
|
||||
titleStr=msgProp.getProperty(fields[1],fields[1]);
|
||||
flag=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr);
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr,titleStr);
|
||||
}
|
||||
headerList.add(titleStr);
|
||||
commentList.add(commentStr);
|
||||
@@ -322,7 +332,7 @@ public class ExcelCsv {
|
||||
log.error("Get entity value failed",ex);
|
||||
val = "";
|
||||
}
|
||||
sb.append(val + ", ");
|
||||
sb.append(val + "┆~");
|
||||
}
|
||||
listT.add(String.valueOf(sb));
|
||||
}
|
||||
@@ -415,7 +425,7 @@ public class ExcelCsv {
|
||||
// 写入文件内容
|
||||
//Html 解码
|
||||
data = Encodes.unescapeHtml(data.toString());
|
||||
String [] datas=data.split(",");
|
||||
String [] datas=data.split("┆~");
|
||||
for (String tag : datas) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if("null".equals(tag.trim())){
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.RegionUtil;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||
@@ -227,6 +228,73 @@ public class ExportExcel {
|
||||
index++;
|
||||
}*/
|
||||
}
|
||||
/*** HTTP(s)重定向 重定向应答码 ***/
|
||||
if("redirect_response_code".equals(headerStr)){
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("REDIRECT_RESPONSE_CODE");
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue = "1";
|
||||
}
|
||||
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++;
|
||||
}
|
||||
}
|
||||
/*** HTTP(s)阻断 应答码 ***/
|
||||
if("response_code".equals(headerStr)){
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("RESPONSE_CODE");
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue = "404";
|
||||
}
|
||||
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++;
|
||||
}
|
||||
}
|
||||
/*** HTTP(s)替换 搜索区域 ***/
|
||||
if(("replace_zone".equals(headerStr)) && (region.getFunctionId().equals(209))){
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("CONTROL_REPLACE_ZONE");
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue = "http_resp_body";
|
||||
}
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
/***发现内容***/
|
||||
if("replaced_content".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
@@ -244,7 +312,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
//intercept replace replace_zone
|
||||
if("replace_zone".equals(headerStr)){
|
||||
if("replace_zone".equals(headerStr) && (region.getFunctionId().equals(212))){
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> interceptReplaceZone=DictUtils.getDictList("INTERCEPT_REPLACE_ZONE");
|
||||
if(interceptReplaceZone !=null && interceptReplaceZone.size()>0){
|
||||
@@ -968,13 +1036,18 @@ public class ExportExcel {
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
}
|
||||
// APP Payload
|
||||
if(region.getFunctionId().equals(563)) {
|
||||
commentStr=commentStr+"▶"+"L3_header:"+msgProp.getProperty("need_input")+"'headerType'"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//expr type
|
||||
if("key_word".equals(headerStr)){
|
||||
if(!StringUtil.isEmpty(region.getConfigMultiKeywords())){
|
||||
if(region.getConfigMultiKeywords().equals(1)){//多关键字输入TODO
|
||||
if(region.getConfigMultiKeywords().equals("1")){//多关键字输入TODO
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//允许输入多关键字,多个关键字用换行表示
|
||||
@@ -1189,6 +1262,95 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
// APP Payload
|
||||
if("headerType".equals(headerStr)){
|
||||
commentStr=commentStr+"IP_header"+"\n"+"ICMP_header"+"\n";
|
||||
index++;
|
||||
index++;
|
||||
defaultValue=region.getConfigDistrict().split(",")[0];
|
||||
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
index++;
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
|
||||
//1、非空说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
//2、默认值说明
|
||||
/*if(!StringUtil.isEmpty(defaultValue)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+"IP_header"+"\n";
|
||||
index++;
|
||||
}*/
|
||||
|
||||
commentStr=commentStr+"▶"+"IP_header:"+msgProp.getProperty("need_input")+"('VER'、'IHL'、'TOS'、'Total Length'、'Flags'、'fragment offset'、'Protocol'),"+msgProp.getProperty("max_input")+"\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+"ICMP_header:"+msgProp.getProperty("need_input")+"('ICMP type'、'ICMP code'、'ICMP identifier')"+"\n";
|
||||
index++;
|
||||
}
|
||||
if("VER".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_4");
|
||||
index++;
|
||||
}
|
||||
if("IHL".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_4");
|
||||
index++;
|
||||
}
|
||||
if("TOS".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_8");
|
||||
index++;
|
||||
}
|
||||
if("Total Length".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_16");
|
||||
index++;
|
||||
}
|
||||
if("Flags".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_3");
|
||||
index++;
|
||||
}
|
||||
if("fragment offset".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_8");
|
||||
index++;
|
||||
}
|
||||
if("Protocol".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_8");
|
||||
index++;
|
||||
}
|
||||
if("ICMP type".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_8");
|
||||
index++;
|
||||
}
|
||||
if("ICMP code".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_8");
|
||||
index++;
|
||||
}
|
||||
if("ICMP identifier".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("hex_minlength_16");
|
||||
index++;
|
||||
}
|
||||
|
||||
}else if(region.getRegionType().equals(6)) {
|
||||
if(region.getFunctionId().equals(400)) {
|
||||
if("group".equals(headerStr)){
|
||||
@@ -2132,6 +2294,9 @@ public class ExportExcel {
|
||||
Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
|
||||
for (String title : titleList) {
|
||||
String noExportField=noExportMap.get(title);
|
||||
if(noExportField.contains("do_log")){
|
||||
noExportField=",do_blacklist,"+noExportField;
|
||||
}
|
||||
List<Object[]> annotationList = Lists.newArrayList();
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
@@ -2218,7 +2383,13 @@ public class ExportExcel {
|
||||
}
|
||||
if(!StringUtil.isEmpty(titleStr)){
|
||||
//去掉不需要展示的header
|
||||
if(!(noExportField.indexOf(","+titleStr+",") > -1)){
|
||||
String noExport="";
|
||||
if(noExportField.contains("&")){
|
||||
noExport=noExportField.substring(0,noExportField.indexOf("&"));
|
||||
}else{
|
||||
noExport=noExportField;
|
||||
}
|
||||
if(!(noExport.indexOf(","+titleStr+",") > -1)){
|
||||
//需要替换的header
|
||||
boolean flag=true;
|
||||
if(noExportField.contains("&")){
|
||||
@@ -2227,14 +2398,14 @@ public class ExportExcel {
|
||||
for (int i = 0; i < replaceStr.length; i++) {
|
||||
String [] fields=replaceStr[i].split(":");
|
||||
if(fields[0].equals(titleStr)){
|
||||
titleStr=msgProp.getProperty(fields[1]);
|
||||
titleStr=msgProp.getProperty(fields[1],fields[1]);
|
||||
flag=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr);
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr,titleStr);
|
||||
}
|
||||
headerList.add(titleStr);
|
||||
commentList.add(commentStr);
|
||||
@@ -2287,11 +2458,10 @@ public class ExportExcel {
|
||||
Row timeRow = sheet.createRow(0);
|
||||
timeRow.setHeightInPoints(16);
|
||||
Cell cellt = timeRow.createCell(0);
|
||||
cellt.setCellStyle(style);
|
||||
cellt.setCellValue(titleTime);
|
||||
sheet.addMergedRegion(callRangeAddress);
|
||||
sheet.autoSizeColumn(0);
|
||||
//--------------------
|
||||
setBorderStyle(CellStyle.BORDER_THIN,callRangeAddress,sheet,wb);
|
||||
}
|
||||
Integer rownum=rownums.get(title);
|
||||
Row headerRow = sheet.createRow(rownum++);
|
||||
@@ -2320,6 +2490,21 @@ public class ExportExcel {
|
||||
log.debug("Initialize success.");
|
||||
}
|
||||
|
||||
|
||||
public void setBorderStyle(int border, CellRangeAddress region, Sheet sheet, SXSSFWorkbook wb){
|
||||
RegionUtil.setBorderBottom(border, region, sheet, wb);//下边框
|
||||
RegionUtil.setBorderLeft(border, region, sheet, wb); //左边框
|
||||
RegionUtil.setBorderRight(border, region, sheet, wb); //右边框
|
||||
RegionUtil.setBorderTop(border, region, sheet, wb); //上边框
|
||||
RegionUtil.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex(), region, sheet, wb);
|
||||
RegionUtil.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex(), region, sheet, wb);
|
||||
RegionUtil.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex(), region, sheet, wb);
|
||||
RegionUtil.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex(), region, sheet, wb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 输出数据流
|
||||
* @param os 输出数据流
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
package com.nis.util.excel.thread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.beust.jcommander.internal.Sets;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.nis.web.service.configuration.AppMultiFeatureCfgService;
|
||||
|
||||
public class CheckAppFeatureComplexStringFormatThread implements Callable<String>{
|
||||
private Logger logger=Logger.getLogger(CheckAppFeatureComplexStringFormatThread.class);
|
||||
private BlockingQueue<? extends Object> srcQueue;
|
||||
private BlockingQueue<AppComplexFeatureCfg> destQueue;
|
||||
private Properties prop;
|
||||
private FunctionServiceDict serviceDict;
|
||||
private FunctionRegionDict regionDict;
|
||||
|
||||
public CheckAppFeatureComplexStringFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<AppComplexFeatureCfg> destQueue) {
|
||||
this.serviceDict=serviceDict;
|
||||
this.regionDict=regionDict;
|
||||
this.srcQueue=srcQueue;
|
||||
this.destQueue=destQueue;
|
||||
this.prop=prop;
|
||||
|
||||
}
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
List<Object> dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
StringBuffer msg=new StringBuffer();
|
||||
while(!srcQueue.isEmpty()) {
|
||||
int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE);
|
||||
if(regionDict.getRegionType().intValue()==3) {
|
||||
try {
|
||||
List<AppComplexFeatureCfg> cfgs=this.checkAppComplexFeatureCfg(msg,dataList);
|
||||
destQueue.addAll(cfgs);
|
||||
}catch (Exception e) {
|
||||
logger.error("checkComplexStringCfg error,",e);
|
||||
// TODO: handle exception
|
||||
//msg=e.getMessage();
|
||||
//msg.append(e.getMessage());
|
||||
//break;
|
||||
}
|
||||
}
|
||||
dataList.clear();
|
||||
}
|
||||
return msg.toString();
|
||||
}
|
||||
public List<AppComplexFeatureCfg> checkAppComplexFeatureCfg(StringBuffer msg,
|
||||
List<?> list) throws ServiceException {
|
||||
logger.warn("start to validate appfeaturecomplexString data...");
|
||||
long start=System.currentTimeMillis();
|
||||
List<AppComplexFeatureCfg> stringList = new ArrayList<AppComplexFeatureCfg>();
|
||||
String exprTypeP = regionDict.getConfigExprType();
|
||||
if (StringUtils.isBlank(exprTypeP)) {
|
||||
throw new RuntimeException("Found String region,but exprType is Empty");
|
||||
}
|
||||
String matchMethodP = regionDict.getConfigMatchMethod();
|
||||
if (StringUtils.isBlank(matchMethodP)) {
|
||||
throw new RuntimeException("Found String region,but matchMethod is Empty");
|
||||
}
|
||||
String hexP = regionDict.getConfigHex();
|
||||
if (StringUtils.isBlank(hexP)) {
|
||||
throw new RuntimeException("Found String region,but hex is Empty");
|
||||
}
|
||||
String mulityKeywordsP = regionDict.getConfigMultiKeywords();
|
||||
if (StringUtils.isBlank(mulityKeywordsP)) {
|
||||
throw new RuntimeException("Found String region,but mulityKeywords is Empty");
|
||||
}
|
||||
String dirtrictP = regionDict.getConfigDistrict();
|
||||
StringBuffer errTip = new StringBuffer();
|
||||
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
|
||||
AppMultiFeatureCfgService appMultiFeatureCfgService = SpringContextHolder.getBean(AppMultiFeatureCfgService.class);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
StringBuffer errInfo = new StringBuffer();
|
||||
AppComplexFeatureCfg baseStringCfg = new AppComplexFeatureCfg();
|
||||
BeanUtils.copyProperties(list.get(i), baseStringCfg);
|
||||
// 配置描述、关键字长度限制
|
||||
if(baseStringCfg.getCfgDesc().length() > 128) {
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
if(baseStringCfg.getCfgKeywords().length() < 4 || baseStringCfg.getCfgKeywords().length() > 1024){
|
||||
errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
if (regionDict.getRegionType().equals(3)) {
|
||||
String keyword = baseStringCfg.getCfgKeywords();
|
||||
String district = baseStringCfg.getDistrict();
|
||||
if (StringUtils.isBlank(keyword)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dirtrictP)) {
|
||||
if (StringUtils.isBlank(district)) {
|
||||
if (dirtrictP.indexOf(",") == -1) {
|
||||
baseStringCfg.setDistrict(dirtrictP);
|
||||
} else {
|
||||
// baseStringCfg.setDistrict(dirtrictP.split(",")[0]);
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("district") + " ")
|
||||
+ ";");
|
||||
}
|
||||
} else if (dirtrictP.indexOf(district) == -1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("district") + " ")
|
||||
+ ";");
|
||||
} else if (dirtrictP.indexOf("others")>-1&&district.equals("others")) {
|
||||
//不允许自定义匹配区域导入
|
||||
errInfo.append(prop.getProperty("district")+" "+
|
||||
String.format(prop.getProperty("can_not_be"), " 'others'")+ ";");
|
||||
}
|
||||
}
|
||||
if (mulityKeywordsP.equals("0")) {
|
||||
if (keyword.indexOf("\n") > -1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";");
|
||||
}
|
||||
Matcher m = pattern.matcher(keyword);
|
||||
if (m.find()) {
|
||||
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
||||
prop.getProperty("key_word") + " '" + keyword + "'") + ";");
|
||||
}
|
||||
} else {
|
||||
boolean has = false;
|
||||
Set<String> keywordSet=Sets.newHashSet();
|
||||
|
||||
for (String key : keyword.split("\n")) {
|
||||
Matcher m = pattern.matcher(key);
|
||||
if (m.find()) {
|
||||
has = true;
|
||||
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
||||
prop.getProperty("key_word") + " '" + key + "'") + ";");
|
||||
break;
|
||||
}
|
||||
if(!keywordSet.contains(key)) {
|
||||
keywordSet.add(key);
|
||||
}else {
|
||||
errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";");
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
if(keyword.replaceAll("\n","").length()>1024) {
|
||||
errInfo.append(String.format(prop.getProperty("most_keywords"),
|
||||
prop.getProperty("key_word")) + ";");
|
||||
}else {
|
||||
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
||||
baseStringCfg.setCfgKeywords(reWord);
|
||||
}
|
||||
}
|
||||
}
|
||||
Integer exprType = baseStringCfg.getExprType();
|
||||
boolean has = false;
|
||||
if (exprType == null) {
|
||||
if (exprTypeP.indexOf(",") == -1) {
|
||||
if (mulityKeywordsP.equals("0") && exprTypeP.equals("1")) {
|
||||
throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId());
|
||||
}
|
||||
baseStringCfg.setExprType(Integer.parseInt(exprTypeP));
|
||||
} else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("0")) {
|
||||
baseStringCfg.setExprType(0);
|
||||
} else if (exprTypeP.indexOf("1") > -1 && mulityKeywordsP.equals("1")
|
||||
&& keyword.indexOf("\n") > -1) {
|
||||
baseStringCfg.setExprType(1);
|
||||
} else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("1")
|
||||
&& keyword.indexOf("\n") == -1) {
|
||||
baseStringCfg.setExprType(0);
|
||||
} else {
|
||||
baseStringCfg.setExprType(Integer.parseInt(exprTypeP.split(",")[0]));
|
||||
}
|
||||
// errInfo.append(String.format(prop.getProperty("can_not_null"),
|
||||
// prop.getProperty("expression_type"))+";");
|
||||
} else {
|
||||
for (String exp : exprTypeP.split(",")) {
|
||||
if (exp.equals(exprType.toString())) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))
|
||||
+ ";");
|
||||
}
|
||||
has = false;
|
||||
}
|
||||
exprType = baseStringCfg.getExprType();
|
||||
Integer matchMethod = baseStringCfg.getMatchMethod();
|
||||
if (matchMethod == null) {
|
||||
if (matchMethodP.indexOf(",") == -1) {
|
||||
if (exprTypeP.equals("1") && !matchMethodP.equals("0")) {
|
||||
throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId());
|
||||
}
|
||||
baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP));
|
||||
} else if (exprType != null && exprType.intValue() == 1) {
|
||||
if (matchMethodP.indexOf("0") > -1) {
|
||||
baseStringCfg.setMatchMethod(0);
|
||||
} else {
|
||||
throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId());
|
||||
}
|
||||
|
||||
} else {
|
||||
baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP.split(",")[0]));
|
||||
}
|
||||
// errInfo.append(String.format(prop.getProperty("can_not_null"),
|
||||
// prop.getProperty("match_method"))+";");
|
||||
} else {
|
||||
for (String exp : matchMethodP.split(",")) {
|
||||
if (exp.equals(matchMethod.toString())) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
Integer isHex = baseStringCfg.getIsHex();
|
||||
Integer isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
if (isHex == null || isCaseInsenstive == null) {
|
||||
if (isHex == null) {
|
||||
if (hexP.indexOf("0")>-1 || hexP.indexOf("2")>-1) {
|
||||
baseStringCfg.setIsHex(0);
|
||||
} else if (hexP.indexOf("1")>-1) {
|
||||
baseStringCfg.setIsHex(1);
|
||||
} else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
}
|
||||
if (isCaseInsenstive == null) {
|
||||
if (hexP.indexOf("0")>-1 || hexP.indexOf("1")>-1) {
|
||||
baseStringCfg.setIsCaseInsenstive(0);
|
||||
} else if (hexP.indexOf("2")>-1) {
|
||||
baseStringCfg.setIsCaseInsenstive(1);
|
||||
} else {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"),
|
||||
prop.getProperty("is_case_insenstive")) + ";");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isHex.intValue() != 0 && isHex.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.equals("1") && isHex.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 关键字十六进制校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
isHex = baseStringCfg.getIsHex();
|
||||
isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
if (isHex != null && isCaseInsenstive != null) {
|
||||
if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) {
|
||||
baseStringCfg.setIsHexbin(0);
|
||||
} else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 0) {
|
||||
baseStringCfg.setIsHexbin(1);
|
||||
} else if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 1) {
|
||||
baseStringCfg.setIsHexbin(2);
|
||||
} else if (hexP.indexOf("1") != -1 && isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) {// 只有是十六进制且取值正确的时候, 才进行(十六进制)与(大小写敏感)的校验
|
||||
errInfo.append(prop.getProperty("hex_case_insensitive")+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
// APP Payload L3_HEADER的特殊属性限制
|
||||
if(baseStringCfg.getDistrict().equals("L3_header")) {
|
||||
String headerType = baseStringCfg.getHeaderType();
|
||||
if(StringUtils.isBlank(headerType)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), "headerType") + ";");
|
||||
}else if((!"IP_header".equals(headerType)) && (!"ICMP_header".equals(headerType))) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), "headerType") + ";");
|
||||
}else{
|
||||
appMultiFeatureCfgService.checkImportAppPayload(baseStringCfg, errInfo, prop);
|
||||
}
|
||||
appMultiFeatureCfgService.setL3HeaderKeyword(baseStringCfg);
|
||||
}else {
|
||||
baseStringCfg.setHeaderType(null);
|
||||
baseStringCfg.setVer(null);
|
||||
baseStringCfg.setIhl(null);
|
||||
baseStringCfg.setTos(null);
|
||||
baseStringCfg.setTotalLength(null);
|
||||
baseStringCfg.setFlags(null);
|
||||
baseStringCfg.setFragmentOffset(null);
|
||||
baseStringCfg.setProtocol(null);
|
||||
baseStringCfg.setIcmpType(null);
|
||||
baseStringCfg.setIcmpCode(null);
|
||||
baseStringCfg.setIcmpIdentifier(null);
|
||||
}
|
||||
}
|
||||
if (errInfo.toString().length() > 0) {
|
||||
errTip.append(String.format(prop.getProperty("line"), baseStringCfg.getIndex()) + ",");
|
||||
errTip.append(errInfo);
|
||||
errTip.append("<br>");
|
||||
}else {
|
||||
stringList.add(baseStringCfg);
|
||||
}
|
||||
}
|
||||
if (errTip.toString().length() > 0) {
|
||||
msg.append(errTip);
|
||||
//throw new ServiceException(errTip.toString());
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("validate appfeaturecomplexString data finish,cost:"+(end-start));
|
||||
return stringList;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import com.beust.jcommander.internal.Lists;
|
||||
import com.beust.jcommander.internal.Sets;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.util.Constants;
|
||||
@@ -89,6 +90,14 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
StringBuffer errInfo = new StringBuffer();
|
||||
ComplexkeywordCfg baseStringCfg = new ComplexkeywordCfg();
|
||||
BeanUtils.copyProperties(list.get(i), baseStringCfg);
|
||||
// 配置描述、关键字长度限制
|
||||
if(baseStringCfg.getCfgDesc().length() > 128) {
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
if(baseStringCfg.getCfgKeywords().length() < 4 || baseStringCfg.getCfgKeywords().length() > 1024){
|
||||
errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
if (regionDict.getRegionType().equals(3)) {
|
||||
if (regionDict.getFunctionId().equals(7)) {
|
||||
Long dnsStrategyId = baseStringCfg.getDnsStrategyId();
|
||||
@@ -100,6 +109,72 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
}
|
||||
}
|
||||
}
|
||||
// 代理HTTP(s)阻断
|
||||
if (regionDict.getFunctionId().equals(207)) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 应答码
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("REDIRECT_RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("redirect_response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2)){
|
||||
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
|
||||
boolean bl = pat.matcher(userRegion2).matches();
|
||||
if (!bl) {
|
||||
errInfo.append(String.format(prop.getProperty("is_in_wrong_format"),
|
||||
prop.getProperty("redirect_url") + " '" + userRegion2 + "' ") + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 代理HTTP(s)替换
|
||||
if (regionDict.getFunctionId().equals(209)) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 搜索区域
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("replace_zone") + " ") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String keyword = baseStringCfg.getCfgKeywords();
|
||||
String district = baseStringCfg.getDistrict();
|
||||
if (StringUtils.isBlank(keyword)) {
|
||||
@@ -282,6 +357,14 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 关键字十六进制校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
isHex = baseStringCfg.getIsHex();
|
||||
isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
@@ -292,7 +375,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
baseStringCfg.setIsHexbin(1);
|
||||
} else if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 1) {
|
||||
baseStringCfg.setIsHexbin(2);
|
||||
}else {
|
||||
} else if (hexP.indexOf("1") != -1 && isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) {// 只有是十六进制且取值正确的时候, 才进行(十六进制)与(大小写敏感)的校验
|
||||
errInfo.append(prop.getProperty("hex_case_insensitive")+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,11 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
StringBuffer errInfo = new StringBuffer();
|
||||
IpPortCfg baseIpCfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(list.get(i), baseIpCfg);
|
||||
// 配置描述长度限制
|
||||
if(baseIpCfg.getCfgDesc().length() > 128) {
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
|
||||
// 特殊字段验证
|
||||
// packet ip ratelimit
|
||||
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
||||
@@ -294,6 +299,72 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
baseIpCfg.setAntiddosProtocol("");
|
||||
}
|
||||
}
|
||||
// 代理HTTP(s)阻断
|
||||
if (regionDict.getFunctionId().equals(207)) {
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 应答码
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();// 重定向URL
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("REDIRECT_RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("redirect_response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2)){
|
||||
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
|
||||
boolean bl = pat.matcher(userRegion2).matches();
|
||||
if (!bl) {
|
||||
errInfo.append(String.format(prop.getProperty("is_in_wrong_format"),
|
||||
prop.getProperty("redirect_url") + " '" + userRegion2 + "' ") + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 代理HTTP(s)替换
|
||||
if (regionDict.getFunctionId().equals(209)) {
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 搜索区域
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("replace_zone") + " ") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (regionDict.getRegionType().equals(1)) {
|
||||
boolean srcIpEmpty = false;
|
||||
boolean destIpEmpty = false;
|
||||
|
||||
@@ -88,6 +88,14 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
StringBuffer errInfo = new StringBuffer();
|
||||
BaseStringCfg baseStringCfg = new BaseStringCfg();
|
||||
BeanUtils.copyProperties(list.get(i), baseStringCfg);
|
||||
// 配置描述、关键字长度限制
|
||||
if(baseStringCfg.getCfgDesc().length() > 128) {
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
if(baseStringCfg.getCfgKeywords().length() < 4 || baseStringCfg.getCfgKeywords().length() > 1024){
|
||||
errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
if (regionDict.getRegionType().equals(2)) {
|
||||
if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();
|
||||
@@ -139,6 +147,72 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
}
|
||||
}
|
||||
// 代理HTTP(s)阻断
|
||||
if (regionDict.getFunctionId().equals(207)) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 应答码
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("REDIRECT_RESPONSE_CODE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("redirect_response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2)){
|
||||
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
|
||||
boolean bl = pat.matcher(userRegion2).matches();
|
||||
if (!bl) {
|
||||
errInfo.append(String.format(prop.getProperty("is_in_wrong_format"),
|
||||
prop.getProperty("redirect_url") + " '" + userRegion2 + "' ") + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 代理HTTP(s)替换
|
||||
if (regionDict.getFunctionId().equals(209)) {
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 搜索区域
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion1)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("replace_zone") + " ") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String keyword = baseStringCfg.getCfgKeywords();
|
||||
if (!regionDict.getFunctionId().equals(403) && !regionDict.getFunctionId().equals(201)) {// 201域名拦截
|
||||
if (StringUtils.isBlank(keyword)) {
|
||||
@@ -324,6 +398,14 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))
|
||||
+ ";");
|
||||
}
|
||||
// 十六进制 关键字校验
|
||||
if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
isHex = baseStringCfg.getIsHex();
|
||||
isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
@@ -334,7 +416,7 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
baseStringCfg.setIsHexbin(1);
|
||||
} else if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 1) {
|
||||
baseStringCfg.setIsHexbin(2);
|
||||
}else {
|
||||
} else if (hexP.indexOf("1") != -1 && isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) {// 只有是十六进制且取值正确的时候, 才进行(十六进制)与(大小写敏感)的校验
|
||||
errInfo.append(prop.getProperty("hex_case_insensitive")+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppHttpCfg;
|
||||
@@ -75,6 +76,7 @@ import com.nis.domain.configuration.PxyObjTrustedCaCrl;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
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.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
@@ -85,6 +87,15 @@ import com.nis.domain.configuration.template.DnsResStrategyTemplate;
|
||||
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.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.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.configuration.template.IpPayloadTemplate;
|
||||
@@ -118,6 +129,7 @@ import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelCsv;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.util.excel.thread.CheckAppFeatureComplexStringFormatThread;
|
||||
import com.nis.util.excel.thread.CheckComplexStringFormatThread;
|
||||
import com.nis.util.excel.thread.CheckDnsResStrategyFormatThread;
|
||||
import com.nis.util.excel.thread.CheckIpFormatThread;
|
||||
@@ -1084,6 +1096,48 @@ public class BaseController {
|
||||
return queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多线程验证
|
||||
* @param _msg
|
||||
* @param serviceDict
|
||||
* @param regionDict
|
||||
* @param list
|
||||
* @return
|
||||
* @throws InterruptedException
|
||||
* @throws ExecutionException
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public BlockingQueue<AppComplexFeatureCfg> checkAppComplexFeatureStringCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,BlockingQueue<? extends Object> list) throws InterruptedException, ExecutionException, ServiceException{
|
||||
logger.warn("start checkAppComplexFeatureStringCfgMulity ,size "+list.size());
|
||||
long start=System.currentTimeMillis();
|
||||
BlockingQueue<AppComplexFeatureCfg> queue=new ArrayBlockingQueue<>(list.size());
|
||||
ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE);
|
||||
List<Future<String>> futures=new ArrayList<>();
|
||||
for(int i=0;i<Constants.MULITY_THREAD_SIZE;i++) {
|
||||
CheckAppFeatureComplexStringFormatThread t = new CheckAppFeatureComplexStringFormatThread(serviceDict,regionDict, this.getMsgProp(), list, queue);
|
||||
futures.add(service.submit(t));
|
||||
}
|
||||
service.shutdown();
|
||||
while(!service.isTerminated()) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for(Future<String> future:futures) {
|
||||
String msg = future.get();
|
||||
if(StringUtils.isNotBlank(msg)) {
|
||||
_msg.append(msg);
|
||||
//throw new ServiceException(msg);
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("checkAppComplexFeatureStringCfgMulity finish,cost:"+(end-start)+",size:"+queue.size());
|
||||
return queue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* setReportSearchTime(报表查询设置开始时间与结束时间) (这里描述这个方法适用条件 – 可选)
|
||||
@@ -1220,14 +1274,17 @@ public class BaseController {
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
BlockingQueue<DnsResStrategy> dnsResStrategies=null;
|
||||
BlockingQueue<AppComplexFeatureCfg> appComplexFeatureCfgs=null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
List<AppPolicyCfg> appPolicyCfgs = new ArrayList<AppPolicyCfg>();
|
||||
List<AppFeatureIndex> appFeatureIndexs= new ArrayList<AppFeatureIndex>();
|
||||
List<Map<Long,Integer>> asnNoMaps=Lists.newArrayList();
|
||||
Map<Long,Integer> newAsnNoMap=Maps.newConcurrentMap();
|
||||
Map<Long,Integer> OldAsnNoMap=Maps.newConcurrentMap();
|
||||
asnNoMaps.add(newAsnNoMap);
|
||||
asnNoMaps.add(OldAsnNoMap);
|
||||
FunctionRegionDict appRegion = null;
|
||||
FunctionRegionDict appFeatureRegion = null;
|
||||
if(serviceDict!=null) {
|
||||
String regionCode = serviceDict.getRegionCode();
|
||||
for (String code : regionCode.split(",")) {
|
||||
@@ -1239,6 +1296,12 @@ public class BaseController {
|
||||
appRegion = d;
|
||||
break;
|
||||
}
|
||||
|
||||
if (d != null && d.getFunctionId() != null
|
||||
&& (d.getFunctionId().intValue()==565 || d.getFunctionId().intValue()==564 || d.getFunctionId().intValue()==566 || d.getFunctionId().intValue()==563)) {
|
||||
appFeatureRegion = d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1279,9 +1342,18 @@ public class BaseController {
|
||||
AsnCacheUtils.init(true);
|
||||
BlockingQueue<AsnIpTemplate> list = ei.getDataList(AsnIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, asnNoMaps, list);
|
||||
} else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
}else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
BlockingQueue<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
BlockingQueue<HttpsRejectIpTemplate> list = ei.getDataList(HttpsRejectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
BlockingQueue<HttpsRedirectIpTemplate> list = ei.getDataList(HttpsRedirectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceIpTemplate> list = ei.getDataList(HttpsReplaceIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
} else {
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
@@ -1307,6 +1379,15 @@ public class BaseController {
|
||||
BlockingQueue<DomainInterceptTemplate> list = ei.getDataList(DomainInterceptTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
BlockingQueue<HttpsRejectTemplate> list = ei.getDataList(HttpsRejectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
BlockingQueue<HttpsRedirectTemplate> list = ei.getDataList(HttpsRedirectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceTemplate> list = ei.getDataList(HttpsReplaceTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
@@ -1317,6 +1398,18 @@ public class BaseController {
|
||||
BlockingQueue<DnsComplexStringTemplate> list = ei.getDataList(DnsComplexStringTemplate.class
|
||||
);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
BlockingQueue<HttpsRejectComplexTemplate> list = ei.getDataList(HttpsRejectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
BlockingQueue<HttpsRedirectComplexTemplate> list = ei.getDataList(HttpsRedirectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceComplexTemplate> list = ei.getDataList(HttpsReplaceComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(563)){// APP Payload
|
||||
BlockingQueue<AppPayloadTemplate> list = ei.getDataList(AppPayloadTemplate.class);
|
||||
appComplexFeatureCfgs = this.checkAppComplexFeatureStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else {
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class
|
||||
);
|
||||
@@ -1339,6 +1432,7 @@ public class BaseController {
|
||||
String specServiceId = request.getParameter("appId");
|
||||
String behaviorId = request.getParameter("behaviorId");
|
||||
String asnIpGroup = request.getParameter("asnGroupId");
|
||||
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
SpecificServiceCfg specificServiceCfg = null;
|
||||
if (serviceDict!=null&&(serviceDict.getServiceId().intValue() == 33 || serviceDict.getServiceId().intValue() == 145
|
||||
@@ -1349,6 +1443,9 @@ public class BaseController {
|
||||
|| serviceDict.getServiceId().intValue() == 1028// app ip
|
||||
|| serviceDict.getServiceId().intValue() == 1024//app http
|
||||
|| serviceDict.getServiceId().intValue() == 1026//app domain
|
||||
|| serviceDict.getServiceId().intValue() == 1027//app dns
|
||||
|| serviceDict.getServiceId().intValue() == 1029//app ssl
|
||||
|| serviceDict.getServiceId().intValue() == 1025//app PAYLOAD
|
||||
)) {
|
||||
if (StringUtils.isNotBlank(specServiceId)) {
|
||||
specificServiceCfg = specificServiceCfgService
|
||||
@@ -1494,7 +1591,7 @@ public class BaseController {
|
||||
asnIpCfgs.add(_cfg);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1507,7 +1604,7 @@ public class BaseController {
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
// List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
@@ -1517,7 +1614,7 @@ public class BaseController {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
// numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
@@ -1558,9 +1655,9 @@ public class BaseController {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
// if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
// cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
// }
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
@@ -1615,15 +1712,29 @@ public class BaseController {
|
||||
if(regionDict.getFunctionId().intValue()!=600
|
||||
&®ionDict.getFunctionId().intValue()!=301
|
||||
&®ionDict.getFunctionId().intValue()!=401
|
||||
&®ionDict.getFunctionId().intValue()!=405) {
|
||||
&®ionDict.getFunctionId().intValue()!=405
|
||||
&®ionDict.getFunctionId().intValue()!=565
|
||||
&®ionDict.getFunctionId().intValue()!=566
|
||||
&®ionDict.getFunctionId().intValue()!=563) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566 || regionDict.getFunctionId().intValue()==563){
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
if(regionDict!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(regionDict.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType()));
|
||||
}
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
appFeatureIndexs.add(appfeature);
|
||||
}
|
||||
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1748,88 +1859,205 @@ public class BaseController {
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.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();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_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());
|
||||
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));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
if (serviceDict.getServiceId().intValue() == 33
|
||||
|| serviceDict.getServiceId().intValue() == 145
|
||||
|| serviceDict.getServiceId().intValue() == 35
|
||||
|| serviceDict.getServiceId().intValue() == 147
|
||||
|| serviceDict.getServiceId().intValue() == 36
|
||||
|| serviceDict.getServiceId().intValue() == 148) {
|
||||
if (appRegion != null) {
|
||||
AppPolicyCfg appPolicyCfg = new AppPolicyCfg();
|
||||
BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"});
|
||||
//appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
//appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
appPolicyCfg.setMatchMethod(0);
|
||||
appPolicyCfg.setIsHexbin(0);
|
||||
appPolicyCfg.setCfgType(appRegion.getConfigRegionValue());
|
||||
appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode());
|
||||
if (StringUtils.isNotBlank(behaviorId)) {
|
||||
//appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
appPolicyCfg.setExprType(1);
|
||||
} else {
|
||||
appPolicyCfg.setExprType(0);
|
||||
}
|
||||
appPolicyCfgs.add(appPolicyCfg);
|
||||
if(!regionDict.getFunctionId().equals(563)) {
|
||||
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());
|
||||
}
|
||||
} else {
|
||||
if(!regionDict.getFunctionId().equals(402)) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
} 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));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
if (serviceDict.getServiceId().intValue() == 33
|
||||
|| serviceDict.getServiceId().intValue() == 145
|
||||
|| serviceDict.getServiceId().intValue() == 35
|
||||
|| serviceDict.getServiceId().intValue() == 147
|
||||
|| serviceDict.getServiceId().intValue() == 36
|
||||
|| serviceDict.getServiceId().intValue() == 148) {
|
||||
if (appRegion != null) {
|
||||
AppPolicyCfg appPolicyCfg = new AppPolicyCfg();
|
||||
BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"});
|
||||
//appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
//appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
appPolicyCfg.setMatchMethod(0);
|
||||
appPolicyCfg.setIsHexbin(0);
|
||||
appPolicyCfg.setCfgType(appRegion.getConfigRegionValue());
|
||||
appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode());
|
||||
if (StringUtils.isNotBlank(behaviorId)) {
|
||||
//appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
appPolicyCfg.setExprType(1);
|
||||
} else {
|
||||
appPolicyCfg.setExprType(0);
|
||||
}
|
||||
appPolicyCfgs.add(appPolicyCfg);
|
||||
}
|
||||
} else {
|
||||
if(!regionDict.getFunctionId().equals(402) && !regionDict.getFunctionId().equals(565)
|
||||
&& !regionDict.getFunctionId().equals(566) && !regionDict.getFunctionId().equals(564)) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566
|
||||
|| regionDict.getFunctionId().intValue()==564){
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
if(regionDict!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(regionDict.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType()));
|
||||
}
|
||||
appFeatureIndexs.add(appfeature);
|
||||
}
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
appFeatureIndexs.clear();
|
||||
}
|
||||
|
||||
}else {
|
||||
// APP Payload处理
|
||||
List<AppComplexFeatureCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!appComplexFeatureCfgs.isEmpty()) {
|
||||
appComplexFeatureCfgs.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 (AppComplexFeatureCfg 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));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
|
||||
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
if(regionDict!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(regionDict.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType()));
|
||||
}
|
||||
appFeatureIndexs.add(appfeature);
|
||||
|
||||
ind++;
|
||||
}
|
||||
ind++;
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
appFeatureIndexs.clear();
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}else if(regionDict.getRegionType().equals(6)) {
|
||||
if(regionDict.getFunctionId().equals(400)) {
|
||||
@@ -1866,7 +2094,7 @@ public class BaseController {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
_dnsResStrategies.clear();
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
@@ -1923,8 +2151,14 @@ public class BaseController {
|
||||
ei.loadInitParams(P2pIpTemplate.class, msgProp, regionDict, serviceDict);
|
||||
} else if (regionDict.getFunctionId().equals(600)) {// ASN IP
|
||||
ei.loadInitParams(AsnIpTemplate.class, msgProp, regionDict, serviceDict);
|
||||
} else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
} else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
ei.loadInitParams(DdosIpTemplate.class, msgProp, regionDict, serviceDict);
|
||||
} else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
ei.loadInitParams(HttpsRejectIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
ei.loadInitParams(HttpsRedirectIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
ei.loadInitParams(HttpsReplaceIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else {
|
||||
ei.loadInitParams(IpAllTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
@@ -1942,13 +2176,27 @@ public class BaseController {
|
||||
}else{// 白名单
|
||||
ei.loadInitParams(DomainInterceptTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
} else {
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
ei.loadInitParams(HttpsRejectTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
ei.loadInitParams(HttpsRedirectTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
ei.loadInitParams(HttpsReplaceTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
|
||||
} else if (regionDict.getRegionType().equals(3)) {// 增强字符串类
|
||||
if (regionDict.getFunctionId().equals(7)&&serviceDict!=null&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(DnsComplexStringTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
ei.loadInitParams(HttpsRejectComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
ei.loadInitParams(HttpsRedirectComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
ei.loadInitParams(HttpsReplaceComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(563)) {// APP Payload
|
||||
ei.loadInitParams(AppPayloadTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
@@ -2031,7 +2279,17 @@ public class BaseController {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ExcelCsv.writeCSVFile(response,titleList,headMap,dataList,fileName,titleTime,msgProp);
|
||||
}
|
||||
|
||||
public String initLogMap(BaseLogEntity log,String title){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(title,title);;
|
||||
if(log.getSearchFoundStartTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("begin_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
if(log.getSearchFoundEndTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("end_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
public String initTimeMap(BaseCfg cfg){
|
||||
Properties msgProp = getMsgProp();
|
||||
@@ -2040,30 +2298,25 @@ public class BaseController {
|
||||
titleTime+=" "+msgProp.getProperty("config_time")+":"+DateUtils.formatDateTime(cfg.getSearch_create_time_start());
|
||||
if(cfg.getSearch_create_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_create_time_end());
|
||||
}
|
||||
}else{
|
||||
if(cfg.getSearch_create_time_end()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("config_time")+":—"+DateUtils.formatDateTime(cfg.getSearch_create_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
|
||||
}
|
||||
}
|
||||
if(cfg.getSearch_edit_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":"+DateUtils.formatDateTime(cfg.getSearch_edit_time_start());
|
||||
if(cfg.getSearch_edit_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_edit_time_end());
|
||||
}
|
||||
}else{
|
||||
if(cfg.getSearch_edit_time_end()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":—"+DateUtils.formatDateTime(cfg.getSearch_edit_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(cfg.getSearch_audit_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("audit_time")+":"+DateUtils.formatDateTime(cfg.getSearch_audit_time_start());
|
||||
if(cfg.getSearch_audit_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_audit_time_end());
|
||||
}
|
||||
}else{
|
||||
if(cfg.getSearch_audit_time_end()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("audit_time")+": —"+DateUtils.formatDateTime(cfg.getSearch_audit_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return titleTime;
|
||||
@@ -2272,7 +2525,7 @@ public class BaseController {
|
||||
if(auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) {
|
||||
functionId=auditBatchCfg.getFunctionId();
|
||||
}
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceList(functionId);
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
|
||||
|
||||
for(Map<String,Object> service:serviceList){
|
||||
String tableNameXml = service.get("tableName").toString();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.nis.web.controller.basics;
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -7,7 +7,6 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -18,20 +17,18 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/asn")
|
||||
@@ -50,9 +47,9 @@ public class AsnIpController extends BaseController{
|
||||
|
||||
// List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4);
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
AsnCacheUtils.init(false);
|
||||
List<ConfigGroupInfo> policyGroups=AsnCacheUtils.getAllAsnGroup();
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
// AsnCacheUtils.init(false);
|
||||
// List<ConfigGroupInfo> policyGroups=AsnCacheUtils.getAllAsnGroup();
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
return "/basics/asnIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/addForm"})
|
||||
@@ -186,33 +183,50 @@ public class AsnIpController extends BaseController{
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
List<AsnIpCfg> list = new ArrayList<AsnIpCfg>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = asnIpCfgService.findByPage(ids);
|
||||
} else {
|
||||
Page<AsnIpCfg> pageInfo=new Page<AsnIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AsnIpCfg> page = asnIpCfgService.findPage(pageInfo, entity);
|
||||
for (AsnIpCfg asnIp : page.getList()) {
|
||||
list=page.getList();
|
||||
}
|
||||
for (AsnIpCfg asnIp : list) {
|
||||
asnIp.setIsIssued(String.valueOf(asnIp.getIsValid()));
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), AsnIpCfg.class);
|
||||
String ipPortInfoNoExport=",do_log,action,valid_identifier,is_audit"
|
||||
String cfgIndexInfoNoExport=",block_type,do_log,action,valid_identifier,is_audit"
|
||||
+ ",auditor,audit_time,letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),ipPortInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
+",userregion2,userregion3,userregion4,userregion5,ir_type,group_name,&userregion1:asn_no-";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null ) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), list);
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("asnIp export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.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;
|
||||
@@ -14,6 +20,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
@@ -133,4 +140,62 @@ public class PolicyGroupController extends BaseController {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Group配置导出
|
||||
@RequestMapping(value = "exportGroup")
|
||||
public void exportGroup(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")PolicyGroupInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
entity.setMenuNameCode("policy_group_manage");
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
List<PolicyGroupInfo> list = new ArrayList<PolicyGroupInfo>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = policyGroupInfoService.findPolicyByGroupInfoList(ids);
|
||||
} else {
|
||||
Page<PolicyGroupInfo> pageInfo=new Page<PolicyGroupInfo>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page page = policyGroupInfoService.findPolicyGroupInfoList(pageInfo,entity);
|
||||
list=page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), PolicyGroupInfo.class);
|
||||
String cfgIndexInfoNoExport=",config_describe,cfg_id,block_type,do_log,action,valid_identifier,is_audit"
|
||||
+ ",auditor,audit_time,letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null ) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), list);
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Group export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +1,37 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.zookeeper.ZooDefs.Ids;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/serviceDictInfo")
|
||||
@@ -474,4 +471,126 @@ public class ServiceDictInfoController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
// dict配置导出
|
||||
@RequestMapping(value = "exportDict")
|
||||
public void exportDict(String itType, ServiceDictInfo serviceDictInfo,Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, RedirectAttributes redirectAttributes,String exType,String hColumns) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
List<ServiceDictInfo> list = Lists.newArrayList();
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
|
||||
//处理数据
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = serviceDictInfoService.findByDictInfo(ids,intArr);
|
||||
} else {
|
||||
|
||||
Page<ServiceDictInfo> pageCondition = new Page<ServiceDictInfo>(request, response);
|
||||
pageCondition.setPageNo(1);
|
||||
pageCondition.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
//查询符合条件总数
|
||||
List<ServiceDictInfo> allList = serviceDictInfoService.findAllServiceDictInfo(serviceDictInfo,intArr,pageCondition.getOrderBy());
|
||||
//查出顶层分页数据
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findTopDictList(pageCondition, serviceDictInfo,intArr);
|
||||
// 删除顶层数据、取出id
|
||||
List<Integer> intList = Lists.newArrayList();
|
||||
for(ServiceDictInfo tempSe : page.getList()) {
|
||||
if (tempSe != null) {
|
||||
intList.add(tempSe.getServiceDictId());
|
||||
}
|
||||
}
|
||||
for (int i = allList.size() - 1; i >= 0; i--) {
|
||||
ServiceDictInfo se = allList.get(i);
|
||||
if(se!=null&&intList.contains(se.getServiceDictId())||(se!=null&&se.getParent().getServiceDictId()==0)){
|
||||
allList.remove(se);
|
||||
}
|
||||
}
|
||||
allList.addAll(page.getList());
|
||||
ServiceDictInfo.sortList(list,allList,0,true);
|
||||
}
|
||||
|
||||
for(ServiceDictInfo tempSe : list) {
|
||||
if(tempSe.getServiceDictCreator()!=null){
|
||||
if(tempSe.getServiceDictCreator().getId()!=null){
|
||||
SysUser creator=UserUtils.get(tempSe.getServiceDictCreator().getId().toString());
|
||||
tempSe.setCreatorName(creator.getName());
|
||||
}
|
||||
}
|
||||
if(tempSe.getServiceDictEditor()!=null){
|
||||
if(tempSe.getServiceDictEditor().getId()!=null){
|
||||
SysUser creator=UserUtils.get(tempSe.getServiceDictEditor().getId().toString());
|
||||
tempSe.setEditorName(creator.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
String dictName=getDicName(intArr);
|
||||
titleList.add(dictName);
|
||||
classMap.put(dictName, ServiceDictInfo.class);
|
||||
String cfgIndexInfoNoExport = "";
|
||||
if("5".equals(itType)){
|
||||
cfgIndexInfoNoExport=",item_type,is_leaf,&config_content:vpn_ip-";
|
||||
}
|
||||
if(serviceDictInfo.getBeginDate()==null){
|
||||
cfgIndexInfoNoExport=",create_time,"+cfgIndexInfoNoExport;
|
||||
}
|
||||
if(serviceDictInfo.getEditBeginDate()==null){
|
||||
cfgIndexInfoNoExport=",edit_time,"+cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(hColumns)) {
|
||||
cfgIndexInfoNoExport = "," +hColumns+ ","+cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(dictName, cfgIndexInfoNoExport);
|
||||
dataMap.put(dictName, list);
|
||||
String timeRange = initDictMap(serviceDictInfo,dictName);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, dictName, titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, dictName, titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dict white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initDictMap(ServiceDictInfo cfg,String dictName){
|
||||
Properties msgProp = getMsgProp();
|
||||
String titleTime=dictName;
|
||||
if(cfg.getBeginDate()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("create_time")+":"+DateUtils.formatDateTime(cfg.getBeginDate());
|
||||
if(cfg.getEndDate()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getEndDate());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(cfg.getEditBeginDate()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":"+DateUtils.formatDateTime(cfg.getEditBeginDate());
|
||||
if(cfg.getEditEndDate()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getEditEndDate());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return titleTime;
|
||||
}
|
||||
|
||||
|
||||
public String getDicName(List intArr){
|
||||
String dicName="";
|
||||
Properties msgProp = getMsgProp();
|
||||
List<String> dict=ConfigDictUtils.getItemTypeByNo("SERVICE_DICT_ITM_TYPE",intArr);
|
||||
if(dict.size()>0){
|
||||
dicName=msgProp.getProperty(dict.get(0),dict.get(0));
|
||||
}
|
||||
return dicName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,14 +13,17 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
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.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -74,7 +77,8 @@ public class TaskInfoController extends BaseController{
|
||||
}else{
|
||||
if (!"true".equals(checkTaskName(taskInfo.getTaskName()))){
|
||||
logger.info(taskInfo.getTaskName()+"重复数据");
|
||||
addMessage("error",model,"save_failed");
|
||||
Properties props=this.getMsgProp();
|
||||
addMessage("error",model,props.getProperty("duplicate", "Duplicate")+" "+props.getProperty("task_name", "Task Name"));
|
||||
return form(taskInfo, model);
|
||||
}
|
||||
// 保存用户信息
|
||||
@@ -160,7 +164,7 @@ public class TaskInfoController extends BaseController{
|
||||
}
|
||||
//配置导出
|
||||
@RequestMapping(value = "exportTaskInfo")
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,String hcolumn,String exType,
|
||||
@ModelAttribute("cfg")TaskInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
@@ -189,6 +193,18 @@ public class TaskInfoController extends BaseController{
|
||||
if(column.toString().length()>0) {
|
||||
column.append(",");
|
||||
}
|
||||
|
||||
if(entity.getBeginDate()==null ){
|
||||
hcolumn+=",task_time,";
|
||||
}
|
||||
if(entity.getDobeginDate()==null){
|
||||
hcolumn+=",edit_time,";
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(hcolumn)){
|
||||
column.append(","+hcolumn+",");
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(),column.toString());
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
@@ -203,15 +219,43 @@ public class TaskInfoController extends BaseController{
|
||||
Page<TaskInfo> page = taskInfoService.findTaskInfo(pageInfo, entity);
|
||||
list=page.getList();
|
||||
}
|
||||
|
||||
dataMap.put(entity.getMenuNameCode(),list);
|
||||
// 获取国际化配置
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
//获取国际化配置
|
||||
String timeRange = initTaskMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
public String initTaskMap(TaskInfo info){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(info.getMenuNameCode(),info.getMenuNameCode());
|
||||
if(info.getBeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("task_time","task_time")+":"+DateUtils.formatDateTime(info.getBeginDate());
|
||||
if(info.getEndDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getEndDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(info.getDobeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("edit_time","edit_time")+":"+DateUtils.formatDateTime(info.getDobeginDate());
|
||||
if(info.getDoendDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getDoendDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -64,6 +64,7 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 特定协议相关配置控制类
|
||||
*
|
||||
* @author zhangwei
|
||||
*
|
||||
*/
|
||||
@@ -72,48 +73,58 @@ import com.nis.web.security.UserUtils;
|
||||
public class AppFeatureCfgController extends BaseController {
|
||||
/**
|
||||
* app协议复杂特征配置列表
|
||||
*
|
||||
* @param model
|
||||
* @param cfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"multiFeatureCfgList"})
|
||||
public String multiFeatureCfgList(Model model,@ModelAttribute("cfg")AppFeatureIndex cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<AppFeatureIndex> searchPage=new Page<AppFeatureIndex>(request,response,"r");
|
||||
@RequestMapping(value = { "multiFeatureCfgList" })
|
||||
public String multiFeatureCfgList(Model model, @ModelAttribute("cfg") AppFeatureIndex cfg,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
Page<AppFeatureIndex> searchPage = new Page<AppFeatureIndex>(request, response, "r");
|
||||
Page<AppFeatureIndex> page = appMultiFeatureCfgService.findAppFeatureIndexList(searchPage, cfg);
|
||||
for(AppFeatureIndex entity:page.getList()){
|
||||
for (AppFeatureIndex entity : page.getList()) {
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
entity.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/app/appMultiFeatureCfgList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置表单
|
||||
*
|
||||
* @param model
|
||||
* @param ids
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"multiFeatureCfgForm"})
|
||||
public String multiFeatureCfgForm(Model model,String ids,AppFeatureIndex entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
@RequestMapping(value = { "multiFeatureCfgForm" })
|
||||
public String multiFeatureCfgForm(Model model, String ids, AppFeatureIndex entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(ids));
|
||||
entity.setIpPortList(appMultiFeatureCfgService.getAppIpRangeCfg(entity.getCompileId(), entity.getFunctionId()));
|
||||
entity.setStrList(appMultiFeatureCfgService.getAppStringFeatureCfg(entity.getCompileId(), entity.getFunctionId(),null));
|
||||
entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(), entity.getFunctionId(),null));
|
||||
entity.setNumCfgList(appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(),null));
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
entity.setIpPortList(
|
||||
appMultiFeatureCfgService.getAppIpRangeCfg(entity.getCompileId(), entity.getFunctionId()));
|
||||
entity.setStrList(appMultiFeatureCfgService.getAppStringFeatureCfg(entity.getCompileId(),
|
||||
entity.getFunctionId(), null));
|
||||
entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(),
|
||||
entity.getFunctionId(), null));
|
||||
entity.setNumCfgList(
|
||||
appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(), null));
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/app/appMultiFeatureCfgForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置新增修改
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -121,29 +132,32 @@ public class AppFeatureCfgController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"saveAppMultiFeatureCfg"})
|
||||
public String saveAppMultiFeatureCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
AppFeatureIndex entity,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "saveAppMultiFeatureCfg" })
|
||||
public String saveAppMultiFeatureCfg(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
AppFeatureIndex entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if(specificService!=null){
|
||||
SpecificServiceCfg specificService = specificServiceCfgService
|
||||
.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if (specificService != null) {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appMultiFeatureCfgService.saveOrUpdateAppFeatureCfg(entity);
|
||||
addMessage(redirectAttributes,"success", "save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/app/feature/multiFeatureCfgList?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置审核
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
@@ -151,19 +165,14 @@ public class AppFeatureCfgController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"auditAppFeatureCfg"})
|
||||
public String auditAppFeatureCfg(Model model,@ModelAttribute("cfg")AppFeatureIndex cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
@RequestMapping(value = { "auditAppFeatureCfg" })
|
||||
public String auditAppFeatureCfg(Model model, @ModelAttribute("cfg") AppFeatureIndex cfg, Integer isValid,
|
||||
Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
AppFeatureIndex entity = new AppFeatureIndex();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
for (String id : idArray) {
|
||||
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
@@ -171,247 +180,264 @@ public class AppFeatureCfgController extends BaseController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
appMultiFeatureCfgService.auditAppFeatureCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
logger.error("app 特征配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app 特征配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("app 特征配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
} else {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> auditPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return multiFeatureCfgList(model, cfg, request, response);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/app/feature/multiFeatureCfgList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置删除
|
||||
*
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"updateAppFeatureCfgValid"})
|
||||
public String updateAppFeatureCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/app/feature/multiFeatureCfgList?functionId="+functionId;
|
||||
@RequestMapping(value = { "updateAppFeatureCfgValid" })
|
||||
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询特征子配置
|
||||
*
|
||||
* @param model
|
||||
* @param cfgId
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"ajaxAppFeatureList"})
|
||||
public String ajaxAppFeatureList(Model model,Long cfgId,Integer compileId,Integer functionId,Integer index) {
|
||||
List<AppIpCfg> ipRangeList = appMultiFeatureCfgService.getAppIpRangeCfg(compileId,functionId);
|
||||
@RequestMapping(value = { "ajaxAppFeatureList" })
|
||||
public String ajaxAppFeatureList(Model model, Long cfgId, Integer compileId, Integer functionId, Integer index) {
|
||||
List<AppIpCfg> ipRangeList = appMultiFeatureCfgService.getAppIpRangeCfg(compileId, functionId);
|
||||
AppFeatureIndex cfg = appMultiFeatureCfgService.getAppFeatureIndex(cfgId);
|
||||
List<Map<String,Object>> tabList = new ArrayList();
|
||||
List<Map<String, Object>> tabList = new ArrayList();
|
||||
String[] cfgRegionValue = cfg.getCfgRegionValue().split(",");
|
||||
String[] cfgRegionType = cfg.getCfgRegionType().split(",");
|
||||
String[] cfgRegionCode = cfg.getCfgRegionCode1().split(",");
|
||||
if(cfgRegionValue.length == cfgRegionType.length && cfgRegionValue.length==cfgRegionCode.length){
|
||||
for(int i=0;i<cfgRegionValue.length;i++){
|
||||
Map<String,Object> map = new HashMap();
|
||||
if (cfgRegionValue.length == cfgRegionType.length && cfgRegionValue.length == cfgRegionCode.length) {
|
||||
for (int i = 0; i < cfgRegionValue.length; i++) {
|
||||
Map<String, Object> map = new HashMap();
|
||||
map.put("regionType", cfgRegionType[i]);
|
||||
map.put("regionValue", cfgRegionValue[i]);
|
||||
if("1".equals(cfgRegionType[i])){
|
||||
if ("1".equals(cfgRegionType[i])) {
|
||||
map.put("ipRangeList", ipRangeList);
|
||||
}
|
||||
if("2".equals(cfgRegionType[i])){
|
||||
List<AppStringFeatureCfg> strList = appMultiFeatureCfgService.getAppStringFeatureCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i]));
|
||||
if ("2".equals(cfgRegionType[i])) {
|
||||
List<AppStringFeatureCfg> strList = appMultiFeatureCfgService.getAppStringFeatureCfg(compileId,
|
||||
functionId, Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("strList", strList);
|
||||
}
|
||||
if("3".equals(cfgRegionType[i])){
|
||||
List<AppComplexFeatureCfg> complexList = appMultiFeatureCfgService.getAppComplexFeatureCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i]));
|
||||
if ("3".equals(cfgRegionType[i])) {
|
||||
List<AppComplexFeatureCfg> complexList = appMultiFeatureCfgService
|
||||
.getAppComplexFeatureCfg(compileId, functionId, Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("complexList", complexList);
|
||||
}
|
||||
if("4".equals(cfgRegionType[i])){
|
||||
List<AppTcpCfg> numCfgList = appMultiFeatureCfgService.getAppTcpCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i]));
|
||||
if ("4".equals(cfgRegionType[i])) {
|
||||
List<AppTcpCfg> numCfgList = appMultiFeatureCfgService.getAppTcpCfg(compileId, functionId,
|
||||
Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("numCfgList", numCfgList);
|
||||
}
|
||||
tabList.add(map);
|
||||
}
|
||||
}else{
|
||||
Map<String,Object> map = new HashMap();
|
||||
} else {
|
||||
Map<String, Object> map = new HashMap();
|
||||
map.put("regionType", "0");
|
||||
map.put("regionValue", "query config detail error");
|
||||
tabList.add(map);
|
||||
}
|
||||
|
||||
/*if(ipRangeList!=null){
|
||||
String cfgType = null;
|
||||
for(AppIpCfg ip:ipRangeList){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strList!=null){
|
||||
String cfgType = null;
|
||||
for(AppStringFeatureCfg cfg:strList){
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(complexList!=null){
|
||||
String cfgType = null;
|
||||
for(AppComplexFeatureCfg cfg:complexList){
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"3",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();0.
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
* if(ipRangeList!=null){ String cfgType = null; for(AppIpCfg
|
||||
* ip:ipRangeList){ if(!ip.getCfgType().equals(cfgType)){
|
||||
* tabList.add(new String[]{"1",ip.getCfgType()}); cfgType =
|
||||
* ip.getCfgType(); } } } if(strList!=null){ String cfgType = null;
|
||||
* for(AppStringFeatureCfg cfg:strList){
|
||||
* if(!cfg.getCfgType().equals(cfgType)){ tabList.add(new
|
||||
* String[]{"2",cfg.getCfgType()}); cfgType = cfg.getCfgType(); } } }
|
||||
* if(complexList!=null){ String cfgType = null;
|
||||
* for(AppComplexFeatureCfg cfg:complexList){
|
||||
* if(!cfg.getCfgType().equals(cfgType)){ tabList.add(new
|
||||
* String[]{"3",cfg.getCfgType()}); cfgType = cfg.getCfgType();0.
|
||||
*
|
||||
* } } }
|
||||
*/
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/app/appSubFeatureList";
|
||||
}
|
||||
|
||||
//appfeature配置导出
|
||||
|
||||
// appfeature配置导出
|
||||
@RequestMapping(value = "exportFeature")
|
||||
public void exportFeature(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AppFeatureIndex entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportFeature(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") AppFeatureIndex entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
List<AppFeatureIndex> ipLists=new ArrayList<AppFeatureIndex>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=appMultiFeatureCfgService.findAppByFeatureIndexList(ids);
|
||||
}else{
|
||||
Page<AppFeatureIndex> pageInfo=new Page<AppFeatureIndex>(request, response,"r");
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
List<AppFeatureIndex> ipLists = new ArrayList<AppFeatureIndex>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = appMultiFeatureCfgService.findAppByFeatureIndexList(ids);
|
||||
} else {
|
||||
Page<AppFeatureIndex> pageInfo = new Page<AppFeatureIndex>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppFeatureIndex> page = appMultiFeatureCfgService.findAppFeatureIndexList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
for(AppFeatureIndex feature:ipLists){
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(feature.getSpecServiceId());
|
||||
feature.setAppName(app.getSpecServiceName());
|
||||
|
||||
for (AppFeatureIndex feature : ipLists) {
|
||||
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"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
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,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), AppFeatureIndex.class);
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<AppComplexFeatureCfg> keywordList = new ArrayList<AppComplexFeatureCfg>();
|
||||
List<AppStringFeatureCfg> strList = new ArrayList<AppStringFeatureCfg>();
|
||||
for (AppFeatureIndex cfg : ipLists) {
|
||||
Map<String, List> maps = appMultiFeatureCfgService.exportFeature(cfg);
|
||||
if (entity.getFunctionId() != 567) {
|
||||
keywordList.addAll(maps.get("APP_KEYWORDS"));
|
||||
} else {
|
||||
strList.addAll(maps.get("APP_DK_GL"));
|
||||
}
|
||||
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"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
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,";
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), AppFeatureIndex.class);
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<AppComplexFeatureCfg> keywordList=new ArrayList<AppComplexFeatureCfg>();
|
||||
List<AppStringFeatureCfg> strList=new ArrayList<AppStringFeatureCfg>();
|
||||
for (AppFeatureIndex cfg : ipLists) {
|
||||
Map<String, List> maps=appMultiFeatureCfgService.exportFeature(cfg);
|
||||
if(entity.getFunctionId()!=567){
|
||||
keywordList.addAll(maps.get("APP_KEYWORDS"));
|
||||
}else{
|
||||
strList.addAll(maps.get("APP_DK_GL"));
|
||||
}
|
||||
ipList.addAll(maps.get("APP_IP_RANGE"));
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if(entity.getFunctionId()!=564 && entity.getFunctionId()!=567 ){
|
||||
keywordList=replaceKeyList(keywordList);
|
||||
titleList.add("APP_IP_RANGE");
|
||||
classMap.put("APP_IP_RANGE", IpPortCfg.class);
|
||||
noExportMap.put("APP_IP_RANGE",ipPortInfoNoExport);
|
||||
dataMap.put("APP_IP_RANGE", ipList);
|
||||
}
|
||||
if(entity.getFunctionId()==563){
|
||||
titleList.add("APP_PAYLOAD");
|
||||
classMap.put("APP_PAYLOAD", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_PAYLOAD",appComplexNoExport);
|
||||
dataMap.put("APP_PAYLOAD", keywordList);
|
||||
}else if(entity.getFunctionId()==565){
|
||||
titleList.add("APP_HTTP");
|
||||
classMap.put("APP_HTTP", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_HTTP",appComplexNoExport);
|
||||
dataMap.put("APP_HTTP", keywordList);
|
||||
}else if(entity.getFunctionId()==566){
|
||||
titleList.add("APP_SSL");
|
||||
classMap.put("APP_SSL", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_SSL",appComplexNoExport);
|
||||
dataMap.put("APP_SSL", keywordList);
|
||||
}else if(entity.getFunctionId()==564){
|
||||
keywordList=replaceKeyList(keywordList);
|
||||
titleList.add("APP_DNS");
|
||||
classMap.put("APP_DNS", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_DNS",appComplexNoExport);
|
||||
dataMap.put("APP_DNS", keywordList);
|
||||
}else if(entity.getFunctionId()==567){
|
||||
strList=replaceFeatureList(strList);
|
||||
appComplexNoExport=appComplexNoExport+"district,";
|
||||
titleList.add("APP_DK");
|
||||
classMap.put("APP_DK", AppStringFeatureCfg.class);
|
||||
noExportMap.put("APP_DK",appComplexNoExport);
|
||||
dataMap.put("APP_DK", strList);
|
||||
}
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
ipList.addAll(maps.get("APP_IP_RANGE"));
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if (entity.getFunctionId() != 564 && entity.getFunctionId() != 567) {
|
||||
keywordList = replaceKeyList(keywordList);
|
||||
titleList.add("APP_IP_RANGE");
|
||||
classMap.put("APP_IP_RANGE", IpPortCfg.class);
|
||||
noExportMap.put("APP_IP_RANGE", ipPortInfoNoExport);
|
||||
dataMap.put("APP_IP_RANGE", ipList);
|
||||
}
|
||||
if (entity.getFunctionId() == 563) {
|
||||
titleList.add("APP_PAYLOAD");
|
||||
classMap.put("APP_PAYLOAD", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_PAYLOAD", appComplexNoExport);
|
||||
dataMap.put("APP_PAYLOAD", keywordList);
|
||||
} else if (entity.getFunctionId() == 565) {
|
||||
titleList.add("APP_HTTP");
|
||||
classMap.put("APP_HTTP", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_HTTP", appComplexNoExport);
|
||||
dataMap.put("APP_HTTP", keywordList);
|
||||
} else if (entity.getFunctionId() == 566) {
|
||||
titleList.add("APP_SSL");
|
||||
classMap.put("APP_SSL", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_SSL", appComplexNoExport);
|
||||
dataMap.put("APP_SSL", keywordList);
|
||||
} else if (entity.getFunctionId() == 564) {
|
||||
keywordList = replaceKeyList(keywordList);
|
||||
titleList.add("APP_DNS");
|
||||
classMap.put("APP_DNS", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_DNS", appComplexNoExport);
|
||||
dataMap.put("APP_DNS", keywordList);
|
||||
} else if (entity.getFunctionId() == 567) {
|
||||
strList = replaceFeatureList(strList);
|
||||
appComplexNoExport = appComplexNoExport + "district,";
|
||||
titleList.add("APP_DK");
|
||||
classMap.put("APP_DK", AppStringFeatureCfg.class);
|
||||
noExportMap.put("APP_DK", appComplexNoExport);
|
||||
dataMap.put("APP_DK", strList);
|
||||
}
|
||||
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Appfeature export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
logger.error("Appfeature export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
public static List<AppComplexFeatureCfg> replaceKeyList(List<AppComplexFeatureCfg> list){
|
||||
|
||||
public static List<AppComplexFeatureCfg> replaceKeyList(List<AppComplexFeatureCfg> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
AppComplexFeatureCfg base=(AppComplexFeatureCfg)list.get(i);
|
||||
AppComplexFeatureCfg base = (AppComplexFeatureCfg) list.get(i);
|
||||
base.setIsHex(base.getIsHexbin());
|
||||
base.setIsCaseInsenstive(base.getIsHexbin());
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
|
||||
}
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***", " "));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<AppStringFeatureCfg> replaceFeatureList(List<AppStringFeatureCfg> list){
|
||||
|
||||
public static List<AppStringFeatureCfg> replaceFeatureList(List<AppStringFeatureCfg> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
AppStringFeatureCfg base=(AppStringFeatureCfg)list.get(i);
|
||||
AppStringFeatureCfg base = (AppStringFeatureCfg) list.get(i);
|
||||
base.setIsHex(base.getIsHexbin());
|
||||
base.setIsCaseInsenstive(base.getIsHexbin());
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
|
||||
}
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***", " "));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 基础协议控制类
|
||||
*
|
||||
* @author wx
|
||||
*
|
||||
*/
|
||||
@@ -43,52 +44,57 @@ import com.nis.web.security.UserUtils;
|
||||
public class BasicProtocolController extends BaseController {
|
||||
/**
|
||||
* app策略列表
|
||||
*
|
||||
* @param model
|
||||
* @param cfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"list"})
|
||||
public String policyCfgList(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
@RequestMapping(value = { "list" })
|
||||
public String policyCfgList(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(searchPage, cfg);
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app =
|
||||
// specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/basicprotocol/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询APP策略IP子配置
|
||||
*
|
||||
* @param model
|
||||
* @param cfgId
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"ajaxIpList"})
|
||||
public String ajaxSslSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId,compileId);
|
||||
@RequestMapping(value = { "ajaxIpList" })
|
||||
public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg ntc:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!ntc.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ntc.getCfgType()});
|
||||
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ntc.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ntc.getCfgType() });
|
||||
cfgType = ntc.getCfgType();
|
||||
}
|
||||
}
|
||||
@@ -98,27 +104,31 @@ public class BasicProtocolController extends BaseController {
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/basicprotocol/basicProtocolSubList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置表单
|
||||
*
|
||||
* @param model
|
||||
* @param ids
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"basicprotocol:config"})
|
||||
public String policyCfgForm(Model model,String ids,AppPolicyCfg entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
@RequestMapping(value = { "form" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/basicprotocol/form";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置新增修改
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -126,34 +136,37 @@ public class BasicProtocolController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"save"})
|
||||
@RequiresPermissions(value={"basicprotocol:config"})
|
||||
public String saveAppPolicyCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
AppPolicyCfg entity,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "save" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String saveAppPolicyCfg(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
AppPolicyCfg entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if(specificService!=null){
|
||||
SpecificServiceCfg specificService = specificServiceCfgService
|
||||
.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if (specificService != null) {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("基础协议信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
// addMessage(redirectAttributes,e.getMessage());
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basicprotocol/list?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置审核
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
@@ -161,21 +174,16 @@ public class BasicProtocolController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"basicprotocol:confirm"})
|
||||
public String auditAppPolicyCfg(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
@RequestMapping(value = { "audit" })
|
||||
@RequiresPermissions(value = { "basicprotocol:confirm" })
|
||||
public String auditAppPolicyCfg(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, Integer isValid,
|
||||
Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
AppPolicyCfg entity = new AppPolicyCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
@@ -183,138 +191,167 @@ public class BasicProtocolController extends BaseController {
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success","audit_success");
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if(e instanceof MaatConvertException) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("app策略配置下发失败:"+e.getMessage());;
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
logger.info("app策略配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("app策略配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("app策略配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
} else {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> auditPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return policyCfgList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/basicprotocol/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置删除
|
||||
*
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"updateValid"})
|
||||
@RequiresPermissions(value={"basicprotocol:config"})
|
||||
public String updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid,ids,functionId);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("基础协议信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/basicprotocol/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AppPolicyCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<AppPolicyCfg> ipLists=new ArrayList<AppPolicyCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=appCfgService.findAppByPolicyList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo=new Page<AppPolicyCfg>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
for(AppPolicyCfg policy:ipLists){
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if(app!=null) {
|
||||
policy.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport=",encrypted_tunnel_behavior,behaviour_type,social_app,behaviour_type,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String subscribeInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo=appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") AppPolicyCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<AppPolicyCfg> ipLists = new ArrayList<AppPolicyCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = appCfgService.findAppByPolicyList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo = new Page<AppPolicyCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
for (AppPolicyCfg policy : ipLists) {
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if (app != null) {
|
||||
policy.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport = ",encrypted_tunnel_behavior,behaviour_type,social_app,behaviour_type,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String subscribeInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList = new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo = appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 加密隧道行为控制类
|
||||
*
|
||||
* @author wx
|
||||
*
|
||||
*/
|
||||
@@ -45,103 +46,117 @@ import com.nis.web.security.UserUtils;
|
||||
public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
/**
|
||||
* app策略列表
|
||||
*
|
||||
* @param model
|
||||
* @param cfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"list"})
|
||||
public String policyCfgList(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
@RequestMapping(value = { "list" })
|
||||
public String policyCfgList(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(searchPage, cfg);
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
// }
|
||||
// //查找社交应用的所有有效二级特定服务
|
||||
// SpecificServiceCfg second=new SpecificServiceCfg();
|
||||
// for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
// if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
// second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// second.setIsValid(Constants.VALID_YES);
|
||||
// second.setIsLeaf(1);
|
||||
// List<SpecificServiceCfg> secondList=specificServiceCfgService.findAllSpecificServiceCfg(second, null);
|
||||
// //遍历,找到匹配项后将行为设置进去
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// if(entity.getBehavCode()==null) continue;
|
||||
// for(SpecificServiceCfg secondCfg:secondList) {
|
||||
// if(secondCfg.getSpecServiceCode()==null) continue;
|
||||
// if(secondCfg.getSpecServiceCode().intValue()==entity.getBehavCode().intValue()) {
|
||||
// entity.setBehavName(secondCfg.getSpecServiceName());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app =
|
||||
// specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
// }
|
||||
// //查找社交应用的所有有效二级特定服务
|
||||
// SpecificServiceCfg second=new SpecificServiceCfg();
|
||||
// for(SysDataDictionaryItem
|
||||
// dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
// if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue()))
|
||||
// {
|
||||
// second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// second.setIsValid(Constants.VALID_YES);
|
||||
// second.setIsLeaf(1);
|
||||
// List<SpecificServiceCfg>
|
||||
// secondList=specificServiceCfgService.findAllSpecificServiceCfg(second,
|
||||
// null);
|
||||
// //遍历,找到匹配项后将行为设置进去
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// if(entity.getBehavCode()==null) continue;
|
||||
// for(SpecificServiceCfg secondCfg:secondList) {
|
||||
// if(secondCfg.getSpecServiceCode()==null) continue;
|
||||
// if(secondCfg.getSpecServiceCode().intValue()==entity.getBehavCode().intValue())
|
||||
// {
|
||||
// entity.setBehavName(secondCfg.getSpecServiceName());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/encryptedtunnelbehav/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询APP策略IP子配置
|
||||
*
|
||||
* @param model
|
||||
* @param cfgId
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"ajaxIpList"})
|
||||
public String ajaxSslSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId,compileId);
|
||||
@RequestMapping(value = { "ajaxIpList" })
|
||||
public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg ntc:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!ntc.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ntc.getCfgType()});
|
||||
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ntc.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ntc.getCfgType() });
|
||||
cfgType = ntc.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/encryptedtunnelbehav/encrypedTunnelSubList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置表单
|
||||
*
|
||||
* @param model
|
||||
* @param ids
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:config"})
|
||||
public String policyCfgForm(Model model,String ids,AppPolicyCfg entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
@RequestMapping(value = { "form" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/encryptedtunnelbehav/form";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置新增修改
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -149,33 +164,36 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"save"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:config"})
|
||||
public String saveAppPolicyCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
AppPolicyCfg entity,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "save" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String saveAppPolicyCfg(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
AppPolicyCfg entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if(specificService!=null){
|
||||
SpecificServiceCfg specificService = specificServiceCfgService
|
||||
.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if (specificService != null) {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("加密隧道信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置审核
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
@@ -183,21 +201,16 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:confirm"})
|
||||
public String auditAppPolicyCfg(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
@RequestMapping(value = { "audit" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:confirm" })
|
||||
public String auditAppPolicyCfg(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, Integer isValid,
|
||||
Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
AppPolicyCfg entity = new AppPolicyCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
@@ -205,157 +218,187 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success","audit_success");
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if(e instanceof MaatConvertException) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("加密隧道配置下发失败:"+e.getMessage());;
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
logger.info("加密隧道配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("加密隧道配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("加密隧道配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> auditPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return policyCfgList(model, cfg, request, response);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置删除
|
||||
*
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"updateValid"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:config"})
|
||||
public String updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid,ids,functionId);
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
} catch (Exception e) {
|
||||
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","delete_failed");
|
||||
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", "delete_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AppPolicyCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") AppPolicyCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
List<AppPolicyCfg> ipLists=new ArrayList<AppPolicyCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=appCfgService.findAppByPolicyList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo=new Page<AppPolicyCfg>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
List<AppPolicyCfg> ipLists = new ArrayList<AppPolicyCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = appCfgService.findAppByPolicyList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo = new Page<AppPolicyCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
for (AppPolicyCfg policy : ipLists) {
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if (app != null) {
|
||||
policy.setBehaviorName(app.getSpecServiceName());
|
||||
}
|
||||
for(AppPolicyCfg policy:ipLists){
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if(app!=null) {
|
||||
policy.setBehaviorName(app.getSpecServiceName());
|
||||
}
|
||||
}
|
||||
// 查找社交应用的所有有效二级特定服务
|
||||
SpecificServiceCfg second = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
//查找社交应用的所有有效二级特定服务
|
||||
SpecificServiceCfg second=new SpecificServiceCfg();
|
||||
for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
}
|
||||
second.setIsValid(Constants.VALID_YES);
|
||||
second.setIsLeaf(1);
|
||||
List<SpecificServiceCfg> secondList = specificServiceCfgService.findAllSpecificServiceCfg(second, null);
|
||||
// 遍历,找到匹配项后将行为设置进去
|
||||
for (AppPolicyCfg policy : ipLists) {
|
||||
if (policy.getBehavCode() == null)
|
||||
continue;
|
||||
for (SpecificServiceCfg secondCfg : secondList) {
|
||||
if (secondCfg.getSpecServiceCode() == null)
|
||||
continue;
|
||||
if (secondCfg.getSpecServiceCode().intValue() == policy.getBehavCode().intValue()) {
|
||||
policy.setBehavName(secondCfg.getSpecServiceName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
second.setIsValid(Constants.VALID_YES);
|
||||
second.setIsLeaf(1);
|
||||
List<SpecificServiceCfg> secondList=specificServiceCfgService.findAllSpecificServiceCfg(second, null);
|
||||
//遍历,找到匹配项后将行为设置进去
|
||||
for(AppPolicyCfg policy:ipLists){
|
||||
if(policy.getBehavCode()==null) continue;
|
||||
for(SpecificServiceCfg secondCfg:secondList) {
|
||||
if(secondCfg.getSpecServiceCode()==null) continue;
|
||||
if(secondCfg.getSpecServiceCode().intValue()==policy.getBehavCode().intValue()) {
|
||||
policy.setBehavName(secondCfg.getSpecServiceName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport=",social_app,basic_protocol,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String subscribeInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo=appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport = ",social_app,basic_protocol,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String subscribeInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList = new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo = appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("TunnelBehavior export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
logger.error("TunnelBehavior export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -22,7 +23,9 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
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.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -80,7 +83,8 @@ public class RequestInfoController extends BaseController{
|
||||
}else{
|
||||
if (!"true".equals(checkRequestNumber(requestInfo.getRequestNumber()))){
|
||||
logger.info(requestInfo.getRequestNumber()+"重复数据");
|
||||
addMessage("error",model,"save_failed");
|
||||
Properties props=this.getMsgProp();
|
||||
addMessage("error",model,props.getProperty("duplicate", "Duplicate")+" "+props.getProperty("title", "Title"));
|
||||
return form(requestInfo, model);
|
||||
}
|
||||
// 保存用户信息
|
||||
@@ -188,7 +192,7 @@ public class RequestInfoController extends BaseController{
|
||||
}
|
||||
//配置导出
|
||||
@RequestMapping(value = "exportRequestInfo")
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response, String exType,String hcolumn,
|
||||
@ModelAttribute("requestInfo")RequestInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
@@ -196,8 +200,6 @@ public class RequestInfoController extends BaseController{
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
//导出选中记录
|
||||
List<RequestInfo> list=Lists.newArrayList();
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
@@ -217,6 +219,17 @@ public class RequestInfoController extends BaseController{
|
||||
if(column.toString().length()>0) {
|
||||
column.append(",");
|
||||
}
|
||||
|
||||
if(entity.getBeginDate()==null){
|
||||
hcolumn+=",request_time,";
|
||||
}
|
||||
if(entity.getDobeginDate()==null){
|
||||
hcolumn+=",edit_time,";
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(hcolumn)){
|
||||
column.append(","+hcolumn+",");
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),column.toString());
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
@@ -231,14 +244,43 @@ public class RequestInfoController extends BaseController{
|
||||
Page<RequestInfo> page = requestInfoService.findRequestInfo(pageInfo, entity);
|
||||
list=page.getList();
|
||||
}
|
||||
|
||||
dataMap.put(entity.getMenuNameCode(),list);
|
||||
// 获取国际化配置
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
String timeRange = initRequestMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
public String initRequestMap(RequestInfo info){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(info.getMenuNameCode(),info.getMenuNameCode());
|
||||
if(info.getBeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("request_time","request_time")+":"+DateUtils.formatDateTime(info.getBeginDate());
|
||||
if(info.getEndDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getEndDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(info.getDobeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("edit_time","edit_time")+":"+DateUtils.formatDateTime(info.getDobeginDate());
|
||||
if(info.getDoendDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getDoendDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,211 +42,231 @@ import com.nis.web.service.configuration.DnsIpCfgService;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/dnsIp")
|
||||
public class DnsIpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")DnsIpCfg entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(new Page<DnsIpCfg>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsIpCfg entity, RedirectAttributes redirectAttributes) {
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(new Page<DnsIpCfg>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/dnsIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String form(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")DnsIpCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:config" })
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = dnsIpCfgService.getDnsIpCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
/*//获取所有响应策略信息
|
||||
List<DnsResStrategy> resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1);
|
||||
model.addAttribute("dnsResStrategys", resStrategys);*/
|
||||
//查询policyGroup列表,供响应策略选择 2018-07-24 经确定IP欺骗只能选择非0号分组
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
/*
|
||||
* //获取所有响应策略信息 List<DnsResStrategy>
|
||||
* resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1);
|
||||
* model.addAttribute("dnsResStrategys", resStrategys);
|
||||
*/
|
||||
// 查询policyGroup列表,供响应策略选择 2018-07-24 经确定IP欺骗只能选择非0号分组
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/dnsIpCfgForm";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化一条dns fakeip配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"initSpoofingIp"})
|
||||
public String initSpoofingIp(){
|
||||
Properties msg=getMsgProp();
|
||||
@RequestMapping(value = { "initSpoofingIp" })
|
||||
public String initSpoofingIp() {
|
||||
Properties msg = getMsgProp();
|
||||
try {
|
||||
DnsIpCfg entity=new DnsIpCfg();
|
||||
DnsIpCfg entity = new DnsIpCfg();
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
entity.setDnsStrategyId(0);
|
||||
List<DnsIpCfg> list=dnsIpCfgService.findDnsIpCfg(entity);
|
||||
if(StringUtil.isEmpty(list)) {
|
||||
List<DnsIpCfg> list = dnsIpCfgService.findDnsIpCfg(entity);
|
||||
if (StringUtil.isEmpty(list)) {
|
||||
dnsIpCfgService.saveAndAudit();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("初始化Spoofing ip失败",e);
|
||||
logger.error("初始化Spoofing ip失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
return msg.getProperty("request_service_failed");
|
||||
}else {
|
||||
} else {
|
||||
return msg.getProperty("save_failed");
|
||||
}
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsIpCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
dnsIpCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String delete(Integer isAudit,Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
dnsIpCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
dnsIpCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DnsIpCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:confirm" })
|
||||
public String audit(Model model, @ModelAttribute("cfg") DnsIpCfg cfg, Integer isValid, Integer isAudit, String ids,
|
||||
Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
dnsIpCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
dnsIpCfgService.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");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}else {
|
||||
Page<DnsIpCfg> searchPage=new Page<DnsIpCfg>(request,response,"r");
|
||||
Page<DnsIpCfg> auditPage=new Page<DnsIpCfg>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<DnsIpCfg> searchPage = new Page<DnsIpCfg>(request, response, "r");
|
||||
Page<DnsIpCfg> auditPage = new Page<DnsIpCfg>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response,cfg, redirectAttributes);
|
||||
|
||||
return list(model, request, response, cfg, redirectAttributes);
|
||||
}
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DNS阻断无策略时检验
|
||||
*
|
||||
* @param entity
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/dnsNoStrategyCheck"})
|
||||
public boolean dnsNoStrategyCheck(DnsIpCfg entity, HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/dnsNoStrategyCheck" })
|
||||
public boolean dnsNoStrategyCheck(DnsIpCfg entity, HttpServletRequest request, HttpServletResponse response) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
List<DnsIpCfg> list = dnsIpCfgService.findDnsIpCfg(entity);
|
||||
if(list.size() > 0){
|
||||
if (list.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//dnsIp配置导出
|
||||
@RequestMapping(value = "exportDnsIp")
|
||||
public void exportDns(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
List<DnsIpCfg> ipLists=new ArrayList<DnsIpCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=dnsIpCfgService.findByPage(ids);
|
||||
}else{
|
||||
Page<DnsIpCfg> pageInfo=new Page<DnsIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
if(StringUtil.isEmpty(ipLists.get(i).getDnsStrategyName())){
|
||||
Properties msgProp = getMsgProp();
|
||||
ipLists.get(i).setDnsStrategyName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
|
||||
String cfgIndexInfoNoExport=",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,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("DnsIp export failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
// dnsIp配置导出
|
||||
@RequestMapping(value = "exportDnsIp")
|
||||
public void exportDns(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsIpCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<DnsIpCfg> ipLists = new ArrayList<DnsIpCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = dnsIpCfgService.findByPage(ids);
|
||||
} else {
|
||||
Page<DnsIpCfg> pageInfo = new Page<DnsIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
if (StringUtil.isEmpty(ipLists.get(i).getDnsStrategyName())) {
|
||||
Properties msgProp = getMsgProp();
|
||||
ipLists.get(i).setDnsStrategyName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
|
||||
String cfgIndexInfoNoExport = ",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) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("DnsIp export failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,189 +33,206 @@ import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* dns响应策略
|
||||
*
|
||||
* @author ddm
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/maintenance/dnsResStrategy")
|
||||
public class DnsResStrategyController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String from(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")DnsResStrategy cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(cfg == null){
|
||||
cfg=new DnsResStrategy();
|
||||
public class DnsResStrategyController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:config" })
|
||||
public String from(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") DnsResStrategy cfg, RedirectAttributes redirectAttributes) {
|
||||
if (cfg == null) {
|
||||
cfg = new DnsResStrategy();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = dnsResStrategyService.getDnsResStrategy(Long.valueOf(ids),-1);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = dnsResStrategyService.getDnsResStrategy(Long.valueOf(ids), -1);
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", false);
|
||||
}else{
|
||||
/*//不存在响应策略为0的配置,则新策略时,cfgId默认为0
|
||||
DnsResStrategy dns0=dnsResStrategyService.getDnsResStrategy(0l,null);
|
||||
if(dns0 == null){
|
||||
cfg.setCfgId(0l);
|
||||
cfg.setCfgDesc("无策略");
|
||||
}*/
|
||||
} else {
|
||||
/*
|
||||
* //不存在响应策略为0的配置,则新策略时,cfgId默认为0 DnsResStrategy
|
||||
* dns0=dnsResStrategyService.getDnsResStrategy(0l,null); if(dns0 ==
|
||||
* null){ cfg.setCfgId(0l); cfg.setCfgDesc("无策略"); }
|
||||
*/
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", true);
|
||||
}
|
||||
|
||||
//查询policyGroup列表,供响应策略选择
|
||||
// List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findHasIpPolicyGroupInfosByType(1);
|
||||
|
||||
// 查询policyGroup列表,供响应策略选择
|
||||
// List<PolicyGroupInfo>
|
||||
// policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findHasIpPolicyGroupInfosByType(1);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/dnsResStrategy/form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsResStrategy cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsResStrategy cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
|
||||
dnsResStrategyService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,@ModelAttribute("cfg")DnsResStrategy entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
//查询时left join policyGroup
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(new Page<DnsResStrategy>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsResStrategy entity, RedirectAttributes redirectAttributes) {
|
||||
// 查询时left join policyGroup
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(new Page<DnsResStrategy>(request, response, "r"),
|
||||
entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/maintenance/dnsResStrategy/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId
|
||||
,Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
dnsResStrategyService.delete(isAudit,isValid,ids,functionId);
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
dnsResStrategyService.delete(isAudit, isValid, ids, functionId);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DnsResStrategy cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:confirm" })
|
||||
public String audit(Model model, @ModelAttribute("cfg") DnsResStrategy cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
dnsResStrategyService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
dnsResStrategyService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
Page<DnsResStrategy> searchPage=new Page<DnsResStrategy>(request,response,"r");
|
||||
Page<DnsResStrategy> auditPage=new Page<DnsResStrategy>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<DnsResStrategy> searchPage = new Page<DnsResStrategy>(request, response, "r");
|
||||
Page<DnsResStrategy> auditPage = new Page<DnsResStrategy>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg,redirectAttributes);
|
||||
|
||||
return list(model, request, response, cfg, redirectAttributes);
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/validCfgId")
|
||||
public boolean validCfgId(Long cfgId) {
|
||||
DnsResStrategy dns=dnsResStrategyService.getDnsResStrategy(cfgId,null);
|
||||
if(dns == null ){
|
||||
DnsResStrategy dns = dnsResStrategyService.getDnsResStrategy(cfgId, null);
|
||||
if (dns == null) {
|
||||
return false;
|
||||
}else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//dns配置导出
|
||||
|
||||
// dns配置导出
|
||||
@RequestMapping(value = "exportDns")
|
||||
public void exportDns(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsResStrategy entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportDns(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsResStrategy entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
List<DnsResStrategy> ipLists=new ArrayList<DnsResStrategy>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=dnsResStrategyService.findByPage(ids);
|
||||
}else{
|
||||
Page<DnsResStrategy> pageInfo=new Page<DnsResStrategy>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
List<DnsResStrategy> ipLists = new ArrayList<DnsResStrategy>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = dnsResStrategyService.findByPage(ids);
|
||||
} else {
|
||||
Page<DnsResStrategy> pageInfo = new Page<DnsResStrategy>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
ipLists.get(i).setMiTtlmax(
|
||||
String.valueOf(ipLists.get(i).getMinTtl()) + "-" + String.valueOf(ipLists.get(i).getMaxTtl()));
|
||||
ipLists.get(i).setDnsId(String.valueOf(ipLists.get(i).getCfgId()));
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsResStrategy.class);
|
||||
String cfgIndexInfoNoExport = ",cfg_id,valid_identifier,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,&config_describe:policy_name-";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
if (entity.gethColumns().contains("policy_name")) {
|
||||
cfgIndexInfoNoExport = ",config_describe," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
ipLists.get(i).setMiTtlmax(String.valueOf(ipLists.get(i).getMinTtl())+"-"+String.valueOf(ipLists.get(i).getMaxTtl()));
|
||||
ipLists.get(i).setDnsId( String.valueOf(ipLists.get(i).getCfgId()));
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsResStrategy.class);
|
||||
String cfgIndexInfoNoExport=",cfg_id,valid_identifier,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(),ipLists);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Dns export failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
logger.error("Dns export failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.nis.web.controller.configuration.maintenance;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -21,7 +20,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.IpAddrPoolCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
@@ -224,5 +222,67 @@ public class IpAddrPoolController extends BaseController{
|
||||
List<IpReuseIpCfg> ipList = ipReuseIpCfgService.getPolicyIpInfo(addrPoolId);
|
||||
return ipList;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "exportIpPool")
|
||||
public void exportIpPool(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpAddrPoolCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<IpAddrPoolCfg> ipLists = new ArrayList<IpAddrPoolCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipAddrPoolCfgService.findByPage(ids);
|
||||
} else {
|
||||
Page<IpAddrPoolCfg> pageInfo = new Page<IpAddrPoolCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpAddrPoolCfg> page = ipAddrPoolCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
for (IpAddrPoolCfg ipAddrPoolCfg : ipLists) {
|
||||
Integer compId=ipAddrPoolCfg.getCfgId().intValue();
|
||||
ipAddrPoolCfg.setCompileId(compId);
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpAddrPoolCfg.class);
|
||||
String cfgIndexInfoNoExport = ",cfg_id,config_describe,block_type,policy_name,do_log,,whether_area_block,do_blacklist,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,213 +34,200 @@ import com.nis.web.service.basics.SysDictInfoService;
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/maintenance/ipMultiplexPoolCfg")
|
||||
public class IpMultiplexPoolCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String from(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
if(cfg == null){
|
||||
cfg=new IpMultiplexPoolCfg();
|
||||
public class IpMultiplexPoolCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:config" })
|
||||
public String from(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg cfg) {
|
||||
if (cfg == null) {
|
||||
cfg = new IpMultiplexPoolCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids), null);
|
||||
initFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
//查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(3);
|
||||
|
||||
// 查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService.getHasAreaPolicyGroups(3);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/ipMultiplexPool/form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, @ModelAttribute("cfg") IpMultiplexPoolCfg cfg) {
|
||||
try {
|
||||
// 设置省份信息
|
||||
groupAreaService.setAreaCodeByGroupId(cfg);
|
||||
|
||||
|
||||
ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){
|
||||
//查询时left join policyGroup
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(new Page<IpMultiplexPoolCfg>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg entity) {
|
||||
// 查询时left join policyGroup
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService
|
||||
.findPage(new Page<IpMultiplexPoolCfg>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/maintenance/ipMultiplexPool/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model,RedirectAttributes redirectAttributes
|
||||
,HttpServletRequest request,HttpServletResponse response){
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexPoolCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexPoolCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error", "delete_failed");
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:confirm"})
|
||||
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:confirm" })
|
||||
public String audit(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexPoolCfgService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("IP复用地址池配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}catch (Exception e) {
|
||||
logger.info("IP复用地址池配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("IP复用地址池配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.info("IP复用地址池配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/validCfgId")
|
||||
public boolean validCfgId(Long cfgId) {
|
||||
IpMultiplexPoolCfg dns=ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(cfgId,null);
|
||||
if(dns == null ){
|
||||
IpMultiplexPoolCfg dns = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(cfgId, null);
|
||||
if (dns == null) {
|
||||
return false;
|
||||
}else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*@RequestMapping(value = {"/snatlist"})
|
||||
public String snatlist(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){
|
||||
//查询时left join policyGroup
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(new Page<IpMultiplexPoolCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,entity);
|
||||
return "/cfg/maintenance/ipMultiplexPool/snatlist";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatform"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatfrom(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
if(cfg == null){
|
||||
cfg=new IpMultiplexPoolCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
//查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(2);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/ipMultiplexPool/snatform";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatsaveOrUpdate"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatsaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
try{
|
||||
// 设置省份信息
|
||||
if(!StringUtil.isEmpty(cfg.getPolicyGroup())){
|
||||
groupAreaService.setAreaCodeByGroupId(cfg);
|
||||
}
|
||||
ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snataudit"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:confirm"})
|
||||
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();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
ipMultiplexPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("SNAT地址池管理配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/snatdelete"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatdelete(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model,RedirectAttributes redirectAttributes
|
||||
,HttpServletRequest request,HttpServletResponse response){
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexPoolCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}*/
|
||||
|
||||
|
||||
/*
|
||||
* @RequestMapping(value = {"/snatlist"}) public String snatlist(Model
|
||||
* model,HttpServletRequest request,HttpServletResponse
|
||||
* response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){ //查询时left join
|
||||
* policyGroup Page<IpMultiplexPoolCfg> page =
|
||||
* ipMultiplexPoolCfgService.findPage(new Page<IpMultiplexPoolCfg>(request,
|
||||
* response,"r"), entity); model.addAttribute("page", page);
|
||||
* initFormCondition(model,entity); return
|
||||
* "/cfg/maintenance/ipMultiplexPool/snatlist"; }
|
||||
*
|
||||
* @RequestMapping(value = {"/snatform"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) public String
|
||||
* snatfrom(Model model, HttpServletRequest request, HttpServletResponse
|
||||
* response, String ids,
|
||||
*
|
||||
* @ModelAttribute("cfg")IpMultiplexPoolCfg cfg){ if(cfg == null){ cfg=new
|
||||
* IpMultiplexPoolCfg(); } if(!StringUtil.isEmpty(ids)){ cfg =
|
||||
* ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
* initUpdateFormCondition(model, cfg); }else{ initFormCondition(model,
|
||||
* cfg); }
|
||||
*
|
||||
* //查询ip复用地址池配置的policyGroup列表 List<PolicyGroupInfo>
|
||||
* policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(2);
|
||||
* model.addAttribute("policyGroups", policyGroups);
|
||||
* model.addAttribute("_cfg", cfg); return
|
||||
* "/cfg/maintenance/ipMultiplexPool/snatform"; }
|
||||
*
|
||||
* @RequestMapping(value = {"/snatsaveOrUpdate"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) public String
|
||||
* snatsaveOrUpdate(Model model,HttpServletRequest
|
||||
* request,HttpServletResponse response,RedirectAttributes
|
||||
* redirectAttributes,
|
||||
*
|
||||
* @ModelAttribute("cfg")IpMultiplexPoolCfg cfg){ try{ // 设置省份信息
|
||||
* if(!StringUtil.isEmpty(cfg.getPolicyGroup())){
|
||||
* groupAreaService.setAreaCodeByGroupId(cfg); }
|
||||
* ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
*
|
||||
* addMessage(redirectAttributes,"success","save_success"); }catch(Exception
|
||||
* e){ e.printStackTrace(); if(e instanceof MaatConvertException) {
|
||||
* addMessage(redirectAttributes,"error", "request_service_failed"); }else {
|
||||
* addMessage(redirectAttributes,"error", "save_failed"); } }
|
||||
*
|
||||
* return "redirect:" + adminPath
|
||||
* +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+cfg.getFunctionId
|
||||
* (); }
|
||||
*
|
||||
* @RequestMapping(value = {"/snataudit"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:confirm"}) 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(); for(String id :idArray){ try {
|
||||
* ipMultiplexPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
* } catch (Exception e) { e.printStackTrace();
|
||||
* logger.error("SNAT地址池管理配置下发失败:"+e.getMessage()); if(e instanceof
|
||||
* MaatConvertException) { addMessage(redirectAttributes,"error",
|
||||
* "request_service_failed"); }else { addMessage(redirectAttributes,"error",
|
||||
* "audit_failed"); } } }
|
||||
*
|
||||
* } return "redirect:" + adminPath
|
||||
* +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId; }
|
||||
*
|
||||
* @RequestMapping(value = {"/snatdelete"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) public String
|
||||
* snatdelete(Integer isAudit,Integer isValid,String ids,Integer
|
||||
* functionId,Model model,RedirectAttributes redirectAttributes
|
||||
* ,HttpServletRequest request,HttpServletResponse response){ try{
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
* ipMultiplexPoolCfgService.delete(isAudit,isValid,ids,functionId); }
|
||||
* addMessage(redirectAttributes,"success","delete_success");
|
||||
* }catch(Exception e){ logger.error(e);
|
||||
* addMessage(redirectAttributes,"error","delete_failed"); } return
|
||||
* "redirect:" + adminPath
|
||||
* +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId; }
|
||||
*/
|
||||
|
||||
/**
|
||||
* 校验IP是否已存在
|
||||
*
|
||||
* @param cfg
|
||||
* @param redirectAttributes
|
||||
* @param request
|
||||
@@ -248,97 +235,143 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/checkIp"})
|
||||
public boolean checkIp(IpMultiplexPoolCfg cfg, HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/checkIp" })
|
||||
public boolean checkIp(IpMultiplexPoolCfg cfg, HttpServletRequest request, HttpServletResponse response) {
|
||||
// 修改
|
||||
if(!StringUtil.isEmpty(cfg.getCfgId())){
|
||||
if (!StringUtil.isEmpty(cfg.getCfgId())) {
|
||||
IpMultiplexPoolCfg poolCfg = ipMultiplexPoolCfgService.getCfgInfo(cfg);
|
||||
if(poolCfg != null && poolCfg.getDestIpAddress().equals(cfg.getDestIpAddress())){
|
||||
if (poolCfg != null && poolCfg.getDestIpAddress().equals(cfg.getDestIpAddress())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
cfg.setCfgId(null);
|
||||
IpMultiplexPoolCfg poolCfg = ipMultiplexPoolCfgService.getCfgInfo(cfg);
|
||||
if(poolCfg != null){
|
||||
if (poolCfg != null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo=new Page<IpMultiplexPoolCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
page.setList(ipMultiplexPoolCfgService.getIsp(page.getList()));
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport=",server_port,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
// snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo = new Page<IpMultiplexPoolCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
page.setList(ipMultiplexPoolCfgService.getIsp(page.getList()));
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport = ",server_port,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
|
||||
//dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo=new Page<IpMultiplexPoolCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport=",isp,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo = new Page<IpMultiplexPoolCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport = ",isp,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,14 @@ import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
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.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -352,4 +357,83 @@ public class UserManageController extends BaseController{
|
||||
model.addAttribute("user", user);
|
||||
return "/cfg/maintenance/userManage/userView";
|
||||
}*/
|
||||
// 配置导出
|
||||
@RequestMapping(value = "exportUser")
|
||||
public void exportbgp(Model model, HttpServletRequest request, HttpServletResponse response,String hColumns,String exType,
|
||||
@ModelAttribute("cfg") UserManage entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
List<UserManage> ipLists = new ArrayList<UserManage>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = userManageService.findByPage(ids);
|
||||
} else {
|
||||
Page<UserManage> pageInfo = new Page<UserManage>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<UserManage> page = userManageService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
titleList.add("user_manage");
|
||||
classMap.put("user_manage", UserManage.class);
|
||||
String cfgIndexInfoNoExport = ",";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(hColumns)) {
|
||||
cfgIndexInfoNoExport = "," + hColumns + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
for (UserManage userManage : ipLists) {
|
||||
if(!StringUtils.isEmpty( userManage.getServerIp())){
|
||||
userManage.setServerIp(userManage.getServerIp().substring(0,userManage.getServerIp().length()-1));
|
||||
}
|
||||
}
|
||||
noExportMap.put("user_manage", cfgIndexInfoNoExport);
|
||||
dataMap.put("user_manage", ipLists);
|
||||
String timeRange = initUserMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "user_manage", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "user_manage", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("user export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
public String initUserMap(UserManage cfg){
|
||||
Properties msgProp = getMsgProp();
|
||||
String titleTime=msgProp.getProperty("user_manage","user_manage");
|
||||
if(cfg.getSearch_create_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("config_time")+":"+DateUtils.formatDateTime(cfg.getSearch_create_time_start());
|
||||
if(cfg.getSearch_create_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_create_time_end());
|
||||
}else {
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(cfg.getSearch_edit_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":"+DateUtils.formatDateTime(cfg.getSearch_edit_time_start());
|
||||
if(cfg.getSearch_edit_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_edit_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return titleTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,165 +39,189 @@ import com.nis.web.security.UserUtils;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/manipulation/ddos")
|
||||
public class DdosCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DdosIpCfg entity){
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(new Page<DdosIpCfg>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg entity) {
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(new Page<DdosIpCfg>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/ddosIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")DdosIpCfg cfg){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids),null);
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/ddosIpCfgForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DdosIpCfg cfg, RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
ddosCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
ddosCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
ddosCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
//@RequiresPermissions(value={"ddos:ip:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DdosIpCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
// @RequiresPermissions(value={"ddos:ip:confirm"})
|
||||
public String audit(Model model, @ModelAttribute("cfg") DdosIpCfg cfg, Integer isValid, Integer isAudit, String ids,
|
||||
Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ddosCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}else {
|
||||
Page<DdosIpCfg> searchPage=new Page<DdosIpCfg>(request,response,"r");
|
||||
Page<DdosIpCfg> auditPage=new Page<DdosIpCfg>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<DdosIpCfg> searchPage = new Page<DdosIpCfg>(request, response, "r");
|
||||
Page<DdosIpCfg> auditPage = new Page<DdosIpCfg>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//ddos配置导出
|
||||
|
||||
// ddos配置导出
|
||||
@RequestMapping(value = "exportDdos")
|
||||
public void exportddos(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DdosIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportddos(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<DdosIpCfg> ipLists=new ArrayList<DdosIpCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ddosCfgService.findByPage(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<DdosIpCfg> pageInfo=new Page<DdosIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DdosIpCfg.class);
|
||||
String cfgIndexInfoNoExport=",do_log,client_ip,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<DdosIpCfg> ipLists = new ArrayList<DdosIpCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ddosCfgService.findByPage(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<DdosIpCfg> pageInfo = new Page<DdosIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DdosIpCfg.class);
|
||||
String cfgIndexInfoNoExport = ",do_log,client_ip,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ddos export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
logger.error("ddos export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据索引表信息异步获取子表信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/ajaxDdosInfo"})
|
||||
public String getDdosInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
@RequestMapping(value = { "/ajaxDdosInfo" })
|
||||
public String getDdosInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
DdosIpCfg cfg = ddosCfgService.getDdosIpCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
//获取DdosIpCfg信息
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
// 获取DdosIpCfg信息
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/ddosSubList";
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpAddrPoolCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
|
||||
@@ -46,101 +47,116 @@ import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.service.configuration.IpMultiplexService;
|
||||
|
||||
/**
|
||||
* @ClassName: ControlController.java
|
||||
* @ClassName: ControlController.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年6月22日 下午4:35:42
|
||||
* @version V1.0
|
||||
*/
|
||||
@Controller
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/manipulation/ipmulitiplex")
|
||||
public class IpMultiplexController extends CommonController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IpMultiplexService ipMultiplexService;
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
// @RequiresPermissions(value={"ip:mulitiplex:config","ip:mulitiplex:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
this._ipList(cfgName,model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
// @RequiresPermissions(value={"ip:mulitiplex:config","ip:mulitiplex:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName, Model model, @ModelAttribute("cfg") IpPortCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
this._ipList(cfgName, model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "/cfg/common/ipList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:config"})
|
||||
public String ipForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
SysDataDictionaryItem dict=null;
|
||||
List<SysDataDictionaryItem> dictList= DictUtils.getDictList("GROUP_TYPE");
|
||||
for(SysDataDictionaryItem di:dictList){
|
||||
if("IP".equals(di.getItemValue())){
|
||||
dict=di;
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:config" })
|
||||
public String ipForm(String cfgName, Model model, String ids, Integer functionId, BaseIpCfg entity) {
|
||||
this._ipForm(cfgName, model, ids, functionId, entity);
|
||||
SysDataDictionaryItem dict = null;
|
||||
List<SysDataDictionaryItem> dictList = DictUtils.getDictList("GROUP_TYPE");
|
||||
for (SysDataDictionaryItem di : dictList) {
|
||||
if ("IP".equals(di.getItemValue())) {
|
||||
dict = di;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(dict!=null){
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(Integer.parseInt(dict.getItemCode()));
|
||||
if (dict != null) {
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService
|
||||
.findPolicyGroupInfosByType(Integer.parseInt(dict.getItemCode()));
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
}
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "/cfg/manipulation/ipmulitiplex/form";
|
||||
}
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
public String saveOrUpdateIp(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
this._saveOrUpdateIp(cfgName,model, cfg);
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
public String saveOrUpdateIp(String cfgName, RedirectAttributes model, IpPortCfg cfg) {
|
||||
this._saveOrUpdateIp(cfgName, model, cfg);
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions("ip:mulitiplex:config")
|
||||
public String deleteIp(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix","/proxy/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+functionId;
|
||||
public String deleteIp(String cfgName, String ids, String compileIds, Integer functionId,
|
||||
RedirectAttributes model) {
|
||||
this._deleteIp(cfgName, ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix", "/proxy/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions("ip:mulitiplex:confirm")
|
||||
public String auditIp(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
public String auditIp(String cfgName, String ids, IpPortCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
this._auditIp(cfgName, ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
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模板下载
|
||||
|
||||
// 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);
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
IpMultiplexPolicyTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpPortCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
this._exportIp(columns, model, request, response, entity, ids, redirectAttributes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IP复用策略拆分为SNAT/DNAT复用策略
|
||||
*/
|
||||
@RequestMapping(value = {"/snatPolicyList"})
|
||||
public String snatPolicyList(Model model,@ModelAttribute("cfg")IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(new Page<IpReusePolicyCfg>(request, response,"r"), cfg);
|
||||
@RequestMapping(value = { "/snatPolicyList" })
|
||||
public String snatPolicyList(Model model, @ModelAttribute("cfg") IpReusePolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(new Page<IpReusePolicyCfg>(request, response, "r"),
|
||||
cfg);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,cfg);
|
||||
|
||||
initFormCondition(model, cfg);
|
||||
|
||||
// 获取地址池、用户信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
@@ -148,357 +164,406 @@ public class IpMultiplexController extends CommonController {
|
||||
model.addAttribute("addrPools", addrPools);
|
||||
return "/cfg/manipulation/ipmulitiplex/snatPolicyList2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatPolicyForm"})
|
||||
@RequiresPermissions(value={"snat_policy:config"})
|
||||
public String snatPolicyForm(Model model, String ids, IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
if(cfg == null){
|
||||
cfg=new IpReusePolicyCfg();
|
||||
|
||||
@RequestMapping(value = { "/snatPolicyForm" })
|
||||
@RequiresPermissions(value = { "snat_policy:config" })
|
||||
public String snatPolicyForm(Model model, String ids, IpReusePolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
if (cfg == null) {
|
||||
cfg = new IpReusePolicyCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexService.getPolicyCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexService.getPolicyCfg(Long.valueOf(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
|
||||
// 获取用户信息 地址池信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
return "/cfg/manipulation/ipmulitiplex/snatPolicyForm2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateSnat"})
|
||||
public String saveOrUpdateSnat(Model model, HttpServletRequest request,HttpServletResponse response,
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdateSnat" })
|
||||
public String saveOrUpdateSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, IpReusePolicyCfg cfg) {
|
||||
try{
|
||||
try {
|
||||
// 添加策略配置信息
|
||||
ipMultiplexService.saveOrUpdate(cfg, request, response);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatDelete"})
|
||||
|
||||
@RequestMapping(value = { "/snatDelete" })
|
||||
@RequiresPermissions("snat_policy:config")
|
||||
public String snatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexService.delete(isValid,ids,functionId);
|
||||
public String snatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexService.delete(isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/auditSnat"})
|
||||
|
||||
@RequestMapping(value = { "/auditSnat" })
|
||||
@RequiresPermissions("snat_policy:confirm")
|
||||
public String auditSnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditSnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexService.auditSnatPolicy(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexService.auditSnatPolicy(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("SNAT策略配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("SNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"/ajaxSnatInfo"})
|
||||
public String ajaxSnatInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
|
||||
@RequestMapping(value = { "/ajaxSnatInfo" })
|
||||
public String ajaxSnatInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
IpReusePolicyCfg cfg = ipMultiplexService.getSnatCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("addrPools", addrPools);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/manipulation/ipmulitiplex/snatSubList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = {"/ajaxDnatInfo"})
|
||||
public String ajaxDnatInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
|
||||
@RequestMapping(value = { "/ajaxDnatInfo" })
|
||||
public String ajaxDnatInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
IpReuseDnatPolicyCfg cfg = ipMultiplexService.getDnatCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatSubList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 异步获取地址池信息
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/ajaxGetAddrPools"})
|
||||
public List<IpAddrPoolCfg> ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/ajaxGetAddrPools" })
|
||||
public List<IpAddrPoolCfg> ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
List<IpAddrPoolCfg> addrPoolsNew=new ArrayList<>();
|
||||
List<IpAddrPoolCfg> addrPoolsNew = new ArrayList<>();
|
||||
for (IpAddrPoolCfg addrPool : addrPools) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("addr_pool_id", addrPool.getCfgId());
|
||||
String url =Constants.IP_REUSE_CALL_CGI_URL ;
|
||||
Map<String, Object> resultMap=ConfigServiceUtil.getCGIInfo(url, Constants.IP_NUM_GET, params);
|
||||
if(!StringUtil.isEmpty(resultMap)
|
||||
&& !StringUtil.isEmpty(resultMap.get("num"))
|
||||
String url = Constants.IP_REUSE_CALL_CGI_URL;
|
||||
Map<String, Object> resultMap = ConfigServiceUtil.getCGIInfo(url, Constants.IP_NUM_GET, params);
|
||||
if (!StringUtil.isEmpty(resultMap) && !StringUtil.isEmpty(resultMap.get("num"))
|
||||
&& Integer.parseInt(resultMap.get("num").toString()) > 0) {
|
||||
addrPoolsNew.add(addrPool);
|
||||
}
|
||||
}
|
||||
return addrPoolsNew;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验地址池是否被策略引用
|
||||
*
|
||||
* @param addrPoolIds
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/ajaxIsUsed"})
|
||||
public boolean ajaxIsUsed(String addrPoolIds, HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/ajaxIsUsed" })
|
||||
public boolean ajaxIsUsed(String addrPoolIds, HttpServletRequest request, HttpServletResponse response) {
|
||||
for (String addrPoolId : addrPoolIds.split(",")) {
|
||||
List<IpReusePolicyCfg> ipList = ipMultiplexService.checkAddrPoolIsUsed(addrPoolId);
|
||||
if(ipList != null && ipList.size() > 0){
|
||||
if (ipList != null && ipList.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"/dnatPolicyList"})
|
||||
public String dnatPolicyList(String cfgName,Model model,@ModelAttribute("cfg")IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
//this._ipList(cfgName,model, cfg, request, response);
|
||||
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(new Page<BaseIpCfg>(request, response,"r"), cfg);
|
||||
|
||||
@RequestMapping(value = { "/dnatPolicyList" })
|
||||
public String dnatPolicyList(String cfgName, Model model, @ModelAttribute("cfg") IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
// this._ipList(cfgName,model, cfg, request, response);
|
||||
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(new Page<BaseIpCfg>(request, response, "r"), cfg);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,cfg);
|
||||
|
||||
initFormCondition(model, cfg);
|
||||
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatPolicyList2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/dnatPolicyForm"})
|
||||
@RequiresPermissions(value={"dnat_policy:config"})
|
||||
public String dnatPolicyForm(String cfgName,Model model,String ids,Integer functionId,IpReuseDnatPolicyCfg cfg) {
|
||||
//this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
|
||||
if(cfg == null){
|
||||
cfg=new IpReuseDnatPolicyCfg();
|
||||
|
||||
@RequestMapping(value = { "/dnatPolicyForm" })
|
||||
@RequiresPermissions(value = { "dnat_policy:config" })
|
||||
public String dnatPolicyForm(String cfgName, Model model, String ids, Integer functionId,
|
||||
IpReuseDnatPolicyCfg cfg) {
|
||||
// this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
|
||||
if (cfg == null) {
|
||||
cfg = new IpReuseDnatPolicyCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexService.getDnatPolicyCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexService.getDnatPolicyCfg(Long.valueOf(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatPolicyForm2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateDnat"})
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdateDnat" })
|
||||
public String saveOrUpdateDnat(Model model, RedirectAttributes redirectAttributes, IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
try{
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
// 添加策略配置信息
|
||||
ipMultiplexService.saveOrUpdateDnat(cfg, request, response);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+cfg.getFunctionId();
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/dnatDelete"})
|
||||
|
||||
@RequestMapping(value = { "/dnatDelete" })
|
||||
@RequiresPermissions("dnat_policy:config")
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
//this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexService.deleteDnat(isValid,ids,functionId);
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexService.deleteDnat(isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/auditDnat"})
|
||||
|
||||
@RequestMapping(value = { "/auditDnat" })
|
||||
@RequiresPermissions("dnat_policy:confirm")
|
||||
public String auditDnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
//this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditDnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
// this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexService.auditDnatPolicy(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexService.auditDnatPolicy(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("DNAT策略配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("DNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")BaseIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo=new Page<BaseIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if(StringUtil.isEmpty(baseIp.getGroupName())){
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport=",client_ip,group_name,server_ip,ip_type,ip_pattern,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpReusePolicyCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
// 导出选中记录
|
||||
List<IpReusePolicyCfg> ipLists = new ArrayList<IpReusePolicyCfg>();
|
||||
|
||||
|
||||
//dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")BaseIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo=new Page<BaseIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if(StringUtil.isEmpty(baseIp.getGroupName())){
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport=",direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipMultiplexService.findByPage(ids);
|
||||
} else {
|
||||
Page<IpReusePolicyCfg> pageInfo = new Page<IpReusePolicyCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(pageInfo,entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
for (IpReusePolicyCfg ipReusePolicyCfg : ipLists) {
|
||||
if(ipReusePolicyCfg.getAddrPoolId()!=null){
|
||||
for (IpAddrPoolCfg addr : addrPools) {
|
||||
if(ipReusePolicyCfg.getAddrPoolId()==addr.getCfgId().intValue()){
|
||||
ipReusePolicyCfg.setAddrPoolName(addr.getAddrPoolName());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ipReusePolicyCfg.getUserType().equals("VPN")){
|
||||
ipReusePolicyCfg.setUserType(msgProp.getProperty("policy_vpn_user","VPN"));
|
||||
}else if(ipReusePolicyCfg.getUserType().equals("SIPv4")){
|
||||
ipReusePolicyCfg.setUserType(msgProp.getProperty("policy_sipv4_user","SIPv4"));
|
||||
}else if(ipReusePolicyCfg.getUserType().equals("SIPv6")){
|
||||
ipReusePolicyCfg.setUserType(msgProp.getProperty("policy_sipv6_user","SIPv6"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpReusePolicyCfg.class);
|
||||
String snatNoExport = ",block_type,client_ip,group_name,server_ip,ip_type,ip_pattern,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpReuseDnatPolicyCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
Properties msgProp = getMsgProp();
|
||||
// 导出选中记录
|
||||
List<BaseIpCfg> ipLists = new ArrayList<BaseIpCfg>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipMultiplexService.findPageByDnat(ids);
|
||||
} else {
|
||||
Page<BaseIpCfg> pageInfo = new Page<BaseIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
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,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(),ipLists);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,87 +19,87 @@ import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/asnPolicy")
|
||||
@Deprecated
|
||||
public class AsnPolicyCfgController extends BaseController {
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
Page<CfgIndexInfo> page = asnPolicyCfgService.findPage(new Page<CfgIndexInfo>(request, response,"r"), entity);
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
Page<CfgIndexInfo> page = asnPolicyCfgService.findPage(new Page<CfgIndexInfo>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/asnPolicyCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"asn:policy:config"})
|
||||
public String form(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "asn:policy:config" })
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
entity = asnPolicyCfgService.get(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model, entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
List<ConfigGroupInfo> policyGroups=asnPolicyCfgService.getConfigGroupInfoList(4);
|
||||
List<ConfigGroupInfo> policyGroups = asnPolicyCfgService.getConfigGroupInfoList(4);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/asnPolicyCfgForm";
|
||||
}
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"asn:policy:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "asn:policy:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
asnPolicyCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/cfg/asnPolicy/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/cfg/asnPolicy/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"asn:policy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "asn:policy:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
asnPolicyCfgService.delete(functionId, isValid, ids);
|
||||
return "redirect:" + adminPath +"/cfg/asnPolicy/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/cfg/asnPolicy/list?functionId=" + functionId;
|
||||
}
|
||||
// @RequestMapping(value = {"/audit"})
|
||||
// @RequiresPermissions(value={"asn:policy:confirm"})
|
||||
// public String audit(Integer isAudit,Integer isValid,String ids
|
||||
// ,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// if(!StringUtil.isEmpty(ids)){
|
||||
// String[] idArray = ids.split(",");
|
||||
// Date auditTime=new Date();
|
||||
// for(String id :idArray){
|
||||
// try {
|
||||
// asnPolicyCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
// } catch (MaatConvertException e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","request_service_failed");
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","audit_failed");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return "redirect:" + adminPath +"/cfg/asnPolicy/list?functionId="+functionId;
|
||||
// }
|
||||
// @RequestMapping(value = {"/audit"})
|
||||
// @RequiresPermissions(value={"asn:policy:confirm"})
|
||||
// public String audit(Integer isAudit,Integer isValid,String ids
|
||||
// ,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// if(!StringUtil.isEmpty(ids)){
|
||||
// String[] idArray = ids.split(",");
|
||||
// Date auditTime=new Date();
|
||||
// for(String id :idArray){
|
||||
// try {
|
||||
// asnPolicyCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
// } catch (MaatConvertException e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","request_service_failed");
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","audit_failed");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return "redirect:" + adminPath
|
||||
// +"/cfg/asnPolicy/list?functionId="+functionId;
|
||||
// }
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -34,227 +33,245 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* BGP配置
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/other/")
|
||||
public class BgpCfgController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"bgpList"})
|
||||
// @RequiresPermissions(value={"other:bgp:config"})
|
||||
public String bgpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class BgpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "bgpList" })
|
||||
// @RequiresPermissions(value={"other:bgp:config"})
|
||||
public String bgpList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = bgpCfgService.getBgpList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/other/bgpList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"bgpForm"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String bgpForm(Model model,String ids,CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "bgpForm" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String bgpForm(Model model, String ids, CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/other/bgpForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveBgpCfg"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String saveBgpCfg(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,String ids,CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
|
||||
@RequestMapping(value = { "saveBgpCfg" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String saveBgpCfg(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.saveBgpCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"ajaxBgpSubList"})
|
||||
public String ajaxBgpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = bgpCfgService.getBgpCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "ajaxBgpSubList" })
|
||||
public String ajaxBgpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = bgpCfgService.getBgpCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcBgpAsCfgList()!=null){
|
||||
if (cfg.getNtcBgpAsCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcBgpAsCfg ip:cfg.getNtcBgpAsCfgList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ip.getCfgType()});
|
||||
for (NtcBgpAsCfg ip : cfg.getNtcBgpAsCfgList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg ip:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ip.getCfgType()});
|
||||
for (NtcSubscribeIdCfg ip : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*TODO
|
||||
* if(cfg.getDomainList()!=null){
|
||||
String cfgType = null;
|
||||
for(ComplexkeywordCfg keyword:cfg.getDomainList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"3",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
model.addAttribute("_cfg", cfg);
|
||||
/*
|
||||
* TODO if(cfg.getDomainList()!=null){ String cfgType = null;
|
||||
* for(ComplexkeywordCfg keyword:cfg.getDomainList()){
|
||||
* if(!keyword.getCfgType().equals(cfgType)){ tabList.add(new
|
||||
* String[]{"3",keyword.getCfgType()}); cfgType = keyword.getCfgType();
|
||||
* } } }
|
||||
*/
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/other/bgpSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"updateBgpCfgValid"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String updateBgpCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.updateBgpCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "updateBgpCfgValid" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.updateBgpCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"auditBgpCfg"})
|
||||
@RequiresPermissions(value={"other:bgp:confirm"})
|
||||
public String auditBgpCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
|
||||
@RequestMapping(value = { "auditBgpCfg" })
|
||||
@RequiresPermissions(value = { "other:bgp:confirm" })
|
||||
public String auditBgpCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
bgpCfgService.auditBgpCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
bgpCfgService.auditBgpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("bgp配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}catch (Exception e) {
|
||||
logger.error("bgp配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("bgp配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("bgp配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} else {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return bgpList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//bgp配置导出
|
||||
@RequestMapping(value = "exportbgp")
|
||||
public void exportbgp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
List<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = bgpCfgService.getBgpList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_BGP_AS");
|
||||
// titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_BGP_AS", BaseStringCfg.class);
|
||||
// classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String regionCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_BGP_AS", regionCfgNoExport);
|
||||
// noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
// List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> asInfoList=new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo=bgpCfgService.exportbgp(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
// subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
asInfoList.addAll(cfgIndexInfo.getNtcBgpAsCfgList());
|
||||
}
|
||||
asInfoList=BaseStringCfg.replaceBaseKeyList(asInfoList);
|
||||
// subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_BGP_AS", asInfoList);
|
||||
// dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("bgp export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
// bgp配置导出
|
||||
@RequestMapping(value = "exportbgp")
|
||||
public void exportbgp(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = bgpCfgService.getBgpList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_BGP_AS");
|
||||
// titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_BGP_AS", BaseStringCfg.class);
|
||||
// classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String regionCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_BGP_AS", regionCfgNoExport);
|
||||
// noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
// List<BaseStringCfg> subscribeInfoList=new
|
||||
// ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> asInfoList = new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo = bgpCfgService.exportbgp(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
// subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
asInfoList.addAll(cfgIndexInfo.getNtcBgpAsCfgList());
|
||||
}
|
||||
asInfoList = BaseStringCfg.replaceBaseKeyList(asInfoList);
|
||||
// subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_BGP_AS", asInfoList);
|
||||
// dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("bgp export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
|
||||
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.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
@@ -41,6 +42,15 @@ import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptTemplate;
|
||||
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.IpPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.IpWhitelistTemplate;
|
||||
@@ -291,11 +301,16 @@ public class IpController extends BaseController{
|
||||
,FunctionServiceDict serviceDict
|
||||
,Integer requestId) throws Exception{
|
||||
Properties pro=getMsgProp();
|
||||
//String serviceName=pro.getProperty(serviceDict.getServiceName());
|
||||
String regionName=pro.getProperty(regionDict.getConfigRegionValue());
|
||||
//serviceName=StringUtil.isEmpty(serviceName) ?serviceDict.getServiceName():serviceName;
|
||||
regionName=StringUtil.isEmpty(regionName) ?regionDict.getConfigRegionValue():regionName;
|
||||
String fileName = regionName+"_Template.xlsx";
|
||||
String menuCode = menuService.getMenuCodeByFunctionId(serviceDict.getFunctionId());
|
||||
String menuName = pro.getProperty(menuCode);
|
||||
String regionName = pro.getProperty(regionDict.getConfigRegionValue());
|
||||
menuName = StringUtil.isEmpty(menuName) ? menuCode : menuName;
|
||||
regionName = StringUtil.isEmpty(regionName) ? regionDict.getConfigRegionValue() : regionName;
|
||||
|
||||
String fileName = regionName + "_Template.xlsx";
|
||||
if(!menuName.equalsIgnoreCase(regionName)) {
|
||||
fileName = menuName +"_"+ fileName;
|
||||
}
|
||||
//ip类模板
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
if(regionDict.getFunctionId().equals(5)){// IP Address
|
||||
@@ -315,7 +330,12 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpPayloadTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(7)||regionDict.getFunctionId().equals(401)){ //Dns IP,DNS FAKE IP
|
||||
}else if(regionDict.getFunctionId().equals(7)) {
|
||||
List<DnsIpTemplate> classList=new ArrayList<DnsIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DnsIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(401)){ //Dns IP,DNS FAKE IP
|
||||
List<DnsFakeIpTemplate> classList=new ArrayList<DnsFakeIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DnsFakeIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
@@ -345,6 +365,21 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, SnatTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
List<HttpsRejectIpTemplate> classList=new ArrayList<HttpsRejectIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectIpTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
List<HttpsRedirectIpTemplate> classList=new ArrayList<HttpsRedirectIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectIpTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
List<HttpsReplaceIpTemplate> classList=new ArrayList<HttpsReplaceIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
|
||||
@@ -381,6 +416,21 @@ public class IpController extends BaseController{
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
List<HttpsRejectTemplate> classList=new ArrayList<HttpsRejectTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
List<HttpsRedirectTemplate> classList=new ArrayList<HttpsRedirectTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
List<HttpsReplaceTemplate> classList=new ArrayList<HttpsReplaceTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),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);
|
||||
@@ -396,6 +446,26 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DnsComplexStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
List<HttpsRejectComplexTemplate> classList=new ArrayList<HttpsRejectComplexTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectComplexTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
List<HttpsRedirectComplexTemplate> classList=new ArrayList<HttpsRedirectComplexTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectComplexTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
List<HttpsReplaceComplexTemplate> classList=new ArrayList<HttpsReplaceComplexTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(563)) {// APP Payload
|
||||
List<AppPayloadTemplate> classList=new ArrayList<AppPayloadTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, AppPayloadTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),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);
|
||||
@@ -462,6 +532,19 @@ public class IpController extends BaseController{
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String asnGroupInfoNoExport="";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("asn_policy", asnGroupInfoNoExport);
|
||||
@@ -480,9 +563,16 @@ public class IpController extends BaseController{
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("asn_policy", groupInfoList);
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
|
||||
@@ -44,275 +44,303 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 邮件相关配置控制类
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/mail/")
|
||||
public class MailCfgController extends BaseController{
|
||||
@RequestMapping(value = {"mailList"})
|
||||
// @RequiresPermissions(value={"mail:config"})
|
||||
public String mailList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class MailCfgController extends BaseController {
|
||||
@RequestMapping(value = { "mailList" })
|
||||
// @RequiresPermissions(value={"mail:config"})
|
||||
public String mailList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = mailCfgService.getMailList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/mail/mailList";
|
||||
}
|
||||
@RequestMapping(value = {"mailForm"})
|
||||
@RequiresPermissions(value={"mail:config"})
|
||||
public String mailForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "mailForm" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String mailForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/mail/mailForm";
|
||||
}
|
||||
@RequestMapping(value = {"saveMailCfg"})
|
||||
@RequiresPermissions(value={"mail:config"})
|
||||
public String saveMailCfg( RedirectAttributes redirectAttributes, Model model,HttpServletRequest request,HttpServletResponse response,String ids,
|
||||
CfgIndexInfo entity,MultipartFile file) {
|
||||
|
||||
|
||||
@RequestMapping(value = { "saveMailCfg" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String saveMailCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, String ids, CfgIndexInfo entity, MultipartFile file) {
|
||||
|
||||
try {
|
||||
ToMaatResult result = null;
|
||||
if(file!=null && file.getSize()>0 && entity.getDigestList()!=null && entity.getDigestList().size()>0){
|
||||
if (file != null && file.getSize() > 0 && entity.getDigestList() != null
|
||||
&& entity.getDigestList().size() > 0) {
|
||||
String sep = System.getProperty("file.separator");
|
||||
String digestFilePath = request.getRealPath("/")+"digestFile";
|
||||
String digestFilePath = request.getRealPath("/") + "digestFile";
|
||||
FileUtils.createDirectory(digestFilePath);
|
||||
String fileName = UUID.randomUUID()+FileUtils.getSuffix(file.getOriginalFilename(), true);
|
||||
File uploadFile = new File(digestFilePath+sep+fileName);
|
||||
String fileName = UUID.randomUUID() + FileUtils.getSuffix(file.getOriginalFilename(), true);
|
||||
File uploadFile = new File(digestFilePath + sep + fileName);
|
||||
FileCopyUtils.copy(file.getBytes(), uploadFile);
|
||||
Date creatTime = entity.getCreateTime();
|
||||
//获取文件摘要接口调用
|
||||
Map<String,Object> fileMap = new HashMap();
|
||||
// 获取文件摘要接口调用
|
||||
Map<String, Object> fileMap = new HashMap();
|
||||
fileMap.put("filetype", FileUtils.getSuffix(file.getOriginalFilename(), false));
|
||||
fileMap.put("datatype", "dbSystem");//源文件存入数据中心
|
||||
|
||||
fileMap.put("createTime",creatTime);
|
||||
fileMap.put("key",FileUtils.getPrefix(file.getOriginalFilename(), false));
|
||||
fileMap.put("datatype", "dbSystem");// 源文件存入数据中心
|
||||
|
||||
fileMap.put("createTime", creatTime);
|
||||
fileMap.put("key", FileUtils.getPrefix(file.getOriginalFilename(), false));
|
||||
fileMap.put("fileName", file.getOriginalFilename());
|
||||
String md5 = DigestUtils.md5Hex(file.getBytes());
|
||||
fileMap.put("checksum", md5);
|
||||
result = ConfigServiceUtil.getFileDigest(null, uploadFile, JsonMapper.toJsonString(fileMap));
|
||||
logger.info("获取文件摘要响应信息:"+result);
|
||||
}
|
||||
mailCfgService.saveMailCfg(entity,result);
|
||||
addMessage(redirectAttributes,"success", "save_success");
|
||||
} catch ( Exception 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");
|
||||
logger.info("获取文件摘要响应信息:" + result);
|
||||
}
|
||||
mailCfgService.saveMailCfg(entity, result);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception 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");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/mail/mailList?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ajaxMailSubList"})
|
||||
public String ajaxMailSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = mailCfgService.getMailCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "ajaxMailSubList" })
|
||||
public String ajaxMailSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = mailCfgService.getMailCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexList()!=null){
|
||||
if (cfg.getComplexList() != null) {
|
||||
String cfgType = null;
|
||||
for(ComplexkeywordCfg keyword:cfg.getComplexList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"3",keyword.getCfgType()});
|
||||
for (ComplexkeywordCfg keyword : cfg.getComplexList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "3", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getDigestList()!=null){
|
||||
if (cfg.getDigestList() != null) {
|
||||
String cfgType = null;
|
||||
for(FileDigestCfg digest:cfg.getDigestList()){
|
||||
if(!digest.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"5",digest.getCfgType()});
|
||||
for (FileDigestCfg digest : cfg.getDigestList()) {
|
||||
if (!digest.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "5", digest.getCfgType() });
|
||||
cfgType = digest.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (NtcSubscribeIdCfg keyword : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/mail/mailSubList";
|
||||
}
|
||||
@RequestMapping(value = {"updateMailCfgValid"})
|
||||
@RequiresPermissions(value={"mail:config"})
|
||||
public String updateMailCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
mailCfgService.updateMailCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/mail/mailList?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "updateMailCfgValid" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
mailCfgService.updateMailCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"auditMailCfg"})
|
||||
@RequiresPermissions(value={"mail:confirm"})
|
||||
public String auditMailCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
|
||||
@RequestMapping(value = { "auditMailCfg" })
|
||||
@RequiresPermissions(value = { "mail:confirm" })
|
||||
public String auditMailCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
mailCfgService.auditMailCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
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");
|
||||
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
logger.error("mail配置下发失败:" + e.getMessage());
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} else {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return mailList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/mail/mailList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//mail配置导出
|
||||
@RequestMapping(value = "exportmail")
|
||||
public void exportmail(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = mailCfgService.getMailList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String regionCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
if(entity.getFunctionId()!=null){
|
||||
if(entity.getFunctionId()!=37){
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_MAIL_BODY");
|
||||
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_MAIL_BODY", ComplexkeywordCfg.class);
|
||||
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_BODY", regionCfgNoExport);
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add("NTC_MAIL_HDR");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_MAIL_HDR", ComplexkeywordCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_HDR", regionCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
List<ComplexkeywordCfg> mailBodyList=new ArrayList<ComplexkeywordCfg>();
|
||||
List<ComplexkeywordCfg> mailReqHdrList=new ArrayList<ComplexkeywordCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps=mailCfgService.exportmail(cfg);
|
||||
mailReqHdrList.addAll(maps.get("NTC_MAIL_HDR"));
|
||||
mailBodyList.addAll(maps.get("NTC_MAIL_BODY"));
|
||||
ipList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
mailBodyList=ComplexkeywordCfg.replaceComplexKeyList(mailBodyList);
|
||||
mailReqHdrList=ComplexkeywordCfg.replaceComplexKeyList(mailReqHdrList);
|
||||
if(entity.getFunctionId()!=null){
|
||||
if(entity.getFunctionId()!=37){
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_MAIL_BODY", mailBodyList);
|
||||
|
||||
}
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_MAIL_HDR", mailReqHdrList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("mail export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
// mail配置导出
|
||||
@RequestMapping(value = "exportmail")
|
||||
public void exportmail(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = mailCfgService.getMailList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String regionCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (entity.getFunctionId() != null) {
|
||||
if (entity.getFunctionId() != 37) {
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_MAIL_BODY");
|
||||
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_MAIL_BODY", ComplexkeywordCfg.class);
|
||||
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_BODY", regionCfgNoExport);
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add("NTC_MAIL_HDR");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_MAIL_HDR", ComplexkeywordCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_HDR", regionCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList = new ArrayList<BaseStringCfg>();
|
||||
List<ComplexkeywordCfg> mailBodyList = new ArrayList<ComplexkeywordCfg>();
|
||||
List<ComplexkeywordCfg> mailReqHdrList = new ArrayList<ComplexkeywordCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps = mailCfgService.exportmail(cfg);
|
||||
mailReqHdrList.addAll(maps.get("NTC_MAIL_HDR"));
|
||||
mailBodyList.addAll(maps.get("NTC_MAIL_BODY"));
|
||||
ipList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
mailBodyList = ComplexkeywordCfg.replaceComplexKeyList(mailBodyList);
|
||||
mailReqHdrList = ComplexkeywordCfg.replaceComplexKeyList(mailReqHdrList);
|
||||
if (entity.getFunctionId() != null) {
|
||||
if (entity.getFunctionId() != 37) {
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_MAIL_BODY", mailBodyList);
|
||||
|
||||
}
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_MAIL_HDR", mailReqHdrList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("mail export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,145 +33,151 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 白名单
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/whitelist")
|
||||
public class WhiteListController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"ip/list"})
|
||||
//@RequiresPermissions(value={"whitelist:ip:config","whitelist:ip:confirm","whitelist:ip:aduit"},logical=Logical.OR)
|
||||
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "ip/list" })
|
||||
// @RequiresPermissions(value={"whitelist:ip:config","whitelist:ip:confirm","whitelist:ip:aduit"},logical=Logical.OR)
|
||||
public String ipList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/whitelist/ipList";
|
||||
}
|
||||
@RequestMapping(value = {"ajaxIpSubList"})
|
||||
public String ajaxIpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = ipCfgService.getIpPortCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "ajaxIpSubList" })
|
||||
public String ajaxIpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = ipCfgService.getIpPortCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (NtcSubscribeIdCfg keyword : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/whitelist/ipSubList";
|
||||
}
|
||||
@RequestMapping(value = {"ip/form"})
|
||||
@RequiresPermissions(value={"whitelist:ip:config"})
|
||||
public String ipForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
|
||||
entity = this.ipCfgService.getIpPortCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "ip/form" })
|
||||
@RequiresPermissions(value = { "whitelist:ip:config" })
|
||||
public String ipForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
|
||||
entity = this.ipCfgService.getIpPortCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/whitelist/ipForm";
|
||||
}
|
||||
@RequestMapping(value = {"ip/save"})
|
||||
public String saveIpCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
|
||||
@RequestMapping(value = { "ip/save" })
|
||||
public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
ipCfgService.saveIpCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ip/audit"})
|
||||
|
||||
@RequestMapping(value = { "ip/audit" })
|
||||
@RequiresPermissions("whitelist:ip:confirm")
|
||||
public String auditIp(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request
|
||||
) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditIp(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = ipCfgService.getIpPortCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
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);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipCfgService.auditIpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.info("ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}catch (Exception e) {
|
||||
logger.info("ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} else {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ipList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"updateIpValid"})
|
||||
@RequiresPermissions(value={"whitelist:ip:config"})
|
||||
public String updateIpCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "updateIpValid" })
|
||||
@RequiresPermissions(value = { "whitelist:ip:config" })
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"domain/list"})
|
||||
//@RequiresPermissions(value={"whitelist:domain:config","whitelist:domain:confirm","whitelist:domain:aduit"},logical=Logical.OR)
|
||||
public String domainList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
|
||||
@RequestMapping(value = { "domain/list" })
|
||||
// @RequiresPermissions(value={"whitelist:domain:config","whitelist:domain:confirm","whitelist:domain:aduit"},logical=Logical.OR)
|
||||
public String domainList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = domainService.getDomainList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/whitelist/domainList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveHttpUrlCfgs"})
|
||||
public String saveHttpUrlCfgs(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,CfgIndexInfo entity) {
|
||||
if(!StringUtil.isEmpty(entity) && !StringUtil.isEmpty(entity.getHttpUrlList())){
|
||||
|
||||
CfgIndexInfo sourceCfg=websiteCfgService.getCfgIndexInfo(entity.getHttpUrlList().get(0).getSourceCompileId());
|
||||
|
||||
@RequestMapping(value = { "saveHttpUrlCfgs" })
|
||||
public String saveHttpUrlCfgs(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
CfgIndexInfo entity) {
|
||||
if (!StringUtil.isEmpty(entity) && !StringUtil.isEmpty(entity.getHttpUrlList())) {
|
||||
|
||||
CfgIndexInfo sourceCfg = websiteCfgService
|
||||
.getCfgIndexInfo(entity.getHttpUrlList().get(0).getSourceCompileId());
|
||||
for (HttpUrlCfg httpUrlCfg : entity.getHttpUrlList()) {
|
||||
CfgIndexInfo cfg=new CfgIndexInfo();
|
||||
List httpList=new ArrayList<>();
|
||||
CfgIndexInfo cfg = new CfgIndexInfo();
|
||||
List httpList = new ArrayList<>();
|
||||
httpUrlCfg.setRequestId(sourceCfg.getRequestId());
|
||||
BeanUtils.copyProperties(httpUrlCfg, cfg);
|
||||
httpList.add(httpUrlCfg);
|
||||
@@ -179,258 +185,315 @@ public class WhiteListController extends CommonController{
|
||||
websiteCfgService.saveHttpCfg(cfg);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"domain/form"})
|
||||
@RequiresPermissions(value={"whitelist:domain:config"})
|
||||
public String domainForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = domainService.getDomainCfg(Long.parseLong(ids),null);
|
||||
|
||||
@RequestMapping(value = { "domain/form" })
|
||||
@RequiresPermissions(value = { "whitelist:domain:config" })
|
||||
public String domainForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = domainService.getDomainCfg(Long.parseLong(ids), null);
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
if(entity.getHttpUrlList().size()==0){
|
||||
if (entity.getHttpUrlList().size() == 0) {
|
||||
entity.getHttpUrlList().add(urlCfg);
|
||||
}
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
List<HttpUrlCfg> urlList=new ArrayList<HttpUrlCfg>();
|
||||
List<HttpUrlCfg> urlList = new ArrayList<HttpUrlCfg>();
|
||||
urlList.add(urlCfg);
|
||||
entity.setHttpUrlList(urlList);
|
||||
initFormCondition(model,entity);
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/whitelist/domainForm";
|
||||
}
|
||||
@RequestMapping(value = {"domain/save"})
|
||||
public String saveOrUpdateDomain(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
|
||||
@RequestMapping(value = { "domain/save" })
|
||||
public String saveOrUpdateDomain(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
domainService.saveDomainCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"domain/ajaxSubList"})
|
||||
public String ajaxDomainSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = domainService.getDomainCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "domain/ajaxSubList" })
|
||||
public String ajaxDomainSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = domainService.getDomainCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getHttpUrlList()!=null){
|
||||
if (cfg.getHttpUrlList() != null) {
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getHttpUrlList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (BaseStringCfg keyword : cfg.getHttpUrlList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (NtcSubscribeIdCfg keyword : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/whitelist/domianSubList";
|
||||
}
|
||||
@RequestMapping(value = {"domain/updateValid"})
|
||||
@RequiresPermissions(value={"whitelist:domain:config"})
|
||||
public String updateDomainValid(Integer isValid,String ids,Integer functionId) {
|
||||
domainService.updateDomainCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "domain/updateValid" })
|
||||
@RequiresPermissions(value = { "whitelist:domain:config" })
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId) {
|
||||
domainService.updateDomainCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"domain/delete"})
|
||||
|
||||
@RequestMapping(value = { "domain/delete" })
|
||||
@RequiresPermissions("whitelist:domain:config")
|
||||
public String deleteDomain(String ids,Integer functionId,RedirectAttributes model) {
|
||||
try{
|
||||
public String deleteDomain(String ids, Integer functionId, RedirectAttributes model) {
|
||||
try {
|
||||
domainService.deleteWhiteDomain(ids);
|
||||
addMessage(model,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(model, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"error","delete_failed");
|
||||
addMessage(model, "error", "delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"domain/audit"})
|
||||
|
||||
@RequestMapping(value = { "domain/audit" })
|
||||
@RequiresPermissions("whitelist:domain:confirm")
|
||||
public String auditDomain(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
public String auditDomain(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = domainService.getDomainCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = domainService.getDomainCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
domainService.auditDomainCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
}catch (Exception e) {
|
||||
logger.error("domain配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("domain配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("domain配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else{//条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} else {// 条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return domainList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
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模板下载
|
||||
|
||||
// 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);
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
WhiteListIpTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "ip/export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpPortCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
this._exportIp(columns, model, request, response, entity, ids, redirectAttributes);
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
String cfgIndexInfoNoExport=",policy_name,do_log,letter,whether_area_block,classification,attribute,label,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",protocol,direction,do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
for (CfgIndexInfo cfg :ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportdomain")
|
||||
public void exportdomain(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = domainService.getDomainList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpUrlInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlInfoNoExport);
|
||||
List<BaseStringCfg> httpurlList=new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo=domainService.exportDomainInfo(cfg);
|
||||
httpurlList.addAll(cfgIndexInfo.getHttpUrlList());
|
||||
}
|
||||
httpurlList=BaseStringCfg.replaceBaseKeyList(httpurlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpurlList);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,do_log,letter,whether_area_block,classification,attribute,label,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",protocol,direction,do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo = ipCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportdomain")
|
||||
public void exportdomain(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = domainService.getDomainList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpUrlInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlInfoNoExport);
|
||||
List<BaseStringCfg> httpurlList = new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo = domainService.exportDomainInfo(cfg);
|
||||
httpurlList.addAll(cfgIndexInfo.getHttpUrlList());
|
||||
}
|
||||
httpurlList = BaseStringCfg.replaceBaseKeyList(httpurlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpurlList);
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,39 +3,27 @@ package com.nis.web.controller.configuration.proxy;
|
||||
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;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.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.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CachePolicyUserRegion;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -43,7 +31,6 @@ import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* http重定向策略
|
||||
@@ -233,166 +220,90 @@ public class CachePolicyController extends BaseController{
|
||||
|
||||
|
||||
//http配置导出
|
||||
/*@RequestMapping(value = "exportHttp")
|
||||
public String exportHttp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
}else{
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(-1);
|
||||
}
|
||||
|
||||
Page<CfgIndexInfo> page = cachePolicyService.getCachePolicyList(pageInfo, entity);
|
||||
Properties prop = getMsgProp();
|
||||
for (CfgIndexInfo str : page.getList()) {
|
||||
if(entity.getFunctionId()!=210 && entity.getFunctionId()!=211){
|
||||
String type="RESPONSE_CODE";
|
||||
if(entity.getFunctionId()==207){
|
||||
type="RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
type="REDIRECT_RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
type="CONTROL_REPLACE_ZONE";
|
||||
}
|
||||
String dictlabel= DictUtils.getDictLabel(type, str.getUserRegion1());
|
||||
str.setUserRegion1(prop.getProperty(dictlabel));
|
||||
if(entity.getFunctionId()==207 || entity.getFunctionId()==208){
|
||||
if(StringUtil.isEmpty(str.getUserRegion2())){
|
||||
if(!StringUtil.isEmpty(str.getUserRegion3())){
|
||||
ProxyFileStrategyCfg file= new ProxyFileStrategyCfg();
|
||||
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(file);
|
||||
if(allProxyFileStrategys!=null && allProxyFileStrategys.size()>0){
|
||||
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
if(entity.getFunctionId()==207){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
}else if(entity.getFunctionId()==211){
|
||||
cfgIndexInfoNoExport=",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
}
|
||||
String httpUrlCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
List<BaseStringCfg> httpUrlList = new ArrayList<>();
|
||||
List<ComplexkeywordCfg> httpReqHdrList = new ArrayList<>();
|
||||
List<ComplexkeywordCfg> httpResHdrList = new ArrayList<>();
|
||||
List<BaseStringCfg> httpReqBodyList = new ArrayList<>();
|
||||
List<BaseStringCfg> httpResBodyList = new ArrayList<>();
|
||||
List<IpPortCfg> ipPortList = new ArrayList<>();
|
||||
List<BaseStringCfg> subscribeIdList = new ArrayList<>();
|
||||
for (CfgIndexInfo cfg : page.getList()) {
|
||||
Map<String, List> maps=cachePolicyService.exportCachePolicy(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
|
||||
httpResHdrList.addAll(maps.get("NTC_HTTP_RES_HDR"));
|
||||
httpReqBodyList.addAll(maps.get("NTC_HTTP_REQ_BODY"));
|
||||
httpResBodyList.addAll(maps.get("NTC_HTTP_RES_BODY"));
|
||||
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
httpUrlList=BaseStringCfg.replaceBaseKeyList(httpUrlList);
|
||||
httpReqHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpReqHdrList);
|
||||
httpResHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpResHdrList);
|
||||
httpReqBodyList=BaseStringCfg.replaceBaseKeyList(httpReqBodyList);
|
||||
httpResBodyList=BaseStringCfg.replaceBaseKeyList(httpResBodyList);
|
||||
subscribeIdList=BaseStringCfg.baseHexList(subscribeIdList);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
titleList.add("NTC_HTTP_REQ_HDR");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class);
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
if(entity.getFunctionId()!=208 && entity.getFunctionId()!=211){
|
||||
titleList.add("NTC_HTTP_RES_BODY");
|
||||
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
|
||||
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
|
||||
}else if(entity.getFunctionId()!=211){
|
||||
titleList.add("NTC_HTTP_RES_HDR");
|
||||
titleList.add("NTC_HTTP_REQ_BODY");
|
||||
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class);
|
||||
noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
|
||||
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
|
||||
}
|
||||
titleList.add("NTC_UNIVERSAL_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID",subscribeIdList);
|
||||
|
||||
}
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed",e);
|
||||
addMessage(redirectAttributes, "export_failed");
|
||||
@RequestMapping(value = "exportCache")
|
||||
public void exportdomain(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CachePolicyUserRegion entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
List<CachePolicyUserRegion> ipLists = new ArrayList<CachePolicyUserRegion>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = cachePolicyService.getCachePolicyByUserRegionList(ids);
|
||||
} else {
|
||||
Page<CachePolicyUserRegion> pageInfo=new Page<CachePolicyUserRegion>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CachePolicyUserRegion> page = cachePolicyService.getCachePolicyUserRegionList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
}*/
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
Properties msgProp = getMsgProp();
|
||||
for (CachePolicyUserRegion cache : ipLists) {
|
||||
for (FunctionServiceDict service : serviceList) {
|
||||
if(cache.getAction().intValue()==service.getAction().intValue()){
|
||||
cache.setActionCode(msgProp.getProperty(service.getActionCode(),service.getActionCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("PXY_CACHE_HTTP_URL");
|
||||
titleList.add("PXY_CACHE_HTTP_COOKIE");
|
||||
classMap.put(entity.getMenuNameCode(), CachePolicyUserRegion.class);
|
||||
classMap.put("PXY_CACHE_HTTP_URL", HttpUrlCfg.class);
|
||||
classMap.put("PXY_CACHE_HTTP_COOKIE", HttpUrlCfg.class);
|
||||
String cfgIndexInfoNoExport=",block_type,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,&action:block_type-";
|
||||
String httpUrlInfoNoExport=",block_type,do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("PXY_CACHE_HTTP_URL", httpUrlInfoNoExport);
|
||||
noExportMap.put("PXY_CACHE_HTTP_COOKIE", httpUrlInfoNoExport);
|
||||
List<BaseStringCfg> urlList=new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> cookieList=new ArrayList<BaseStringCfg>();
|
||||
for (CachePolicyUserRegion cfg : ipLists) {
|
||||
Map<String, List> maps=cachePolicyService.getExport(Long.valueOf(cfg.getCfgId()));
|
||||
urlList.addAll(maps.get("PXY_CACHE_HTTP_URL"));
|
||||
cookieList.addAll(maps.get("PXY_CACHE_HTTP_COOKIE"));
|
||||
}
|
||||
urlList=BaseStringCfg.replaceBaseKeyList(urlList);
|
||||
cookieList=BaseStringCfg.replaceBaseKeyList(cookieList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("PXY_CACHE_HTTP_URL", urlList);
|
||||
dataMap.put("PXY_CACHE_HTTP_COOKIE", cookieList);
|
||||
/*}*/
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,35 +44,37 @@ import jersey.repackaged.com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* http重定向策略
|
||||
*
|
||||
* @author zhangwei
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/proxy/control/httpRedirect")
|
||||
public class HttpRedirectPolicyController extends BaseController{
|
||||
@RequestMapping(value = {"httpRedirectList","httpBlockList","httpReplaceList","httpMonitList","httpWhitelistList"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg){
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class HttpRedirectPolicyController extends BaseController {
|
||||
@RequestMapping(value = { "httpRedirectList", "httpBlockList", "httpReplaceList", "httpMonitList",
|
||||
"httpWhitelistList", ""})
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = httpRedirectCfgService.getHttpRedirectList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
//获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
initPageCondition(model, cfg);
|
||||
// 获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
|
||||
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
|
||||
return "/cfg/proxy/control/httpRedirectList";
|
||||
}
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"control:httpBlock:config"
|
||||
,"control:httpRedirect:config"
|
||||
,"control:httpReplace:config"
|
||||
,"control:httpMinit:config"
|
||||
,"control:httpWhitelist:config"
|
||||
}
|
||||
,logical=Logical.OR)
|
||||
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")CfgIndexInfo entity){
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(ids),null);
|
||||
|
||||
|
||||
@RequestMapping(value = { "form" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(ids), null);
|
||||
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
@@ -94,31 +96,31 @@ public class HttpRedirectPolicyController extends BaseController{
|
||||
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
|
||||
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
|
||||
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
|
||||
|
||||
if(entity.getHttpUrlList().size()==0){
|
||||
|
||||
if (entity.getHttpUrlList().size() == 0) {
|
||||
entity.getHttpUrlList().add(urlCfg);
|
||||
}
|
||||
if(entity.getHttpReqHdrList().size()==0){
|
||||
if (entity.getHttpReqHdrList().size() == 0) {
|
||||
entity.getHttpReqHdrList().add(reqHdrCfg);
|
||||
}
|
||||
if(entity.getHttpResHdrList().size()==0){
|
||||
if (entity.getHttpResHdrList().size() == 0) {
|
||||
entity.getHttpResHdrList().add(resHdrCfg);
|
||||
}
|
||||
if(entity.getHttpReqBodyList().size()==0){
|
||||
if (entity.getHttpReqBodyList().size() == 0) {
|
||||
entity.getHttpReqBodyList().add(reqBodyCfg);
|
||||
}
|
||||
if(entity.getHttpResBodyList().size()==0){
|
||||
if (entity.getHttpResBodyList().size() == 0) {
|
||||
entity.getHttpResBodyList().add(resBodyCfg);
|
||||
}
|
||||
if(entity.getIpPortList().size()==0){
|
||||
if (entity.getIpPortList().size() == 0) {
|
||||
entity.getIpPortList().add(ipPortCfg);
|
||||
}
|
||||
if(entity.getNtcSubscribeIdCfgList().size()==0){
|
||||
if (entity.getNtcSubscribeIdCfgList().size() == 0) {
|
||||
entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg);
|
||||
}
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
//设置http各类配置的配置域类型
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
// 设置http各类配置的配置域类型
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
@@ -137,303 +139,321 @@ public class HttpRedirectPolicyController extends BaseController{
|
||||
IpPortCfg ipPortCfg = new IpPortCfg();
|
||||
ipPortCfg.setCfgType(Constants.HTTP_IP_REGION);
|
||||
entity.setIpPort(ipPortCfg);
|
||||
//subscribeId
|
||||
// subscribeId
|
||||
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
|
||||
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
|
||||
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
|
||||
|
||||
List<HttpUrlCfg> urlList=new ArrayList<HttpUrlCfg>();
|
||||
|
||||
List<HttpUrlCfg> urlList = new ArrayList<HttpUrlCfg>();
|
||||
urlList.add(urlCfg);
|
||||
entity.setHttpUrlList(urlList);
|
||||
List<HttpReqHeadCfg> reqHdrList=new ArrayList<HttpReqHeadCfg>();
|
||||
List<HttpReqHeadCfg> reqHdrList = new ArrayList<HttpReqHeadCfg>();
|
||||
reqHdrList.add(reqHdrCfg);
|
||||
entity.setHttpReqHdrList(reqHdrList);
|
||||
List<HttpResHeadCfg> resHdrList=new ArrayList<HttpResHeadCfg>();
|
||||
List<HttpResHeadCfg> resHdrList = new ArrayList<HttpResHeadCfg>();
|
||||
resHdrList.add(resHdrCfg);
|
||||
entity.setHttpResHdrList(resHdrList);
|
||||
List<HttpBodyCfg> reqBodyList=new ArrayList<HttpBodyCfg>();
|
||||
List<HttpBodyCfg> reqBodyList = new ArrayList<HttpBodyCfg>();
|
||||
reqBodyList.add(reqBodyCfg);
|
||||
entity.setHttpReqBodyList(reqBodyList);
|
||||
List<HttpBodyCfg> resBodyList=new ArrayList<HttpBodyCfg>();
|
||||
List<HttpBodyCfg> resBodyList = new ArrayList<HttpBodyCfg>();
|
||||
resBodyList.add(resBodyCfg);
|
||||
entity.setHttpResBodyList(resBodyList);
|
||||
|
||||
List<IpPortCfg> ipPortList=new ArrayList<IpPortCfg>();
|
||||
|
||||
List<IpPortCfg> ipPortList = new ArrayList<IpPortCfg>();
|
||||
ipPortList.add(ipPortCfg);
|
||||
entity.setIpPortList(ipPortList);
|
||||
|
||||
|
||||
List<NtcSubscribeIdCfg> subscribeCfgList = Lists.newArrayList();
|
||||
subscribeCfgList.add(subscribeIdCfg);
|
||||
entity.setNtcSubscribeIdCfgList(subscribeCfgList);
|
||||
|
||||
initFormCondition(model,entity);
|
||||
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
//获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
// 获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
|
||||
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
model.addAttribute("_cfg", entity);
|
||||
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
|
||||
return "/cfg/proxy/control/httpRedirectForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
@RequiresPermissions(value={"control:httpBlock:config"
|
||||
,"control:httpRedirect:config"
|
||||
,"control:httpReplace:config"
|
||||
,"control:httpMinit:config"
|
||||
,"control:httpWhitelist:config"}
|
||||
,logical=Logical.OR)
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
httpRedirectCfgService.saveHttpCfg(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId="
|
||||
+ cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ajaxHttpSubList"})
|
||||
public String ajaxHttpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = httpRedirectCfgService.getHttpCfg(cfgId,compileId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
|
||||
@RequestMapping(value = { "ajaxHttpSubList" })
|
||||
public String ajaxHttpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = httpRedirectCfgService.getHttpCfg(cfgId, compileId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
return "/cfg/proxy/control/httpRedirectSubList";
|
||||
}
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"control:httpBlock:config"
|
||||
,"control:httpRedirect:config"
|
||||
,"control:httpReplace:config"
|
||||
,"control:httpMinit:config"
|
||||
,"control:httpWhitelist:config"}
|
||||
,logical=Logical.OR)
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
httpRedirectCfgService.updateHttpCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "delete" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
httpRedirectCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"control:httpBlock:confirm"
|
||||
,"control:httpRedirect:confirm"
|
||||
,"control:httpReplace:confirm"
|
||||
,"control:httpMinit:confirm"
|
||||
,"control:httpWhitelist:confirm"}
|
||||
,logical=Logical.OR)
|
||||
public String audit(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(id),null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
@RequestMapping(value = { "audit" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:confirm", "control:httpRedirect:confirm",
|
||||
"control:httpReplace:confirm", "control:httpMinit:confirm",
|
||||
"control:httpWhitelist:confirm" }, logical = Logical.OR)
|
||||
public String audit(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for (String id : idArray) {
|
||||
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
e.printStackTrace();
|
||||
logger.info("http重定向配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+functionId;
|
||||
}
|
||||
|
||||
|
||||
//http配置导出
|
||||
@RequestMapping(value = "exportHttp")
|
||||
public void exportHttp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
} else {// 条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
|
||||
List<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
// http配置导出
|
||||
@RequestMapping(value = "exportHttp")
|
||||
public void exportHttp(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
|
||||
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
Properties prop = getMsgProp();
|
||||
for (CfgIndexInfo str : ipLists) {
|
||||
if (entity.getFunctionId() != 210 && entity.getFunctionId() != 211) {
|
||||
String type = "RESPONSE_CODE";
|
||||
if (entity.getFunctionId() == 207) {
|
||||
type = "RESPONSE_CODE";
|
||||
} else if (entity.getFunctionId() == 208) {
|
||||
type = "REDIRECT_RESPONSE_CODE";
|
||||
} else if (entity.getFunctionId() == 209) {
|
||||
type = "CONTROL_REPLACE_ZONE";
|
||||
}
|
||||
|
||||
Properties prop = getMsgProp();
|
||||
for (CfgIndexInfo str :ipLists) {
|
||||
if(entity.getFunctionId()!=210 && entity.getFunctionId()!=211){
|
||||
String type="RESPONSE_CODE";
|
||||
if(entity.getFunctionId()==207){
|
||||
type="RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
type="REDIRECT_RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
type="CONTROL_REPLACE_ZONE";
|
||||
}
|
||||
String dictlabel= DictUtils.getDictLabel(type, str.getUserRegion1());
|
||||
str.setUserRegion1(prop.getProperty(dictlabel));
|
||||
if(entity.getFunctionId()==207 || entity.getFunctionId()==208){
|
||||
if(StringUtil.isEmpty(str.getUserRegion2())){
|
||||
if(!StringUtil.isEmpty(str.getUserRegion3())){
|
||||
ProxyFileStrategyCfg file= new ProxyFileStrategyCfg();
|
||||
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(file);
|
||||
if(allProxyFileStrategys!=null && allProxyFileStrategys.size()>0){
|
||||
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
|
||||
}
|
||||
String dictlabel = DictUtils.getDictLabel(type, str.getUserRegion1());
|
||||
str.setUserRegion1(prop.getProperty(dictlabel));
|
||||
if (entity.getFunctionId() == 207 || entity.getFunctionId() == 208) {
|
||||
if (StringUtil.isEmpty(str.getUserRegion2())) {
|
||||
if (!StringUtil.isEmpty(str.getUserRegion3())) {
|
||||
ProxyFileStrategyCfg file = new ProxyFileStrategyCfg();
|
||||
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
|
||||
.getProxyFileStrategyCfgList(file);
|
||||
if (allProxyFileStrategys != null && allProxyFileStrategys.size() > 0) {
|
||||
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
if(entity.getFunctionId()==207){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
}else if(entity.getFunctionId()==211){
|
||||
cfgIndexInfoNoExport=",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
}
|
||||
String httpUrlCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
List<BaseStringCfg> httpUrlList = new ArrayList<>();
|
||||
List<ComplexkeywordCfg> httpReqHdrList = new ArrayList<>();
|
||||
List<ComplexkeywordCfg> httpResHdrList = new ArrayList<>();
|
||||
List<BaseStringCfg> httpReqBodyList = new ArrayList<>();
|
||||
List<BaseStringCfg> httpResBodyList = new ArrayList<>();
|
||||
List<IpPortCfg> ipPortList = new ArrayList<>();
|
||||
List<BaseStringCfg> subscribeIdList = new ArrayList<>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps=httpRedirectCfgService.exportHttpCfg(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
|
||||
httpResHdrList.addAll(maps.get("NTC_HTTP_RES_HDR"));
|
||||
httpReqBodyList.addAll(maps.get("NTC_HTTP_REQ_BODY"));
|
||||
httpResBodyList.addAll(maps.get("NTC_HTTP_RES_BODY"));
|
||||
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
httpUrlList=BaseStringCfg.replaceBaseKeyList(httpUrlList);
|
||||
httpReqHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpReqHdrList);
|
||||
httpResHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpResHdrList);
|
||||
httpReqBodyList=BaseStringCfg.replaceBaseKeyList(httpReqBodyList);
|
||||
httpResBodyList=BaseStringCfg.replaceBaseKeyList(httpResBodyList);
|
||||
subscribeIdList=BaseStringCfg.baseHexList(subscribeIdList);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
titleList.add("NTC_HTTP_REQ_HDR");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class);
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
if(entity.getFunctionId()!=208 && entity.getFunctionId()!=211){
|
||||
titleList.add("NTC_HTTP_RES_BODY");
|
||||
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
|
||||
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
|
||||
}else if(entity.getFunctionId()!=211){
|
||||
titleList.add("NTC_HTTP_RES_HDR");
|
||||
titleList.add("NTC_HTTP_REQ_BODY");
|
||||
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class);
|
||||
noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
|
||||
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
|
||||
}
|
||||
titleList.add("NTC_UNIVERSAL_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID",subscribeIdList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
}
|
||||
/*return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();*/
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
if (entity.getFunctionId() == 207) {
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
|
||||
} else if (entity.getFunctionId() == 208) {
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
|
||||
} else if (entity.getFunctionId() == 209) {
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
} else if (entity.getFunctionId() == 211) {
|
||||
cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
}
|
||||
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqHeadCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResHeadCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqBodyCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResBodyCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
List<BaseStringCfg> httpUrlList = new ArrayList<>();
|
||||
List<ComplexkeywordCfg> httpReqHdrList = new ArrayList<>();
|
||||
List<ComplexkeywordCfg> httpResHdrList = new ArrayList<>();
|
||||
List<BaseStringCfg> httpReqBodyList = new ArrayList<>();
|
||||
List<BaseStringCfg> httpResBodyList = new ArrayList<>();
|
||||
List<IpPortCfg> ipPortList = new ArrayList<>();
|
||||
List<BaseStringCfg> subscribeIdList = new ArrayList<>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps = httpRedirectCfgService.exportHttpCfg(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
|
||||
httpResHdrList.addAll(maps.get("NTC_HTTP_RES_HDR"));
|
||||
httpReqBodyList.addAll(maps.get("NTC_HTTP_REQ_BODY"));
|
||||
httpResBodyList.addAll(maps.get("NTC_HTTP_RES_BODY"));
|
||||
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
httpUrlList = BaseStringCfg.replaceBaseKeyList(httpUrlList);
|
||||
httpReqHdrList = ComplexkeywordCfg.replaceComplexKeyList(httpReqHdrList);
|
||||
httpResHdrList = ComplexkeywordCfg.replaceComplexKeyList(httpResHdrList);
|
||||
httpReqBodyList = BaseStringCfg.replaceBaseKeyList(httpReqBodyList);
|
||||
httpResBodyList = BaseStringCfg.replaceBaseKeyList(httpResBodyList);
|
||||
subscribeIdList = BaseStringCfg.baseHexList(subscribeIdList);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
titleList.add("NTC_HTTP_REQ_HDR");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class);
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
if (entity.getFunctionId() != 208 && entity.getFunctionId() != 211) {
|
||||
titleList.add("NTC_HTTP_RES_BODY");
|
||||
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
|
||||
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
|
||||
} else if (entity.getFunctionId() != 211) {
|
||||
titleList.add("NTC_HTTP_RES_HDR");
|
||||
titleList.add("NTC_HTTP_REQ_BODY");
|
||||
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class);
|
||||
noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
|
||||
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
|
||||
}
|
||||
titleList.add("NTC_UNIVERSAL_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList);
|
||||
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
/*
|
||||
* return "redirect:" + adminPath
|
||||
* +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
@@ -27,6 +26,7 @@ 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.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -36,315 +36,361 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value={"${adminPath}/proxy/intercept"})
|
||||
public class InterceptController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"/ip/list","/domain/list","/ippayload/list"})
|
||||
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
@RequestMapping(value = { "${adminPath}/proxy/intercept" })
|
||||
public class InterceptController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "/ip/list", "/domain/list", "/ippayload/list" })
|
||||
public String ipList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
|
||||
//获取证书信息
|
||||
List<PxyObjKeyring> certificateList=new ArrayList<PxyObjKeyring>();
|
||||
if(cfg.getFunctionId().equals(200)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
initPageCondition(model, cfg);
|
||||
|
||||
// 获取证书信息
|
||||
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
|
||||
if (cfg.getFunctionId().equals(200)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if(cfg.getFunctionId().equals(201)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
if (cfg.getFunctionId().equals(201)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
model.addAttribute("certificateList", certificateList);
|
||||
//IP地址仿冒策略使用策略组
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
/*if(cfg.getFunctionId().equals(214)){
|
||||
// IP地址仿冒策略使用策略组
|
||||
//List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
List<CfgIndexInfo> list = page.getList();
|
||||
for(CfgIndexInfo c:list){
|
||||
Long cfgId = Long.parseLong(c.getUserRegion2());//user_region2字段存储的为IP仿冒池的ID信息(策略组ID)
|
||||
PxyObjSpoofingIpPool pool = pxyObjSpoofingIpPoolService.getPxyObjSpoofingIpPool(cfgId);
|
||||
c.setUserRegion2(pool.getGroupName());//将IP仿冒池的策略组名重新赋给user_region2
|
||||
}
|
||||
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
}*/
|
||||
return "/cfg/intercept/interceptList";
|
||||
}
|
||||
@RequestMapping(value = {"/interceptIpForm","interceptDomainForm","interceptIpPayloadForm"})
|
||||
public String interceptIpForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "/interceptIpForm", "interceptDomainForm", "interceptIpPayloadForm" })
|
||||
public String interceptIpForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
//获取证书信息
|
||||
List<PxyObjKeyring> certificateList=new ArrayList<PxyObjKeyring>();
|
||||
if(entity.getFunctionId().equals(200)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
// 获取证书信息
|
||||
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
|
||||
if (entity.getFunctionId().equals(200)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if(entity.getFunctionId().equals(201)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
if (entity.getFunctionId().equals(201)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
model.addAttribute("certificateList", certificateList);
|
||||
|
||||
|
||||
model.addAttribute("_cfg", entity);
|
||||
//IP地址仿冒策略使用策略组
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
|
||||
// IP地址仿冒策略使用策略组
|
||||
// List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
// List<PxyObjSpoofingIpPool> pools = pxyObjSpoofingIpPoolService.findPxyObjSpoofingIpPools(new PxyObjSpoofingIpPool());
|
||||
// model.addAttribute("policyGroups", pools);
|
||||
|
||||
return "/cfg/intercept/interceptForm";
|
||||
}
|
||||
@RequestMapping(value = {"/ip/saveOrUpdate","/domain/saveOrUpdate","/ippayload/SaveOrUpdate"})
|
||||
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes,Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
|
||||
@RequestMapping(value = { "/ip/saveOrUpdate", "/domain/saveOrUpdate", "/ippayload/SaveOrUpdate" })
|
||||
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, String ids, CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptCfg(entity);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("save_failed", e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/ajaxInterceptIpSubList","/ajaxInterceptDomainSubList","/ajaxInterceptIpPayloadSubList"})
|
||||
public String ajaxInterceptIpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = interceptCfgService.getInterceptCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "/ajaxInterceptIpSubList", "/ajaxInterceptDomainSubList",
|
||||
"/ajaxInterceptIpPayloadSubList" })
|
||||
public String ajaxInterceptIpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = interceptCfgService.getInterceptCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getInterceptPktBinList()!=null){
|
||||
if (cfg.getInterceptPktBinList() != null) {
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getInterceptPktBinList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (BaseStringCfg keyword : cfg.getInterceptPktBinList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getHttpUrlList()!=null){
|
||||
if (cfg.getHttpUrlList() != null) {
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getHttpUrlList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (BaseStringCfg keyword : cfg.getHttpUrlList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/intercept/interceptSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"auditInterceptIpCfg","auditInterceptDomainCfg","auditInterceptIpPayloadCfg"})
|
||||
public String auditInterceptIpCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
|
||||
@RequestMapping(value = { "auditInterceptIpCfg", "auditInterceptDomainCfg", "auditInterceptIpPayloadCfg" })
|
||||
public String auditInterceptIpCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid,
|
||||
Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
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");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} else {// 条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ipList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"updateInterceptIpValid","updateInterceptDomainValid","updateInterceptIpPayloadValid"})
|
||||
public String updateInterceptIpValid(Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
|
||||
@RequestMapping(value = { "updateInterceptIpValid", "updateInterceptDomainValid", "updateInterceptIpPayloadValid" })
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
interceptCfgService.updatInterceptValid(isValid,ids,functionId);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
interceptCfgService.updatInterceptValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("intercept ip delete failed",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
logger.error("intercept ip delete failed", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/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,IpAddrTemplate.class);
|
||||
redirectAttributes.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","intercept:ip");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/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,IpAddrTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "/ip/export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
}*/
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
Map<String, String> replaceExportMap=new HashMap<String, String>();
|
||||
Properties prop = getMsgProp();
|
||||
List<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
//获取证书信息
|
||||
List<PxyObjKeyring> certificateList=new ArrayList<PxyObjKeyring>();
|
||||
if(entity.getFunctionId().equals(200)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if(entity.getFunctionId().equals(201)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
for (CfgIndexInfo str : ipLists) {
|
||||
if(!StringUtil.isEmpty(str.getUserRegion5())){
|
||||
String cs= DictUtils.getDictLabel("INTERCEPT_DOMAIN_INTENSITY", str.getUserRegion5());
|
||||
str.setUserRegion5(prop.getProperty(cs));
|
||||
}
|
||||
if(certificateList!=null){
|
||||
if(entity.getFunctionId()==200|| entity.getFunctionId()==201){
|
||||
if(!StringUtil.isEmpty(str.getUserRegion1())){
|
||||
boolean flag=false;
|
||||
for (PxyObjKeyring pxyObjKeyring : certificateList) {
|
||||
if(str.getUserRegion1().equals(String.valueOf(pxyObjKeyring.getCompileId()))){
|
||||
str.setUserRegion1(pxyObjKeyring.getCfgDesc());
|
||||
flag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
str.setUserRegion1(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
String cfgIndexInfoNoExport="";
|
||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String interceptNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String httpUrlCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> httpUrlList=new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> pktBinList=new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps=interceptCfgService.exportIpInfo(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
ipList.addAll(maps.get("PXY_INTERCEPT_IP"));
|
||||
pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN"));
|
||||
}
|
||||
pktBinList=BaseStringCfg.replaceBaseKeyList(pktBinList);
|
||||
httpUrlList=BaseStringCfg.baseHexList(httpUrlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if(entity.getFunctionId()==212){ //IP Payload
|
||||
cfgIndexInfoNoExport=",do_log,log_total,policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
titleList.add("PXY_INTERCEPT_PKT_BIN");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
classMap.put("PXY_INTERCEPT_PKT_BIN", InterceptPktBin.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("PXY_INTERCEPT_PKT_BIN", interceptNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
|
||||
}else if(entity.getFunctionId()==200){//IP拦截
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion2:ratelimit-userregion1:certificate-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
}else if(entity.getFunctionId()==201){//域名拦截
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:certificate-userregion5:intercept_intensity-";
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
* //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,IpAddrTemplate.class);
|
||||
* redirectAttributes.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
* redirectAttributes.addAttribute("requiresPermissionPrefix","intercept:ip"
|
||||
* ); return "redirect:" + adminPath
|
||||
* +"/proxy/intercept/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,IpAddrTemplate.class); } //ip配置导出
|
||||
*
|
||||
* @RequestMapping(value = "/ip/export") public void exportIp(String
|
||||
* columns,Model model,HttpServletRequest request,HttpServletResponse
|
||||
* response,
|
||||
*
|
||||
* @ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes
|
||||
* redirectAttributes){ this._exportIp(columns,model, request, response,
|
||||
* entity, ids, redirectAttributes); }
|
||||
*/
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
Map<String, String> replaceExportMap = new HashMap<String, String>();
|
||||
Properties prop = getMsgProp();
|
||||
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// 获取证书信息
|
||||
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
|
||||
if (entity.getFunctionId().equals(200)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if (entity.getFunctionId().equals(201)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
for (CfgIndexInfo str : ipLists) {
|
||||
if (!StringUtil.isEmpty(str.getUserRegion5())) {
|
||||
String cs = DictUtils.getDictLabel("INTERCEPT_DOMAIN_INTENSITY", str.getUserRegion5());
|
||||
str.setUserRegion5(prop.getProperty(cs));
|
||||
}
|
||||
if (certificateList != null) {
|
||||
if (entity.getFunctionId() == 200 || entity.getFunctionId() == 201) {
|
||||
if (!StringUtil.isEmpty(str.getUserRegion1())) {
|
||||
boolean flag = false;
|
||||
for (PxyObjKeyring pxyObjKeyring : certificateList) {
|
||||
if (str.getUserRegion1().equals(String.valueOf(pxyObjKeyring.getCompileId()))) {
|
||||
str.setUserRegion1(pxyObjKeyring.getCfgDesc());
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
str.setUserRegion1(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
String cfgIndexInfoNoExport = "";
|
||||
String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String interceptNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> httpUrlList = new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> pktBinList = new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps = interceptCfgService.exportIpInfo(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
ipList.addAll(maps.get("PXY_INTERCEPT_IP"));
|
||||
pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN"));
|
||||
}
|
||||
pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList);
|
||||
httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if (entity.getFunctionId() == 212) { // IP Payload
|
||||
cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
titleList.add("PXY_INTERCEPT_PKT_BIN");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
classMap.put("PXY_INTERCEPT_PKT_BIN", InterceptPktBin.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("PXY_INTERCEPT_PKT_BIN", interceptNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
|
||||
} else if (entity.getFunctionId() == 200) {// IP拦截
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,userregion2,&userregion1:intercept_file_strategy-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
} else if (entity.getFunctionId() == 201) {// 域名拦截
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:intercept_file_strategy-userregion5:intercept_intensity-";
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
}else if(entity.getFunctionId()==214){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion2:With-userregion1:Spoofing-";
|
||||
}
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
|
||||
/* } */
|
||||
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
@@ -88,7 +89,7 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
model.addAttribute("isAdd", true);
|
||||
}
|
||||
|
||||
List<PolicyGroupInfo> groups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
/*List<PolicyGroupInfo> groups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
List<PolicyGroupInfo> policyGroups = new ArrayList();
|
||||
//解决目前一个分组只能有一个生效IP
|
||||
for(PolicyGroupInfo group:groups){
|
||||
@@ -100,7 +101,7 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
policyGroups.add(group);
|
||||
}
|
||||
}
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("policyGroups", policyGroups);*/
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/proxy/spoofingIpPool/form";
|
||||
}
|
||||
@@ -198,4 +199,66 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
return "redirect:" + adminPath +"/proxy/spoofing/pool/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpPool")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") PxyObjSpoofingIpPool entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
List<PxyObjSpoofingIpPool> ipLists = new ArrayList<PxyObjSpoofingIpPool>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = pxyObjSpoofingIpPoolService.findByPage(ids);
|
||||
} else {
|
||||
Page<PxyObjSpoofingIpPool> pageInfo = new Page<PxyObjSpoofingIpPool>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<PxyObjSpoofingIpPool> page = pxyObjSpoofingIpPoolService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), PxyObjSpoofingIpPool.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,do_log,ir_type,whether_area_block,do_blacklist,block_type,ip_pattern,client_ip,server_ip,port_pattern,client_port,server_port,direction,protocol,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
/* } */
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -133,4 +134,61 @@ public class ConfigureStatisticsController extends BaseController{
|
||||
map.put("ruleLimit", ruleLimit);
|
||||
return map;
|
||||
}
|
||||
|
||||
//configureStateStatisticsPrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/configureStateStatisticsPrint"})
|
||||
public Map configureStateStatisticsPrint(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes){
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
/****************************Request Info Statistics*****************************/
|
||||
//1、查询所有有效的service
|
||||
List<FunctionServiceDict> serviceDictList = DictUtils.getFunctionServiceDictList();
|
||||
//2、查询所有菜单
|
||||
List<SysMenu> menuList = UserUtils.getMenuCfgList();
|
||||
//3、根据来函分页
|
||||
RequestInfo requestInfo=new RequestInfo();
|
||||
requestInfo.setIsAudit(1);
|
||||
requestInfo.setIsValid(1);
|
||||
Page page = new Page(request, response,"r");
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
Page requestPage = requestInfoService.findRequestInfo(page,requestInfo);
|
||||
List<RequestInfo> requestInfos=requestPage.getList();
|
||||
//4、根据当前页的requestInfo信息查询request统计信息
|
||||
List<Object[]> requestStatisticList=new ArrayList<Object[]>();
|
||||
if(!StringUtil.isEmpty(requestInfos)){
|
||||
Date requestStatisticTime=configureStatisticsService.getRequestStatisticTime();
|
||||
String requestStatisticTimeStr="";
|
||||
if(!StringUtil.isEmpty(requestStatisticTime)){
|
||||
requestStatisticTimeStr=sdf.format(requestStatisticTime);
|
||||
}
|
||||
requestStatisticList=configureStatisticsService.getRequestStateStatistics(requestInfos,menuList,requestStatisticTimeStr);
|
||||
if(!StringUtil.isEmpty(requestStatisticList)){
|
||||
for (Iterator iterator = requestStatisticList.iterator(); iterator.hasNext();) {
|
||||
Map map = (Map) iterator.next();
|
||||
for (RequestInfo requestInfoO : requestInfos) {
|
||||
if(requestInfoO.getId().toString().equals(map.get("request").toString())){
|
||||
map.put("request", requestInfoO.getRequestTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("requestStatisticTime", requestStatisticTimeStr);
|
||||
}
|
||||
Properties msgProp = getMsgProp();
|
||||
for (int i = 0; i < menuList.size(); i++) {
|
||||
String property = msgProp.getProperty(menuList.get(i).getCode(), menuList.get(i).getCode());
|
||||
menuList.get(i).setCode(property);
|
||||
}
|
||||
requestPage.setList(requestStatisticList);
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
model.addAttribute("serviceList", serviceDictList);
|
||||
model.addAttribute("page", requestPage);
|
||||
Map<String,Object> maps=new HashMap<String,Object>();
|
||||
maps.put("menuList", menuList);
|
||||
maps.put("requestStatisticList", requestStatisticList);
|
||||
return maps;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -94,6 +96,49 @@ public class DashboardController extends BaseController{
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 跳转活跃端口详情界面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="portActiveChart")
|
||||
@ResponseBody
|
||||
public List portActiveChart(String beginDate,String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_PORTACTIVE_FIVEMINUTE;//+Constants.TRAFFIC_IPACTIVE_ONEHOUR;
|
||||
url=urlAddDate(url, beginDate, endDate);
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
logger.debug("活跃端口从"+beginDate+"到"+endDate+",间隔5分钟数据"+fromJsonList);
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
return list;
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("活跃端口详情界面数据获取错误"+e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转活跃端口详情界面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="portActiveList")
|
||||
public String portActiveList(Model model){
|
||||
// 默认当前时间一小时
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("beginDate", beginDate);
|
||||
model.addAttribute("endDate", endDate);
|
||||
return "/dashboard/trafficPortActiveList";
|
||||
}
|
||||
/**
|
||||
* 活跃IP TOP10
|
||||
*/
|
||||
@@ -194,7 +239,7 @@ public class DashboardController extends BaseController{
|
||||
return "/dashboard/trafficIpActiveList";
|
||||
}
|
||||
/**
|
||||
* 活跃IP TOP10 一小时 间隔5分钟数据
|
||||
* 活跃IP TOP10 一小时每个IP的最大值
|
||||
*/
|
||||
@RequestMapping(value="ajaxIpActiveList")
|
||||
@ResponseBody
|
||||
@@ -209,6 +254,24 @@ public class DashboardController extends BaseController{
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
logger.debug("活跃IP1小时"+fromJsonList);
|
||||
list = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken<List<TrafficIpActiveStatistic>>() {}.getType()) ;
|
||||
Collections.sort(list, new Comparator<TrafficIpActiveStatistic>() {
|
||||
|
||||
@Override
|
||||
public int compare(TrafficIpActiveStatistic o1, TrafficIpActiveStatistic o2) {
|
||||
if(o1==null&&o2!=null){
|
||||
return 1;
|
||||
}
|
||||
if(o1!=null&&o2==null){
|
||||
return -1;
|
||||
}
|
||||
if(o1==o2&&o1==null){
|
||||
return 0;
|
||||
}
|
||||
Long ob1 = o1.getC2sByteLen()+o1.getS2cByteLen();
|
||||
Long ob2 = o2.getC2sByteLen()+o2.getS2cByteLen();
|
||||
return -(ob1).compareTo(ob2);
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -283,19 +346,19 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("protoType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("protoType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("protoType", code.getItem());
|
||||
map.put("protoType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 协议没匹配的匹配app码表
|
||||
for (CodeResult code : appCodeList) {
|
||||
Double value3 = Double.valueOf(code.getCode());
|
||||
Double value3 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value3)){
|
||||
map.put("protoType", code.getItem());
|
||||
map.put("protoType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -330,11 +393,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("appType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("appType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("appType", code.getItem());
|
||||
map.put("appType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -369,11 +432,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("osType", code.getItem());
|
||||
map.put("osType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -403,8 +466,8 @@ public class DashboardController extends BaseController{
|
||||
//将标签文字转为数字
|
||||
Integer os=null;
|
||||
for (CodeResult codeResult : codeList1) {
|
||||
if(osType.equalsIgnoreCase(codeResult.getItem())){
|
||||
os=Integer.parseInt(codeResult.getCode());
|
||||
if(osType.equalsIgnoreCase(codeResult.getItem().trim())){
|
||||
os=Integer.parseInt(codeResult.getCode().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -421,11 +484,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(null!=list&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString().trim());
|
||||
for (CodeResult code : codeList2) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("bsType", code.getItem());
|
||||
map.put("bsType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
//10个域名之外的为others 设为-1外
|
||||
@@ -465,11 +528,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("bsType", code.getItem());
|
||||
map.put("bsType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -499,13 +562,13 @@ public class DashboardController extends BaseController{
|
||||
//将标签文字转为数字
|
||||
Integer bs=null;
|
||||
for (CodeResult codeResult : codeList1) {
|
||||
if(bsType.equalsIgnoreCase(codeResult.getItem())){
|
||||
bs=Integer.parseInt(codeResult.getCode());
|
||||
if(bsType.equalsIgnoreCase(codeResult.getItem().trim())){
|
||||
bs=Integer.parseInt(codeResult.getCode().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(bs==null){
|
||||
bs=Integer.parseInt(bsType);//处理为匹配项编码
|
||||
bs=Integer.parseInt(bsType.trim());//处理为匹配项编码
|
||||
}
|
||||
try {
|
||||
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_SYSTEM_CHART+"?bsType="+bs);
|
||||
@@ -517,16 +580,16 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(null!=list&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString().trim());
|
||||
for (CodeResult code : codeList2) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
//10个域名之外的为others webId设为-1外
|
||||
if(map.get("osType").toString().equals("-1")){
|
||||
map.put("osType", "Others");
|
||||
break;
|
||||
}
|
||||
if(value1.equals(value2)){
|
||||
map.put("osType", code.getItem());
|
||||
map.put("osType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -563,15 +626,15 @@ public class DashboardController extends BaseController{
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1=0d;
|
||||
if(StringUtil.isBlank(map.get("websiteServiceId").toString())){
|
||||
if(StringUtil.isBlank(map.get("websiteServiceId").toString().trim())){
|
||||
value1=268435455d;
|
||||
}else{
|
||||
value1 = Double.parseDouble(map.get("websiteServiceId").toString());
|
||||
value1 = Double.parseDouble(map.get("websiteServiceId").toString().trim());
|
||||
}
|
||||
for (SysDataDictionaryItem code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getItemCode());
|
||||
Double value2 = Double.valueOf(code.getItemCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("websiteService", code.getItemValue());
|
||||
map.put("websiteService", code.getItemValue().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -611,7 +674,7 @@ public class DashboardController extends BaseController{
|
||||
if(wdt!=null){
|
||||
String domain = wdt.getDomain();
|
||||
Double domainId = wdt.getId().doubleValue();
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString());
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString().trim());
|
||||
//10个域名之外的为others webId设为-1外
|
||||
if(dataMap.get("webId").toString().equals("-1")){
|
||||
dataMap.put("domain", "Others");
|
||||
@@ -661,12 +724,12 @@ public class DashboardController extends BaseController{
|
||||
if(StringUtil.isBlank(map.get("topicId").toString())){
|
||||
value1=268435455d;
|
||||
}else{
|
||||
value1 = Double.parseDouble(map.get("topicId").toString());
|
||||
value1 = Double.parseDouble(map.get("topicId").toString().trim());
|
||||
}
|
||||
for (SysDataDictionaryItem code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getItemCode());
|
||||
Double value2 = Double.valueOf(code.getItemCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("topic", code.getItemValue());
|
||||
map.put("topic", code.getItemValue().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -678,7 +741,7 @@ public class DashboardController extends BaseController{
|
||||
if(wdt!=null){
|
||||
String domain = wdt.getDomain();
|
||||
Double domainId = wdt.getId().doubleValue();
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString());
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString().trim());
|
||||
//10个域名之外的为others webId设为-1
|
||||
// if(dataMap.get("webId").toString().equals("-1")){
|
||||
// dataMap.put("domain", "Others");
|
||||
|
||||
@@ -67,27 +67,26 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
HashMap<String, Object> m = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.NTC_TOTAL_REPORT);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
Random r = new Random();
|
||||
Double rejectNum=0d;
|
||||
Double dropConnNum=0d;
|
||||
Double monitorNum=0d;
|
||||
Double loopConnNum=0d;
|
||||
Double liveConnNum=0d;
|
||||
Double closeConnNum=0d;
|
||||
Double newUniConnNum=0d;
|
||||
Double inoctetsNum=0d;
|
||||
Double outoctetsNum=0d;
|
||||
Double bandwidth=0d;
|
||||
if(list!=null&&list.size()>0){
|
||||
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.NTC_TOTAL_REPORT);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
if(fromJsonList!=null&&list!=null&&list.size()>0){
|
||||
Map map = (Map) list.get(0);
|
||||
rejectNum = (Double) map.get("rejectNum") ;
|
||||
monitorNum = (Double) map.get("monitorNum");
|
||||
dropConnNum = (Double) map.get("dropConnNum");
|
||||
loopConnNum = (Double) map.get("loopConnNum");
|
||||
liveConnNum = (Double) map.get("liveConnNum");
|
||||
closeConnNum = (Double) map.get("closeConnNum");
|
||||
newUniConnNum = (Double) map.get("newUniConnNum");
|
||||
inoctetsNum = (Double) map.get("inoctets");
|
||||
outoctetsNum = (Double) map.get("outoctets");
|
||||
@@ -101,7 +100,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
m.put("monitorNum", monitorNum);
|
||||
m.put("loopConnNum", loopConnNum);
|
||||
m.put("dropConnNum", dropConnNum);
|
||||
m.put("liveConnNum", liveConnNum);
|
||||
m.put("closeConnNum", closeConnNum);
|
||||
m.put("newUniConnNum", newUniConnNum);
|
||||
|
||||
m.put("bandwidth", bandwidth);
|
||||
@@ -261,17 +260,15 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="bandwidthTransThree")
|
||||
@ResponseBody
|
||||
public Map bandwidthTransThree(String beginDate,String endDate){
|
||||
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
//String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
|
||||
//String url="http://192.168.11.78:8080/galaxy/service/log/v1/"+Constants.TRAFFIC_BANDWIDTH_TRANS_THREE;
|
||||
//String url="http://192.168.11.78:8080/galaxy/service/log/v1/"+Constants.TRAFFIC_BANDWIDTH_TRANS_FOUR;
|
||||
String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_THREE;
|
||||
//String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_FOUR;
|
||||
try {
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
|
||||
url=url+"&searchQuotaType="+searchQuotaType;
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
@@ -303,12 +300,19 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="protocolList")
|
||||
@ResponseBody
|
||||
public List protocolList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
public List protocolList(Model model,Integer[] protoType,@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_PROTOCOL_LIST;
|
||||
try {
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
if(protoType!=null){
|
||||
for (Integer dom : protoType) {
|
||||
if(dom!=null){
|
||||
url=url+"&protoType="+dom;
|
||||
}
|
||||
}
|
||||
}
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
@@ -374,14 +378,18 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="appList")
|
||||
@ResponseBody
|
||||
public List appList(@RequestParam(value="appType",required=false)Integer appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
|
||||
public List appList(@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;
|
||||
try {
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
if(!StringUtil.isEmpty(appType)){
|
||||
url=url+"&appType="+appType;
|
||||
if(appType!=null){
|
||||
for (Integer dom : appType) {
|
||||
if(dom!=null){
|
||||
url=url+"&appType="+dom;
|
||||
}
|
||||
}
|
||||
}
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
@@ -477,7 +485,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="websiteList")
|
||||
@ResponseBody
|
||||
public List websiteList(Integer entranceId,Integer domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
public List websiteList(Integer entranceId,Integer[] domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST_NOTIME;
|
||||
@@ -491,7 +499,11 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
url=urlAddDate(url, beginDate, endDate);
|
||||
if(domain!=null){
|
||||
url=url+"&domain="+domain;
|
||||
for (Integer dom : domain) {
|
||||
if(dom!=null){
|
||||
url=url+"&domain="+dom;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entranceId!=null){
|
||||
url=url+"&entranceId="+entranceId;
|
||||
@@ -502,9 +514,9 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
logger.debug("website接口数据"+fromJsonList);
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
BigDecimal divisor=new BigDecimal(1024*1024*1024);
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
DecimalFormat df = new DecimalFormat("0.000000000");
|
||||
DecimalFormat dl = new DecimalFormat("0");
|
||||
DecimalFormat pf = new DecimalFormat("0.00%");
|
||||
DecimalFormat pf = new DecimalFormat("0.000000000");
|
||||
// Double totalLink=0d;
|
||||
Double totalGbyte=0d;
|
||||
Double totalPackets=0d;
|
||||
@@ -528,10 +540,10 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
Map m=(Map)object;
|
||||
// Double perLink = ((Double)m.get("linkNum"))/totalLink;
|
||||
// m.put("perLink",pf.format(perLink));
|
||||
Double perPackets = ((Double)m.get("pktCount"))/totalPackets;
|
||||
m.put("perPackets", pf.format(perPackets));
|
||||
Double perGbyte = ((Double)m.get("byteCount"))/totalGbyte;
|
||||
m.put("perGbyte", pf.format(perGbyte));
|
||||
// Double perPackets = ((Double)m.get("pktCount"))/totalPackets;
|
||||
m.put("totalPackets", pf.format(totalPackets));
|
||||
// Double perGbyte = ((Double)m.get("byteCount"))/totalGbyte;
|
||||
m.put("totalGbyte", pf.format(totalGbyte/1024/1024/1024));
|
||||
if(map.containsKey(Long.parseLong(dl.format(m.get("webId"))))){
|
||||
m.put("website", map.get(Long.parseLong(dl.format(m.get("webId")))));
|
||||
}else{
|
||||
@@ -626,4 +638,70 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* drop, loop,new link,close link,pass,live link
|
||||
*/
|
||||
@RequestMapping("ntcTotalReportDetail")
|
||||
public String ntcTotalReportDetail(Model model,String searchAction){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//鑾峰彇鍒板畬鏁寸殑鏃堕棿
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("searchAction", searchAction);
|
||||
model.addAttribute("beginDate", oneHoursAgo);
|
||||
model.addAttribute("endDate", now);
|
||||
return "/dashboard/ntcTotalReportDetailList";
|
||||
}
|
||||
@RequestMapping("ajaxNtcTotalReportDetail")
|
||||
@ResponseBody
|
||||
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
try {
|
||||
String url=Constants.DASHBOARD_URL+Constants.TREND_TOTAL_REPORT;
|
||||
if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
}
|
||||
URIBuilder uriBuilder = new URIBuilder(url);
|
||||
uriBuilder.addParameter("searchReportStartTime",beginDate);
|
||||
uriBuilder.addParameter("searchReportEndTime",endDate);
|
||||
url=uriBuilder.toString();
|
||||
if(searchAction!=null){
|
||||
if("action_drop".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+1;
|
||||
}
|
||||
if("action_loop".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+2;
|
||||
}
|
||||
if("new_link".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+3;
|
||||
}
|
||||
if("close_link".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+4;
|
||||
}
|
||||
if("pass".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+6;
|
||||
}
|
||||
if("live_link".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+5;
|
||||
}
|
||||
}
|
||||
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
logger.debug("动作详情统计一小时"+fromJsonList);
|
||||
map = (Map) fromJsonList.get("data");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("动作详情统计一小时数据获取错误"+e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,16 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@@ -23,20 +26,31 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.dashboard.NtcRadiusReport;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.report.NtcAsnRecord;
|
||||
import com.nis.domain.report.NtcIpRangeReport;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/traffic")
|
||||
public class TrafficStatisticsReportController extends BaseController {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户行为查询
|
||||
*
|
||||
* @param bean
|
||||
* @param model
|
||||
* @param request
|
||||
@@ -44,140 +58,382 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("userBehavior")
|
||||
public String list(@ModelAttribute("log") NtcRadiusReport bean,Model model, HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes) {
|
||||
public String list(@ModelAttribute("log") NtcRadiusReport bean, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> userJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> ipJsonList = new HashMap<String, Object>();
|
||||
String searchBusinessType = bean.getSearchBusinessType();
|
||||
if("2".endsWith(searchBusinessType)) {
|
||||
if ("2".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 2);// 用户查询
|
||||
}
|
||||
if("3".endsWith(searchBusinessType)) {
|
||||
if ("3".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 3);// IP查询
|
||||
}
|
||||
String url = Constants.DASHBOARD_URL+Constants.NTC_RADIUS_REPORT;
|
||||
String url = Constants.DASHBOARD_URL + Constants.NTC_RADIUS_REPORT;
|
||||
String statTime = bean.getSearchFoundStartTime();
|
||||
String endTime = bean.getSearchFoundEndTime();
|
||||
String account = bean.getAccount();
|
||||
String nasIp = bean.getNasIp();
|
||||
String destUrl = url+ "?searchBusinessType=1";
|
||||
String userUrl = url+ "?searchBusinessType=2";
|
||||
String ipUrl =url + "?searchBusinessType=3";
|
||||
String destUrl = url + "?searchBusinessType=1";
|
||||
String userUrl = url + "?searchBusinessType=2";
|
||||
String ipUrl = url + "?searchBusinessType=3";
|
||||
List list = new ArrayList();
|
||||
List userList = new ArrayList();
|
||||
List ipList = new ArrayList();
|
||||
try {
|
||||
if(StringUtil.isBlank(statTime)&&StringUtil.isBlank(endTime)) {
|
||||
if (StringUtil.isBlank(statTime) && StringUtil.isBlank(endTime)) {
|
||||
// 设置默认时间为1小时
|
||||
// statTime=DateUtils.getDate()+" 00:00:00"; // 默认今天
|
||||
// endTime=DateUtils.getDateTime();
|
||||
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
// statTime=DateUtils.getDate()+" 00:00:00"; // 默认今天
|
||||
// endTime=DateUtils.getDateTime();
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
endTime = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
statTime = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());
|
||||
endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
statTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());
|
||||
bean.setSearchFoundStartTime(statTime);
|
||||
bean.setSearchFoundEndTime(endTime);
|
||||
statTime=URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime=URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl="&searchReportStartTime="+statTime+"&searchReportEndTime="+endTime;
|
||||
destUrl=destUrl+paramUrl;
|
||||
userUrl=userUrl+paramUrl;
|
||||
ipUrl=ipUrl+paramUrl;
|
||||
}else {
|
||||
statTime=URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime=URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl="&searchReportStartTime="+statTime+"&searchReportEndTime="+endTime;
|
||||
destUrl=destUrl+paramUrl;
|
||||
userUrl=userUrl+paramUrl;
|
||||
ipUrl=ipUrl+paramUrl;
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
} else {
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
}
|
||||
model.addAttribute("nowTime", DateUtils.getDateTime());
|
||||
// 用户及IP数据
|
||||
String string = HttpClientUtil.get(destUrl);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
Map map = (Map) list.get(0);
|
||||
List nasIpList=(List) map.get("nasIpList");
|
||||
List accountList=(List) map.get("accountList");
|
||||
if (!StringUtil.isEmpty(nasIpList)&&nasIpList.size()>0) {
|
||||
List nasIpList = (List) map.get("nasIpList");
|
||||
List accountList = (List) map.get("accountList");
|
||||
if (!StringUtil.isEmpty(nasIpList) && nasIpList.size() > 0) {
|
||||
List newNasIpList = new ArrayList();
|
||||
for (int i = 0; i < nasIpList.size(); i++) {
|
||||
newNasIpList.add(nasIpList.get(i));
|
||||
if (i+1>=10) {
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nasIpList = newNasIpList;
|
||||
}
|
||||
if (!StringUtil.isEmpty(accountList)&&accountList.size()>0) {
|
||||
if (!StringUtil.isEmpty(accountList) && accountList.size() > 0) {
|
||||
List newAccountList = new ArrayList();
|
||||
for (int i = 0; i < accountList.size(); i++) {
|
||||
newAccountList.add(accountList.get(i));
|
||||
if (i+1>=10) {
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
accountList = newAccountList;
|
||||
}
|
||||
System.out.println("-------------------:"+nasIpList.size()+"+++"+accountList.size()+"==================");
|
||||
System.out.println(
|
||||
"-------------------:" + nasIpList.size() + "+++" + accountList.size() + "==================");
|
||||
model.addAttribute("nasIpList", nasIpList);
|
||||
model.addAttribute("accountList", accountList);
|
||||
if(StringUtil.isBlank(account)&&accountList!=null&&accountList.size()>0&&!"3".equals(searchBusinessType)) {
|
||||
if (StringUtil.isBlank(account) && accountList != null && accountList.size() > 0
|
||||
&& !"3".equals(searchBusinessType)) {
|
||||
Map accountMap = (Map) accountList.get(0);
|
||||
String firstAccount="";
|
||||
if(accountMap!=null&&accountMap.get("account")!=null){
|
||||
firstAccount=(String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl+"&searchAccount="+firstAccount);
|
||||
String firstAccount = "";
|
||||
if (accountMap != null && accountMap.get("account") != null) {
|
||||
firstAccount = (String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + firstAccount);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>(){}.getType());
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
}
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", firstAccount);
|
||||
}
|
||||
if(StringUtil.isBlank(nasIp)&&nasIpList!=null&&nasIpList.size()>0&&!"2".equals(searchBusinessType)) {
|
||||
if (StringUtil.isBlank(nasIp) && nasIpList != null && nasIpList.size() > 0
|
||||
&& !"2".equals(searchBusinessType)) {
|
||||
Map ipMap = (Map) nasIpList.get(0);
|
||||
String firstIp="";
|
||||
if(ipMap!=null&&ipMap.get("nasIp")!=null){
|
||||
firstIp=(String) ipMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl+"&searchNasIp="+firstIp);
|
||||
String firstIp = "";
|
||||
if (ipMap != null && ipMap.get("nasIp") != null) {
|
||||
firstIp = (String) ipMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + firstIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>(){}.getType());
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
}
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", firstIp);
|
||||
|
||||
|
||||
}
|
||||
if("2".endsWith(searchBusinessType)&&!StringUtil.isBlank(account)) {
|
||||
|
||||
String userString = HttpClientUtil.get(userUrl+"&searchAccount="+account);
|
||||
if ("2".endsWith(searchBusinessType) && !StringUtil.isBlank(account)) {
|
||||
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + account);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>(){}.getType());
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", account);
|
||||
}
|
||||
if ("3".endsWith(searchBusinessType)&&!StringUtil.isBlank(nasIp)) {
|
||||
String ipString = HttpClientUtil.get(ipUrl+"&searchNasIp="+nasIp);
|
||||
if ("3".endsWith(searchBusinessType) && !StringUtil.isBlank(nasIp)) {
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + nasIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>(){}.getType());
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", nasIp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
}
|
||||
return "/dashboard/trafficUserBehavior";
|
||||
}
|
||||
|
||||
// 用户行为导出
|
||||
@RequestMapping(value = "userBehaviorExport")
|
||||
public void userBehaviorExport(@ModelAttribute("log") NtcRadiusReport bean, Model model, String hColumns,
|
||||
String type, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
|
||||
List<NtcRadiusReport> exportList = new ArrayList<NtcRadiusReport>();
|
||||
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> userJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> ipJsonList = new HashMap<String, Object>();
|
||||
String searchBusinessType = bean.getSearchBusinessType();
|
||||
if ("2".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 2);// 用户查询
|
||||
}
|
||||
if ("3".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 3);// IP查询
|
||||
}
|
||||
String url = Constants.DASHBOARD_URL+ Constants.NTC_RADIUS_REPORT;
|
||||
String statTime = bean.getSearchFoundStartTime();
|
||||
String endTime = bean.getSearchFoundEndTime();
|
||||
String account = bean.getAccount();
|
||||
String nasIp = bean.getNasIp();
|
||||
String destUrl = url + "?searchBusinessType=1";
|
||||
String userUrl = url + "?searchBusinessType=2";
|
||||
String ipUrl = url + "?searchBusinessType=3";
|
||||
List list = new ArrayList();
|
||||
List userList = new ArrayList();
|
||||
List ipList = new ArrayList();
|
||||
try {
|
||||
if (StringUtil.isBlank(statTime) && StringUtil.isBlank(endTime)) {
|
||||
// 设置默认时间为1小时
|
||||
// statTime=DateUtils.getDate()+" 00:00:00"; // 默认今天
|
||||
// endTime=DateUtils.getDateTime();
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
statTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());
|
||||
bean.setSearchFoundStartTime(statTime);
|
||||
bean.setSearchFoundEndTime(endTime);
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
} else {
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
}
|
||||
model.addAttribute("nowTime", DateUtils.getDateTime());
|
||||
// 用户及IP数据
|
||||
String string = HttpClientUtil.get(destUrl);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
Map map = (Map) list.get(0);
|
||||
List nasIpList = (List) map.get("nasIpList");
|
||||
List accountList = (List) map.get("accountList");
|
||||
if (!StringUtil.isEmpty(nasIpList) && nasIpList.size() > 0) {
|
||||
List newNasIpList = new ArrayList();
|
||||
for (int i = 0; i < nasIpList.size(); i++) {
|
||||
newNasIpList.add(nasIpList.get(i));
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nasIpList = newNasIpList;
|
||||
}
|
||||
if (!StringUtil.isEmpty(accountList) && accountList.size() > 0) {
|
||||
List newAccountList = new ArrayList();
|
||||
for (int i = 0; i < accountList.size(); i++) {
|
||||
newAccountList.add(accountList.get(i));
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
accountList = newAccountList;
|
||||
}
|
||||
System.out.println(
|
||||
"-------------------:" + nasIpList.size() + "+++" + accountList.size() + "==================");
|
||||
model.addAttribute("nasIpList", nasIpList);
|
||||
model.addAttribute("accountList", accountList);
|
||||
if (StringUtil.isBlank(account) && accountList != null && accountList.size() > 0
|
||||
&& !"3".equals(searchBusinessType)) {
|
||||
Map accountMap = (Map) accountList.get(0);
|
||||
String firstAccount = "";
|
||||
if (accountMap != null && accountMap.get("account") != null) {
|
||||
firstAccount = (String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + firstAccount);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < userList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(userList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
}
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", firstAccount);
|
||||
}
|
||||
if (StringUtil.isBlank(nasIp) && nasIpList != null && nasIpList.size() > 0
|
||||
&& !"2".equals(searchBusinessType)) {
|
||||
Map ipMap = (Map) nasIpList.get(0);
|
||||
String firstIp = "";
|
||||
if (ipMap != null && ipMap.get("nasIp") != null) {
|
||||
firstIp = (String) ipMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + firstIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < ipList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(ipList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
}
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", firstIp);
|
||||
|
||||
}
|
||||
if ("2".endsWith(searchBusinessType) && !StringUtil.isBlank(account)) {
|
||||
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + account);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < userList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(userList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", account);
|
||||
}
|
||||
if ("3".endsWith(searchBusinessType) && !StringUtil.isBlank(nasIp)) {
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + nasIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < ipList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(ipList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", nasIp);
|
||||
}
|
||||
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
|
||||
titleList.add("traffic_user_behavior");
|
||||
classMap.put("traffic_user_behavior", NtcRadiusReport.class);
|
||||
|
||||
Properties msgProp = getMsgProp();
|
||||
NtcRadiusReport ntcRadiusReport = new NtcRadiusReport();
|
||||
long nums = 0;
|
||||
for (NtcRadiusReport entity : exportList) {
|
||||
if (null != entity.getNum()) {
|
||||
nums += entity.getNum();
|
||||
}
|
||||
}
|
||||
String report_total = msgProp.getProperty("report_total");
|
||||
ntcRadiusReport.setAccount(report_total);
|
||||
ntcRadiusReport.setNum(nums);
|
||||
ntcRadiusReport.setNasIp(" 一 ");
|
||||
ntcRadiusReport.setReportTime(" 一 ");
|
||||
|
||||
exportList.add(ntcRadiusReport);
|
||||
|
||||
dataMap.put("traffic_user_behavior", exportList);
|
||||
|
||||
String cfgIndexInfoNoExport = "";
|
||||
noExportMap.put("traffic_user_behavior", cfgIndexInfoNoExport);
|
||||
String timeRange = initLogMap(bean, "traffic_user_behavior");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "traffic_user_behavior", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "traffic_user_behavior", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String initLogMap(NtcRadiusReport log, String title) {
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime = msgProp.getProperty(title, title);
|
||||
;
|
||||
if (log.getSearchFoundStartTime() != null) {
|
||||
logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchFoundStartTime();
|
||||
}
|
||||
if (log.getSearchFoundEndTime() != null) {
|
||||
logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,16 @@ public class DynamicIndexController extends BaseController {
|
||||
public String dynamicIndex(HttpServletRequest request){
|
||||
String serviceIds = request.getParameter("sid");
|
||||
String baseNum = request.getParameter("baseNum");
|
||||
Object trafficAreaStat = trafficAreaStat(null, Integer.parseInt(baseNum));
|
||||
Object dropStat = dropStat(null, Integer.parseInt(baseNum));
|
||||
Object logStat = logStat(null, serviceIds, Integer.parseInt(baseNum));
|
||||
String hourStr = request.getParameter("hour");
|
||||
String dropBaseNum = request.getParameter("dropBaseNum");
|
||||
String serviceBaseNum = request.getParameter("serviceBaseNum");
|
||||
Integer hour = null;
|
||||
if(hourStr!=null &&!"".equals(hourStr)){
|
||||
hour = Integer.parseInt(hourStr);
|
||||
}
|
||||
Object trafficAreaStat = trafficAreaStat(hour, Long.valueOf(baseNum));
|
||||
Object dropStat = dropStat(hour, Long.valueOf(dropBaseNum));
|
||||
Object logStat = logStat(hour, serviceIds, Long.valueOf(serviceBaseNum));
|
||||
Gson gson = new GsonBuilder().create();
|
||||
String trafficJson = gson.toJson(trafficAreaStat);
|
||||
String dropJson = gson.toJson(dropStat);
|
||||
@@ -89,26 +96,25 @@ public class DynamicIndexController extends BaseController {
|
||||
* @param hour 取hour小时内的流量数据,默认24小时
|
||||
* @return
|
||||
*/
|
||||
public Object trafficAreaStat(Integer hour, Integer baseNum) {
|
||||
public Object trafficAreaStat(Integer hour, long baseNum) {
|
||||
List<Map> results = new ArrayList<>();
|
||||
|
||||
if (hour == null || hour <= 0) {
|
||||
hour = 24;
|
||||
}
|
||||
|
||||
hour = 2;
|
||||
}
|
||||
Date now = new Date();
|
||||
Date start = new Date(now.getTime()-(hour*60*60*1000));
|
||||
|
||||
Date start = new Date(now.getTime()-(hour*60*60*1000)-(5*60*1000));
|
||||
now = new Date(now.getTime()-5*60*1000);
|
||||
String nowString = DateUtils.formatDate(now, "yyyy-MM-dd HH:mm:ss");
|
||||
String startString = DateUtils.formatDate(start, "yyyy-MM-dd HH:mm:ss");
|
||||
nowString = "2018-12-05 00:00:00";
|
||||
startString = "2018-12-04 17:00:00";
|
||||
/*nowString = "2018-12-05 00:00:00";
|
||||
startString = "2018-12-04 17:00:00";*/
|
||||
String url = Constants.LOG_BASE_URL + Constants.TRAFFIC_AREA_STAT;
|
||||
//String url = "http://localhost:8080/ntc/helloworld/test";
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("searchReportStartTime", startString);
|
||||
params.put("searchReportEndTime", nowString);
|
||||
//params.put("baseNum", baseNum);
|
||||
params.put("baseNum", baseNum);
|
||||
|
||||
try {
|
||||
String recv = HttpClientUtil.getMsg(url, params, null);
|
||||
@@ -126,7 +132,11 @@ public class DynamicIndexController extends BaseController {
|
||||
}
|
||||
List<Object> point = new ArrayList<>();//每个点 [时间戳, 数值]
|
||||
point.add(DateUtils.parseDate(entity.getReportTime()).getTime());
|
||||
point.add(entity.getSum());
|
||||
/*if(0<entity.getSum()){//1024*1024*1024=1073741824
|
||||
point.add(entity.getSum()/1073741824);
|
||||
}else{
|
||||
point.add(entity.getSum());
|
||||
}*/point.add(entity.getSum());
|
||||
|
||||
List<List<Object>> points = t.get(entity.getArea());//所有点
|
||||
points.add(point);
|
||||
@@ -166,11 +176,12 @@ public class DynamicIndexController extends BaseController {
|
||||
* @param hour 取hour小时内的丢弃数据,默认24小时
|
||||
* @return
|
||||
*/
|
||||
public Object dropStat(Integer hour, Integer baseNum) {
|
||||
public Object dropStat(Integer hour, long baseNum) {
|
||||
List<Map> results = new ArrayList<>();
|
||||
|
||||
if (hour == null || hour <= 0) {
|
||||
hour = 24;
|
||||
//hour = 24;
|
||||
hour = 2;
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
@@ -184,8 +195,8 @@ public class DynamicIndexController extends BaseController {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("searchReportStartTime", startString);
|
||||
params.put("searchReportEndTime", nowString);
|
||||
params.put("searchBusinessType", 1);
|
||||
//params.put("baseNum", baseNum);
|
||||
params.put("searchBusinessType", 2);
|
||||
params.put("baseNum", baseNum);
|
||||
|
||||
try {
|
||||
String recv = HttpClientUtil.getMsg(url, params, null);
|
||||
@@ -229,7 +240,7 @@ public class DynamicIndexController extends BaseController {
|
||||
* @param hour 取hour小时内的日志数据,默认24小时
|
||||
* @return
|
||||
*/
|
||||
public Object logStat(Integer hour, String serviceIds, Integer baseNum) {
|
||||
public Object logStat(Integer hour, String serviceIds, long baseNum) {
|
||||
String[] _idsArr = serviceIds.split(",");
|
||||
Long[] idsArr = new Long[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
@@ -239,7 +250,7 @@ public class DynamicIndexController extends BaseController {
|
||||
List results = new ArrayList<>();
|
||||
|
||||
if (hour == null || hour <= 0) {
|
||||
hour = 24;
|
||||
hour = 2;
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
@@ -186,7 +186,8 @@ public class DkBehaviorLogController extends BaseController{
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put(name, cfgIndexInfoNoExport);
|
||||
dataMap.put(name, list);
|
||||
|
||||
String timeRange= initLogMap(entry,name);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, name, titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
@@ -124,6 +124,8 @@ public class BgpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("bgp_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("bgp_control", list);
|
||||
String timeRange= initLogMap(log,"bgp_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(types)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "bgp_control", titleList, classMap,
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -31,6 +32,7 @@ import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.log.NtcBGPLog;
|
||||
import com.nis.domain.log.NtcCollectRadiusLog;
|
||||
import com.nis.domain.log.NtcCollectVoipLog;
|
||||
@@ -140,7 +142,7 @@ public class CollectVoipLogController extends BaseController {
|
||||
url = Constants.LOG_BASE_URL + Constants.NTC_COLLECT_VOIP_LOG;
|
||||
String jsonString = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
// GsonBuilder builder = new GsonBuilder();
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
// builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
|
||||
//
|
||||
// public Date deserialize(JsonElement json, java.lang.reflect.Type typeOfT,
|
||||
@@ -148,8 +150,8 @@ public class CollectVoipLogController extends BaseController {
|
||||
// return new Date(json.getAsJsonPrimitive().getAsLong());
|
||||
// }
|
||||
// });
|
||||
// Gson gson = builder.setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().create();
|
||||
Gson gson = builder.setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
||||
// Gson gson = new GsonBuilder().create();
|
||||
// gson泛型支持
|
||||
LogRecvData<NtcCollectVoipLog> fromJson = gson.fromJson(jsonString,
|
||||
new TypeToken<LogRecvData<NtcCollectVoipLog>>() {
|
||||
@@ -278,6 +280,8 @@ public class CollectVoipLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",cfg_id,action," + hColumns;
|
||||
noExportMap.put("collect_voip", cfgIndexInfoNoExport);
|
||||
dataMap.put("collect_voip", list);
|
||||
String timeRange= initLogVoipMap(entry,"collect_voip");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "collect_voip", titleList, classMap,
|
||||
@@ -291,6 +295,20 @@ public class CollectVoipLogController extends BaseController {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initLogVoipMap(NtcCollectVoipLog log,String title){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(title,title);;
|
||||
if(log.getSearchFoundStartTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("begin_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
if(log.getSearchFoundEndTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("end_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<NtcCollectVoipLog> getList() {
|
||||
List<NtcCollectVoipLog> list = new ArrayList<NtcCollectVoipLog>();
|
||||
|
||||
@@ -170,7 +170,8 @@ public class DdosLogController extends BaseController{
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("target_ip_protect", cfgIndexInfoNoExport);
|
||||
dataMap.put("target_ip_protect", list);
|
||||
|
||||
String timeRange= initLogMap(log,"target_ip_protect");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "target_ip_protect", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -133,6 +133,8 @@ public class DnsLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("DNS", cfgIndexInfoNoExport);
|
||||
dataMap.put("DNS", list);
|
||||
String timeRange= initLogMap(log,"DNS");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "DNS", titleList, classMap, dataMap,
|
||||
|
||||
@@ -144,6 +144,8 @@ public class FtpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("ftp_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ftp_control", list);
|
||||
String timeRange= initLogMap(log,"ftp_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ftp_control", titleList, classMap,
|
||||
|
||||
@@ -147,8 +147,8 @@ public class HttpKeyLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("http_keyword", cfgIndexInfoNoExport);
|
||||
dataMap.put("http_keyword", list);
|
||||
// String timeRange= initLogMap(log,"http_keyword");
|
||||
// noExportMap.put("timeRange", timeRange);
|
||||
String timeRange= initLogMap(log,"http_keyword");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "http_keyword", titleList, classMap,
|
||||
|
||||
@@ -143,8 +143,8 @@ public class HttpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("HTTP", cfgIndexInfoNoExport);
|
||||
dataMap.put("HTTP", list);
|
||||
/*String timeRange= initLogMap(log,"HTTP");
|
||||
noExportMap.put("timeRange", timeRange);*/
|
||||
String timeRange= initLogMap(log,"HTTP");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "HTTP", titleList, classMap, dataMap,
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.util.FileUtil;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -27,11 +20,8 @@ import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.NtcHttpLog;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
@@ -138,7 +128,6 @@ public class IpLogController extends BaseController {
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcIpLog> list = new ArrayList<NtcIpLog>();
|
||||
@@ -156,8 +145,8 @@ public class IpLogController extends BaseController {
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
|
||||
titleList.add("Ip");
|
||||
classMap.put("Ip", NtcIpLog.class);
|
||||
titleList.add("ip_control");
|
||||
classMap.put("ip_control", NtcIpLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
@@ -165,14 +154,15 @@ public class IpLogController extends BaseController {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("Ip", cfgIndexInfoNoExport);
|
||||
dataMap.put("Ip", list);
|
||||
|
||||
noExportMap.put("ip_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ip_control", list);
|
||||
String timeRange= initLogMap(log,"ip_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ip", titleList, classMap,
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ip_control", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "Ip", titleList, classMap, dataMap,
|
||||
this._export(model, request, response, redirectAttributes, "ip_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -19,13 +21,14 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.IrDnatLog;
|
||||
import com.nis.domain.log.NtcIpsecLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/log/ntc/irDnatLogs")
|
||||
@@ -70,4 +73,69 @@ public class IrDnatLogController extends BaseController {
|
||||
return "/log/ntc/irDnatLogList";
|
||||
}
|
||||
|
||||
|
||||
// Ip配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportIp(@ModelAttribute("log") IrDnatLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
List<IrDnatLog> list = new ArrayList<IrDnatLog>();
|
||||
PageLog<IrDnatLog> page = new PageLog<IrDnatLog>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.IR_DNAT_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<IrDnatLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<IrDnatLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<IrDnatLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (IrDnatLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}
|
||||
titleList.add("dnat_multiplex");
|
||||
classMap.put("dnat_multiplex", IrDnatLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("dnat_multiplex", cfgIndexInfoNoExport);
|
||||
dataMap.put("dnat_multiplex", list);
|
||||
String timeRange= initLogMap(log,"dnat_multiplex");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "dnat_multiplex", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "dnat_multiplex", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat_multiplex export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -19,13 +21,14 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.log.IrDnatLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.IrSnatLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/log/ntc/irSnatLogs")
|
||||
@@ -71,4 +74,70 @@ public class IrSnatLogController extends BaseController {
|
||||
return "/log/ntc/irSnatLogList";
|
||||
}
|
||||
|
||||
// Ip配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportIp(@ModelAttribute("log") IrSnatLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
List<IrSnatLog> list = new ArrayList<IrSnatLog>();
|
||||
PageLog<IrSnatLog> page = new PageLog<IrSnatLog>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.IR_SNAT_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<IrSnatLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<IrSnatLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<IrSnatLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (IrSnatLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}
|
||||
|
||||
titleList.add("snat_multiplex");
|
||||
classMap.put("snat_multiplex", IrSnatLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("snat_multiplex", cfgIndexInfoNoExport);
|
||||
dataMap.put("snat_multiplex", list);
|
||||
String timeRange= initLogMap(log,"snat_multiplex");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "snat_multiplex", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "snat_multiplex", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("snat_multiplex export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -151,6 +151,8 @@ public class MailLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("mail_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("mail_control", list);
|
||||
String timeRange= initLogMap(log,"mail_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "mail_control", titleList, classMap,
|
||||
|
||||
@@ -147,6 +147,8 @@ public class MmAvUrlLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("streaming_media", cfgIndexInfoNoExport);
|
||||
dataMap.put("streaming_media", list);
|
||||
String timeRange= initLogMap(log,"streaming_media");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "streaming_media", titleList, classMap,
|
||||
|
||||
@@ -146,7 +146,8 @@ public class MmFileDigestLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",log_uri,direction," + hColumns;
|
||||
noExportMap.put("file_digest_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("file_digest_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"file_digest_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "file_digest_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -169,6 +169,8 @@ public class MmPornAvSampleController extends BaseController {
|
||||
String cfgIndexInfoNoExport=","+hColumns;
|
||||
noExportMap.put("av_sample_video_porn_control",cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_video_porn_control",list);
|
||||
String timeRange= initLogMap(log,"av_sample_video_porn_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"av_sample_video_porn_control",titleList,classMap,dataMap,noExportMap);
|
||||
|
||||
@@ -127,7 +127,8 @@ public class MmSampleAudioController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_audio_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_audio_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_audio_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_audio_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -112,8 +112,8 @@ public class MmSamplePicController extends BaseController{
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("SamplePic");
|
||||
classMap.put("SamplePic", MmSamplePicLog.class);
|
||||
titleList.add("av_sample_picture_control");
|
||||
classMap.put("av_sample_picture_control", MmSamplePicLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
@@ -123,7 +123,8 @@ public class MmSamplePicController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_picture_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_picture_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_picture_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_picture_control", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user