diff --git a/src/main/java/com/nis/domain/SysUser.java b/src/main/java/com/nis/domain/SysUser.java index 1ad76b148..8e5e96474 100644 --- a/src/main/java/com/nis/domain/SysUser.java +++ b/src/main/java/com/nis/domain/SysUser.java @@ -167,7 +167,7 @@ public class SysUser extends BaseEntity { } public static boolean isAdmin(String loginId){ - return loginId != null && "admin".equals(loginId); + return loginId != null && "ceiec".equals(loginId); } diff --git a/src/main/java/com/nis/domain/basics/PolicyGroupInfo.java b/src/main/java/com/nis/domain/basics/PolicyGroupInfo.java index 5d4ec3c1b..2a372b989 100644 --- a/src/main/java/com/nis/domain/basics/PolicyGroupInfo.java +++ b/src/main/java/com/nis/domain/basics/PolicyGroupInfo.java @@ -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 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; diff --git a/src/main/java/com/nis/domain/basics/ServiceDictInfo.java b/src/main/java/com/nis/domain/basics/ServiceDictInfo.java index 2d2dc7611..3d2e43ed8 100644 --- a/src/main/java/com/nis/domain/basics/ServiceDictInfo.java +++ b/src/main/java/com/nis/domain/basics/ServiceDictInfo.java @@ -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{ 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 childrenList = new ArrayList();//子列表 @@ -41,6 +50,11 @@ public class ServiceDictInfo extends BaseEntity{ 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{ */ private List 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; diff --git a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java index 87f8945c0..779681480 100644 --- a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java @@ -43,6 +43,19 @@ public class AppComplexFeatureCfg extends BaseCfg { private String appName; private List 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 { public void setIpPortList(List 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; + } + } diff --git a/src/main/java/com/nis/domain/configuration/AvFileSampleCfg.java b/src/main/java/com/nis/domain/configuration/AvFileSampleCfg.java index 446203897..1ae4d318c 100644 --- a/src/main/java/com/nis/domain/configuration/AvFileSampleCfg.java +++ b/src/main/java/com/nis/domain/configuration/AvFileSampleCfg.java @@ -12,11 +12,11 @@ public class AvFileSampleCfg extends BaseCfg { 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") diff --git a/src/main/java/com/nis/domain/configuration/BaseCfg.java b/src/main/java/com/nis/domain/configuration/BaseCfg.java index 6a58c7ea7..dfbe2285c 100644 --- a/src/main/java/com/nis/domain/configuration/BaseCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseCfg.java @@ -261,18 +261,20 @@ public class BaseCfg extends BaseEntity 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 extends BaseEntity implements Cloneable{ public void setCancelRequestId(Integer cancelRequestId) { this.cancelRequestId = cancelRequestId; } + public Integer getDoBlackList() { + return doBlackList; + } + public void setDoBlackList(Integer doBlackList) { + this.doBlackList = doBlackList; + } } diff --git a/src/main/java/com/nis/domain/configuration/BaseIpCfg.java b/src/main/java/com/nis/domain/configuration/BaseIpCfg.java index 146de6aa4..864c34c6a 100644 --- a/src/main/java/com/nis/domain/configuration/BaseIpCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseIpCfg.java @@ -69,7 +69,28 @@ public class BaseIpCfg extends BaseCfg { 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; } diff --git a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java index a75f3405e..8e14a2720 100644 --- a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java @@ -44,6 +44,14 @@ public class BaseStringCfg extends BaseCfg { 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; } diff --git a/src/main/java/com/nis/domain/configuration/CachePolicyUserRegion.java b/src/main/java/com/nis/domain/configuration/CachePolicyUserRegion.java new file mode 100644 index 000000000..d1b82e673 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/CachePolicyUserRegion.java @@ -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 { + + 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 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 getCache_key() { + return cache_key; + } + public void setCache_key(Map 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; + } + + +} diff --git a/src/main/java/com/nis/domain/configuration/DnsResStrategy.java b/src/main/java/com/nis/domain/configuration/DnsResStrategy.java index ba5b6e5e9..eb7004088 100644 --- a/src/main/java/com/nis/domain/configuration/DnsResStrategy.java +++ b/src/main/java/com/nis/domain/configuration/DnsResStrategy.java @@ -16,7 +16,7 @@ public class DnsResStrategy extends BaseCfg { 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 { 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; diff --git a/src/main/java/com/nis/domain/configuration/FileDigestCfg.java b/src/main/java/com/nis/domain/configuration/FileDigestCfg.java index 8be421416..57fef7b6d 100644 --- a/src/main/java/com/nis/domain/configuration/FileDigestCfg.java +++ b/src/main/java/com/nis/domain/configuration/FileDigestCfg.java @@ -29,13 +29,13 @@ public class FileDigestCfg extends BaseCfg { 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; diff --git a/src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java b/src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java index f8cdda62c..f8e854c0f 100644 --- a/src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java +++ b/src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java @@ -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{ 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 ipCfgs; // 地址池IP信息 - @SerializedName("cfgId") + @ExcelField(title="address_pool_id",sort=0) private Integer compileId; public String getIndexTable() { diff --git a/src/main/java/com/nis/domain/configuration/IpReuseDnatPolicyCfg.java b/src/main/java/com/nis/domain/configuration/IpReuseDnatPolicyCfg.java index 47803a4f8..124bb0bd8 100644 --- a/src/main/java/com/nis/domain/configuration/IpReuseDnatPolicyCfg.java +++ b/src/main/java/com/nis/domain/configuration/IpReuseDnatPolicyCfg.java @@ -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 diff --git a/src/main/java/com/nis/domain/configuration/IpReusePolicyCfg.java b/src/main/java/com/nis/domain/configuration/IpReusePolicyCfg.java index 573bb6f00..af29f5ca5 100644 --- a/src/main/java/com/nis/domain/configuration/IpReusePolicyCfg.java +++ b/src/main/java/com/nis/domain/configuration/IpReusePolicyCfg.java @@ -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{ 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{ 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 diff --git a/src/main/java/com/nis/domain/configuration/PxyObjSpoofingIpPool.java b/src/main/java/com/nis/domain/configuration/PxyObjSpoofingIpPool.java index 6094f6f2c..9e4d5bc46 100644 --- a/src/main/java/com/nis/domain/configuration/PxyObjSpoofingIpPool.java +++ b/src/main/java/com/nis/domain/configuration/PxyObjSpoofingIpPool.java @@ -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) { diff --git a/src/main/java/com/nis/domain/configuration/UserManage.java b/src/main/java/com/nis/domain/configuration/UserManage.java index da0163f70..5ce08c73e 100644 --- a/src/main/java/com/nis/domain/configuration/UserManage.java +++ b/src/main/java/com/nis/domain/configuration/UserManage.java @@ -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{ 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{ 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; diff --git a/src/main/java/com/nis/domain/configuration/template/AppPayloadTemplate.java b/src/main/java/com/nis/domain/configuration/template/AppPayloadTemplate.java new file mode 100644 index 000000000..4b1bde10d --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/AppPayloadTemplate.java @@ -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; + } + +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsRedirectComplexTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsRedirectComplexTemplate.java new file mode 100644 index 000000000..8e6112b85 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsRedirectComplexTemplate.java @@ -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; + } +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsRedirectIpTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsRedirectIpTemplate.java new file mode 100644 index 000000000..3cf44b757 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsRedirectIpTemplate.java @@ -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; + } +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsRedirectTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsRedirectTemplate.java new file mode 100644 index 000000000..0a2ae6aa0 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsRedirectTemplate.java @@ -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; + } +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsRejectComplexTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsRejectComplexTemplate.java new file mode 100644 index 000000000..72f569dda --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsRejectComplexTemplate.java @@ -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; + } + +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsRejectIpTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsRejectIpTemplate.java new file mode 100644 index 000000000..d02510027 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsRejectIpTemplate.java @@ -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; + } + +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsRejectTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsRejectTemplate.java new file mode 100644 index 000000000..3cb2ffcc0 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsRejectTemplate.java @@ -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; + } + +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsReplaceComplexTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsReplaceComplexTemplate.java new file mode 100644 index 000000000..18a39ed14 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsReplaceComplexTemplate.java @@ -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; + } +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsReplaceIpTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsReplaceIpTemplate.java new file mode 100644 index 000000000..c7a57075b --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsReplaceIpTemplate.java @@ -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; + } +} diff --git a/src/main/java/com/nis/domain/configuration/template/HttpsReplaceTemplate.java b/src/main/java/com/nis/domain/configuration/template/HttpsReplaceTemplate.java new file mode 100644 index 000000000..2a40ee17b --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/template/HttpsReplaceTemplate.java @@ -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; + } +} diff --git a/src/main/java/com/nis/domain/configuration/template/IpWhitelistTemplate.java b/src/main/java/com/nis/domain/configuration/template/IpWhitelistTemplate.java index dd512c90a..728e672a8 100644 --- a/src/main/java/com/nis/domain/configuration/template/IpWhitelistTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/IpWhitelistTemplate.java @@ -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; + } + } diff --git a/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java b/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java index 0cd839f36..cb836f0b7 100644 --- a/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java +++ b/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java @@ -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; } diff --git a/src/main/java/com/nis/domain/log/IrDnatLog.java b/src/main/java/com/nis/domain/log/IrDnatLog.java index 132c481e2..3c89a4add 100644 --- a/src/main/java/com/nis/domain/log/IrDnatLog.java +++ b/src/main/java/com/nis/domain/log/IrDnatLog.java @@ -1,19 +1,27 @@ package com.nis.domain.log; +import com.nis.util.excel.ExcelField; + public class IrDnatLog extends BaseLogEntity { 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; diff --git a/src/main/java/com/nis/domain/log/IrSnatLog.java b/src/main/java/com/nis/domain/log/IrSnatLog.java index 5b1fe3e2a..120f31763 100644 --- a/src/main/java/com/nis/domain/log/IrSnatLog.java +++ b/src/main/java/com/nis/domain/log/IrSnatLog.java @@ -1,17 +1,25 @@ package com.nis.domain.log; +import com.nis.util.excel.ExcelField; + public class IrSnatLog extends BaseLogEntity { 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; diff --git a/src/main/java/com/nis/domain/maat/MaatCfg.java b/src/main/java/com/nis/domain/maat/MaatCfg.java index f0a091425..bcbf489e0 100644 --- a/src/main/java/com/nis/domain/maat/MaatCfg.java +++ b/src/main/java/com/nis/domain/maat/MaatCfg.java @@ -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(); diff --git a/src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java b/src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java new file mode 100644 index 000000000..869d7e249 --- /dev/null +++ b/src/main/java/com/nis/domain/maat/ToUpdateMaatBeanStatus.java @@ -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 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 getConfigCompileStartStopList() { + return configCompileStartStopList; + } + + public void setConfigCompileStartStopList(List configCompileStartStopList) { + this.configCompileStartStopList = configCompileStartStopList; + } + + public Integer getOpAction() { + return opAction; + } + + public void setOpAction(Integer opAction) { + this.opAction = opAction; + } + + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/nis/domain/report/NtcAsnRecord.java b/src/main/java/com/nis/domain/report/NtcAsnRecord.java index 2e7bcf469..5877e78ef 100644 --- a/src/main/java/com/nis/domain/report/NtcAsnRecord.java +++ b/src/main/java/com/nis/domain/report/NtcAsnRecord.java @@ -7,11 +7,11 @@ public class NtcAsnRecord extends BaseLogEntity{ 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; diff --git a/src/main/java/com/nis/domain/report/NtcEventKeyProtectionReport.java b/src/main/java/com/nis/domain/report/NtcEventKeyProtectionReport.java new file mode 100644 index 000000000..7b90222d3 --- /dev/null +++ b/src/main/java/com/nis/domain/report/NtcEventKeyProtectionReport.java @@ -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 { + + /** + * + */ + + @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 + "]"; + } + +} diff --git a/src/main/java/com/nis/domain/report/NtcEventMonitorOrBlockReport.java b/src/main/java/com/nis/domain/report/NtcEventMonitorOrBlockReport.java new file mode 100644 index 000000000..814d5a87b --- /dev/null +++ b/src/main/java/com/nis/domain/report/NtcEventMonitorOrBlockReport.java @@ -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 { + /** + * + */ + 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 + "]"; + } + +} diff --git a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java index d930b4496..80bdfa40b 100644 --- a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java +++ b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java @@ -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{ 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界面添加标记 diff --git a/src/main/java/com/nis/util/ConfigServiceUtil.java b/src/main/java/com/nis/util/ConfigServiceUtil.java index c29b8b35f..8779f74ff 100644 --- a/src/main/java/com/nis/util/ConfigServiceUtil.java +++ b/src/main/java/com/nis/util/ConfigServiceUtil.java @@ -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(""); + } + if(response !=null && response.getStatus() == 200){ + JSONObject resObject = JSONObject.fromObject(result); + bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class); + }else{ + throw new MaatConvertException(":"+result); + } + } catch (Exception e) { + throw e; + } + + return result; + } public static void main(String[] args) { try { // getId(1,1); diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 79c7af97b..c8a5836d5 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -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"); } diff --git a/src/main/java/com/nis/util/SchedulerTaskUtil.java b/src/main/java/com/nis/util/SchedulerTaskUtil.java new file mode 100644 index 000000000..52baa0ca0 --- /dev/null +++ b/src/main/java/com/nis/util/SchedulerTaskUtil.java @@ -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> serviceList = serviceTemplate.getServiceListByServiceId(serviceId); + //根据编译ID查询配置表中的配置信息 + for(Map 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 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 configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + +// for(Integer compileId:compileIds){ + entity.setCompileId(compileId); + //查询配置 + if("cfg_index_info".equals(tableName)){ + list = configSynchronizationDao.getCfgIndexList(entity); + List> cfgList = (List>) service.get("cfgList"); + for(int i=0;i 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> cfgList = (List>) service.get("cfgList"); + for(int i=0;i 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> cfgList = (List>) service.get("cfgList"); + for(int i=0;i 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 compileIdArray = Lists.newArrayList(); + for(int i=0;i> getServiceList(Integer functionId){ + public List> getServiceListByFunctionId(Integer functionId){ List> list =new ArrayList(); if(!StringUtil.isEmpty(functionId)) { List serviceList = DictUtils.getFunctionServiceDictList(functionId); @@ -97,6 +96,34 @@ public class ServiceConfigTemplateUtil { } + } + } + return list; + } + /** + * + * @param serviceId + * @return + */ + public List> getServiceListByServiceId(Integer serviceId){ + List> list =new ArrayList(); + if(!StringUtil.isEmpty(serviceId)) { + List elements = root.selectNodes("service"); + for(Element element:elements){ + String serviceIdC=element.attributeValue("id"); + if(!StringUtil.isEmpty(serviceIdC) + && String.valueOf(serviceId).equals(serviceIdC)) { + Map map = new HashMap(); + for(int i=0;i> list = serviceTemplate.getServiceList(5); + List> list = serviceTemplate.getServiceListByServiceId(518); for(Map map :list){ System.out.println("业务配置:"+map.get("id")+","+map.get("functionId")+","+map.get("serviceType")+","+map.get("tableName")); List> cfgList = (List>) map.get("cfgList"); diff --git a/src/main/java/com/nis/util/StringUtils.java b/src/main/java/com/nis/util/StringUtils.java index e1113c80c..cd30adf6d 100644 --- a/src/main/java/com/nis/util/StringUtils.java +++ b/src/main/java/com/nis/util/StringUtils.java @@ -1,520 +1,520 @@ -/** - * Copyright © 2012-2014 JeeSite All rights reserved. - */ -package com.nis.util; - -import java.io.UnsupportedEncodingException; -import java.util.List; -import java.util.Locale; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringEscapeUtils; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.servlet.LocaleResolver; - -import com.ckfinder.connector.ServletContextFactory; -import com.google.common.collect.Lists; -import com.nis.web.service.SpringContextHolder; - -/** - * 字符串工具类, 继承org.apache.commons.lang3.StringUtils类 - * - * @author ThinkGem - * @version 2013-05-22 - */ -public class StringUtils extends org.apache.commons.lang3.StringUtils { - - private static final char SEPARATOR = '_'; - private static final String CHARSET_NAME = "UTF-8"; - public static final String HASH_ALGORITHM = "SHA-1"; - public static final int HASH_INTERATIONS = 1024; - public static final int SALT_SIZE = 8; - - /** - * 转换为字节数组 - * - * @param str - * @return - */ - public static byte[] getBytes(String str) { - if (str != null) { - try { - return str.getBytes(CHARSET_NAME); - } catch (UnsupportedEncodingException e) { - return null; - } - } else { - return null; - } - } - - /** - * 转换为字节数组 - * - * @param str - * @return - */ - public static String toString(byte[] bytes) { - try { - return new String(bytes, CHARSET_NAME); - } catch (UnsupportedEncodingException e) { - return EMPTY; - } - } - - /** - * 是否包含字符串 - * - * @param str - * 验证字符串 - * @param strs - * 字符串组 - * @return 包含返回true - */ - public static boolean inString(String str, String... strs) { - if (str != null) { - for (String s : strs) { - if (str.equals(trim(s))) { - return true; - } - } - } - return false; - } - - /** - * 替换掉HTML标签方法 - */ - public static String replaceHtml(String html) { - if (isBlank(html)) { - return ""; - } - String regEx = "<.+?>"; - Pattern p = Pattern.compile(regEx); - Matcher m = p.matcher(html); - String s = m.replaceAll(""); - return s; - } - - /** - * 替换为手机识别的HTML,去掉样式及属性,保留回车。 - * - * @param html - * @return - */ - public static String replaceMobileHtml(String html) { - if (html == null) { - return ""; - } - return html.replaceAll("<([a-z]+?)\\s+?.*?>", "<$1>"); - } - - /** - * 替换为手机识别的HTML,去掉样式及属性,保留回车。 - * - * @param txt - * @return - */ - public static String toHtml(String txt) { - if (txt == null) { - return ""; - } - return replace(replace(Encodes.escapeHtml(txt), "\n", "
"), "\t", "    "); - } - - /** - * 缩略字符串(不区分中英文字符) - * - * @param str - * 目标字符串 - * @param length - * 截取长度 - * @return - */ - public static String abbr(String str, int length) { - if (str == null) { - return ""; - } - try { - StringBuilder sb = new StringBuilder(); - int currentLength = 0; - for (char c : replaceHtml(StringEscapeUtils.unescapeHtml4(str)).toCharArray()) { - currentLength += String.valueOf(c).getBytes("GBK").length; - if (currentLength <= length - 3) { - sb.append(c); - } else { - sb.append("..."); - break; - } - } - return sb.toString(); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - return ""; - } - - public static String abbr2(String param, int length) { - if (param == null) { - return ""; - } - StringBuffer result = new StringBuffer(); - int n = 0; - char temp; - boolean isCode = false; // 是不是HTML代码 - boolean isHTML = false; // 是不是HTML特殊字符,如  - for (int i = 0; i < param.length(); i++) { - temp = param.charAt(i); - if (temp == '<') { - isCode = true; - } else if (temp == '&') { - isHTML = true; - } else if (temp == '>' && isCode) { - n = n - 1; - isCode = false; - } else if (temp == ';' && isHTML) { - isHTML = false; - } - try { - if (!isCode && !isHTML) { - n += String.valueOf(temp).getBytes("GBK").length; - } - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - - if (n <= length - 3) { - result.append(temp); - } else { - result.append("..."); - break; - } - } - // 取出截取字符串中的HTML标记 - String temp_result = result.toString().replaceAll("(>)[^<>]*(]*/?>", - ""); - // 去掉成对的HTML标记 - temp_result = temp_result.replaceAll("<([a-zA-Z]+)[^<>]*>(.*?)", "$2"); - // 用正则表达式取出标记 - Pattern p = Pattern.compile("<([a-zA-Z]+)[^<>]*>"); - Matcher m = p.matcher(temp_result); - List endHTML = Lists.newArrayList(); - while (m.find()) { - endHTML.add(m.group(1)); - } - // 补全不成对的HTML标记 - for (int i = endHTML.size() - 1; i >= 0; i--) { - result.append(""); - } - return result.toString(); - } - - /** - * 转换为Double类型 - */ - public static Double toDouble(Object val) { - if (val == null) { - return 0D; - } - try { - return Double.valueOf(trim(val.toString())); - } catch (Exception e) { - return 0D; - } - } - - /** - * 转换为Float类型 - */ - public static Float toFloat(Object val) { - return toDouble(val).floatValue(); - } - - /** - * 转换为Long类型 - */ - public static Long toLong(Object val) { - return toDouble(val).longValue(); - } - - /** - * 转换为Integer类型 - */ - public static Integer toInteger(Object val) { - return toLong(val).intValue(); - } - - /** - * 获得i18n字符串 - */ - public static String getMessage(String code, Object[] args) { - LocaleResolver localLocaleResolver = (LocaleResolver) SpringContextHolder.getBean(LocaleResolver.class); - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()) - .getRequest(); - Locale localLocale = localLocaleResolver.resolveLocale(request); - return SpringContextHolder.getApplicationContext().getMessage(code, args, localLocale); - } - - /** - * 获得用户远程地址 - */ - public static String getRemoteAddr(HttpServletRequest request) { - String remoteAddr = request.getHeader("X-Real-IP"); - if (isNotBlank(remoteAddr)) { - remoteAddr = request.getHeader("X-Forwarded-For"); - } else if (isNotBlank(remoteAddr)) { - remoteAddr = request.getHeader("Proxy-Client-IP"); - } else if (isNotBlank(remoteAddr)) { - remoteAddr = request.getHeader("WL-Proxy-Client-IP"); - } - return remoteAddr != null ? remoteAddr : request.getRemoteAddr(); - } - - /** - * 驼峰命名法工具 - * - * @return toCamelCase("hello_world") == "helloWorld" - * toCapitalizeCamelCase("hello_world") == "HelloWorld" - * toUnderScoreCase("helloWorld") = "hello_world" - */ - public static String toCamelCase(String s) { - if (s == null) { - return null; - } - - s = s.toLowerCase(); - - StringBuilder sb = new StringBuilder(s.length()); - boolean upperCase = false; - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - if (c == SEPARATOR) { - upperCase = true; - } else if (upperCase) { - sb.append(Character.toUpperCase(c)); - upperCase = false; - } else { - sb.append(c); - } - } - - return sb.toString(); - } - - /** - * 驼峰命名法工具 - * - * @return toCamelCase("hello_world") == "helloWorld" - * toCapitalizeCamelCase("hello_world") == "HelloWorld" - * toUnderScoreCase("helloWorld") = "hello_world" - */ - public static String toCapitalizeCamelCase(String s) { - if (s == null) { - return null; - } - s = toCamelCase(s); - return s.substring(0, 1).toUpperCase() + s.substring(1); - } - - /** - * 驼峰命名法工具 - * - * @return toCamelCase("hello_world") == "helloWorld" - * toCapitalizeCamelCase("hello_world") == "HelloWorld" - * toUnderScoreCase("helloWorld") = "hello_world" - */ - public static String toUnderScoreCase(String s) { - if (s == null) { - return null; - } - - StringBuilder sb = new StringBuilder(); - boolean upperCase = false; - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - boolean nextUpperCase = true; - - if (i < (s.length() - 1)) { - nextUpperCase = Character.isUpperCase(s.charAt(i + 1)); - } - - if ((i > 0) && Character.isUpperCase(c)) { - if (!upperCase || !nextUpperCase) { - sb.append(SEPARATOR); - } - upperCase = true; - } else { - upperCase = false; - } - - sb.append(Character.toLowerCase(c)); - } - - return sb.toString(); - } - - /** - * 如果不为空,则设置值 - * - * @param target - * @param source - */ - public static void setValueIfNotBlank(String target, String source) { - if (isNotBlank(source)) { - target = source; - } - } - - /** - * 转换为JS获取对象值,生成三目运算返回结果 - * - * @param objectString - * 对象串 例如:row.user.id - * 返回:!row?'':!row.user?'':!row.user.id?'':row.user.id - */ - public static String jsGetVal(String objectString) { - StringBuilder result = new StringBuilder(); - StringBuilder val = new StringBuilder(); - String[] vals = split(objectString, "."); - for (int i = 0; i < vals.length; i++) { - val.append("." + vals[i]); - result.append("!" + (val.substring(1)) + "?'':"); - } - result.append(val.substring(1)); - return result.toString(); - } - - /** - * 生成安全的密码,生成随机的16位salt并经过1024次 sha-1 hash - */ - public static String entryptPassword(String plainPassword) { - byte[] salt = Digests.generateSalt(SALT_SIZE); - byte[] hashPassword = Digests.sha1(plainPassword.getBytes(), salt, HASH_INTERATIONS); - return Encodes.encodeHex(salt) + Encodes.encodeHex(hashPassword); - } - - /** - * 验证密码 - * - * @param plainPassword - * 明文密码 - * @param password - * 密文密码 - * @return 验证成功返回true - */ - public static boolean validatePassword(String plainPassword, String password) { - byte[] salt = Encodes.decodeHex(password.substring(0, 16)); - byte[] hashPassword = Digests.sha1(plainPassword.getBytes(), salt, HASH_INTERATIONS); - return password.equals(Encodes.encodeHex(salt) + Encodes.encodeHex(hashPassword)); - } - - /** - * 获取上传文件的根目录 - * - * @return - */ - public static String getUserfilesBaseDir() { - String dir = Configurations.getStringProperty("userfiles.basedir", ""); - try { - if (StringUtils.isBlank(dir)) { - dir = ServletContextFactory.getServletContext().getRealPath("/"); - } else { - dir = ServletContextFactory.getServletContext().getRealPath("/") + dir; - } - } catch (Exception e) { - return ""; - } - - if (!dir.endsWith("/")) { - dir += "/"; - } - return dir; - } - - /** - * - *

- * 判断字符串是否为空. 为空条件:全角\半角\tab 等没有实际意义的字符. - * 具体参看{@link Character#isWhitespace(char)}对空格的定义. - *

- * - *
-	* StringUtils.isBlank("  ") = true 为半角空格
-	* StringUtils.isBlank("  ") = true 为全角空格
-	* StringUtils.isBlank("	") = true 为tab键
-	 * 
- * - * @param str - * 字符串 - * @return true 字符串为空 ,false 不为空 - */ - public static boolean strIsBlank(String str) { - int strLen; - if (str == null || (strLen = str.length()) == 0) { - return true; - } - for (int i = 0; i < strLen; i++) { - if ((Character.isWhitespace(str.charAt(i)) == false)) { - return false; - } - } - return true; - } - - /** - * 截取转义页面字符串 - * @param str - * @param len - * @return - */ - public static String stringFormat(String str,int len){ - if(str==null||str.trim().equals("")||str.trim().equals("null")){ - return ""; - } - - if(len!=-1){ - try { - StringBuilder sb = new StringBuilder(); - int currentLength = 0; - for (char c : str.toCharArray()) { - currentLength += String.valueOf(c).getBytes("GBK").length; - if (currentLength <= len - 3) { - sb.append(c); - } else { - sb.append("..."); - break; - } - } - return Encodes.escapeHtml(sb.toString()); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - return str; - } - - public static String revertStr(String str,String regex){ - String[] split = str.split(regex); - String value = ""; - for (int i = split.length-1; i >= 0 ; i--) { - if( i != 0) { - value += split[i]+"/"; - }else { - value += split[i]; - } - - } - return value; - } -} +/** + * Copyright © 2012-2014 JeeSite All rights reserved. + */ +package com.nis.util; + +import java.io.UnsupportedEncodingException; +import java.util.List; +import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringEscapeUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.LocaleResolver; + +import com.ckfinder.connector.ServletContextFactory; +import com.google.common.collect.Lists; +import com.nis.web.service.SpringContextHolder; + +/** + * 字符串工具类, 继承org.apache.commons.lang3.StringUtils类 + * + * @author ThinkGem + * @version 2013-05-22 + */ +public class StringUtils extends org.apache.commons.lang3.StringUtils { + + private static final char SEPARATOR = '_'; + private static final String CHARSET_NAME = "UTF-8"; + public static final String HASH_ALGORITHM = "SHA-1"; + public static final int HASH_INTERATIONS = 1024; + public static final int SALT_SIZE = 8; + + /** + * 转换为字节数组 + * + * @param str + * @return + */ + public static byte[] getBytes(String str) { + if (str != null) { + try { + return str.getBytes(CHARSET_NAME); + } catch (UnsupportedEncodingException e) { + return null; + } + } else { + return null; + } + } + + /** + * 转换为字节数组 + * + * @param str + * @return + */ + public static String toString(byte[] bytes) { + try { + return new String(bytes, CHARSET_NAME); + } catch (UnsupportedEncodingException e) { + return EMPTY; + } + } + + /** + * 是否包含字符串 + * + * @param str + * 验证字符串 + * @param strs + * 字符串组 + * @return 包含返回true + */ + public static boolean inString(String str, String... strs) { + if (str != null) { + for (String s : strs) { + if (str.equals(trim(s))) { + return true; + } + } + } + return false; + } + + /** + * 替换掉HTML标签方法 + */ + public static String replaceHtml(String html) { + if (isBlank(html)) { + return ""; + } + String regEx = "<.+?>"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(html); + String s = m.replaceAll(""); + return s; + } + + /** + * 替换为手机识别的HTML,去掉样式及属性,保留回车。 + * + * @param html + * @return + */ + public static String replaceMobileHtml(String html) { + if (html == null) { + return ""; + } + return html.replaceAll("<([a-z]+?)\\s+?.*?>", "<$1>"); + } + + /** + * 替换为手机识别的HTML,去掉样式及属性,保留回车。 + * + * @param txt + * @return + */ + public static String toHtml(String txt) { + if (txt == null) { + return ""; + } + return replace(replace(Encodes.escapeHtml(txt), "\n", "
"), "\t", "    "); + } + + /** + * 缩略字符串(不区分中英文字符) + * + * @param str + * 目标字符串 + * @param length + * 截取长度 + * @return + */ + public static String abbr(String str, int length) { + if (str == null) { + return ""; + } + try { + StringBuilder sb = new StringBuilder(); + int currentLength = 0; + for (char c : replaceHtml(StringEscapeUtils.unescapeHtml4(str)).toCharArray()) { + currentLength += String.valueOf(c).getBytes("GBK").length; + if (currentLength <= length - 3) { + sb.append(c); + } else { + sb.append("..."); + break; + } + } + return sb.toString(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return ""; + } + + public static String abbr2(String param, int length) { + if (param == null) { + return ""; + } + StringBuffer result = new StringBuffer(); + int n = 0; + char temp; + boolean isCode = false; // 是不是HTML代码 + boolean isHTML = false; // 是不是HTML特殊字符,如  + for (int i = 0; i < param.length(); i++) { + temp = param.charAt(i); + if (temp == '<') { + isCode = true; + } else if (temp == '&') { + isHTML = true; + } else if (temp == '>' && isCode) { + n = n - 1; + isCode = false; + } else if (temp == ';' && isHTML) { + isHTML = false; + } + try { + if (!isCode && !isHTML) { + n += String.valueOf(temp).getBytes("GBK").length; + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + if (n <= length - 3) { + result.append(temp); + } else { + result.append("..."); + break; + } + } + // 取出截取字符串中的HTML标记 + String temp_result = result.toString().replaceAll("(>)[^<>]*(]*/?>", + ""); + // 去掉成对的HTML标记 + temp_result = temp_result.replaceAll("<([a-zA-Z]+)[^<>]*>(.*?)", "$2"); + // 用正则表达式取出标记 + Pattern p = Pattern.compile("<([a-zA-Z]+)[^<>]*>"); + Matcher m = p.matcher(temp_result); + List endHTML = Lists.newArrayList(); + while (m.find()) { + endHTML.add(m.group(1)); + } + // 补全不成对的HTML标记 + for (int i = endHTML.size() - 1; i >= 0; i--) { + result.append(""); + } + return result.toString(); + } + + /** + * 转换为Double类型 + */ + public static Double toDouble(Object val) { + if (val == null) { + return 0D; + } + try { + return Double.valueOf(trim(val.toString())); + } catch (Exception e) { + return 0D; + } + } + + /** + * 转换为Float类型 + */ + public static Float toFloat(Object val) { + return toDouble(val).floatValue(); + } + + /** + * 转换为Long类型 + */ + public static Long toLong(Object val) { + return toDouble(val).longValue(); + } + + /** + * 转换为Integer类型 + */ + public static Integer toInteger(Object val) { + return toLong(val).intValue(); + } + + /** + * 获得i18n字符串 + */ + public static String getMessage(String code, Object[] args) { + LocaleResolver localLocaleResolver = (LocaleResolver) SpringContextHolder.getBean(LocaleResolver.class); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()) + .getRequest(); + Locale localLocale = localLocaleResolver.resolveLocale(request); + return SpringContextHolder.getApplicationContext().getMessage(code, args, localLocale); + } + + /** + * 获得用户远程地址 + */ + public static String getRemoteAddr(HttpServletRequest request) { + String remoteAddr = request.getHeader("X-Real-IP"); + if (isBlank(remoteAddr)) { + remoteAddr = request.getHeader("X-Forwarded-For"); + } else if (isBlank(remoteAddr)) { + remoteAddr = request.getHeader("Proxy-Client-IP"); + } else if (isBlank(remoteAddr)) { + remoteAddr = request.getHeader("WL-Proxy-Client-IP"); + } + return remoteAddr != null ? remoteAddr : request.getRemoteAddr(); + } + + /** + * 驼峰命名法工具 + * + * @return toCamelCase("hello_world") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + public static String toCamelCase(String s) { + if (s == null) { + return null; + } + + s = s.toLowerCase(); + + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + if (c == SEPARATOR) { + upperCase = true; + } else if (upperCase) { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } else { + sb.append(c); + } + } + + return sb.toString(); + } + + /** + * 驼峰命名法工具 + * + * @return toCamelCase("hello_world") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + public static String toCapitalizeCamelCase(String s) { + if (s == null) { + return null; + } + s = toCamelCase(s); + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + + /** + * 驼峰命名法工具 + * + * @return toCamelCase("hello_world") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + public static String toUnderScoreCase(String s) { + if (s == null) { + return null; + } + + StringBuilder sb = new StringBuilder(); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + boolean nextUpperCase = true; + + if (i < (s.length() - 1)) { + nextUpperCase = Character.isUpperCase(s.charAt(i + 1)); + } + + if ((i > 0) && Character.isUpperCase(c)) { + if (!upperCase || !nextUpperCase) { + sb.append(SEPARATOR); + } + upperCase = true; + } else { + upperCase = false; + } + + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 如果不为空,则设置值 + * + * @param target + * @param source + */ + public static void setValueIfNotBlank(String target, String source) { + if (isNotBlank(source)) { + target = source; + } + } + + /** + * 转换为JS获取对象值,生成三目运算返回结果 + * + * @param objectString + * 对象串 例如:row.user.id + * 返回:!row?'':!row.user?'':!row.user.id?'':row.user.id + */ + public static String jsGetVal(String objectString) { + StringBuilder result = new StringBuilder(); + StringBuilder val = new StringBuilder(); + String[] vals = split(objectString, "."); + for (int i = 0; i < vals.length; i++) { + val.append("." + vals[i]); + result.append("!" + (val.substring(1)) + "?'':"); + } + result.append(val.substring(1)); + return result.toString(); + } + + /** + * 生成安全的密码,生成随机的16位salt并经过1024次 sha-1 hash + */ + public static String entryptPassword(String plainPassword) { + byte[] salt = Digests.generateSalt(SALT_SIZE); + byte[] hashPassword = Digests.sha1(plainPassword.getBytes(), salt, HASH_INTERATIONS); + return Encodes.encodeHex(salt) + Encodes.encodeHex(hashPassword); + } + + /** + * 验证密码 + * + * @param plainPassword + * 明文密码 + * @param password + * 密文密码 + * @return 验证成功返回true + */ + public static boolean validatePassword(String plainPassword, String password) { + byte[] salt = Encodes.decodeHex(password.substring(0, 16)); + byte[] hashPassword = Digests.sha1(plainPassword.getBytes(), salt, HASH_INTERATIONS); + return password.equals(Encodes.encodeHex(salt) + Encodes.encodeHex(hashPassword)); + } + + /** + * 获取上传文件的根目录 + * + * @return + */ + public static String getUserfilesBaseDir() { + String dir = Configurations.getStringProperty("userfiles.basedir", ""); + try { + if (StringUtils.isBlank(dir)) { + dir = ServletContextFactory.getServletContext().getRealPath("/"); + } else { + dir = ServletContextFactory.getServletContext().getRealPath("/") + dir; + } + } catch (Exception e) { + return ""; + } + + if (!dir.endsWith("/")) { + dir += "/"; + } + return dir; + } + + /** + * + *

+ * 判断字符串是否为空. 为空条件:全角\半角\tab 等没有实际意义的字符. + * 具体参看{@link Character#isWhitespace(char)}对空格的定义. + *

+ * + *
+	* StringUtils.isBlank("  ") = true 为半角空格
+	* StringUtils.isBlank("  ") = true 为全角空格
+	* StringUtils.isBlank("	") = true 为tab键
+	 * 
+ * + * @param str + * 字符串 + * @return true 字符串为空 ,false 不为空 + */ + public static boolean strIsBlank(String str) { + int strLen; + if (str == null || (strLen = str.length()) == 0) { + return true; + } + for (int i = 0; i < strLen; i++) { + if ((Character.isWhitespace(str.charAt(i)) == false)) { + return false; + } + } + return true; + } + + /** + * 截取转义页面字符串 + * @param str + * @param len + * @return + */ + public static String stringFormat(String str,int len){ + if(str==null||str.trim().equals("")||str.trim().equals("null")){ + return ""; + } + + if(len!=-1){ + try { + StringBuilder sb = new StringBuilder(); + int currentLength = 0; + for (char c : str.toCharArray()) { + currentLength += String.valueOf(c).getBytes("GBK").length; + if (currentLength <= len - 3) { + sb.append(c); + } else { + sb.append("..."); + break; + } + } + return Encodes.escapeHtml(sb.toString()); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + return str; + } + + public static String revertStr(String str,String regex){ + String[] split = str.split(regex); + String value = ""; + for (int i = split.length-1; i >= 0 ; i--) { + if( i != 0) { + value += split[i]+"/"; + }else { + value += split[i]; + } + + } + return value; + } +} diff --git a/src/main/java/com/nis/util/excel/ExcelCsv.java b/src/main/java/com/nis/util/excel/ExcelCsv.java index dc9bd3447..6d6e04cd6 100644 --- a/src/main/java/com/nis/util/excel/ExcelCsv.java +++ b/src/main/java/com/nis/util/excel/ExcelCsv.java @@ -130,6 +130,9 @@ public class ExcelCsv { Map> commentMap=new HashMap>(); for (String title : titleList) { String noExportField=noExportMap.get(title); + if(noExportField.contains("do_log")){ + noExportField=",do_blacklist,"+noExportField; + } List annotationList = Lists.newArrayList(); List list=new ArrayList(); // 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())){ diff --git a/src/main/java/com/nis/util/excel/ExportExcel.java b/src/main/java/com/nis/util/excel/ExportExcel.java index 437c05430..ad4edaaff 100644 --- a/src/main/java/com/nis/util/excel/ExportExcel.java +++ b/src/main/java/com/nis/util/excel/ExportExcel.java @@ -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 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 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 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 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> commentMap=new HashMap>(); for (String title : titleList) { String noExportField=noExportMap.get(title); + if(noExportField.contains("do_log")){ + noExportField=",do_blacklist,"+noExportField; + } List annotationList = Lists.newArrayList(); List list=new ArrayList(); // 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 输出数据流 diff --git a/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java new file mode 100644 index 000000000..106d24e7e --- /dev/null +++ b/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java @@ -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{ + private Logger logger=Logger.getLogger(CheckAppFeatureComplexStringFormatThread.class); + private BlockingQueue srcQueue; + private BlockingQueue destQueue; + private Properties prop; + private FunctionServiceDict serviceDict; + private FunctionRegionDict regionDict; + + public CheckAppFeatureComplexStringFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue srcQueue,BlockingQueue destQueue) { + this.serviceDict=serviceDict; + this.regionDict=regionDict; + this.srcQueue=srcQueue; + this.destQueue=destQueue; + this.prop=prop; + + } + @Override + public String call() throws Exception { + List 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 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 checkAppComplexFeatureCfg(StringBuffer msg, + List list) throws ServiceException { + logger.warn("start to validate appfeaturecomplexString data..."); + long start=System.currentTimeMillis(); + List stringList = new ArrayList(); + 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 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("
"); + }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; + } +} diff --git a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java index d9469a734..20bd6bf07 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java @@ -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{ 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{ } } } + // 代理HTTP(s)阻断 + if (regionDict.getFunctionId().equals(207)) { + String userRegion1 = baseStringCfg.getUserRegion1();// 应答码 + if (StringUtils.isNotBlank(userRegion1)) { + List 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 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 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.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{ 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")+ ";"); } } diff --git a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java index be6b0fb91..5d849ba57 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java @@ -103,6 +103,11 @@ public class CheckIpFormatThread implements Callable{ 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{ baseIpCfg.setAntiddosProtocol(""); } } + // 代理HTTP(s)阻断 + if (regionDict.getFunctionId().equals(207)) { + String userRegion1 = baseIpCfg.getUserRegion1();// 应答码 + if (StringUtils.isNotBlank(userRegion1)) { + List 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 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 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; diff --git a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java index e50768a3c..df3afa7b7 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java @@ -88,6 +88,14 @@ public class CheckStringFormatThread implements Callable{ 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{ } } } + // 代理HTTP(s)阻断 + if (regionDict.getFunctionId().equals(207)) { + String userRegion1 = baseStringCfg.getUserRegion1();// 应答码 + if (StringUtils.isNotBlank(userRegion1)) { + List 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 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 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.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{ 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")+ ";"); } } diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 35f5dbfc8..300264f7f 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -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 checkAppComplexFeatureStringCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,BlockingQueue list) throws InterruptedException, ExecutionException, ServiceException{ + logger.warn("start checkAppComplexFeatureStringCfgMulity ,size "+list.size()); + long start=System.currentTimeMillis(); + BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); + ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); + List> futures=new ArrayList<>(); + for(int i=0;i 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> stringCfgs =null; BlockingQueue complexkeywordCfgs =null; BlockingQueue dnsResStrategies=null; + BlockingQueue appComplexFeatureCfgs=null; List cfgIndexInfos = new ArrayList(); List appPolicyCfgs = new ArrayList(); + List appFeatureIndexs= new ArrayList(); List> asnNoMaps=Lists.newArrayList(); Map newAsnNoMap=Maps.newConcurrentMap(); Map 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 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 list = ei.getDataList(DdosIpTemplate.class ); ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list); + }else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断 + BlockingQueue list = ei.getDataList(HttpsRejectIpTemplate.class ); + ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list); + }else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向 + BlockingQueue list = ei.getDataList(HttpsRedirectIpTemplate.class ); + ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list); + }else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换 + BlockingQueue list = ei.getDataList(HttpsReplaceIpTemplate.class ); + ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list); } else { BlockingQueue list = ei.getDataList(IpAllTemplate.class ); ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list); @@ -1307,6 +1379,15 @@ public class BaseController { BlockingQueue list = ei.getDataList(DomainInterceptTemplate.class); stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list); } + }else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断 + BlockingQueue list = ei.getDataList(HttpsRejectTemplate.class); + stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list); + }else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向 + BlockingQueue list = ei.getDataList(HttpsRedirectTemplate.class); + stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list); + }else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换 + BlockingQueue list = ei.getDataList(HttpsReplaceTemplate.class); + stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list); }else { BlockingQueue list = ei.getDataList(StringAllTemplate.class ); stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list); @@ -1317,6 +1398,18 @@ public class BaseController { BlockingQueue list = ei.getDataList(DnsComplexStringTemplate.class ); complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list); + } else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断 + BlockingQueue list = ei.getDataList(HttpsRejectComplexTemplate.class); + complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list); + } else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向 + BlockingQueue list = ei.getDataList(HttpsRedirectComplexTemplate.class); + complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list); + } else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换 + BlockingQueue list = ei.getDataList(HttpsReplaceComplexTemplate.class); + complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list); + } else if(regionDict.getFunctionId().equals(563)){// APP Payload + BlockingQueue list = ei.getDataList(AppPayloadTemplate.class); + appComplexFeatureCfgs = this.checkAppComplexFeatureStringCfgMulity(errTip,serviceDict, regionDict, list); } else { BlockingQueue 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 compileIds=Lists.newArrayList(); List regionIds=Lists.newArrayList(); List groupIds=Lists.newArrayList(); -// List numRegionGroupIds=Lists.newArrayList(); + List numRegionGroupIds=Lists.newArrayList(); List 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 _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); - while(!complexkeywordCfgs.isEmpty()) { - complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE); - List compileIds=Lists.newArrayList(); - try { - compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size()); - } catch (Exception e) { - e.printStackTrace(); - logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+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 _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); + while(!complexkeywordCfgs.isEmpty()) { + complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE); + List compileIds=Lists.newArrayList(); + List groupIds=Lists.newArrayList(); + List 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(":"+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 _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); + while(!appComplexFeatureCfgs.isEmpty()) { + appComplexFeatureCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE); + List compileIds=Lists.newArrayList(); + List groupIds=Lists.newArrayList(); + List 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(":"+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> serviceList = serviceTemplate.getServiceList(functionId); + List> serviceList = serviceTemplate.getServiceListByFunctionId(functionId); for(Map service:serviceList){ String tableNameXml = service.get("tableName").toString(); diff --git a/src/main/java/com/nis/web/controller/basics/AsnIpController.java b/src/main/java/com/nis/web/controller/basics/AsnIpController.java index d78ccde84..9f2aa1202 100644 --- a/src/main/java/com/nis/web/controller/basics/AsnIpController.java +++ b/src/main/java/com/nis/web/controller/basics/AsnIpController.java @@ -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 policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4); // model.addAttribute("policyGroups", policyGroups); - AsnCacheUtils.init(false); - List policyGroups=AsnCacheUtils.getAllAsnGroup(); - model.addAttribute("policyGroups", policyGroups); +// AsnCacheUtils.init(false); +// List policyGroups=AsnCacheUtils.getAllAsnGroup(); +// model.addAttribute("policyGroups", policyGroups); return "/basics/asnIpCfgList"; } @RequestMapping(value = {"/addForm"}) @@ -186,33 +183,50 @@ public class AsnIpController extends BaseController{ Map> classMap=new HashMap>(); Map dataMap=new HashMap(); Map noExportMap=new HashMap(); - - - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{*/ - //条件导出数据大于最大导出数,只导出最大导出条数 - entity.setTableName(IpPortCfg.getTablename()); + List list = new ArrayList(); + if (!StringUtil.isEmpty(ids)) { + list = asnIpCfgService.findByPage(ids); + } else { Page pageInfo=new Page(request, response,"r"); pageInfo.setPageNo(1); pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); Page 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"); diff --git a/src/main/java/com/nis/web/controller/basics/PolicyGroupController.java b/src/main/java/com/nis/web/controller/basics/PolicyGroupController.java index 41c4c4300..8cef98d7b 100644 --- a/src/main/java/com/nis/web/controller/basics/PolicyGroupController.java +++ b/src/main/java/com/nis/web/controller/basics/PolicyGroupController.java @@ -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 titleList=new ArrayList(); + Map> classMap=new HashMap>(); + Map dataMap=new HashMap(); + Map noExportMap=new HashMap(); + List list = new ArrayList(); + if (!StringUtil.isEmpty(ids)) { + list = policyGroupInfoService.findPolicyByGroupInfoList(ids); + } else { + Page pageInfo=new Page(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(); + } + } diff --git a/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java b/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java index 02d5965c1..70118cee7 100644 --- a/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java +++ b/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java @@ -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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List list = Lists.newArrayList(); + List intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType); + //处理数据 + if (!StringUtil.isEmpty(ids)) { + list = serviceDictInfoService.findByDictInfo(ids,intArr); + } else { + + Page pageCondition = new Page(request, response); + pageCondition.setPageNo(1); + pageCondition.setPageSize(Constants.MAX_EXPORT_SIZE); + //查询符合条件总数 + List allList = serviceDictInfoService.findAllServiceDictInfo(serviceDictInfo,intArr,pageCondition.getOrderBy()); + //查出顶层分页数据 + Page page = serviceDictInfoService.findTopDictList(pageCondition, serviceDictInfo,intArr); + // 删除顶层数据、取出id + List 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 dict=ConfigDictUtils.getItemTypeByNo("SERVICE_DICT_ITM_TYPE",intArr); + if(dict.size()>0){ + dicName=msgProp.getProperty(dict.get(0),dict.get(0)); + } + return dicName; + } + } diff --git a/src/main/java/com/nis/web/controller/basics/TaskInfoController.java b/src/main/java/com/nis/web/controller/basics/TaskInfoController.java index d43774474..1d2e298d9 100644 --- a/src/main/java/com/nis/web/controller/basics/TaskInfoController.java +++ b/src/main/java/com/nis/web/controller/basics/TaskInfoController.java @@ -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 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; + } } diff --git a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java index b421742ac..00c2b9c13 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -58,6 +58,7 @@ import com.nis.web.security.UserUtils; /** * 特定协议相关配置控制类 + * * @author zhangwei * */ @@ -66,61 +67,69 @@ import com.nis.web.security.UserUtils; public class AppCfgController extends BaseController { /** * app策略列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"policyCfgList"}) - public String policyCfgList(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "policyCfgList" }) + public String policyCfgList(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page 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(); -// second.setCfgType(1); -// second.setIsValid(Constants.VALID_YES); -// second.setIsLeaf(1); -// List 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(); + // second.setCfgType(1); + // second.setIsValid(Constants.VALID_YES); + // second.setIsLeaf(1); + // List + // 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/app/appPolicyCfgList"; } + /** * ajax设置Name + * * @param model * @param ids * @return */ - @RequestMapping(value="ajaxAppName",method=RequestMethod.POST) + @RequestMapping(value = "ajaxAppName", method = RequestMethod.POST) @ResponseBody - public List> ajaxAppName(Model model,String ids){ - List> dataList=new ArrayList<>(); - List serviceList=specificServiceCfgService.getBySpecServiceCodes(ids); - Map appMap=new HashMap<>(); - Map behavMap=new HashMap<>(); - for(SpecificServiceCfg cfg:serviceList) { - if(cfg.getIsLeaf().intValue()==0) { + public List> ajaxAppName(Model model, String ids) { + List> dataList = new ArrayList<>(); + List serviceList = specificServiceCfgService.getBySpecServiceCodes(ids); + Map appMap = new HashMap<>(); + Map behavMap = new HashMap<>(); + for (SpecificServiceCfg cfg : serviceList) { + if (cfg.getIsLeaf().intValue() == 0) { appMap.put(cfg.getSpecServiceCode().toString(), cfg.getSpecServiceName()); - }else { + } else { behavMap.put(cfg.getSpecServiceCode().toString(), cfg.getSpecServiceName()); } } @@ -128,61 +137,67 @@ public class AppCfgController extends BaseController { dataList.add(behavMap); return dataList; } + /** * 查询APP策略IP子配置 + * * @param model * @param cfgId * @param index * @return */ - @RequestMapping(value = {"ajaxAppPolicyIpList"}) - public String ajaxSslSubList(Model model,Long cfgId,Integer index,Integer compileId) { - AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId,compileId); + @RequestMapping(value = { "ajaxAppPolicyIpList" }) + public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) { + AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId); List 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/app/appPolicySubList"; } + /** * 策略配置表单 + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"policyCfgForm"}) - @RequiresPermissions(value={"app:policy: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 = { "policyCfgForm" }) + @RequiresPermissions(value = { "app:policy: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/app/appPolicyCfgForm"; } + /** * 策略配置新增修改 + * * @param model * @param request * @param response @@ -190,31 +205,34 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppPolicyCfg"}) - @RequiresPermissions(value={"app:policy:config"}) - public String saveAppPolicyCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppPolicyCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppPolicyCfg" }) + @RequiresPermissions(value = { "app:policy: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) { - logger.error("saveAppPolicyCfg failed",e); + logger.error("saveAppPolicyCfg failed", e); e.printStackTrace(); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/app/policyCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + entity.getFunctionId(); } + /** * 策略配置审核 + * * @param isAudit * @param isValid * @param ids @@ -222,21 +240,16 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppPolicyCfg"}) - @RequiresPermissions(value={"app:policy: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 = { "auditAppPolicyCfg" }) + @RequiresPermissions(value = { "app:policy: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()); @@ -244,96 +257,104 @@ public class AppCfgController extends BaseController { entity.setFunctionId(functionId); entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP); try { - appCfgService.auditAppPolicyCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppPolicyCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("app策略配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app策略配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 +"/app/policyCfgList?functionId="+functionId; + + return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + functionId; } + /** * 策略配置删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppPolicyCfgValid"}) - @RequiresPermissions(value={"app:policy:config"}) - public String updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppPolicyCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/policyCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppPolicyCfgValid" }) + @RequiresPermissions(value = { "app:policy:config" }) + public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + functionId; } - + /** * app协议IP配置列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"ipCfgList"}) - public String ipCfgList(Model model,@ModelAttribute("cfg")AppIpCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "ipCfgList" }) + public String ipCfgList(Model model, @ModelAttribute("cfg") AppIpCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppIpList(searchPage, cfg); - for(AppIpCfg entity:page.getList()){ + for (AppIpCfg 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/appIpCfgList"; } + /** * 协议IP配置表单 + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"ipCfgForm"}) - @RequiresPermissions(value={"app:ip:config"}) - public String ipCfgForm(Model model,String ids,AppIpCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "ipCfgForm" }) + @RequiresPermissions(value = { "app:ip:config" }) + public String ipCfgForm(Model model, String ids, AppIpCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppIpCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appIpCfgForm"; } + /** * 协议IP配置新增修改 + * * @param model * @param request * @param response @@ -341,31 +362,34 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppIpCfg"}) - @RequiresPermissions(value={"app:ip:config"}) - public String saveAppIpCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppIpCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppIpCfg" }) + @RequiresPermissions(value = { "app:ip:config" }) + public String saveAppIpCfg(Model model, HttpServletRequest request, HttpServletResponse response, AppIpCfg 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.saveOrUpdateAppIpCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("saveAppIpCfg failed",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + logger.error("saveAppIpCfg failed", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/app/ipCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + entity.getFunctionId(); } + /** * 协议IP配置审核 + * * @param isAudit * @param isValid * @param ids @@ -373,22 +397,17 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppIpCfg"}) - @RequiresPermissions(value={"app:ip:confirm"}) - public String auditAppIpCfg(Model model,@ModelAttribute("cfg")AppIpCfg cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)) { + @RequestMapping(value = { "auditAppIpCfg" }) + @RequiresPermissions(value = { "app:ip:confirm" }) + public String auditAppIpCfg(Model model, @ModelAttribute("cfg") AppIpCfg cfg, Integer isValid, Integer isAudit, + String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response, + HttpServletRequest request) { + if (!StringUtil.isEmpty(ids)) { AppIpCfg entity = new AppIpCfg(); String[] idArray = ids.split(","); - //同一编译IP的分组 - Map> dataMap=new HashMap<>(); - for(String id :idArray){ + // 同一编译IP的分组 + Map> dataMap = new HashMap<>(); + for (String id : idArray) { entity = appCfgService.getAppIpCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -396,106 +415,116 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); entity.setTableName(AppIpCfg.getTablename()); - if(dataMap.containsKey(entity.getCompileId())) { + if (dataMap.containsKey(entity.getCompileId())) { dataMap.get(entity.getCompileId()).add(entity); - }else { - List ipList=new ArrayList<>(); + } else { + List ipList = new ArrayList<>(); ipList.add(entity); dataMap.put(entity.getCompileId(), ipList); } } - for(List entitys:dataMap.values()) { + for (List entitys : dataMap.values()) { try { - appCfgService.auditAppIpCfg(entitys,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppIpCfg(entitys, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("app协议IP配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app协议IP配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 ipCfgList(model, cfg, request, response); } - - return "redirect:" + adminPath +"/app/ipCfgList?functionId="+functionId; + + return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + functionId; } + /** * IP配置删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppIpCfgValid"}) - @RequiresPermissions(value={"app:ip:config"}) - public String updateAppIpCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppIpCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/ipCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppIpCfgValid" }) + @RequiresPermissions(value = { "app:ip:config" }) + public String updateAppIpCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppIpCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + functionId; } + /** * app协议http配置列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"httpCfgList"}) - public String httpCfgList(Model model,@ModelAttribute("cfg")AppHttpCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "httpCfgList" }) + public String httpCfgList(Model model, @ModelAttribute("cfg") AppHttpCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppHttpList(searchPage, cfg); - for(AppHttpCfg entity:page.getList()){ + for (AppHttpCfg entity : page.getList()) { SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); entity.setAppName(app.getSpecServiceName()); -// entity.setCfgKeywords(entity.getCfgKeywords().replace(Constants.KEYWORD_EXPR, "&")); + // entity.setCfgKeywords(entity.getCfgKeywords().replace(Constants.KEYWORD_EXPR, + // "&")); } model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/app/appHttpCfgList"; } + /** * 协议http配置表单 + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"httpCfgForm"}) - @RequiresPermissions(value={"app:http:config"}) - public String httpCfgForm(Model model,String ids,AppHttpCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "httpCfgForm" }) + @RequiresPermissions(value = { "app:http:config" }) + public String httpCfgForm(Model model, String ids, AppHttpCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppHttpCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appHttpCfgForm"; } + /** * http配置新增修改 + * * @param model * @param request * @param response @@ -503,31 +532,34 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppHttpCfg"}) - @RequiresPermissions(value={"app:http:config"}) - public String saveAppHttpCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppHttpCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppHttpCfg" }) + @RequiresPermissions(value = { "app:http:config" }) + public String saveAppHttpCfg(Model model, HttpServletRequest request, HttpServletResponse response, + AppHttpCfg 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.saveOrUpdateAppHttpCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { e.printStackTrace(); logger.error("saveAppHttpCfg 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 +"/app/httpCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/httpCfgList?functionId=" + entity.getFunctionId(); } + /** * http配置审核 + * * @param isAudit * @param isValid * @param ids @@ -535,20 +567,15 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppHttpCfg"}) -// @RequiresPermissions(value={"app:http:confirm"}) - public String auditAppHttpCfg(Model model,@ModelAttribute("cfg")AppHttpCfg cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + @RequestMapping(value = { "auditAppHttpCfg" }) + // @RequiresPermissions(value={"app:http:confirm"}) + public String auditAppHttpCfg(Model model, @ModelAttribute("cfg") AppHttpCfg cfg, Integer isValid, Integer isAudit, + String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response, + HttpServletRequest request) { + if (!StringUtil.isEmpty(ids)) { AppHttpCfg entity = new AppHttpCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = appCfgService.getAppHttpCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -556,94 +583,103 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - appCfgService.auditAppHttpCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppHttpCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("app http配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app http配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 httpCfgList(model, cfg, request, response); } - return "redirect:" + adminPath +"/app/httpCfgList?functionId="+functionId; + return "redirect:" + adminPath + "/app/httpCfgList?functionId=" + functionId; } + /** * http配置删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppHttpCfgValid"}) - @RequiresPermissions(value={"app:http:config"}) - public String updateAppHttpCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppHttpCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/httpCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppHttpCfgValid" }) + @RequiresPermissions(value = { "app:http:config" }) + public String updateAppHttpCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppHttpCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/httpCfgList?functionId=" + functionId; } + /** * app协议domain配置列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"domainCfgList"}) - public String domainCfgList(Model model,@ModelAttribute("cfg")AppDomainCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "domainCfgList" }) + public String domainCfgList(Model model, @ModelAttribute("cfg") AppDomainCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppDomainList(searchPage, cfg); - for(AppDomainCfg entity:page.getList()){ + for (AppDomainCfg 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/appDomainCfgList"; } + /** * 协议domain配置表单 + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"domainCfgForm"}) - @RequiresPermissions(value={"app:domain:config"}) - public String domainCfgForm(Model model,String ids,AppDomainCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "domainCfgForm" }) + @RequiresPermissions(value = { "app:domain:config" }) + public String domainCfgForm(Model model, String ids, AppDomainCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppDomainCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appDomainCfgForm"; } -/** + + /** * domain配置新增修改 + * * @param model * @param request * @param response @@ -651,30 +687,33 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppDomainCfg"}) - @RequiresPermissions(value={"app:domain:config"}) - public String saveAppDomainCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppDomainCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppDomainCfg" }) + @RequiresPermissions(value = { "app:domain:config" }) + public String saveAppDomainCfg(Model model, HttpServletRequest request, HttpServletResponse response, + AppDomainCfg 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.saveOrUpdateAppDomainCfg(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/domainCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + entity.getFunctionId(); } + /** * domain配置审核 + * * @param isAudit * @param isValid * @param ids @@ -682,20 +721,15 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppDomainCfg"}) -// @RequiresPermissions(value={"app:domain:confirm"}) - public String auditAppDomainCfg(Model model,@ModelAttribute("cfg")AppDomainCfg cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + @RequestMapping(value = { "auditAppDomainCfg" }) + // @RequiresPermissions(value={"app:domain:confirm"}) + public String auditAppDomainCfg(Model model, @ModelAttribute("cfg") AppDomainCfg cfg, Integer isValid, + Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletResponse response, HttpServletRequest request) { + if (!StringUtil.isEmpty(ids)) { AppDomainCfg entity = new AppDomainCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = appCfgService.getAppDomainCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -703,94 +737,103 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - appCfgService.auditAppDomainCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppDomainCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("app协议domain配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app协议domain配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 domainCfgList(model, cfg, request, response); } - return "redirect:" + adminPath +"/app/domainCfgList?functionId="+functionId; + return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + functionId; } + /** * domain配置删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppDomainCfgValid"}) - @RequiresPermissions(value={"app:domain:config"}) - public String updateAppDomainCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppDomainCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/domainCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppDomainCfgValid" }) + @RequiresPermissions(value = { "app:domain:config" }) + public String updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppDomainCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + functionId; } + /** * app协议byte配置列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"byteCfgList"}) - public String byteCfgList(Model model,@ModelAttribute("cfg")AppByteCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "byteCfgList" }) + public String byteCfgList(Model model, @ModelAttribute("cfg") AppByteCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppByteList(searchPage, cfg); - for(AppByteCfg entity:page.getList()){ + for (AppByteCfg 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/appByteCfgList"; } + /** * 协议byte配置表单 + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"byteCfgForm"}) - @RequiresPermissions(value={"app:byte:config"}) - public String byteCfgForm(Model model,String ids,AppByteCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "byteCfgForm" }) + @RequiresPermissions(value = { "app:byte:config" }) + public String byteCfgForm(Model model, String ids, AppByteCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppByteCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appByteCfgForm"; } -/** + + /** * byte配置新增修改 + * * @param model * @param request * @param response @@ -798,31 +841,34 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppByteCfg"}) - @RequiresPermissions(value={"app:byte:config"}) - public String saveAppByteCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppByteCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppByteCfg" }) + @RequiresPermissions(value = { "app:byte:config" }) + public String saveAppByteCfg(Model model, HttpServletRequest request, HttpServletResponse response, + AppByteCfg 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.saveOrUpdateAppByteCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("saveAppByteCfg failed",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + logger.error("saveAppByteCfg failed", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/app/byteCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/byteCfgList?functionId=" + entity.getFunctionId(); } + /** * byte配置审核 + * * @param isAudit * @param isValid * @param ids @@ -830,12 +876,13 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppByteCfg"}) -// @RequiresPermissions(value={"app:byte:confirm"}) - public String auditAppByteCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "auditAppByteCfg" }) + // @RequiresPermissions(value={"app:byte:confirm"}) + public String auditAppByteCfg(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { AppByteCfg entity = new AppByteCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = appCfgService.getAppByteCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -843,75 +890,83 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - appCfgService.auditAppByteCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppByteCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("app协议byte配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app协议byte配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - return "redirect:" + adminPath +"/app/byteCfgList?functionId="+functionId; + return "redirect:" + adminPath + "/app/byteCfgList?functionId=" + functionId; } + /** * byte配置删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppByteCfgValid"}) - @RequiresPermissions(value={"app:byte:config"}) - public String updateAppByteCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppByteCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/byteCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppByteCfgValid" }) + @RequiresPermissions(value = { "app:byte:config" }) + public String updateAppByteCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppByteCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/byteCfgList?functionId=" + functionId; } - + /** * APP ssl证书特征配置 列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"sslCfgList"}) - public String sslCfgList(Model model,@ModelAttribute("cfg")AppSslCertCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "sslCfgList" }) + public String sslCfgList(Model model, @ModelAttribute("cfg") AppSslCertCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppSslList(searchPage, cfg); - for(AppSslCertCfg entity:page.getList()){ + for (AppSslCertCfg 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/appSslCfgList"; } + /** * APP ssl证书特征配置表单(新增/修改) + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"sslCfgForm"}) - @RequiresPermissions(value={"app:ssl:config"}) - public String sslCfgForm(Model model,String ids,AppSslCertCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "sslCfgForm" }) + @RequiresPermissions(value = { "app:ssl:config" }) + public String sslCfgForm(Model model, String ids, AppSslCertCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppSslCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appSslCfgForm"; } + /** * APP ssl证书特征配置(新增/修改)提交 + * * @param model * @param request * @param response @@ -919,31 +974,34 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppSslCfg"}) - @RequiresPermissions(value={"app:ssl:config"}) - public String saveAppSslCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppSslCertCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppSslCfg" }) + @RequiresPermissions(value = { "app:ssl:config" }) + public String saveAppSslCfg(Model model, HttpServletRequest request, HttpServletResponse response, + AppSslCertCfg 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.saveOrUpdateAppSslCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { e.printStackTrace(); logger.error("saveAppSslCfg 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 +"/app/sslCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/sslCfgList?functionId=" + entity.getFunctionId(); } + /** * APP ssl证书特征配置 审核 + * * @param isAudit * @param isValid * @param ids @@ -951,20 +1009,15 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppSslCfg"}) - @RequiresPermissions(value={"app:ssl:confirm"}) - public String auditAppSslCfg(Model model,@ModelAttribute("cfg")AppSslCertCfg cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + @RequestMapping(value = { "auditAppSslCfg" }) + @RequiresPermissions(value = { "app:ssl:confirm" }) + public String auditAppSslCfg(Model model, @ModelAttribute("cfg") AppSslCertCfg cfg, Integer isValid, + Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletResponse response, HttpServletRequest request) { + if (!StringUtil.isEmpty(ids)) { AppSslCertCfg entity = new AppSslCertCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = appCfgService.getAppSslCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -972,98 +1025,103 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - appCfgService.auditAppSslCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppSslCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { - logger.error("app SSL配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app SSL配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 sslCfgList(model, cfg, request, response); } - - return "redirect:" + adminPath +"/app/sslCfgList?functionId="+functionId; + + return "redirect:" + adminPath + "/app/sslCfgList?functionId=" + functionId; } + /** * APP ssl证书特征配置 删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppSslCfgValid"}) - @RequiresPermissions(value={"app:ssl:config"}) - public String updateAppSslCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppSslCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/sslCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppSslCfgValid" }) + @RequiresPermissions(value = { "app:ssl:config" }) + public String updateAppSslCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppSslCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/sslCfgList?functionId=" + functionId; } - /** * APP TCP会话字节数特征 列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"tcpCfgList"}) - public String tcpCfgList(Model model,@ModelAttribute("cfg")AppTcpCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "tcpCfgList" }) + public String tcpCfgList(Model model, @ModelAttribute("cfg") AppTcpCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppTcpList(searchPage, cfg); - for(AppTcpCfg entity:page.getList()){ + for (AppTcpCfg 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/appTcpCfgList"; } - + /** * APP TCP会话字节数特征表单(新增/修改) + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"tcpCfgForm"}) - @RequiresPermissions(value={"app:tcp:config"}) - public String tcpCfgForm(Model model,String ids,AppTcpCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "tcpCfgForm" }) + @RequiresPermissions(value = { "app:tcp:config" }) + public String tcpCfgForm(Model model, String ids, AppTcpCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppTcpCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appTcpCfgForm"; } - + /** * APP TCP会话字节数特征配置(新增/修改)提交 + * * @param model * @param request * @param response @@ -1071,47 +1129,49 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppTcpCfg"}) - @RequiresPermissions(value={"app:tcp:config"}) - public String saveAppTcpCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppTcpCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppTcpCfg" }) + @RequiresPermissions(value = { "app:tcp:config" }) + public String saveAppTcpCfg(Model model, HttpServletRequest request, HttpServletResponse response, AppTcpCfg 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.saveOrUpdateAppTcpeCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("saveAppTcpCfg failed",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + logger.error("saveAppTcpCfg failed", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/app/tcpCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/tcpCfgList?functionId=" + entity.getFunctionId(); } - + /** * APP TCP会话字节数特征配置删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppTcpCfgValid"}) - @RequiresPermissions(value={"app:tcp:config"}) - public String updateAppTcpCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppTcpCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/tcpCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppTcpCfgValid" }) + @RequiresPermissions(value = { "app:tcp:config" }) + public String updateAppTcpCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppTcpCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/tcpCfgList?functionId=" + functionId; } - - + /** * APP TCP会话字节数特征配置 审核 + * * @param isAudit * @param isValid * @param ids @@ -1119,12 +1179,13 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppTcpCfg"}) - @RequiresPermissions(value={"app:tcp:confirm"}) - public String auditAppTcpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "auditAppTcpCfg" }) + @RequiresPermissions(value = { "app:tcp:confirm" }) + public String auditAppTcpCfg(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { AppTcpCfg entity = new AppTcpCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = appCfgService.getAppTcpCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -1132,64 +1193,67 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - appCfgService.auditAppTcpCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppTcpCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { - logger.error("app SSL配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app SSL配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - return "redirect:" + adminPath +"/app/tcpCfgList?functionId="+functionId; + return "redirect:" + adminPath + "/app/tcpCfgList?functionId=" + functionId; } - - - - + /** * APP header特征配置 列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"headerCfgList"}) - public String headerCfgList(Model model,@ModelAttribute("cfg")AppHeaderCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "headerCfgList" }) + public String headerCfgList(Model model, @ModelAttribute("cfg") AppHeaderCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppHeaderList(searchPage, cfg); - for(AppHeaderCfg entity:page.getList()){ + for (AppHeaderCfg 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/appHeaderCfgList"; } + /** * APP header特征配置表单 (修改/新增) + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"headerCfgForm"}) - @RequiresPermissions(value={"app:header:config"}) - public String headerCfgForm(Model model,String ids,AppHeaderCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "headerCfgForm" }) + @RequiresPermissions(value = { "app:header:config" }) + public String headerCfgForm(Model model, String ids, AppHeaderCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppHeaderCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appHeaderCfgForm"; } + /** * APP header特征配置 (新增/修改)表单提交 + * * @param model * @param request * @param response @@ -1197,31 +1261,34 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppHeaderCfg"}) - @RequiresPermissions(value={"app:header:config"}) - public String saveAppHeaderCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppHeaderCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppHeaderCfg" }) + @RequiresPermissions(value = { "app:header:config" }) + public String saveAppHeaderCfg(Model model, HttpServletRequest request, HttpServletResponse response, + AppHeaderCfg 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.saveOrUpdateAppHeaderCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("saveAppHeaderCfg failed",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + logger.error("saveAppHeaderCfg failed", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/app/headerCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/headerCfgList?functionId=" + entity.getFunctionId(); } + /** * APP header特征配置 审核 + * * @param isAudit * @param isValid * @param ids @@ -1229,12 +1296,13 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppHeaderCfg"}) - @RequiresPermissions(value={"app:header:confirm"}) - public String auditAppHeaderCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "auditAppHeaderCfg" }) + @RequiresPermissions(value = { "app:header:confirm" }) + public String auditAppHeaderCfg(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { AppHeaderCfg entity = new AppHeaderCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = appCfgService.getAppHeaderCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -1242,96 +1310,109 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - appCfgService.auditAppHeaderCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + appCfgService.auditAppHeaderCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { e.printStackTrace(); - logger.error("app Header配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app Header配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - return "redirect:" + adminPath +"/app/headerCfgList?functionId="+functionId; + return "redirect:" + adminPath + "/app/headerCfgList?functionId=" + functionId; } + /** * APP header特征配置 删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppHeaderCfgValid"}) - @RequiresPermissions(value={"app:header:config"}) - public String updateAppHeaderCfgValid(Integer isValid,String ids,Integer functionId) { - appCfgService.updateAppHeaderCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/app/headerCfgList?functionId="+functionId; + @RequestMapping(value = { "updateAppHeaderCfgValid" }) + @RequiresPermissions(value = { "app:header:config" }) + public String updateAppHeaderCfgValid(Integer isValid, String ids, Integer functionId) { + appCfgService.updateAppHeaderCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/app/headerCfgList?functionId=" + functionId; } - + /** * 主题网站配置列表 + * * @param model * @param cfg * @param request * @param response * @return */ - @RequestMapping(value = {"topicDomainCfgList"}) - public String TopicDomainCfgList(Model model,@ModelAttribute("cfg")AppTopicDomainCfg cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "topicDomainCfgList" }) + public String TopicDomainCfgList(Model model, @ModelAttribute("cfg") AppTopicDomainCfg cfg, + HttpServletRequest request, HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page page = appCfgService.findAppTopicDomainList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/app/appTopicDomainCfgList"; } + /** * * 获取服务与主题关系表中的域名 + * * @param websiteDomainTopic * @param response * @return */ @ResponseBody - @RequestMapping(value = "WebsiteDomainTopicList",method=RequestMethod.GET) - public List> WebsiteDomainTopicList(@ModelAttribute("websiteDomainTopic")WebsiteDomainTopic websiteDomainTopic,@RequestParam("websiteServiceId") Long websiteServiceId,@RequestParam("topicId") Long topicId,HttpServletResponse response){ + @RequestMapping(value = "WebsiteDomainTopicList", method = RequestMethod.GET) + public List> WebsiteDomainTopicList( + @ModelAttribute("websiteDomainTopic") WebsiteDomainTopic websiteDomainTopic, + @RequestParam("websiteServiceId") Long websiteServiceId, @RequestParam("topicId") Long topicId, + HttpServletResponse response) { List> mapList = Lists.newArrayList(); - if(websiteServiceId!=null&&topicId!=null){ + if (websiteServiceId != null && topicId != null) { List list = appCfgService.getDomainDict(websiteDomainTopic); - if(list!=null&&list.size()>0){ + if (list != null && list.size() > 0) { for (WebsiteDomainTopic domain : list) { Map map = Maps.newHashMap(); - map.put("domain",domain.getDomain()); - map.put("domainId",domain.getId()); - + map.put("domain", domain.getDomain()); + map.put("domainId", domain.getId()); + mapList.add(map); } } } return mapList; } + /** * app主题网站配置表单 + * * @param model * @param ids * @param entity * @return */ - @RequestMapping(value = {"topicDomainCfgForm"}) - @RequiresPermissions(value={"app:topic:config"}) - public String topicDomainCfgForm(Model model,String ids,@ModelAttribute("_cfg")AppTopicDomainCfg entity) { - if(StringUtils.isNotBlank(ids)){ + @RequestMapping(value = { "topicDomainCfgForm" }) + @RequiresPermissions(value = { "app:topic:config" }) + public String topicDomainCfgForm(Model model, String ids, @ModelAttribute("_cfg") AppTopicDomainCfg entity) { + if (StringUtils.isNotBlank(ids)) { entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(ids)); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/app/appTopicDomainCfgForm"; } -/** + + /** * app主题网站配置新增修改 + * * @param model * @param request * @param response @@ -1339,52 +1420,56 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"saveAppTopicDomainCfg"}) - @RequiresPermissions(value={"app:topic:config"}) - public String saveAppTopicDomainCfg(Model model,HttpServletRequest request,HttpServletResponse response, - AppTopicDomainCfg entity,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "saveAppTopicDomainCfg" }) + @RequiresPermissions(value = { "app:topic:config" }) + public String saveAppTopicDomainCfg(Model model, HttpServletRequest request, HttpServletResponse response, + AppTopicDomainCfg entity, RedirectAttributes redirectAttributes) { try { - //验证域名的重复行 - if(!StringUtil.isBlank(entity.getCfgKeywords())){ + // 验证域名的重复行 + if (!StringUtil.isBlank(entity.getCfgKeywords())) { WebsiteDomainTopic websiteDomainTopic = new WebsiteDomainTopic(); websiteDomainTopic.setDomain(entity.getCfgKeywords()); List domainDict = appCfgService.getDomainDict(websiteDomainTopic); - if((domainDict==null || domainDict.size()==0)){ - //保存到域名关联表中 - if(entity!=null&&entity.getWebsiteServiceId()!=null&&entity.getTopicId()!=null){ + if ((domainDict == null || domainDict.size() == 0)) { + // 保存到域名关联表中 + if (entity != null && entity.getWebsiteServiceId() != null && entity.getTopicId() != null) { websiteDomainTopic.setWebsiteServiceId(entity.getWebsiteServiceId()); websiteDomainTopic.setTopicId(entity.getTopicId()); websiteDomainTopic.setCreateTime(new Date()); websiteDomainTopic.setCreatorId(Integer.valueOf(UserUtils.getUser().getId().toString())); websiteDomainTopic.setIsValid(Constants.VALID_YES); appCfgService.saveDomainDict(websiteDomainTopic); - }else{ - addMessage(redirectAttributes,"error","save_failed"); - return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+entity.getFunctionId(); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + entity.getFunctionId(); } } } - if(entity!=null&&StringUtil.isBlank(entity.getCfgKeywords())&&!StringUtil.isBlank(entity.getCfgKeywords())){ + if (entity != null && StringUtil.isBlank(entity.getCfgKeywords()) + && !StringUtil.isBlank(entity.getCfgKeywords())) { entity.setCfgKeywords(entity.getCfgKeywords()); } appCfgService.saveOrUpdateAppTopicDomainCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_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","save_failed"); + logger.error("app主题网站配置下发失败", e); + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + entity.getFunctionId(); } + /** * domain配置审核 + * * @param isAudit * @param isValid * @param ids @@ -1392,20 +1477,15 @@ public class AppCfgController extends BaseController { * @param redirectAttributes * @return */ - @RequestMapping(value = {"auditAppTopicDomainCfg"}) -// @RequiresPermissions(value={"app:domain:confirm"}) - public String auditAppTopicDomainCfg(Model model,@ModelAttribute("cfg")AppTopicDomainCfg cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + @RequestMapping(value = { "auditAppTopicDomainCfg" }) + // @RequiresPermissions(value={"app:domain:confirm"}) + public String auditAppTopicDomainCfg(Model model, @ModelAttribute("cfg") AppTopicDomainCfg cfg, Integer isValid, + Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletResponse response, HttpServletRequest request) { + if (!StringUtil.isEmpty(ids)) { AppTopicDomainCfg entity = new AppTopicDomainCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); @@ -1413,500 +1493,648 @@ public class AppCfgController extends BaseController { entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - appCfgService.auditAppTopicDomainCfg(entity,isAudit); - addMessage(redirectAttributes,"success","audit_success"); + appCfgService.auditAppTopicDomainCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { - logger.error("app主题网站配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("app主题网站配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 TopicDomainCfgList(model, cfg, request, response); } - return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+functionId; + return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + functionId; } + /** * 网站主题配置删除 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateAppTopicDomainCfgValid"}) - @RequiresPermissions(value={"app:topic:config"}) - public String updateAppTopicDomainCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "updateAppTopicDomainCfgValid" }) + @RequiresPermissions(value = { "app:topic:config" }) + public String updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { try { - appCfgService.updateAppTopicDomainCfgValid(isValid,ids,functionId); - addMessage(redirectAttributes,"success","delete_success"); + appCfgService.updateAppTopicDomainCfgValid(isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); } catch (Exception e) { - logger.error("app主题网站删除失败",e); - if(e instanceof MaatConvertException) { + logger.error("app主题网站删除失败", 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 +"/app/topicDomainCfgList?functionId="+functionId; + return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + functionId; } - - - /**********************内置APP特征文件上传*******************************/ - @RequestMapping(value = {"/appBuiltinFeatureFileForm"}) - @RequiresPermissions(value={"app:built_in_file:config"}) - public String from(Model model, - HttpServletRequest request, - HttpServletResponse response, - String ids, - @ModelAttribute("cfg")AppBuiltInFeatureFile cfg - ,RedirectAttributes redirectAttributes){ - if(cfg == null){ - cfg=new AppBuiltInFeatureFile(); + + /********************** 内置APP特征文件上传 *******************************/ + @RequestMapping(value = { "/appBuiltinFeatureFileForm" }) + @RequiresPermissions(value = { "app:built_in_file:config" }) + public String from(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + @ModelAttribute("cfg") AppBuiltInFeatureFile cfg, RedirectAttributes redirectAttributes) { + if (cfg == null) { + cfg = new AppBuiltInFeatureFile(); } - if(!StringUtil.isEmpty(ids)){ - cfg = appBuiltInFeatureService.getAppBuiltInFeatureFile(Long.valueOf(ids),-1); + if (!StringUtil.isEmpty(ids)) { + cfg = appBuiltInFeatureService.getAppBuiltInFeatureFile(Long.valueOf(ids), -1); initFormCondition(model, cfg); model.addAttribute("isAdd", false); - }else{ + } else { initFormCondition(model, cfg); model.addAttribute("isAdd", true); } - + model.addAttribute("_cfg", cfg); return "/cfg/app/appBuiltinFeatureFileForm"; } - - @RequestMapping(value = {"/appBuiltinFeatureFileSaveOrUpdate"}) - @RequiresPermissions(value={"app:built_in_file:config"}) - public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")AppBuiltInFeatureFile cfg, - MultipartFile file, - RedirectAttributes redirectAttributes){ - File fileD=null; - try{ - - if(file != null) { - String filename = file.getOriginalFilename(); - String prefix = FileUtils.getPrefix(filename, false); - String suffix = FileUtils.getSuffix(filename, false); - fileD = File.createTempFile("file_"+ prefix, suffix); - file.transferTo(fileD);//复制文件 - String md5 = FileUtils.getFileMD5(fileD); - Map srcMap = Maps.newHashMap(); - srcMap.put("filetype", suffix); - srcMap.put("datatype", "dbSystem");//源文件存入数据中心 - srcMap.put("createTime",new Date()); - srcMap.put("key",prefix); - srcMap.put("fileName", filename); - srcMap.put("checksum", md5); - ToMaatResult result = ConfigServiceUtil.postFileCfg(null, fileD, JsonMapper.toJsonString(srcMap)); - logger.info("APP 内置特征 文件上传响应信息:"+JsonMapper.toJsonString(result)); - String accessUrl = null; - if(!StringUtil.isEmpty(result)){ - ResponseData data = result.getData(); - accessUrl=data.getAccessUrl(); - cfg.setFilePath(accessUrl);; - } - } - appBuiltInFeatureService.saveOrUpdate(cfg); - - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ + + @RequestMapping(value = { "/appBuiltinFeatureFileSaveOrUpdate" }) + @RequiresPermissions(value = { "app:built_in_file:config" }) + public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AppBuiltInFeatureFile cfg, MultipartFile file, + RedirectAttributes redirectAttributes) { + File fileD = null; + try { + + if (file != null) { + String filename = file.getOriginalFilename(); + String prefix = FileUtils.getPrefix(filename, false); + String suffix = FileUtils.getSuffix(filename, false); + fileD = File.createTempFile("file_" + prefix, suffix); + file.transferTo(fileD);// 复制文件 + String md5 = FileUtils.getFileMD5(fileD); + Map srcMap = Maps.newHashMap(); + srcMap.put("filetype", suffix); + srcMap.put("datatype", "dbSystem");// 源文件存入数据中心 + srcMap.put("createTime", new Date()); + srcMap.put("key", prefix); + srcMap.put("fileName", filename); + srcMap.put("checksum", md5); + ToMaatResult result = ConfigServiceUtil.postFileCfg(null, fileD, JsonMapper.toJsonString(srcMap)); + logger.info("APP 内置特征 文件上传响应信息:" + JsonMapper.toJsonString(result)); + String accessUrl = null; + if (!StringUtil.isEmpty(result)) { + ResponseData data = result.getData(); + accessUrl = data.getAccessUrl(); + cfg.setFilePath(accessUrl); + ; + } + } + appBuiltInFeatureService.saveOrUpdate(cfg); + + addMessage(redirectAttributes, "success", "save_success"); + } catch (Exception e) { e.printStackTrace(); - logger.error("appBuiltinFeatureFileSaveOrUpdate failed",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + logger.error("appBuiltinFeatureFileSaveOrUpdate failed", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/app/appBuiltinFeatureFileList?functionId="+cfg.getFunctionId(); + + return "redirect:" + adminPath + "/app/appBuiltinFeatureFileList?functionId=" + cfg.getFunctionId(); } - - @RequestMapping(value = {"/appBuiltinFeatureFileList"}) - public String list(Model model,HttpServletRequest request,HttpServletResponse response - ,@ModelAttribute("cfg")AppBuiltInFeatureFile entity - ,RedirectAttributes redirectAttributes){ - Page page = appBuiltInFeatureService.findPage(new Page(request, response,"r"), entity); + + @RequestMapping(value = { "/appBuiltinFeatureFileList" }) + public String list(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AppBuiltInFeatureFile entity, RedirectAttributes redirectAttributes) { + Page page = appBuiltInFeatureService + .findPage(new Page(request, response, "r"), entity); model.addAttribute("page", page); initPageCondition(model); return "/cfg/app/appBuiltinFeatureFileList"; } - - @RequestMapping(value = {"/appBuiltinFeatureFileDelete"}) - @RequiresPermissions(value={"app:built_in_file:config"}) - public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId - ,Model model,HttpServletRequest request - ,HttpServletResponse response - ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(ids)){ - appBuiltInFeatureService.delete(isAudit,isValid,ids,functionId); + + @RequestMapping(value = { "/appBuiltinFeatureFileDelete" }) + @RequiresPermissions(value = { "app:built_in_file:config" }) + public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(ids)) { + appBuiltInFeatureService.delete(isAudit, isValid, ids, functionId); } - - return "redirect:" + adminPath +"/app/appBuiltinFeatureFileList?functionId="+functionId; + + return "redirect:" + adminPath + "/app/appBuiltinFeatureFileList?functionId=" + functionId; } - - @RequestMapping(value = {"/audit"}) - @RequiresPermissions(value={"app:built_in_file:confirm"}) - public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId, + + @RequestMapping(value = { "/audit" }) + @RequiresPermissions(value = { "app:built_in_file:confirm" }) + public String audit(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes) { - if(!StringUtil.isEmpty(ids)){ + 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 { - appBuiltInFeatureService.audit(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); + appBuiltInFeatureService.audit(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); } catch (Exception e) { e.printStackTrace(); logger.error("appBuiltinFeature audit failed", e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - + } - return "redirect:" + adminPath +"/app/appBuiltinFeatureFileList?functionId="+functionId; + return "redirect:" + adminPath + "/app/appBuiltinFeatureFileList?functionId=" + functionId; } + @ResponseBody @RequestMapping(value = "/validCfgId") public boolean validCfgId(Long cfgId) { - AppBuiltInFeatureFile dns=appBuiltInFeatureService.getAppBuiltInFeatureFile(cfgId,null); - if(dns == null ){ + AppBuiltInFeatureFile dns = appBuiltInFeatureService.getAppBuiltInFeatureFile(cfgId, null); + if (dns == null) { return false; - }else{ + } else { return true; } } - - //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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppByPolicyList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = appCfgService.findAppPolicyList(pageInfo, entity); - ipLists=page.getList(); - } - - for(AppPolicyCfg policy:ipLists){ - SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId()); - if(app!=null) { - policy.setSocialName(app.getSpecServiceName()); - } - } - //查找社交应用的所有有效二级特定服务 - SpecificServiceCfg second=new SpecificServiceCfg(); - for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) { - if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) { - second.setCfgType(Integer.parseInt(dict.getItemCode())); - break; - } - } - second.setIsValid(Constants.VALID_YES); - second.setIsLeaf(1); - List 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=",encrypted_tunnel_behavior,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 ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - 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"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + + // 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppByPolicyList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = appCfgService.findAppPolicyList(pageInfo, entity); + ipLists = page.getList(); } - - //top - @RequestMapping(value = "exportTop") - public void exportTop(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")AppTopicDomainCfg entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppByTopicDomainList(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = appCfgService.findAppTopicDomainList(pageInfo, entity); - ipLists=page.getList(); - } - - for (int i = 0; i < ipLists.size(); i++) { - AppTopicDomainCfg appTop=ipLists.get(i); - appTop.setIsHex(appTop.getIsHexbin()); - appTop.setIsCaseInsenstive(appTop.getIsHexbin()); - } - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), AppTopicDomainCfg.class); - String cfgIndexInfoNoExport=",letter,whether_area_block,classification,attribute,label,do_log,block_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("top export failed",e); - addMessage(redirectAttributes,"error","export_failed"); + + for (AppPolicyCfg policy : ipLists) { + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId()); + if (app != null) { + policy.setSocialName(app.getSpecServiceName()); } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); } - - //appIp配置导出 - @RequestMapping(value = "exportAppIp") - public void exportAppIp(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")AppIpCfg entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppByIpList(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = appCfgService.findAppIpList(pageInfo, entity); - ipLists=page.getList(); - } - - - for(AppIpCfg appIp:ipLists){ - SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(appIp.getSpecServiceId()); - appIp.setAppName(app.getSpecServiceName()); - } - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), AppIpCfg.class); - String cfgIndexInfoNoExport=",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("appIp export failed",e); - addMessage(redirectAttributes,"error","export_failed"); + // 查找社交应用的所有有效二级特定服务 + SpecificServiceCfg second = new SpecificServiceCfg(); + for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) { + if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) { + second.setCfgType(Integer.parseInt(dict.getItemCode())); + break; } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); } - - //appHttp配置导出 - @RequestMapping(value = "exportAppHttp") - public void exportAppHttp(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")AppHttpCfg entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppByHttpList(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = appCfgService.findAppHttpList(pageInfo, entity); - ipLists=page.getList(); - } - - for(AppHttpCfg http:ipLists){ - http.setIsHex(http.getIsHexbin()); - http.setIsCaseInsenstive(http.getIsHexbin()); - http.setCfgKeywords(Functions.replace(http.getCfgKeywords(), "***and***"," ")); - SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(http.getSpecServiceId()); - http.setAppName(app.getSpecServiceName()); - } - - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), AppHttpCfg.class); - String cfgIndexInfoNoExport=",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("http export failed",e); - addMessage(redirectAttributes,"error","export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); - } - - //appdomain配置导出 - @RequestMapping(value = "exportDomain") - public void exportDomain(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")AppDomainCfg entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists= new ArrayList(); - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppByDomainList(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = appCfgService.findAppDomainList(pageInfo, entity); - ipLists=page.getList(); - } - for(AppDomainCfg domain:ipLists){ - domain.setIsHex(domain.getIsHexbin()); - domain.setIsCaseInsenstive(domain.getIsHexbin()); - SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(domain.getSpecServiceId()); - domain.setAppName(app.getSpecServiceName()); - } - - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), AppDomainCfg.class); - String cfgIndexInfoNoExport=",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("Domain export failed",e); - addMessage(redirectAttributes,"error","export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); - } - - //appssl配置导出 - @RequestMapping(value = "exportAppSsl") - public void exportAppSsl(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")AppSslCertCfg entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists= new ArrayList(); - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppBySslList(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = appCfgService.findAppSslList(pageInfo, entity); - ipLists=page.getList(); + second.setIsValid(Constants.VALID_YES); + second.setIsLeaf(1); + List 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; } - - for(AppSslCertCfg ssl:ipLists){ - ssl.setIsHex(ssl.getIsHexbin()); - ssl.setIsCaseInsenstive(ssl.getIsHexbin()); - ssl.setCfgKeywords(Functions.replace(ssl.getCfgKeywords(), "***and***"," ")); - SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(ssl.getSpecServiceId()); - ssl.setAppName(app.getSpecServiceName()); - } - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), AppSslCertCfg.class); - String cfgIndexInfoNoExport=",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("App ssl 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"); + 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,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 ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + 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(); + } + + // top + @RequestMapping(value = "exportTop") + public void exportTop(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AppTopicDomainCfg entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppByTopicDomainList(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = appCfgService.findAppTopicDomainList(pageInfo, entity); + ipLists = page.getList(); + } + + for (int i = 0; i < ipLists.size(); i++) { + AppTopicDomainCfg appTop = ipLists.get(i); + appTop.setIsHex(appTop.getIsHexbin()); + appTop.setIsCaseInsenstive(appTop.getIsHexbin()); + } + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), AppTopicDomainCfg.class); + String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_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("top export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // appIp配置导出 + @RequestMapping(value = "exportAppIp") + public void exportAppIp(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AppIpCfg entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppByIpList(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = appCfgService.findAppIpList(pageInfo, entity); + ipLists = page.getList(); + } + + for (AppIpCfg appIp : ipLists) { + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(appIp.getSpecServiceId()); + appIp.setAppName(app.getSpecServiceName()); + } + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), AppIpCfg.class); + String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("appIp export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // appHttp配置导出 + @RequestMapping(value = "exportAppHttp") + public void exportAppHttp(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AppHttpCfg entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppByHttpList(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = appCfgService.findAppHttpList(pageInfo, entity); + ipLists = page.getList(); + } + + for (AppHttpCfg http : ipLists) { + http.setIsHex(http.getIsHexbin()); + http.setIsCaseInsenstive(http.getIsHexbin()); + http.setCfgKeywords(Functions.replace(http.getCfgKeywords(), "***and***", " ")); + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(http.getSpecServiceId()); + http.setAppName(app.getSpecServiceName()); + } + + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), AppHttpCfg.class); + String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("http export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // appdomain配置导出 + @RequestMapping(value = "exportDomain") + public void exportDomain(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AppDomainCfg entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppByDomainList(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = appCfgService.findAppDomainList(pageInfo, entity); + ipLists = page.getList(); + } + for (AppDomainCfg domain : ipLists) { + domain.setIsHex(domain.getIsHexbin()); + domain.setIsCaseInsenstive(domain.getIsHexbin()); + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(domain.getSpecServiceId()); + domain.setAppName(app.getSpecServiceName()); + } + + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), AppDomainCfg.class); + String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("Domain export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // appssl配置导出 + @RequestMapping(value = "exportAppSsl") + public void exportAppSsl(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AppSslCertCfg entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppBySslList(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = appCfgService.findAppSslList(pageInfo, entity); + ipLists = page.getList(); + } + + for (AppSslCertCfg ssl : ipLists) { + ssl.setIsHex(ssl.getIsHexbin()); + ssl.setIsCaseInsenstive(ssl.getIsHexbin()); + ssl.setCfgKeywords(Functions.replace(ssl.getCfgKeywords(), "***and***", " ")); + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(ssl.getSpecServiceId()); + ssl.setAppName(app.getSpecServiceName()); + } + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), AppSslCertCfg.class); + String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_type,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("App ssl export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java index b1e3b7154..ef626a469 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java @@ -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 searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "multiFeatureCfgList" }) + public String multiFeatureCfgList(Model model, @ModelAttribute("cfg") AppFeatureIndex cfg, + HttpServletRequest request, HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page 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 searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 ipRangeList = appMultiFeatureCfgService.getAppIpRangeCfg(compileId,functionId); + @RequestMapping(value = { "ajaxAppFeatureList" }) + public String ajaxAppFeatureList(Model model, Long cfgId, Integer compileId, Integer functionId, Integer index) { + List ipRangeList = appMultiFeatureCfgService.getAppIpRangeCfg(compileId, functionId); AppFeatureIndex cfg = appMultiFeatureCfgService.getAppFeatureIndex(cfgId); - List> tabList = new ArrayList(); + List> 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 map = new HashMap(); + if (cfgRegionValue.length == cfgRegionType.length && cfgRegionValue.length == cfgRegionCode.length) { + for (int i = 0; i < cfgRegionValue.length; i++) { + Map 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 strList = appMultiFeatureCfgService.getAppStringFeatureCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i])); + if ("2".equals(cfgRegionType[i])) { + List strList = appMultiFeatureCfgService.getAppStringFeatureCfg(compileId, + functionId, Integer.valueOf(cfgRegionCode[i])); map.put("strList", strList); } - if("3".equals(cfgRegionType[i])){ - List complexList = appMultiFeatureCfgService.getAppComplexFeatureCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i])); + if ("3".equals(cfgRegionType[i])) { + List complexList = appMultiFeatureCfgService + .getAppComplexFeatureCfg(compileId, functionId, Integer.valueOf(cfgRegionCode[i])); map.put("complexList", complexList); } - if("4".equals(cfgRegionType[i])){ - List numCfgList = appMultiFeatureCfgService.getAppTcpCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i])); + if ("4".equals(cfgRegionType[i])) { + List numCfgList = appMultiFeatureCfgService.getAppTcpCfg(compileId, functionId, + Integer.valueOf(cfgRegionCode[i])); map.put("numCfgList", numCfgList); } tabList.add(map); } - }else{ - Map map = new HashMap(); + } else { + Map 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=appMultiFeatureCfgService.findAppByFeatureIndexList(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = appMultiFeatureCfgService.findAppByFeatureIndexList(ids); + } else { + Page pageInfo = new Page(request, response, "r"); pageInfo.setPageNo(1); pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); Page 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 ipList = new ArrayList(); + List keywordList = new ArrayList(); + List strList = new ArrayList(); + for (AppFeatureIndex cfg : ipLists) { + Map 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 ipList=new ArrayList(); - List keywordList=new ArrayList(); - List strList=new ArrayList(); - for (AppFeatureIndex cfg : ipLists) { - Map 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 replaceKeyList(List list){ + + public static List replaceKeyList(List 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 replaceFeatureList(List list){ + + public static List replaceFeatureList(List 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; } - - + } diff --git a/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java b/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java index 03f8275f5..8a4456ec6 100644 --- a/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java +++ b/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java @@ -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 searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "list" }) + public String policyCfgList(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page 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 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 searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppByPolicyList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppByPolicyList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + 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(); + } + } diff --git a/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java b/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java index 1144e00b4..27b5b6e4f 100644 --- a/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java +++ b/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java @@ -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 searchPage=new Page(request,response,"r"); + @RequestMapping(value = { "list" }) + public String policyCfgList(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "r"); Page 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 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 + // 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 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 searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=appCfgService.findAppByPolicyList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = appCfgService.findAppPolicyList(pageInfo, entity); - ipLists=page.getList(); + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = appCfgService.findAppByPolicyList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 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 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 ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - 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 ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + 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(); } - } diff --git a/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java b/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java index 866f1b0bb..ae3f0ce6d 100644 --- a/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java +++ b/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java @@ -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> classMap=new HashMap>(); Map dataMap=new HashMap(); Map noExportMap=new HashMap(); - - //导出选中记录 List 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 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; + } } diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java index 76f7e971e..05da5f890 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java @@ -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 page = dnsIpCfgService.findPage(new Page(request, response,"r"), entity); + + @RequestMapping(value = { "/list" }) + public String list(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") DnsIpCfg entity, RedirectAttributes redirectAttributes) { + Page page = dnsIpCfgService.findPage(new Page(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 resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1); - model.addAttribute("dnsResStrategys", resStrategys);*/ - //查询policyGroup列表,供响应策略选择 2018-07-24 经确定IP欺骗只能选择非0号分组 - List policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1); + /* + * //获取所有响应策略信息 List + * resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1); + * model.addAttribute("dnsResStrategys", resStrategys); + */ + // 查询policyGroup列表,供响应策略选择 2018-07-24 经确定IP欺骗只能选择非0号分组 + List 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 list=dnsIpCfgService.findDnsIpCfg(entity); - if(StringUtil.isEmpty(list)) { + List 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 searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=dnsIpCfgService.findByPage(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = dnsIpCfgService.findByPage(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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(); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java index 7cf5f23a1..c87146bdd 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java @@ -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 policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1); - List policyGroups=policyGroupInfoService.findHasIpPolicyGroupInfosByType(1); + + // 查询policyGroup列表,供响应策略选择 + // List + // policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1); + List 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 page = dnsResStrategyService.findPage(new Page(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 page = dnsResStrategyService.findPage(new Page(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 searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=dnsResStrategyService.findByPage(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = dnsResStrategyService.findPage(pageInfo, entity); - ipLists=page.getList(); + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = dnsResStrategyService.findByPage(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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(); } } diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java index 25569c76e..564c499ac 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java @@ -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 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipAddrPoolCfgService.findByPage(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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"); + } + } } diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java index 58b64100c..b9224b1fe 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java @@ -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 policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(3); + + // 查询ip复用地址池配置的policyGroup列表 + List 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 page = ipMultiplexPoolCfgService.findPage(new Page(request, response,"r"), entity); + + @RequestMapping(value = { "/list" }) + public String list(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") IpMultiplexPoolCfg entity) { + // 查询时left join policyGroup + Page page = ipMultiplexPoolCfgService + .findPage(new Page(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 page = ipMultiplexPoolCfgService.findPage(new Page(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 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 page = + * ipMultiplexPoolCfgService.findPage(new Page(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 + * 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{*/ - //条件导出数据大于最大导出数,只导出最大导出条数 - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + /* + * //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String + * id:ids.split(",")){ Long.parseLong(id); } //List + * list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename() + * , entity.getFunctionId(), ids); }else{ + */ + // 条件导出数据大于最大导出数,只导出最大导出条数 + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{*/ - //条件导出数据大于最大导出数,只导出最大导出条数 - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + /* + * //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String + * id:ids.split(",")){ Long.parseLong(id); } //List + * list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename() + * , entity.getFunctionId(), ids); }else{ + */ + // 条件导出数据大于最大导出数,只导出最大导出条数 + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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(); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/UserManageController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/UserManageController.java index 7359c6dbf..fcefabe27 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/UserManageController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/UserManageController.java @@ -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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = userManageService.findByPage(ids); + } else { + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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; + } } diff --git a/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java b/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java index 9766cd83e..465a92917 100644 --- a/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java @@ -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 page = ddosCfgService.findPage(new Page(request, response,"r"), entity); + + @RequestMapping(value = { "/list" }) + public String list(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") DdosIpCfg entity) { + Page page = ddosCfgService.findPage(new Page(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 searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); - + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ddosCfgService.findByPage(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = ddosCfgService.findPage(pageInfo, entity); - ipLists=page.getList(); - } - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ddosCfgService.findByPage(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = ddosCfgService.findPage(pageInfo, entity); + ipLists = page.getList(); + } + /* + * //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String + * id:ids.split(",")){ Long.parseLong(id); } //List + * 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 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"; diff --git a/src/main/java/com/nis/web/controller/configuration/manipulation/IpMultiplexController.java b/src/main/java/com/nis/web/controller/configuration/manipulation/IpMultiplexController.java index 87feb33ca..df8f9a255 100644 --- a/src/main/java/com/nis/web/controller/configuration/manipulation/IpMultiplexController.java +++ b/src/main/java/com/nis/web/controller/configuration/manipulation/IpMultiplexController.java @@ -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 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 dictList = DictUtils.getDictList("GROUP_TYPE"); + for (SysDataDictionaryItem di : dictList) { + if ("IP".equals(di.getItemValue())) { + dict = di; break; } } - if(dict!=null){ - List policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(Integer.parseInt(dict.getItemCode())); + if (dict != null) { + List 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 page = ipMultiplexService.findPage(new Page(request, response,"r"), cfg); + @RequestMapping(value = { "/snatPolicyList" }) + public String snatPolicyList(Model model, @ModelAttribute("cfg") IpReusePolicyCfg cfg, HttpServletRequest request, + HttpServletResponse response) { + + Page page = ipMultiplexService.findPage(new Page(request, response, "r"), + cfg); model.addAttribute("page", page); - initFormCondition(model,cfg); - + initFormCondition(model, cfg); + // 获取地址池、用户信息 List users = userManageService.findUsers(); List 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 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 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 users = userManageService.findUsers(); List 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 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 ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response){ + @RequestMapping(value = { "/ajaxGetAddrPools" }) + public List ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response) { List addrPools = ipAddrPoolCfgService.getEffectiveAddrPool(); - List addrPoolsNew=new ArrayList<>(); + List addrPoolsNew = new ArrayList<>(); for (IpAddrPoolCfg addrPool : addrPools) { Map params = new HashMap(); params.put("addr_pool_id", addrPool.getCfgId()); - String url =Constants.IP_REUSE_CALL_CGI_URL ; - Map 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 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 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 page = ipMultiplexService.findPageDnat(new Page(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 page = ipMultiplexService.findPageDnat(new Page(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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - Properties msgProp = getMsgProp(); - - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{*/ - //条件导出数据大于最大导出数,只导出最大导出条数 - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + Properties msgProp = getMsgProp(); + // 导出选中记录 + List ipLists = new ArrayList(); - - //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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - Properties msgProp = getMsgProp(); - - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{*/ - //条件导出数据大于最大导出数,只导出最大导出条数 - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = ipMultiplexService.findPage(pageInfo,entity); + ipLists = page.getList(); } + List 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + Properties msgProp = getMsgProp(); + // 导出选中记录 + List ipLists = new ArrayList(); + if (!StringUtil.isEmpty(ids)) { + ipLists = ipMultiplexService.findPageByDnat(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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(); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AsnPolicyCfgController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AsnPolicyCfgController.java index b35f187f0..b29dc337d 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AsnPolicyCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AsnPolicyCfgController.java @@ -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 page = asnPolicyCfgService.findPage(new Page(request, response,"r"), entity); + @RequestMapping(value = { "/list" }) + public String list(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, RedirectAttributes redirectAttributes) { + Page page = asnPolicyCfgService.findPage(new Page(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 policyGroups=asnPolicyCfgService.getConfigGroupInfoList(4); + List 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; + // } } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java index a2be7c3e0..baf8f5bf4 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java @@ -42,1086 +42,1068 @@ import com.nis.web.controller.BaseController; /** * 处理音视频文本业务 + * * @author ddm * */ @Controller @RequestMapping("${adminPath}/ntc/av") -public class AvContentController extends BaseController { - /*****************************voip业务***************/ - //音视频VOIP IP配置新增界面 - @RequestMapping(value = {"/voipForm"}) - @RequiresPermissions(value={"avVoip:config"}) - public String voipFrom(Model model,HttpServletRequest request ,HttpServletResponse response - ,String compileIds,String ids, CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(ids)){ - cfg.setCfgId(Long.parseLong(ids)); - cfg = avContentCfgService.getCfgIndexInfo(cfg); - initUpdateFormCondition(model, cfg); - }else{ - initFormCondition(model,cfg); - } - - model.addAttribute("_cfg", cfg); - return "/cfg/av/voip/voipForm"; +public class AvContentController extends BaseController { + /***************************** voip业务 ***************/ + // 音视频VOIP IP配置新增界面 + @RequestMapping(value = { "/voipForm" }) + @RequiresPermissions(value = { "avVoip:config" }) + public String voipFrom(Model model, HttpServletRequest request, HttpServletResponse response, String compileIds, + String ids, CfgIndexInfo cfg, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(ids)) { + cfg.setCfgId(Long.parseLong(ids)); + cfg = avContentCfgService.getCfgIndexInfo(cfg); + initUpdateFormCondition(model, cfg); + } else { + initFormCondition(model, cfg); } - //音视频VOIP Account配置新增界面 -/* @RequestMapping(value = {"/voipAccountForm"}) - @RequiresPermissions(value={"avVoipAccount:config"}) - public String voipAccountForm(Model model,HttpServletRequest request ,HttpServletResponse response - ,String compileIds,String ids, CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){ - //修改 - if(!StringUtil.isEmpty(compileIds)){ - cfg.setCompileId(Integer.parseInt(compileIds)); - cfg = avContentCfgService.getCfgIndexInfo2(cfg); - initUpdateFormCondition(model, cfg); - }else{ - initFormCondition(model,cfg);//新增 - } - - model.addAttribute("_cfg", cfg); - return "/cfg/av/voip/voipAccountForm"; - }*/ - - //保存voip ip信息 - @RequestMapping(value = {"/saveVoip"}) - public String saveVoip(Model model,HttpServletRequest request,HttpServletResponse response,String ids, - CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){ - try{ - avContentCfgService.saveOrUpdateAvVoip(cfg); - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ - if(e instanceof MaatConvertException) { - e.printStackTrace(); - logger.error("voip 信息保存失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - e.printStackTrace(); - logger.error("voip 信息保存失败",e); - addMessage(redirectAttributes,"error","save_failed"); - } - } - return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+cfg.getFunctionId(); + + model.addAttribute("_cfg", cfg); + return "/cfg/av/voip/voipForm"; } - //保存voip Account信息 -/* @RequestMapping(value = {"/saveAccountVoip"}) - public String saveAccountVoip(Model model,HttpServletRequest request,HttpServletResponse response,String ids, - CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){ - try{ - avContentCfgService.saveOrUpdateAvVoipAccount(cfg); - addMessage(redirectAttributes,"save_success"); - }catch(Exception e){ - if(e instanceof MaatConvertException) { + // 音视频VOIP Account配置新增界面 + /* + * @RequestMapping(value = {"/voipAccountForm"}) + * + * @RequiresPermissions(value={"avVoipAccount:config"}) public String + * voipAccountForm(Model model,HttpServletRequest request + * ,HttpServletResponse response ,String compileIds,String ids, CfgIndexInfo + * cfg ,RedirectAttributes redirectAttributes){ //修改 + * if(!StringUtil.isEmpty(compileIds)){ + * cfg.setCompileId(Integer.parseInt(compileIds)); cfg = + * avContentCfgService.getCfgIndexInfo2(cfg); initUpdateFormCondition(model, + * cfg); }else{ initFormCondition(model,cfg);//新增 } + * + * model.addAttribute("_cfg", cfg); return "/cfg/av/voip/voipAccountForm"; } + */ + + // 保存voip ip信息 + @RequestMapping(value = { "/saveVoip" }) + public String saveVoip(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + CfgIndexInfo cfg, RedirectAttributes redirectAttributes) { + try { + avContentCfgService.saveOrUpdateAvVoip(cfg); + addMessage(redirectAttributes, "success", "save_success"); + } catch (Exception e) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.error("voip Account信息保存失败",e); - addMessage(redirectAttributes,"request_service_failed"); - }else { + logger.error("voip 信息保存失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("voip Account信息保存失败",e); - addMessage(redirectAttributes,"save_failed"); + logger.error("voip 信息保存失败", e); + addMessage(redirectAttributes, "error", "save_failed"); } } - return "redirect:" + adminPath +"/ntc/av/voipAccountList?functionId="+cfg.getFunctionId(); - }*/ - //视频文本VOIP 配置列表 - @RequestMapping(value = {"/voipList"}) - public String voipCfgList(Model model,HttpServletRequest request ,HttpServletResponse response ,@ModelAttribute("cfg")CfgIndexInfo entity - ,RedirectAttributes redirectAttributes){ - /*if(entity.getIpPort()== null){ - entity.setIpPort(new IpPortCfg()); - } - if(entity.getVoipAccount()== null){ - entity.setVoipAccount(new AvVoipAccountCfg()); - } - if(entity.getNtcSubscribeIdCfg()==null){ - entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); - }*/ - Page page = avContentCfgService.findPage(new Page(request, response,"r"), entity); + return "redirect:" + adminPath + "/ntc/av/voipList?functionId=" + cfg.getFunctionId(); + } + + // 保存voip Account信息 + /* + * @RequestMapping(value = {"/saveAccountVoip"}) public String + * saveAccountVoip(Model model,HttpServletRequest + * request,HttpServletResponse response,String ids, CfgIndexInfo cfg + * ,RedirectAttributes redirectAttributes){ try{ + * avContentCfgService.saveOrUpdateAvVoipAccount(cfg); + * addMessage(redirectAttributes,"save_success"); }catch(Exception e){ if(e + * instanceof MaatConvertException) { e.printStackTrace(); + * logger.error("voip Account信息保存失败",e); + * addMessage(redirectAttributes,"request_service_failed"); }else { + * e.printStackTrace(); logger.error("voip Account信息保存失败",e); + * addMessage(redirectAttributes,"save_failed"); } } return "redirect:" + + * adminPath +"/ntc/av/voipAccountList?functionId="+cfg.getFunctionId(); } + */ + // 视频文本VOIP 配置列表 + @RequestMapping(value = { "/voipList" }) + public String voipCfgList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, RedirectAttributes redirectAttributes) { + /* + * if(entity.getIpPort()== null){ entity.setIpPort(new IpPortCfg()); } + * if(entity.getVoipAccount()== null){ entity.setVoipAccount(new + * AvVoipAccountCfg()); } if(entity.getNtcSubscribeIdCfg()==null){ + * entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); } + */ + Page page = avContentCfgService.findPage(new Page(request, response, "r"), entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); return "/cfg/av/voip/voipList"; } - //视频文本VOIP Account配置列表 -/* @RequestMapping(value = {"/voipAccountList"}) - public String voipCfgAccountList(Model model,HttpServletRequest request ,HttpServletResponse response - ,@ModelAttribute("cfg")CfgIndexInfo entity ,RedirectAttributes redirectAttributes){ - if(entity.getVoipAccount()== null){ - entity.setVoipAccount(new AvVoipAccountCfg()); - } - if(entity.getNtcSubscribeIdCfg()==null){ - entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); - } - Page page = avContentCfgService.findAccountPage(new Page(request, response,"r"), entity); - model.addAttribute("page", page); - initPageCondition(model,entity); - return "/cfg/av/voip/voipAccountList"; - }*/ - - - //修改VOIP IP配置状态 - @RequestMapping(value = {"/updateAvVoipValid"}) - @RequiresPermissions(value={"avVoip:config"}) - public String updateVoipValid(Integer isAudit,String compileIds,Integer isValid,String ids,Integer functionId - ,RedirectAttributes redirectAttributes - ) { + // 视频文本VOIP Account配置列表 + /* + * @RequestMapping(value = {"/voipAccountList"}) public String + * voipCfgAccountList(Model model,HttpServletRequest request + * ,HttpServletResponse response ,@ModelAttribute("cfg")CfgIndexInfo entity + * ,RedirectAttributes redirectAttributes){ if(entity.getVoipAccount()== + * null){ entity.setVoipAccount(new AvVoipAccountCfg()); } + * if(entity.getNtcSubscribeIdCfg()==null){ entity.setNtcSubscribeIdCfg(new + * NtcSubscribeIdCfg()); } Page page = + * avContentCfgService.findAccountPage(new Page(request, + * response,"r"), entity); model.addAttribute("page", page); + * initPageCondition(model,entity); return "/cfg/av/voip/voipAccountList"; } + */ + + // 修改VOIP IP配置状态 + @RequestMapping(value = { "/updateAvVoipValid" }) + @RequiresPermissions(value = { "avVoip:config" }) + public String updateVoipValid(Integer isAudit, String compileIds, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { try { - avContentCfgService.updateAvVoipValid(isAudit,isValid,compileIds,functionId); - addMessage(redirectAttributes,"success", "delete_success"); + avContentCfgService.updateAvVoipValid(isAudit, isValid, compileIds, functionId); + addMessage(redirectAttributes, "success", "delete_success"); } catch (Exception e) { - if(e instanceof MaatConvertException) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.error("voip 信息审核失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.error("voip 信息审核失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("voip 信息审核失败",e); - addMessage(redirectAttributes,"error","delete_failed"); + logger.error("voip 信息审核失败", e); + addMessage(redirectAttributes, "error", "delete_failed"); } } - return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/voipList?functionId=" + functionId; } - //修改VOIP account配置状态 -/* @RequestMapping(value = {"/updateAvVoipAccountValid"}) - @RequiresPermissions(value={"avVoipAccount:config"}) - public String updateVoipAccountValid(Integer isAudit,String compileIds,Integer isValid,String ids,Integer functionId - ,RedirectAttributes redirectAttributes - ) { - try { - avContentCfgService.updateAvVoipAccountValid(isAudit,isValid,compileIds,functionId); - } catch (Exception e) { - if(e instanceof MaatConvertException) { - e.printStackTrace(); - logger.error("voip Account信息审核失败",e); - addMessage(redirectAttributes,"request_service_failed"); - }else { - e.printStackTrace(); - logger.error("voip Account信息审核失败",e); - addMessage(redirectAttributes,"audit_failed"); - } - } - return "redirect:" + adminPath +"/ntc/av/voipAccountList?functionId="+functionId; - }*/ - //修改VOIP IP配置审核状态 - @RequestMapping(value = {"/auditAvVoip"}) - @RequiresPermissions(value={"avVoip:confirm"}) - public String auditVoip(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + + // 修改VOIP account配置状态 + /* + * @RequestMapping(value = {"/updateAvVoipAccountValid"}) + * + * @RequiresPermissions(value={"avVoipAccount:config"}) public String + * updateVoipAccountValid(Integer isAudit,String compileIds,Integer + * isValid,String ids,Integer functionId ,RedirectAttributes + * redirectAttributes ) { try { + * avContentCfgService.updateAvVoipAccountValid(isAudit,isValid,compileIds, + * functionId); } catch (Exception e) { if(e instanceof + * MaatConvertException) { e.printStackTrace(); + * logger.error("voip Account信息审核失败",e); + * addMessage(redirectAttributes,"request_service_failed"); }else { + * e.printStackTrace(); logger.error("voip Account信息审核失败",e); + * addMessage(redirectAttributes,"audit_failed"); } } return "redirect:" + + * adminPath +"/ntc/av/voipAccountList?functionId="+functionId; } + */ + // 修改VOIP IP配置审核状态 + @RequestMapping(value = { "/auditAvVoip" }) + @RequiresPermissions(value = { "avVoip:confirm" }) + public String auditVoip(Model model, @ModelAttribute("cfg") CfgIndexInfo 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 { - avContentCfgService.auditAvVoip(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); - } catch ( Exception e) { - if(e instanceof MaatConvertException) { + avContentCfgService.auditAvVoip(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.error("VOIP配置下发失败:"+e.getMessage());; - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.error("VOIP配置下发失败:" + e.getMessage()); + ; + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("VOIP配置下发失败",e); - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("VOIP配置下发失败", e); + addMessage(redirectAttributes, "error", "audit_failed"); } - + } } - - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 voipCfgList(model, request, response, cfg, redirectAttributes); } - return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/voipList?functionId=" + functionId; } - //修改VOIP IP配置审核状态 -/* @RequestMapping(value = {"/auditAvVoipAccount"}) - @RequiresPermissions(value={"avVoipAccount:confirm"}) - public String auditVoipAccount(Integer isAudit,Integer isValid,String ids - ,String compileIds,Integer functionId - ,RedirectAttributes redirectAttributes) { - if(!StringUtil.isEmpty(compileIds)){ - String[] idArray = compileIds.split(","); - Date auditTime=new Date(); - for(String id :idArray){ - try { - avContentCfgService.auditAvVoipAccount(isAudit,isValid,functionId,id,auditTime); - } catch (MaatConvertException e) { - if(e instanceof MaatConvertException) { - e.printStackTrace(); - logger.info("VOIPAccount配置下发失败:"+e.getMessage());; - addMessage(redirectAttributes,"request_service_failed"); - }else { - e.printStackTrace(); - logger.error("VOIPAccount配置下发失败",e); - addMessage(redirectAttributes,"audit_failed"); - } - } - } - - } - return "redirect:" + adminPath +"/ntc/av/voipAccountList?functionId="+functionId; - }*/ - + // 修改VOIP IP配置审核状态 + /* + * @RequestMapping(value = {"/auditAvVoipAccount"}) + * + * @RequiresPermissions(value={"avVoipAccount:confirm"}) public String + * auditVoipAccount(Integer isAudit,Integer isValid,String ids ,String + * compileIds,Integer functionId ,RedirectAttributes redirectAttributes) { + * if(!StringUtil.isEmpty(compileIds)){ String[] idArray = + * compileIds.split(","); Date auditTime=new Date(); for(String id + * :idArray){ try { + * avContentCfgService.auditAvVoipAccount(isAudit,isValid,functionId,id, + * auditTime); } catch (MaatConvertException e) { if(e instanceof + * MaatConvertException) { e.printStackTrace(); + * logger.info("VOIPAccount配置下发失败:"+e.getMessage());; + * addMessage(redirectAttributes,"request_service_failed"); }else { + * e.printStackTrace(); logger.error("VOIPAccount配置下发失败",e); + * addMessage(redirectAttributes,"audit_failed"); } } } + * + * } return "redirect:" + adminPath + * +"/ntc/av/voipAccountList?functionId="+functionId; } + */ + /** - * 账号account - * 根据索引表信息异步获取子表信息 + * 账号account 根据索引表信息异步获取子表信息 + * * @return */ - /*@ResponseBody - @RequestMapping(value = "ajaxVoipAccountInfo") - public Map getVoipAccountInfo(CfgIndexInfo cfgIndexInfo) { - Map voipAndAccountInfoMap=new HashMap(); - List voipAccountCfgList=new ArrayList(); - List ntcSubscribeIdCfgList=new ArrayList(); - - voipAccountCfgList = avContentCfgService.getVoipAccountCfgList(cfgIndexInfo); - ntcSubscribeIdCfgList=avContentCfgService.getSubscribeIdCfgList(cfgIndexInfo); - - voipAndAccountInfoMap.put("account", voipAccountCfgList); - voipAndAccountInfoMap.put("subscribe", ntcSubscribeIdCfgList); - return voipAndAccountInfoMap; - }*/ + /* + * @ResponseBody + * + * @RequestMapping(value = "ajaxVoipAccountInfo") public Map + * getVoipAccountInfo(CfgIndexInfo cfgIndexInfo) { Map + * voipAndAccountInfoMap=new HashMap(); + * List voipAccountCfgList=new + * ArrayList(); List + * ntcSubscribeIdCfgList=new ArrayList(); + * + * voipAccountCfgList = + * avContentCfgService.getVoipAccountCfgList(cfgIndexInfo); + * ntcSubscribeIdCfgList=avContentCfgService.getSubscribeIdCfgList( + * cfgIndexInfo); + * + * voipAndAccountInfoMap.put("account", voipAccountCfgList); + * voipAndAccountInfoMap.put("subscribe", ntcSubscribeIdCfgList); return + * voipAndAccountInfoMap; } + */ /** * 根据索引表信息异步获取子表信息 + * * @return */ - @RequestMapping(value = {"/ajaxVoipIpInfo"}) - public String getVoipIpInfo(Model model,Long cfgId,Integer index,Integer compileId) { + @RequestMapping(value = { "/ajaxVoipIpInfo" }) + public String getVoipIpInfo(Model model, Long cfgId, Integer index, Integer compileId) { CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); cfgIndexInfo.setCfgId(cfgId); cfgIndexInfo.setCompileId(compileId); CfgIndexInfo cfg = avContentCfgService.getCfgIndexInfo(cfgIndexInfo); List tabList = new ArrayList(); - //获取voipIpCfg信息 -/* if(cfg.getVoipIps()!=null){ + // 获取voipIpCfg信息 + /* + * if(cfg.getVoipIps()!=null){ String cfgType = null; for(AvVoipIpCfg + * ip:cfg.getVoipIps()){ if(!ip.getCfgType().equals(cfgType)){ + * tabList.add(new String[]{"1",ip.getCfgType()}); cfgType = + * ip.getCfgType(); } } } + */ + if (cfg.getIpPortList() != null) { String cfgType = null; - for(AvVoipIpCfg ip:cfg.getVoipIps()){ - if(!ip.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"1",ip.getCfgType()}); - cfgType = ip.getCfgType(); - } - } - }*/ - 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.getVoipAccounts()!=null){ + + if (cfg.getVoipAccounts() != null) { String cfgType = null; - for(AvVoipAccountCfg account:cfg.getVoipAccounts()){ - if(account!=null&&!account.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",account.getCfgType()}); + for (AvVoipAccountCfg account : cfg.getVoipAccounts()) { + if (account != null && !account.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "2", account.getCfgType() }); cfgType = account.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/av/voip/voipSubList"; } - /*****************************voip业务***************/ - - /*****************************contIp业务***************/ - //视频文本内容配置列表 - @RequestMapping(value = {"/contIpList"}) - public String contIpList(Model model,HttpServletRequest request - ,HttpServletResponse response - ,@ModelAttribute("cfg")BaseIpCfg entity - ,RedirectAttributes redirectAttributes){ - Page page = avContentCfgService.findContIpPage(new Page(request, response,"r"), entity); + + /***************************** voip业务 ***************/ + + /***************************** contIp业务 ***************/ + // 视频文本内容配置列表 + @RequestMapping(value = { "/contIpList" }) + public String contIpList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") BaseIpCfg entity, RedirectAttributes redirectAttributes) { + Page page = avContentCfgService.findContIpPage(new Page(request, response, "r"), entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); return "/cfg/av/contIp/contIpList"; } - //音视频CONTIP新增界面 - @RequestMapping(value = {"/contIpForm"}) - @RequiresPermissions(value={"avContIp:config"}) - public String contIpForm(Model model,HttpServletRequest request,HttpServletResponse response - ,String ids,String compileIds - ,BaseIpCfg cfg - ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(compileIds)){ + + // 音视频CONTIP新增界面 + @RequestMapping(value = { "/contIpForm" }) + @RequiresPermissions(value = { "avContIp:config" }) + public String contIpForm(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + String compileIds, BaseIpCfg cfg, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(compileIds)) { cfg.setCompileId(Integer.parseInt(compileIds)); cfg = avContentCfgService.getContIpCfgById(cfg); initUpdateFormCondition(model, cfg); - }else{ - initFormCondition(model,cfg); + } else { + initFormCondition(model, cfg); } model.addAttribute("_cfg", cfg); return "/cfg/av/contIp/contIpForm"; } - - //保存CONTIP信息 - @RequestMapping(value = {"/saveContIp"}) - public String saveContIp(Model model,HttpServletRequest request - ,HttpServletResponse response, - @ModelAttribute("cfg")BaseIpCfg cfg, - @ModelAttribute("areaCfgIds")String areaCfgIds - ,RedirectAttributes redirectAttributes){ - try{ - avContentCfgService.saveOrUpdateContIp(cfg,areaCfgIds); - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ - logger.error("信息保存失败",e); + + // 保存CONTIP信息 + @RequestMapping(value = { "/saveContIp" }) + public String saveContIp(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") BaseIpCfg cfg, @ModelAttribute("areaCfgIds") String areaCfgIds, + RedirectAttributes redirectAttributes) { + try { + avContentCfgService.saveOrUpdateContIp(cfg, areaCfgIds); + 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 +"/ntc/av/contIpList?functionId="+cfg.getFunctionId(); + + return "redirect:" + adminPath + "/ntc/av/contIpList?functionId=" + cfg.getFunctionId(); } - - //修改CONTIP例配置状态 - @RequestMapping(value = {"/updateAvContIpValid"}) - @RequiresPermissions(value={"avContIp:config"}) - public String updateAvContIpValid(Integer isAudit,Integer isValid - ,String ids,Integer functionId - ,RedirectAttributes redirectAttributes){ - avContentCfgService.updateContIpValid(isAudit,isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/av/contIpList?functionId="+functionId; + + // 修改CONTIP例配置状态 + @RequestMapping(value = { "/updateAvContIpValid" }) + @RequiresPermissions(value = { "avContIp:config" }) + public String updateAvContIpValid(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { + avContentCfgService.updateContIpValid(isAudit, isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/av/contIpList?functionId=" + functionId; } - //修改CONTIP配置审核 - @RequestMapping(value = {"/auditAvContIp"}) - @RequiresPermissions(value={"avContIp:confirm"}) - public String auditContIp(Integer isAudit,Integer isValid - ,String ids,String compileIds,Integer functionId - , RedirectAttributes redirectAttributes) { - if(!StringUtil.isEmpty(compileIds)){ + + // 修改CONTIP配置审核 + @RequestMapping(value = { "/auditAvContIp" }) + @RequiresPermissions(value = { "avContIp:confirm" }) + public String auditContIp(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId, + RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(compileIds)) { String[] idArray = compileIds.split(","); - Date auditTime=new Date(); - for(String id :idArray){ + Date auditTime = new Date(); + for (String id : idArray) { try { - avContentCfgService.auditContIp(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); + avContentCfgService.auditContIp(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); } catch (MaatConvertException e) { - logger.error("Cont Ip配置下发失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); - }catch (Exception e) { - logger.error("Cont Ip配置下发失败",e); - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("Cont Ip配置下发失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } catch (Exception e) { + logger.error("Cont Ip配置下发失败", e); + addMessage(redirectAttributes, "error", "audit_failed"); } - + } - + } - return "redirect:" + adminPath +"/ntc/av/contIpList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/contIpList?functionId=" + functionId; } + // 获取域配置信息 - @RequestMapping(value = {"ajaxAvContIpList"}) - public String ajaxAvContIpList(Model model,Long cfgId,Integer index) { + @RequestMapping(value = { "ajaxAvContIpList" }) + public String ajaxAvContIpList(Model model, Long cfgId, Integer index) { BaseIpCfg baseIpCfg = new BaseIpCfg(); baseIpCfg.setCfgId(cfgId); BaseIpCfg cfg = avContentCfgService.getContIpCfgById(baseIpCfg); List tabList = new ArrayList(); - - tabList.add(new String[]{"1",cfg.getCfgType()}); - if(cfg.getNtcSubscribeIdCfgList()!=null){ + + tabList.add(new String[] { "1", cfg.getCfgType() }); + if (cfg.getNtcSubscribeIdCfgList() != null) { String cfgType = null; - for(BaseStringCfg subscribeId:cfg.getNtcSubscribeIdCfgList()){ - if(!subscribeId.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",subscribeId.getCfgType()}); + for (BaseStringCfg subscribeId : cfg.getNtcSubscribeIdCfgList()) { + if (!subscribeId.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "2", subscribeId.getCfgType() }); cfgType = subscribeId.getCfgType(); } } } - model.addAttribute("_cfg", cfg); + model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); return "/cfg/av/subList"; } - /*****************************contIp业务***************/ - - /*****************************picIp业务***************/ - //视频文本内容配置列表 - @RequestMapping(value = {"/picIpList"}) - public String picIpList(Model model,HttpServletRequest request - ,HttpServletResponse response - ,@ModelAttribute("cfg")BaseIpCfg entity - ,RedirectAttributes redirectAttributes){ - Page page = avContentCfgService.findPicIpPage(new Page(request, response,"r"), entity); + + /***************************** contIp业务 ***************/ + + /***************************** picIp业务 ***************/ + // 视频文本内容配置列表 + @RequestMapping(value = { "/picIpList" }) + public String picIpList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") BaseIpCfg entity, RedirectAttributes redirectAttributes) { + Page page = avContentCfgService.findPicIpPage(new Page(request, response, "r"), entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); return "/cfg/av/picIp/picIpList"; } - //音视频CONTIP新增界面 - @RequestMapping(value = {"/picIpForm"}) - @RequiresPermissions(value={"avPicIp:config"}) - public String picIpForm(Model model,HttpServletRequest request - ,HttpServletResponse response,String ids - ,String compileIds,BaseIpCfg cfg - ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(compileIds)){ + + // 音视频CONTIP新增界面 + @RequestMapping(value = { "/picIpForm" }) + @RequiresPermissions(value = { "avPicIp:config" }) + public String picIpForm(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + String compileIds, BaseIpCfg cfg, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(compileIds)) { cfg.setCompileId(Integer.parseInt(compileIds)); cfg = avContentCfgService.getPicIpCfgById(cfg); initUpdateFormCondition(model, cfg); - }else{ - initFormCondition(model,cfg); + } else { + initFormCondition(model, cfg); } model.addAttribute("_cfg", cfg); return "/cfg/av/picIp/picIpForm"; } - - //保存CONTIP信息 - @RequestMapping(value = {"/savePicIp"}) - public String savePicIp(Model model,HttpServletRequest request - ,HttpServletResponse response, - @ModelAttribute("cfg")BaseIpCfg cfg, - @ModelAttribute("areaCfgIds")String areaCfgIds - ,RedirectAttributes redirectAttributes){ - try{ - avContentCfgService.saveOrUpdatePicIp(cfg,areaCfgIds); - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ - logger.error("信息保存失败",e); + + // 保存CONTIP信息 + @RequestMapping(value = { "/savePicIp" }) + public String savePicIp(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") BaseIpCfg cfg, @ModelAttribute("areaCfgIds") String areaCfgIds, + RedirectAttributes redirectAttributes) { + try { + avContentCfgService.saveOrUpdatePicIp(cfg, areaCfgIds); + 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 +"/ntc/av/picIpList?functionId="+cfg.getFunctionId(); + + return "redirect:" + adminPath + "/ntc/av/picIpList?functionId=" + cfg.getFunctionId(); } - - //修改CONTIP例配置状态 - @RequestMapping(value = {"/updatePicIpValid"}) - @RequiresPermissions(value={"avPicIp:config"}) - public String updateAvPicIpValid(Integer isAudit,Integer isValid - ,String ids,Integer functionId - ,RedirectAttributes redirectAttributes){ - avContentCfgService.updatePicIpValid(isAudit,isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/av/picIpList?functionId="+functionId; + + // 修改CONTIP例配置状态 + @RequestMapping(value = { "/updatePicIpValid" }) + @RequiresPermissions(value = { "avPicIp:config" }) + public String updateAvPicIpValid(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { + avContentCfgService.updatePicIpValid(isAudit, isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/av/picIpList?functionId=" + functionId; } - //修改CONTIP配置审核 - @RequestMapping(value = {"/auditPicIp"}) - @RequiresPermissions(value={"avPicIp:confirm"}) - public String auditPicIp(Integer isAudit,Integer isValid,String ids - ,String compileIds,Integer functionId - , RedirectAttributes redirectAttributes) { - if(!StringUtil.isEmpty(compileIds)){ + + // 修改CONTIP配置审核 + @RequestMapping(value = { "/auditPicIp" }) + @RequiresPermissions(value = { "avPicIp:confirm" }) + public String auditPicIp(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId, + RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(compileIds)) { String[] idArray = compileIds.split(","); - Date auditTime=new Date(); - for(String id :idArray){ + Date auditTime = new Date(); + for (String id : idArray) { try { - avContentCfgService.auditPicIp(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); + avContentCfgService.auditPicIp(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); } catch (MaatConvertException e) { e.printStackTrace(); - logger.error("Pic Ip配置下发失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); + logger.error("Pic Ip配置下发失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); } catch (Exception e) { e.printStackTrace(); - logger.error("Pic Ip配置下发失败",e); - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("Pic Ip配置下发失败", e); + addMessage(redirectAttributes, "error", "audit_failed"); } } - + } - return "redirect:" + adminPath +"/ntc/av/picIpList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/picIpList?functionId=" + functionId; } + // 获取域配置信息 - @RequestMapping(value = {"ajaxAvPicIpList"}) - public String ajaxAvPicIpList(Model model,Long cfgId,Integer index) { + @RequestMapping(value = { "ajaxAvPicIpList" }) + public String ajaxAvPicIpList(Model model, Long cfgId, Integer index) { BaseIpCfg baseIpCfg = new BaseIpCfg(); baseIpCfg.setCfgId(cfgId); BaseIpCfg cfg = avContentCfgService.getPicIpCfgById(baseIpCfg); List tabList = new ArrayList(); - - tabList.add(new String[]{"1",cfg.getCfgType()}); - if(cfg.getNtcSubscribeIdCfgList()!=null){ + + tabList.add(new String[] { "1", cfg.getCfgType() }); + if (cfg.getNtcSubscribeIdCfgList() != null) { String cfgType = null; - for(BaseStringCfg subscribeId:cfg.getNtcSubscribeIdCfgList()){ - if(!subscribeId.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",subscribeId.getCfgType()}); + for (BaseStringCfg subscribeId : cfg.getNtcSubscribeIdCfgList()) { + if (!subscribeId.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "2", subscribeId.getCfgType() }); cfgType = subscribeId.getCfgType(); } } } - model.addAttribute("_cfg", cfg); + model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); return "/cfg/av/subList"; - } - /*****************************picIp业务***************/ - - - /*****************************contUrl业务***************/ - //视频文本内容配置列表 - @RequestMapping(value = {"/contUrlList"}) - public String contUrlList(Model model,HttpServletRequest request - ,HttpServletResponse response - ,@ModelAttribute("cfg")CfgIndexInfo entity - ,RedirectAttributes redirectAttributes){ - /*if(entity.getIpPort()== null){ - entity.setIpPort(new IpPortCfg()); - } - if(entity.getAvContUrlCfgList()== null){ - entity.setAvContUrlCfg(new AvContUrlCfg());; - } - if(entity.getNtcSubscribeIdCfg()==null){ - entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); - }*/ - Page page = avContentCfgService.findPage(new Page(request, response,"r"), entity); + } + + /***************************** picIp业务 ***************/ + + /***************************** contUrl业务 ***************/ + // 视频文本内容配置列表 + @RequestMapping(value = { "/contUrlList" }) + public String contUrlList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, RedirectAttributes redirectAttributes) { + /* + * if(entity.getIpPort()== null){ entity.setIpPort(new IpPortCfg()); } + * if(entity.getAvContUrlCfgList()== null){ entity.setAvContUrlCfg(new + * AvContUrlCfg());; } if(entity.getNtcSubscribeIdCfg()==null){ + * entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); } + */ + Page page = avContentCfgService.findPage(new Page(request, response, "r"), entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); return "/cfg/av/contUrl/contUrlList"; } - //音视频CONTUrl新增界面 - @RequestMapping(value = {"/contUrlForm"}) - @RequiresPermissions(value={"avContUrl:config"}) - public String contUrlForm(Model model,HttpServletRequest request ,HttpServletResponse response - ,String compileIds,String ids, CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(ids)){ + + // 音视频CONTUrl新增界面 + @RequestMapping(value = { "/contUrlForm" }) + @RequiresPermissions(value = { "avContUrl:config" }) + public String contUrlForm(Model model, HttpServletRequest request, HttpServletResponse response, String compileIds, + String ids, CfgIndexInfo cfg, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(ids)) { cfg.setCfgId(Long.parseLong(ids)); cfg = avContentCfgService.getUrlCfgIndexInfo(cfg); AvContUrlCfg urlCfg = new AvContUrlCfg(); urlCfg.setCfgType("NTC_STREAMING_MEDIA_URL"); cfg.setAvContUrlCfg(urlCfg); - if(cfg.getAvContUrlCfgList().size()==0){ + if (cfg.getAvContUrlCfgList().size() == 0) { cfg.getAvContUrlCfgList().add(urlCfg); } initUpdateFormCondition(model, cfg); - }else{ + } else { AvContUrlCfg urlCfg = new AvContUrlCfg(); urlCfg.setCfgType("NTC_STREAMING_MEDIA_URL"); cfg.setAvContUrlCfg(urlCfg); - List urlList=new ArrayList(); + List urlList = new ArrayList(); urlList.add(urlCfg); cfg.setAvContUrlCfgList(urlList); - initFormCondition(model,cfg); + initFormCondition(model, cfg); } model.addAttribute("_cfg", cfg); return "/cfg/av/contUrl/contUrlForm"; } - - //保存CONTUrl信息 - @RequestMapping(value = {"/saveContUrl"}) - public String saveContUrl(Model model,HttpServletRequest request,HttpServletResponse response,String ids, - CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){ - try{ + + // 保存CONTUrl信息 + @RequestMapping(value = { "/saveContUrl" }) + public String saveContUrl(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + CfgIndexInfo cfg, RedirectAttributes redirectAttributes) { + try { avContentCfgService.saveOrUpdateContUrl(cfg); - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ - if(e instanceof MaatConvertException) { + addMessage(redirectAttributes, "success", "save_success"); + } catch (Exception e) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.error("Stream Media 信息保存失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.error("Stream Media 信息保存失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("Stream Media 信息保存失败",e); - addMessage(redirectAttributes,"error","save_failed"); + logger.error("Stream Media 信息保存失败", e); + addMessage(redirectAttributes, "error", "save_failed"); } } - return "redirect:" + adminPath +"/ntc/av/contUrlList?functionId="+cfg.getFunctionId(); + return "redirect:" + adminPath + "/ntc/av/contUrlList?functionId=" + cfg.getFunctionId(); } - - //修改CONTUrl例配置状态 - @RequestMapping(value = {"/updateAvContUrlValid"}) - @RequiresPermissions(value={"avContUrl:config"}) - public String updateAvContUrlValid(Integer isAudit,Integer isValid - ,String ids,Integer functionId - ,RedirectAttributes redirectAttributes){ - avContentCfgService.updateContUrlValid(isAudit,isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/av/contUrlList?functionId="+functionId; + + // 修改CONTUrl例配置状态 + @RequestMapping(value = { "/updateAvContUrlValid" }) + @RequiresPermissions(value = { "avContUrl:config" }) + public String updateAvContUrlValid(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { + avContentCfgService.updateContUrlValid(isAudit, isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/av/contUrlList?functionId=" + functionId; } - //修改CONTUrl配置审核 - @RequestMapping(value = {"/auditAvContUrl"}) - @RequiresPermissions(value={"avContUrl:confirm"}) - public String auditContUrl(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + + // 修改CONTUrl配置审核 + @RequestMapping(value = { "/auditAvContUrl" }) + @RequiresPermissions(value = { "avContUrl:confirm" }) + public String auditContUrl(Model model, @ModelAttribute("cfg") CfgIndexInfo 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 { - avContentCfgService.auditContUrl(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); - } catch ( Exception e) { + avContentCfgService.auditContUrl(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { e.printStackTrace(); - logger.info("Cont Url配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error", "request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.info("Cont Url配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 contUrlList(model, request, response, cfg, redirectAttributes); } - return "redirect:" + adminPath +"/ntc/av/contUrlList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/contUrlList?functionId=" + functionId; } + // 获取域配置信息 - @RequestMapping(value = {"ajaxAvContUrlList"}) - public String ajaxAvContUrlList(Model model,Long cfgId,Integer index,Integer compileId) { + @RequestMapping(value = { "ajaxAvContUrlList" }) + public String ajaxAvContUrlList(Model model, Long cfgId, Integer index, Integer compileId) { CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); cfgIndexInfo.setCfgId(cfgId); cfgIndexInfo.setCompileId(compileId); CfgIndexInfo cfg = avContentCfgService.getUrlCfgIndexInfo(cfgIndexInfo); List 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.getAvContUrlCfgList()!=null){ + if (cfg.getAvContUrlCfgList() != null) { String cfgType = null; - for(AvContUrlCfg avContUrlCfg:cfg.getAvContUrlCfgList()){ - if(!avContUrlCfg.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",avContUrlCfg.getCfgType()}); + for (AvContUrlCfg avContUrlCfg : cfg.getAvContUrlCfgList()) { + if (!avContUrlCfg.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "2", avContUrlCfg.getCfgType() }); cfgType = avContUrlCfg.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/av/contUrl/contSubList"; } - /*****************************contUrl业务***************/ - - - /*****************************picUrl业务***************/ - //视频文本内容配置列表 - @RequestMapping(value = {"/picUrlList"}) - public String picUrlList(Model model,HttpServletRequest request - ,HttpServletResponse response - ,@ModelAttribute("cfg")BaseStringCfg entity - ,RedirectAttributes redirectAttributes){ - Page page = avContentCfgService.findPicUrlPage(new Page(request, response,"r"), entity); + + /***************************** contUrl业务 ***************/ + + /***************************** picUrl业务 ***************/ + // 视频文本内容配置列表 + @RequestMapping(value = { "/picUrlList" }) + public String picUrlList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") BaseStringCfg entity, RedirectAttributes redirectAttributes) { + Page page = avContentCfgService.findPicUrlPage(new Page(request, response, "r"), + entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); return "/cfg/av/picUrl/picUrlList"; } - //音视频CONTUrl新增界面 - @RequestMapping(value = {"/picUrlForm"}) - @RequiresPermissions(value={"avPicUrl:config"}) - public String picUrlForm(Model model,HttpServletRequest request - ,HttpServletResponse response,String ids - ,String compileIds,@ModelAttribute("cfg")BaseStringCfg cfg - ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(compileIds)){ + + // 音视频CONTUrl新增界面 + @RequestMapping(value = { "/picUrlForm" }) + @RequiresPermissions(value = { "avPicUrl:config" }) + public String picUrlForm(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + String compileIds, @ModelAttribute("cfg") BaseStringCfg cfg, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(compileIds)) { cfg.setCompileId(Integer.parseInt(compileIds)); cfg = avContentCfgService.getPicUrlCfgById(cfg); initUpdateFormCondition(model, cfg); - }else{ - initFormCondition(model,cfg); + } else { + initFormCondition(model, cfg); } model.addAttribute("_cfg", cfg); return "/cfg/av/picUrl/picUrlForm"; } - - //保存CONTUrl信息 - @RequestMapping(value = {"/savePicUrl"}) - public String savePicUrl(Model model,HttpServletRequest request - ,HttpServletResponse response, - @ModelAttribute("cfg")BaseStringCfg cfg, - @ModelAttribute("areaCfgIds")String areaCfgIds - ,RedirectAttributes redirectAttributes){ - try{ - avContentCfgService.saveOrUpdatePicUrl(cfg,areaCfgIds); - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ - logger.error("信息保存失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error", "request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + + // 保存CONTUrl信息 + @RequestMapping(value = { "/savePicUrl" }) + public String savePicUrl(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") BaseStringCfg cfg, @ModelAttribute("areaCfgIds") String areaCfgIds, + RedirectAttributes redirectAttributes) { + try { + avContentCfgService.saveOrUpdatePicUrl(cfg, areaCfgIds); + addMessage(redirectAttributes, "success", "save_success"); + } catch (Exception e) { + logger.error("信息保存失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/ntc/av/picUrlList?functionId="+cfg.getFunctionId(); + + return "redirect:" + adminPath + "/ntc/av/picUrlList?functionId=" + cfg.getFunctionId(); } - - //修改CONTUrl例配置状态 - @RequestMapping(value = {"/updateAvPicUrlValid"}) - @RequiresPermissions(value={"avPicUrl:config"}) - public String updateAvPicUrlValid(Integer isAudit,Integer isValid - ,String ids,Integer functionId - ,RedirectAttributes redirectAttributes){ - avContentCfgService.updatePicUrlValid(isAudit,isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/av/picUrlList?functionId="+functionId; + + // 修改CONTUrl例配置状态 + @RequestMapping(value = { "/updateAvPicUrlValid" }) + @RequiresPermissions(value = { "avPicUrl:config" }) + public String updateAvPicUrlValid(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { + avContentCfgService.updatePicUrlValid(isAudit, isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/av/picUrlList?functionId=" + functionId; } - //修改CONTUrl配置审核 - @RequestMapping(value = {"/auditAvPicUrl"}) - @RequiresPermissions(value={"avPicUrl:confirm"}) - public String auditPicUrl(Integer isAudit,Integer isValid - ,String ids,String compileIds,Integer functionId - , RedirectAttributes redirectAttributes) { - if(!StringUtil.isEmpty(compileIds)){ + + // 修改CONTUrl配置审核 + @RequestMapping(value = { "/auditAvPicUrl" }) + @RequiresPermissions(value = { "avPicUrl:confirm" }) + public String auditPicUrl(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId, + RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(compileIds)) { String[] idArray = compileIds.split(","); - Date auditTime=new Date(); - for(String id :idArray){ + Date auditTime = new Date(); + for (String id : idArray) { try { - avContentCfgService.auditPicUrl(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); - } catch ( Exception e) { + avContentCfgService.auditPicUrl(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { e.printStackTrace(); - logger.info("Pic Url配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error", "request_service_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.info("Pic Url配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } } } - + } - return "redirect:" + adminPath +"/ntc/av/picUrlList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/picUrlList?functionId=" + functionId; } + // 获取域配置信息 - @RequestMapping(value = {"ajaxAvPicUrlList"}) - public String ajaxAvPicUrlList(Model model,Long cfgId,Integer index) { + @RequestMapping(value = { "ajaxAvPicUrlList" }) + public String ajaxAvPicUrlList(Model model, Long cfgId, Integer index) { BaseStringCfg baseStrCfg = new BaseStringCfg(); baseStrCfg.setCfgId(cfgId); BaseStringCfg cfg = avContentCfgService.getPicUrlCfgById(baseStrCfg); List tabList = new ArrayList(); - - tabList.add(new String[]{"2",cfg.getCfgType()}); - if(cfg.getNtcSubscribeIdCfgList()!=null){ + + tabList.add(new String[] { "2", cfg.getCfgType() }); + if (cfg.getNtcSubscribeIdCfgList() != null) { String cfgType = null; - for(NtcSubscribeIdCfg subscribeId:cfg.getNtcSubscribeIdCfgList()){ - if(!subscribeId.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",subscribeId.getCfgType()}); + for (NtcSubscribeIdCfg subscribeId : cfg.getNtcSubscribeIdCfgList()) { + if (!subscribeId.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "2", subscribeId.getCfgType() }); cfgType = subscribeId.getCfgType(); } } } - model.addAttribute("_cfg", cfg); + model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); return "/cfg/av/subList"; } - /*****************************picUrl业务***************/ + + /***************************** picUrl业务 ***************/ /** - * 1、effectiveIds分组展示 - * 2、无effectiveIds查询area_ip,根据compileId查询展示 + * 1、effectiveIds分组展示 2、无effectiveIds查询area_ip,根据compileId查询展示 */ @ResponseBody @RequestMapping(value = "/area/ajaxAreaEffictiveInfo") - public Map ajaxAreaEffictiveInfo(String areaEffectiveIds,Integer compileId) { - Map data=new HashMap(); - - List areaIsps=new ArrayList(); - List areaIps=new ArrayList(); - if(StringUtils.isEmpty(areaEffectiveIds)){ - areaIps=ipCfgService.getAreaCfgByCompileId(compileId); - }else{ - List itTypeList=new ArrayList(); + public Map ajaxAreaEffictiveInfo(String areaEffectiveIds, Integer compileId) { + Map data = new HashMap(); + + List areaIsps = new ArrayList(); + List areaIps = new ArrayList(); + if (StringUtils.isEmpty(areaEffectiveIds)) { + areaIps = ipCfgService.getAreaCfgByCompileId(compileId); + } else { + List itTypeList = new ArrayList(); itTypeList.add(Constants.ITEM_TYPE_AREA); - List areas = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null); + List areas = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(), itTypeList, null); itTypeList.clear(); itTypeList.add(Constants.ITEM_TYPE_ISP); - List isps = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null); + List isps = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(), itTypeList, null); getAreaIsps(areaEffectiveIds, areaIsps, isps, areas); - + } data.put("areaIsps", areaIsps); data.put("areaIps", areaIps); return data; } - //视频文本VOIP配置列表导出 - @RequestMapping(value = {"/voipExport"}) - public String voipExport(Model model, - HttpServletRequest request, - HttpServletResponse response, - @ModelAttribute("cfg")CfgIndexInfo entity, - String ids, - RedirectAttributes redirectAttributes){ + + // 视频文本VOIP配置列表导出 + @RequestMapping(value = { "/voipExport" }) + public String voipExport(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) { try { - //获取国际化配置 + // 获取国际化配置 Properties msgProp = getMsgProp(); - //获取分类、性质、标签 - List fls=serviceDictInfoService.findAllFlDict(); - List xzs=serviceDictInfoService.findAllXzDict(); - List labels=serviceDictInfoService.findAllLableDict(); - Map map=new HashMap(); + // 获取分类、性质、标签 + List fls = serviceDictInfoService.findAllFlDict(); + List xzs = serviceDictInfoService.findAllXzDict(); + List labels = serviceDictInfoService.findAllLableDict(); + Map map = new HashMap(); map.put("fls", fls); map.put("xzs", xzs); map.put("labels", labels); - - String fileName = "数据-"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx"; - - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - - }else{ - //导出查询条件下的所有记录 - - if(entity.getVoipIp()== null){ - entity.setVoipIp(new AvVoipIpCfg()); - } - if(entity.getVoipAccount()== null){ - entity.setVoipAccount(new AvVoipAccountCfg()); - } - //条件导出数据大于最大导出数,只导出最大导出条数 - Page pageInfo=new Page(request, response,"r"); - if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){ - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - }else{ - pageInfo.setPageNo(1); - pageInfo.setPageSize(-1); - } - Page page = avContentCfgService.findPage(pageInfo, entity); - new ExportExcel(msgProp,null, CfgIndexInfo.class,1).setDataList(msgProp,page.getList(),map).write(response, fileName).dispose(); - } - - return null; - } catch (Exception e) { - e.printStackTrace(); - addMessage(redirectAttributes,"error", "export_failed"); - } - - return "redirect:" + adminPath +"/ntc/av/picUrlList?functionId="+entity.getFunctionId(); - } - - //stream配置导出 - @RequestMapping(value = "exportStream") - public void exportStream(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"r"); + + String fileName = "数据-" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx"; + + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + + } else { + // 导出查询条件下的所有记录 + + if (entity.getVoipIp() == null) { + entity.setVoipIp(new AvVoipIpCfg()); + } + if (entity.getVoipAccount() == null) { + entity.setVoipAccount(new AvVoipAccountCfg()); + } + // 条件导出数据大于最大导出数,只导出最大导出条数 + Page pageInfo = new Page(request, response, "r"); + if (pageInfo.getCount() > Constants.MAX_EXPORT_SIZE) { pageInfo.setPageNo(1); pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - if(entity.getIpPort()== null){ - entity.setIpPort(new IpPortCfg()); - } - if(entity.getAvContUrlCfgList()== null){ - entity.setAvContUrlCfg(new AvContUrlCfg());; - } - if(entity.getNtcSubscribeIdCfg()==null){ - entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); - } - Page page = avContentCfgService.findPage(pageInfo, entity); - ipLists=page.getList(); + } else { + pageInfo.setPageNo(1); + pageInfo.setPageSize(-1); } - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_UNIVERSAL_IP"); - titleList.add("NTC_STREAMING_MEDIA_URL"); - titleList.add("NTC_SUBSCRIBE_ID"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); - classMap.put("NTC_STREAMING_MEDIA_URL", 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_UNIVERSAL_IP", ipPortInfoNoExport); - noExportMap.put("NTC_STREAMING_MEDIA_URL", regionCfgNoExport); - noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); - List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - List streamurlList=new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - Map maps=avContentCfgService.exportstream(cfg); - ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); - streamurlList.addAll(maps.get("NTC_STREAMING_MEDIA_URL")); - subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); - } - subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); - streamurlList=BaseStringCfg.replaceBaseKeyList(streamurlList); - dataMap.put(entity.getMenuNameCode(), ipLists); - dataMap.put("NTC_UNIVERSAL_IP", ipList); - dataMap.put("NTC_STREAMING_MEDIA_URL", streamurlList); - dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); - /*}*/ - this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); - } catch (Exception e) { - logger.error("stream export failed",e); - addMessage(redirectAttributes,"error", "export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); - } - - //voip配置导出 - @RequestMapping(value = "exportVoip") - public void exportVoip(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - if(entity.getIpPort()== null){ - entity.setIpPort(new IpPortCfg()); - } - if(entity.getVoipAccount()== null){ - entity.setVoipAccount(new AvVoipAccountCfg()); - } - if(entity.getNtcSubscribeIdCfg()==null){ - entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); - } - Page page = avContentCfgService.findPage(new Page(request, response,"r"), entity); - ipLists=page.getList(); - } - - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_UNIVERSAL_IP"); - titleList.add("NTC_VOIP_ACCOUNT"); - titleList.add("NTC_SUBSCRIBE_ID"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); - classMap.put("NTC_VOIP_ACCOUNT", 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_UNIVERSAL_IP", ipPortInfoNoExport); - noExportMap.put("NTC_VOIP_ACCOUNT", regionCfgNoExport); - noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); - List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - List countlList=new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - Map maps=avContentCfgService.exportvoip(cfg); - ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); - countlList.addAll(maps.get("NTC_VOIP_ACCOUNT")); - subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); - } - countlList=BaseStringCfg.replaceBaseKeyList(countlList); - subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); - dataMap.put(entity.getMenuNameCode(),ipLists); - dataMap.put("NTC_UNIVERSAL_IP", ipList); - dataMap.put("NTC_VOIP_ACCOUNT", countlList); - dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); - /*}*/ - this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); - } catch (Exception e) { - logger.error("voip export failed",e); - addMessage(redirectAttributes,"error", "export_failed"); + Page page = avContentCfgService.findPage(pageInfo, entity); + new ExportExcel(msgProp, null, CfgIndexInfo.class, 1).setDataList(msgProp, page.getList(), map) + .write(response, fileName).dispose(); } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + + return null; + } catch (Exception e) { + e.printStackTrace(); + addMessage(redirectAttributes, "error", "export_failed"); } + + return "redirect:" + adminPath + "/ntc/av/picUrlList?functionId=" + entity.getFunctionId(); + } + + // stream配置导出 + @RequestMapping(value = "exportStream") + public void exportStream(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = avContentCfgService.findPage(pageInfo, entity); + ipLists = page.getList(); + } + titleList.add(entity.getMenuNameCode()); + titleList.add("NTC_UNIVERSAL_IP"); + titleList.add("NTC_STREAMING_MEDIA_URL"); + titleList.add("NTC_SUBSCRIBE_ID"); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); + classMap.put("NTC_STREAMING_MEDIA_URL", 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_UNIVERSAL_IP", ipPortInfoNoExport); + noExportMap.put("NTC_STREAMING_MEDIA_URL", regionCfgNoExport); + noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); + List ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + List streamurlList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + Map maps = avContentCfgService.exportstream(cfg); + ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); + streamurlList.addAll(maps.get("NTC_STREAMING_MEDIA_URL")); + subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); + } + subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList); + streamurlList = BaseStringCfg.replaceBaseKeyList(streamurlList); + dataMap.put(entity.getMenuNameCode(), ipLists); + dataMap.put("NTC_UNIVERSAL_IP", ipList); + dataMap.put("NTC_STREAMING_MEDIA_URL", streamurlList); + 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("stream export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // voip配置导出 + @RequestMapping(value = "exportVoip") + public void exportVoip(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = avContentCfgService.findPage(new Page(request, response, "r"), + entity); + ipLists = page.getList(); + } + + titleList.add(entity.getMenuNameCode()); + titleList.add("NTC_UNIVERSAL_IP"); + titleList.add("NTC_VOIP_ACCOUNT"); + titleList.add("NTC_SUBSCRIBE_ID"); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); + classMap.put("NTC_VOIP_ACCOUNT", 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_UNIVERSAL_IP", ipPortInfoNoExport); + noExportMap.put("NTC_VOIP_ACCOUNT", regionCfgNoExport); + noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); + List ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + List countlList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + Map maps = avContentCfgService.exportvoip(cfg); + ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); + countlList.addAll(maps.get("NTC_VOIP_ACCOUNT")); + subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); + } + countlList = BaseStringCfg.replaceBaseKeyList(countlList); + subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList); + dataMap.put(entity.getMenuNameCode(), ipLists); + dataMap.put("NTC_UNIVERSAL_IP", ipList); + dataMap.put("NTC_VOIP_ACCOUNT", countlList); + 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("voip export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java index f72403808..32baf47df 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java @@ -43,6 +43,7 @@ import com.nis.domain.configuration.AvSignSampleCfg; import com.nis.domain.configuration.AvSignSampleCfgModel; import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.FileDigestCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.maat.ToMaatResult; @@ -71,613 +72,673 @@ import it.sauronsoftware.jave.VideoInfo; /** * 处理音视频业务 + * * @author zhangwei * */ @Controller @RequestMapping("${adminPath}/ntc/av") -public class AvController extends BaseController { +public class AvController extends BaseController { - //音视频文件样例配置列表 - @RequestMapping(value = {"/sample/fileSampleList","/sample/fileSampleSpeakerList","/sample/fileSampleLogoList","/sample/fileSampleFaceList"}) - public String fileSampleList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")AvFileSampleCfg entity){ - Page page = avCfgService.getAvFileSampleList(new Page(request, response,"a"), entity); + // 音视频文件样例配置列表 + @RequestMapping(value = { "/sample/fileSampleList", "/sample/fileSampleSpeakerList", "/sample/fileSampleLogoList", + "/sample/fileSampleFaceList" }) + public String fileSampleList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AvFileSampleCfg entity) { + Page page = avCfgService.getAvFileSampleList(new Page(request, response, "a"), + entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); - for(FunctionRegionDict region:regionList){ - model.addAttribute("regionValue",region.getConfigRegionValue()); + for (FunctionRegionDict region : regionList) { + model.addAttribute("regionValue", region.getConfigRegionValue()); break; } return "/cfg/av/fileSampleList"; } - //音视频标志样例配置列表 - @RequestMapping(value = {"/sample/audioSignSampleList"}) - public String audioSignSampleList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")AvSignSampleCfg entity){ - Page page = avCfgService.getAvSignSampleList(new Page(request, response,"a"), entity); + + // 音视频标志样例配置列表 + @RequestMapping(value = { "/sample/audioSignSampleList" }) + public String audioSignSampleList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AvSignSampleCfg entity) { + Page page = avCfgService.getAvSignSampleList(new Page(request, response, "a"), + entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); - for(FunctionRegionDict region:regionList){ - model.addAttribute("regionValue",region.getConfigRegionValue()); + for (FunctionRegionDict region : regionList) { + model.addAttribute("regionValue", region.getConfigRegionValue()); break; } return "/cfg/av/signSampleList"; } - //视频标志样例配置列表 - @RequestMapping(value = {"/sample/signSampleList"}) - public String signSampleList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")AvSignSampleCfg entity){ + + // 视频标志样例配置列表 + @RequestMapping(value = { "/sample/signSampleList" }) + public String signSampleList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AvSignSampleCfg entity) { List list = avCfgService.getSignSampleList(entity); model.addAttribute("cfgs", list); model.addAttribute("functionId", entity.getFunctionId()); - initPageCondition(model,entity); - /*List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); - for(FunctionRegionDict region:regionList){ - model.addAttribute("regionValue",region.getConfigRegionValue()); - break; - }*/ + initPageCondition(model, entity); + /* + * List regionList = + * DictUtils.getFunctionRegionDictList(entity.getFunctionId()); + * for(FunctionRegionDict region:regionList){ + * model.addAttribute("regionValue",region.getConfigRegionValue()); + * break; } + */ List serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId()); model.addAttribute("serviceList", serviceList); - //return "/cfg/av/signSampleList"; + // return "/cfg/av/signSampleList"; return "/cfg/av/switchSignSample"; } + // 日志获取样例获取域配置信息 - @RequestMapping(value = {"ajaxSignSampleList"}) - public String ajaxSignSampleList(Model model,Long cfgId,Integer index,Integer compileId) { + @RequestMapping(value = { "ajaxSignSampleList" }) + public String ajaxSignSampleList(Model model, Long cfgId, Integer index, Integer compileId) { List tabList = new ArrayList(); AvSignSampleCfg cfg = new AvSignSampleCfg(); cfg.setCfgId(cfgId); cfg.setCompileId(compileId); List list = avCfgService.getSignSampleList(cfg); - if(list!=null){ - cfg=list.get(0); + if (list != null) { + cfg = list.get(0); } cfg.setCfgType("5"); - String cfgType = null; - if(cfg.getCfgType()!=null){ - tabList.add(new String[]{"5",cfg.getCfgType()}); - cfgType = cfg.getCfgType(); - } - model.addAttribute("_cfg", cfg); + String cfgType = null; + if (cfg.getCfgType() != null) { + tabList.add(new String[] { "5", cfg.getCfgType() }); + cfgType = cfg.getCfgType(); + } + model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); return "/cfg/av/switchSignSampleSubList"; } - //文件样例配置界面 - @RequestMapping(value = {"/sample/fileSampleForm"}) - public String fileSampleForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,AvFileSampleCfg entity){ - if(!StringUtil.isEmpty(ids)){ - entity = avCfgService.getAvFileSampleById(Long.parseLong(ids),null); + // 文件样例配置界面 + @RequestMapping(value = { "/sample/fileSampleForm" }) + public String fileSampleForm(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + AvFileSampleCfg entity) { + if (!StringUtil.isEmpty(ids)) { + entity = avCfgService.getAvFileSampleById(Long.parseLong(ids), null); } - - initFormCondition(model,entity); + + initFormCondition(model, entity); model.addAttribute("_cfg", entity); return "/cfg/av/fileSampleForm"; } + // 日志获取样例获取域配置信息 - @RequestMapping(value = {"ajaxfileSampleList"}) - public String ajaxAvContIpList(Model model,Long cfgId,Integer index,Integer compileId) { - AvFileSampleCfg cfg = avCfgService.getAvFileSampleById(cfgId,compileId); + @RequestMapping(value = { "ajaxfileSampleList" }) + public String ajaxAvContIpList(Model model, Long cfgId, Integer index, Integer compileId) { + AvFileSampleCfg cfg = avCfgService.getAvFileSampleById(cfgId, compileId); List tabList = new ArrayList(); - if(cfg!=null){ + if (cfg != null) { String cfgType = null; - if(!cfg.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"5",cfg.getCfgType()}); + if (!cfg.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "5", cfg.getCfgType() }); cfgType = cfg.getCfgType(); } } - model.addAttribute("_cfg", cfg); + model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); return "/cfg/av/fileSampleSubList"; } - //标志样例配置界面 - @RequestMapping(value = {"/sample/audioSignSampleForm"}) - public String audioSignSampleForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,AvSignSampleCfg entity){ - if(!StringUtil.isEmpty(ids)){ + + // 标志样例配置界面 + @RequestMapping(value = { "/sample/audioSignSampleForm" }) + public String audioSignSampleForm(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + AvSignSampleCfg entity) { + if (!StringUtil.isEmpty(ids)) { entity = avCfgService.getAvSignSampleById(Long.parseLong(ids)); } - initFormCondition(model,entity); + initFormCondition(model, entity); model.addAttribute("_cfg", entity); return "/cfg/av/signSampleForm"; } - //保存文件样例配置 - @RequestMapping(value = {"/sample/saveFileSample"}) - public String saveFileSample(Model model,HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes, - String ids,AvFileSampleCfg entity,MultipartFile srcFile,MultipartFile sampleFile,String picPath,String videoToPicture){ - try{ -// if(srcFile!=null && sampleFile!=null && -// srcFile.getSize()>0 && sampleFile.getSize()>0){ + + // 保存文件样例配置 + @RequestMapping(value = { "/sample/saveFileSample" }) + public String saveFileSample(Model model, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes, String ids, AvFileSampleCfg entity, MultipartFile srcFile, + MultipartFile sampleFile, String picPath, String videoToPicture) { + try { + // if(srcFile!=null && sampleFile!=null && + // srcFile.getSize()>0 && sampleFile.getSize()>0){ String sep = System.getProperty("file.separator"); - String srcFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"srcFile";//源文件保存路径 - String sampleFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"sampleFile";//样例文件保存路径 - String resultFilePath = Constants.AV_FILE_PATH+entity.getCfgType()+sep+"resultFile";//结果文件保存路径 + String srcFilePath = Constants.AV_FILE_PATH + entity.getCfgType() + sep + "srcFile";// 源文件保存路径 + String sampleFilePath = Constants.AV_FILE_PATH + entity.getCfgType() + sep + "sampleFile";// 样例文件保存路径 + String resultFilePath = Constants.AV_FILE_PATH + entity.getCfgType() + sep + "resultFile";// 结果文件保存路径 FileUtils.createDirectory(srcFilePath); - FileUtils.createDirectory(sampleFilePath); - String fileName = UUID.randomUUID()+""; - - //视频样例生成并选中的图片压缩为zip文件 - if("true".equals(videoToPicture)){ - if(!StringUtils.isBlank(entity.getSrcPath())){ - String[] srcArray = entity.getSrcPath().split("\\|");//所选图片数组 - String srcFileAllPath = srcFilePath+sep+fileName+".zip"; + FileUtils.createDirectory(sampleFilePath); + String fileName = UUID.randomUUID() + ""; + + // 视频样例生成并选中的图片压缩为zip文件 + if ("true".equals(videoToPicture)) { + if (!StringUtils.isBlank(entity.getSrcPath())) { + String[] srcArray = entity.getSrcPath().split("\\|");// 所选图片数组 + String srcFileAllPath = srcFilePath + sep + fileName + ".zip"; File zipFile = new File(srcFileAllPath); ZipOutputStream zouts = new ZipOutputStream(new FileOutputStream(zipFile)); - for(String s:srcArray){ - if(!"".equals(s)){ - String filePath = picPath+sep+s; + for (String s : srcArray) { + if (!"".equals(s)) { + String filePath = picPath + sep + s; File file = new File(filePath); - //将文件添加至压缩文件 + // 将文件添加至压缩文件 FileUtils.zipFilesToZipFile(file.getParent(), file, zouts); file.delete(); } } FileUtils.deleteDirectory(picPath); - if(zouts!=null){ + if (zouts != null) { zouts.close(); } FileInputStream input = new FileInputStream(srcFileAllPath); - srcFile = new MockMultipartFile(zipFile.getName(), input); - if(input!=null){ - input.close(); - } + srcFile = new MockMultipartFile(zipFile.getName(), input); + if (input != null) { + input.close(); + } } } - - if(srcFile!=null && srcFile.getSize()>0 && entity!=null){ + + if (srcFile != null && srcFile.getSize() > 0 && entity != null) { String srcFileAllPath = ""; - if(StringUtil.isBlank(srcFile.getOriginalFilename())){ - srcFileAllPath = srcFilePath+sep+fileName+FileUtils.getSuffix(srcFile.getName(), true); - }else{ - srcFileAllPath = srcFilePath+sep+fileName+FileUtils.getSuffix(srcFile.getOriginalFilename(), true); + if (StringUtil.isBlank(srcFile.getOriginalFilename())) { + srcFileAllPath = srcFilePath + sep + fileName + FileUtils.getSuffix(srcFile.getName(), true); + } else { + srcFileAllPath = srcFilePath + sep + fileName + + FileUtils.getSuffix(srcFile.getOriginalFilename(), true); } - - String sampleFileAllPath = sampleFilePath+sep+fileName+".sample"; - String resultFileAllPath = resultFilePath+sep+fileName+".result"; + + String sampleFileAllPath = sampleFilePath + sep + fileName + ".sample"; + String resultFileAllPath = resultFilePath + sep + fileName + ".result"; entity.setSrcPath(srcFileAllPath); entity.setSamplePath(sampleFileAllPath); entity.setResultPath(resultFileAllPath); - + File uploadSrcFile = new File(srcFileAllPath); - if(!uploadSrcFile.exists()){ - FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件 + if (!uploadSrcFile.exists()) { + FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);// 保存源文件 } entity.setSrcUrl(""); entity.setSampleUrl(""); - /*String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath(); - String srcUrl = host+srcFilePath.substring(srcFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSrcFile.getName(); - String sampleUrl = host+sampleFilePath.substring(sampleFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSampleFile.getName(); - srcUrl = srcUrl.replace("\\", "/"); - sampleUrl = sampleUrl.replace("\\", "/"); - logger.info("srcUrl:"+srcUrl); - logger.info("sampleUrl:"+sampleUrl); - entity.setSrcUrl(srcUrl); - entity.setSampleUrl(sampleUrl);*/ - -// File uploadSrcFile = new File(srcFilePath); -// FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile); -// String srcMd5 = FileUtils.getFileMD5(uploadSrcFile); -// File uploadSampleFile = new File(sampleFilePath); -// String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile); - -// entity.setSrcMd5(srcMd5); -// entity.setSampleMd5(sampleMd5); - - //音频、视频、VoIP、说话人(音频)、人脸识别(视频)样例需要验证时长 - if(Constants.AUDIO_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false)) - ||Constants.VIDEO_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false)) - ||Constants.VOIP_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false)) - ||Constants.SPEAKER_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(),false)) - ){ - if(!validateAvDuration(uploadSrcFile)){ - addMessage(redirectAttributes,"error","exceeds_duration_limit"); - logger.error("The duration of uploaded files exceeds the limit("+Constants.AV_DURATION_LIMIT+"s)."); + /* + * String host = + * request.getScheme()+"://"+request.getServerName()+":"+request + * .getServerPort()+request.getContextPath(); String srcUrl = + * host+srcFilePath.substring(srcFilePath.indexOf(Constants. + * AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+ + * uploadSrcFile.getName(); String sampleUrl = + * host+sampleFilePath.substring(sampleFilePath.indexOf( + * Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+ + * sep+uploadSampleFile.getName(); srcUrl = + * srcUrl.replace("\\", "/"); sampleUrl = + * sampleUrl.replace("\\", "/"); logger.info("srcUrl:"+srcUrl); + * logger.info("sampleUrl:"+sampleUrl); + * entity.setSrcUrl(srcUrl); entity.setSampleUrl(sampleUrl); + */ + + // File uploadSrcFile = new File(srcFilePath); + // FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile); + // String srcMd5 = FileUtils.getFileMD5(uploadSrcFile); + // File uploadSampleFile = new File(sampleFilePath); + // String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile); + + // entity.setSrcMd5(srcMd5); + // entity.setSampleMd5(sampleMd5); + + // 音频、视频、VoIP、说话人(音频)、人脸识别(视频)样例需要验证时长 + if (Constants.AUDIO_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(), false)) + || Constants.VIDEO_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(), false)) + || Constants.VOIP_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(), false)) + || Constants.SPEAKER_FILE_TYPE.contains(FileUtils.getSuffix(uploadSrcFile.getName(), false))) { + if (!validateAvDuration(uploadSrcFile)) { + addMessage(redirectAttributes, "error", "exceeds_duration_limit"); + logger.error("The duration of uploaded files exceeds the limit(" + Constants.AV_DURATION_LIMIT + + "s)."); throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit")); } } - + } - - + avCfgService.saveOrUpdateAvFileSample(entity, srcFile); - 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 if(e instanceof CallExternalProceduresException) { - addMessage(redirectAttributes,"error","call_external_procedures_failed"); - }else if(e instanceof MultiPartNewException) { - addMessage(redirectAttributes,"error",e.getMessage()); - }else{ - addMessage(redirectAttributes,"error","save_failed"); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else if (e instanceof CallExternalProceduresException) { + addMessage(redirectAttributes, "error", "call_external_procedures_failed"); + } else if (e instanceof MultiPartNewException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - - return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId(); + + return "redirect:" + adminPath + "/ntc/av/sample/fileSampleList?functionId=" + entity.getFunctionId(); } - //保存标志样例配置 - @RequestMapping(value = {"/sample/saveAudioSignSample"}) - public String saveAudioSignSample(Model model,HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes,String ids,AvSignSampleCfg entity){ - try{ + + // 保存标志样例配置 + @RequestMapping(value = { "/sample/saveAudioSignSample" }) + public String saveAudioSignSample(Model model, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes, String ids, AvSignSampleCfg entity) { + try { avCfgService.saveOrUpdateAvSignSample(entity); - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ - logger.error("saveAudioSignSample failed",e); + addMessage(redirectAttributes, "success", "save_success"); + } catch (Exception e) { + logger.error("saveAudioSignSample failed", e); e.printStackTrace(); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else if(e instanceof CallExternalProceduresException) { - addMessage(redirectAttributes,"error","call_external_procedures_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + if (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/av/sample/audioSignSampleList?functionId="+entity.getFunctionId(); + return "redirect:" + adminPath + "/ntc/av/sample/audioSignSampleList?functionId=" + entity.getFunctionId(); } - //修改文件样例配置状态 - @RequestMapping(value = {"/sample/updateAvFileSampleValid"}) - public String updateAvFileSampleValid(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes){ - avCfgService.updateAvFileSampleValid(isAudit,isValid,ids); - addMessage(redirectAttributes,"success","delete_success"); - return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId; + + // 修改文件样例配置状态 + @RequestMapping(value = { "/sample/updateAvFileSampleValid" }) + public String updateAvFileSampleValid(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { + avCfgService.updateAvFileSampleValid(isAudit, isValid, ids); + addMessage(redirectAttributes, "success", "delete_success"); + return "redirect:" + adminPath + "/ntc/av/sample/fileSampleList?functionId=" + functionId; } - //修改文件样例配置审核状态 + + // 修改文件样例配置审核状态 /** * 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次 + * * @param isAudit * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"/sample/auditAvFileSample"}) - public String auditAvFileSample(Model model,@ModelAttribute("cfg")AvFileSampleCfg cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request){ - if(!StringUtil.isEmpty(ids)){ - //avCfgService.auditAvFileSample(isAudit,isValid,ids); + @RequestMapping(value = { "/sample/auditAvFileSample" }) + public String auditAvFileSample(Model model, @ModelAttribute("cfg") AvFileSampleCfg cfg, Integer isValid, + Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletResponse response, HttpServletRequest request) { + if (!StringUtil.isEmpty(ids)) { + // avCfgService.auditAvFileSample(isAudit,isValid,ids); AvFileSampleCfg entity = new AvFileSampleCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ - entity = avCfgService.getAvFileSampleById(Long.parseLong(id),null); + for (String id : idArray) { + entity = avCfgService.getAvFileSampleById(Long.parseLong(id), null); entity.setIsAudit(isAudit); entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); -// String oldSrcUrl = entity.getSrcPath(); -// String oldSampleUrl = entity.getSamplePath(); + // String oldSrcUrl = entity.getSrcPath(); + // String oldSampleUrl = entity.getSamplePath(); try { - /*if(isAudit==1){ - Date creatTime = entity.getCreateTime(); - //音视频文件上传接口调用 - File srcFile = new File(oldSrcUrl); - Map srcMap = new HashMap(); - srcMap.put("filetype", FileUtils.getSuffix(srcFile.getName(), false)); - srcMap.put("datatype", "dbSystem");//源文件存入数据中心 - - srcMap.put("createTime",creatTime); - srcMap.put("key",FileUtils.getPrefix(srcFile.getName(), false)); - srcMap.put("fileName", srcFile.getName()); - srcMap.put("checksum", entity.getSrcMd5()); - ToMaatResult result1 = ConfigServiceUtil.postFileCfg(null, srcFile, JsonMapper.toJsonString(srcMap)); - logger.info("音视频源文件上传响应信息:"+result1); - //获取文件上传响应信息(新的文件访问路径) - String srcAccessUrl = null; - if(!StringUtil.isEmpty(result1)){ - ResponseData data = result1.getData(); - srcAccessUrl=data.getAccessUrl(); - entity.setSrcUrl(srcAccessUrl); -// entity.setSrcPath(""); - } - File sampleFile = new File(oldSampleUrl); - Map sampleMap = new HashMap(); - sampleMap.put("filetype", FileUtils.getSuffix(sampleFile.getName(), false)); - sampleMap.put("datatype", "fileSystem");//样例文件存入fastdfs - sampleMap.put("createTime", creatTime); - sampleMap.put("key",FileUtils.getPrefix(sampleFile.getName(), false)); - sampleMap.put("fileName", sampleFile.getName()); - sampleMap.put("checksum", entity.getSampleMd5()); - ToMaatResult result2 = ConfigServiceUtil.postFileCfg(null, sampleFile, JsonMapper.toJsonString(sampleMap)); - logger.info("音视频样例文件上传响应信息:"+result2); - - //获取文件上传响应信息(新的文件访问路径) - String sampleAccessUrl = null; - if(!StringUtil.isEmpty(result2)){ - ResponseData data = result2.getData(); - sampleAccessUrl = data.getAccessUrl(); - entity.setSampleUrl(sampleAccessUrl); -// entity.setSamplePath(""); - - } - }*/ - avCfgService.auditAvFileSample(entity,isAudit); - //删除本地源文件和样例文件 - /*if(!oldSrcUrl.equals(entity.getSrcUrl())){ - FileUtils.deleteFile(oldSrcUrl); - } - if(!oldSampleUrl.equals(entity.getSampleUrl())){ - FileUtils.deleteFile(oldSampleUrl); - }*/ - addMessage(redirectAttributes,"success", "audit_success"); - }catch(Exception e){ + /* + * if(isAudit==1){ Date creatTime = entity.getCreateTime(); + * //音视频文件上传接口调用 File srcFile = new File(oldSrcUrl); + * Map srcMap = new HashMap(); + * srcMap.put("filetype", + * FileUtils.getSuffix(srcFile.getName(), false)); + * srcMap.put("datatype", "dbSystem");//源文件存入数据中心 + * + * srcMap.put("createTime",creatTime); + * srcMap.put("key",FileUtils.getPrefix(srcFile.getName(), + * false)); srcMap.put("fileName", srcFile.getName()); + * srcMap.put("checksum", entity.getSrcMd5()); ToMaatResult + * result1 = ConfigServiceUtil.postFileCfg(null, srcFile, + * JsonMapper.toJsonString(srcMap)); + * logger.info("音视频源文件上传响应信息:"+result1); + * //获取文件上传响应信息(新的文件访问路径) String srcAccessUrl = null; + * if(!StringUtil.isEmpty(result1)){ ResponseData data = + * result1.getData(); srcAccessUrl=data.getAccessUrl(); + * entity.setSrcUrl(srcAccessUrl); // entity.setSrcPath(""); + * } File sampleFile = new File(oldSampleUrl); + * Map sampleMap = new HashMap(); + * sampleMap.put("filetype", + * FileUtils.getSuffix(sampleFile.getName(), false)); + * sampleMap.put("datatype", "fileSystem");//样例文件存入fastdfs + * sampleMap.put("createTime", creatTime); + * sampleMap.put("key",FileUtils.getPrefix(sampleFile. + * getName(), false)); sampleMap.put("fileName", + * sampleFile.getName()); sampleMap.put("checksum", + * entity.getSampleMd5()); ToMaatResult result2 = + * ConfigServiceUtil.postFileCfg(null, sampleFile, + * JsonMapper.toJsonString(sampleMap)); + * logger.info("音视频样例文件上传响应信息:"+result2); + * + * //获取文件上传响应信息(新的文件访问路径) String sampleAccessUrl = null; + * if(!StringUtil.isEmpty(result2)){ ResponseData data = + * result2.getData(); sampleAccessUrl = data.getAccessUrl(); + * entity.setSampleUrl(sampleAccessUrl); // + * entity.setSamplePath(""); + * + * } } + */ + avCfgService.auditAvFileSample(entity, isAudit); + // 删除本地源文件和样例文件 + /* + * if(!oldSrcUrl.equals(entity.getSrcUrl())){ + * FileUtils.deleteFile(oldSrcUrl); } + * if(!oldSampleUrl.equals(entity.getSampleUrl())){ + * FileUtils.deleteFile(oldSampleUrl); } + */ + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { e.printStackTrace(); - if(e instanceof MaatConvertException) { - logger.info("音视频文件样例配置下发失败:"+e.getMessage()); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - logger.error("auditAvFileSample failed",e); - addMessage(redirectAttributes,"error","audit_failed"); + if (e instanceof MaatConvertException) { + logger.info("音视频文件样例配置下发失败:" + e.getMessage()); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + logger.error("auditAvFileSample failed", e); + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else { + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 fileSampleList(model, request, response, cfg); } - return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/sample/fileSampleList?functionId=" + functionId; } - //修改标志样例配置状态 - @RequestMapping(value = {"/sample/updateAvSignSampleValid"}) - public String updateAvSignSampleValid(Integer isAudit,Integer isValid,String ids,Integer functionId){ - avCfgService.updateAvSignSampleValid(isAudit,isValid,ids); - return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId; + + // 修改标志样例配置状态 + @RequestMapping(value = { "/sample/updateAvSignSampleValid" }) + public String updateAvSignSampleValid(Integer isAudit, Integer isValid, String ids, Integer functionId) { + avCfgService.updateAvSignSampleValid(isAudit, isValid, ids); + return "redirect:" + adminPath + "/ntc/av/sample/signSampleList?functionId=" + functionId; } - - //修改标志样例配置审核状态 + + // 修改标志样例配置审核状态 /** * 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次 + * * @param isAudit * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"/sample/auditAvAudioSignSample"}) - public String auditAvAudioSignSample(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes){ -// avCfgService.auditAvSignSample(isAudit,isValid,ids); + @RequestMapping(value = { "/sample/auditAvAudioSignSample" }) + public String auditAvAudioSignSample(Integer isAudit, Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { + // avCfgService.auditAvSignSample(isAudit,isValid,ids); AvSignSampleCfg entity = new AvSignSampleCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity = avCfgService.getAvSignSampleById(Long.parseLong(id)); entity.setIsAudit(isAudit); entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); try { - avCfgService.audioAuditAvSignSample(entity,isAudit,false); - addMessage(redirectAttributes,"success", "audit_success"); - }catch(Exception e){ + avCfgService.audioAuditAvSignSample(entity, isAudit, false); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { e.printStackTrace(); - if(e instanceof MaatConvertException) { - logger.error("音视频标识样例配置下发失败:"+e.getMessage()); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - logger.error("auditAvAudioSignSample failed",e); - addMessage(redirectAttributes,"error","audit_failed"); + if (e instanceof MaatConvertException) { + logger.error("音视频标识样例配置下发失败:" + e.getMessage()); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + logger.error("auditAvAudioSignSample failed", e); + addMessage(redirectAttributes, "error", "audit_failed"); } } } - return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/sample/signSampleList?functionId=" + functionId; } - //修改标志样例配置审核状态 + + // 修改标志样例配置审核状态 /** * 审核配置下发,为了保证配置下发过程事务正确,一条配置提交一次 + * * @param isAudit * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"/sample/auditAvSignSample"}) - public String auditAvSignSample(Integer preset,AvSignSampleCfgModel cfg,Integer functionId,RedirectAttributes redirectAttributes){ - //预置配置 + @RequestMapping(value = { "/sample/auditAvSignSample" }) + public String auditAvSignSample(Integer preset, AvSignSampleCfgModel cfg, Integer functionId, + RedirectAttributes redirectAttributes) { + // 预置配置 try { - if(preset!=null&&1==preset){//预置信息需要在数据库中插入一条记录 + if (preset != null && 1 == preset) {// 预置信息需要在数据库中插入一条记录 for (AvSignSampleCfg avSignSampleCfg : cfg.getCfgs()) { avCfgService.saveOrUpdateAvSignSample(avSignSampleCfg); } - addMessage(redirectAttributes,"success","save_success"); - return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId; + addMessage(redirectAttributes, "success", "save_success"); + return "redirect:" + adminPath + "/ntc/av/sample/signSampleList?functionId=" + functionId; } } catch (Exception e1) { - if(e1 instanceof MaatConvertException) { - logger.error("预置失败",e1); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - logger.error("auditAvSignSample failed",e1); - addMessage(redirectAttributes,"error","save_failed"); + if (e1 instanceof MaatConvertException) { + logger.error("预置失败", e1); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + logger.error("auditAvSignSample failed", e1); + addMessage(redirectAttributes, "error", "save_failed"); } } - //修改下发配置 - if(cfg != null && cfg.getCfgs() != null ){ + // 修改下发配置 + if (cfg != null && cfg.getCfgs() != null) { for (AvSignSampleCfg avSignSampleCfg : cfg.getCfgs()) { - /*if(StringUtil.isEmpty(avSignSampleCfg.getIsValid())){ - avSignSampleCfg.setIsValid(0); - }*/ - if(cfg.getAction()!=null){ + /* + * if(StringUtil.isEmpty(avSignSampleCfg.getIsValid())){ + * avSignSampleCfg.setIsValid(0); } + */ + if (cfg.getAction() != null) { avSignSampleCfg.setAction(cfg.getAction()); } - //isValid值变更才下发 -// if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){ - try { - avCfgService.auditAvSignSample(avSignSampleCfg); - addMessage(redirectAttributes,"success","save_success"); - }catch(Exception e){ - e.printStackTrace(); - if(e instanceof MaatConvertException) { - logger.error("下发失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - logger.error("auditAvSignSample failed",e); - addMessage(redirectAttributes,"error","save_failed"); - } + // isValid值变更才下发 + // if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){ + try { + avCfgService.auditAvSignSample(avSignSampleCfg); + addMessage(redirectAttributes, "success", "save_success"); + } catch (Exception e) { + e.printStackTrace(); + if (e instanceof MaatConvertException) { + logger.error("下发失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + logger.error("auditAvSignSample failed", e); + addMessage(redirectAttributes, "error", "save_failed"); } } - -// } + } + + // } } - return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/av/sample/signSampleList?functionId=" + functionId; } - - //ysp配置导出 + + // ysp配置导出 @RequestMapping(value = "exportYsp") - public void exportYsp(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")AvFileSampleCfg entity,String ids,RedirectAttributes redirectAttributes){ + public void exportYsp(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") AvFileSampleCfg entity, String ids, RedirectAttributes redirectAttributes) { try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{*/ - //条件导出数据大于最大导出数,只导出最大导出条数 + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = avCfgService.getAvFileBySampleList(ids); + } else { entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); + Page pageInfo = new Page(request, response, "a"); pageInfo.setPageNo(1); pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); Page page = avCfgService.getAvFileSampleList(pageInfo, entity); - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), AvFileSampleCfg.class); - String cfgIndexInfoNoExport=",group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; - noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); - dataMap.put(entity.getMenuNameCode(), page.getList()); - /*}*/ - this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); + ipLists = page.getList(); + } + // 条件导出数据大于最大导出数,只导出最大导出条数 + + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), AvFileSampleCfg.class); + String cfgIndexInfoNoExport = ",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("ysp export failed",e); - addMessage(redirectAttributes,"error","export_failed"); + logger.error("ysp 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(); } - + /** * 验证音视频时长 - * @throws EncoderException - * @throws InputFormatException + * + * @throws EncoderException + * @throws InputFormatException */ - public boolean validateAvDuration(File file) throws InputFormatException, EncoderException{ - //验证音视频文件时长 + public boolean validateAvDuration(File file) throws InputFormatException, EncoderException { + // 验证音视频文件时长 Encoder encoder = new Encoder(); String length = ""; MultimediaInfo m = encoder.getInfo(file); - long ls = m.getDuration()/1000; - int hour = (int) (ls/3600); - int minute = (int) (ls%3600)/60; - int second = (int) (ls-hour*3600-minute*60); - length = hour+"'"+minute+"''"+second+"'''"; - logger.info(file.getName()+"时长:"+length); - if(ls>0 && ls>Constants.AV_DURATION_LIMIT){ + long ls = m.getDuration() / 1000; + int hour = (int) (ls / 3600); + int minute = (int) (ls % 3600) / 60; + int second = (int) (ls - hour * 3600 - minute * 60); + length = hour + "'" + minute + "''" + second + "'''"; + logger.info(file.getName() + "时长:" + length); + if (ls > 0 && ls > Constants.AV_DURATION_LIMIT) { return false; - }else{ + } else { return true; } } + /** * 上传视频文件,调用脚本生成关键帧图片,返回图片保存路径 + * * @param cfg * @param functionId * @param redirectAttributes * @return */ @ResponseBody - @RequestMapping(value = {"/sample/videoToPicture"}) - public Map videoToPicture(Model model,@RequestParam("srcFile") CommonsMultipartFile srcFile){ - + @RequestMapping(value = { "/sample/videoToPicture" }) + public Map videoToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile srcFile) { + String sep = System.getProperty("file.separator"); - String random = UUID.randomUUID()+""; - String srcFilePath = Constants.AV_FILE_PATH+"video"+sep+"srcFile";//视频源文件保存路径 - String picFilePath = StringUtils.getUserfilesBaseDir()+"video"+sep+"picFile"+sep+random+sep;//视频生成的关键帧图片文件保存路径 - + String random = UUID.randomUUID() + ""; + String srcFilePath = Constants.AV_FILE_PATH + "video" + sep + "srcFile";// 视频源文件保存路径 + String picFilePath = StringUtils.getUserfilesBaseDir() + "video" + sep + "picFile" + sep + random + sep;// 视频生成的关键帧图片文件保存路径 + FileUtils.createDirectory(srcFilePath); FileUtils.createDirectory(picFilePath); - String srcFileAllPath = srcFilePath+sep+random+FileUtils.getSuffix(srcFile.getOriginalFilename(), true);//新的文件名 + String srcFileAllPath = srcFilePath + sep + random + FileUtils.getSuffix(srcFile.getOriginalFilename(), true);// 新的文件名 File uploadSrcFile = new File(srcFileAllPath); Map map = new HashMap(); map.put("picFilePath", picFilePath); try { Properties msgProp = getMsgProp(); - FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件 - if(validateAvDuration(uploadSrcFile)){ + FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);// 保存源文件 + if (validateAvDuration(uploadSrcFile)) { String shellName = Constants.VEDIO_TO_PICTURE_PROC; -// String params = srcFileAllPath+" "+picFilePath+" 0.95 90.0 0.5"; - String[] params = new String[]{srcFileAllPath,picFilePath}; - logger.info("调用视频转关键帧图片程序:"+shellName+" " +StringUtils.join(params," ")); + // String params = srcFileAllPath+" "+picFilePath+" 0.95 90.0 + // 0.5"; + String[] params = new String[] { srcFileAllPath, picFilePath }; + logger.info("调用视频转关键帧图片程序:" + shellName + " " + StringUtils.join(params, " ")); Map resultMap = avCfgService.execShell(shellName, params); - if(resultMap.get("exitStatus").equals(0)){//调用外部程序成功 - String out = resultMap.get("out").toString();//输出参数 - logger.info("调用视频转关键帧图片程序输出参数:"+out); - JSONArray resArray =JSONArray.fromObject(out); + if (resultMap.get("exitStatus").equals(0)) {// 调用外部程序成功 + String out = resultMap.get("out").toString();// 输出参数 + logger.info("调用视频转关键帧图片程序输出参数:" + out); + JSONArray resArray = JSONArray.fromObject(out); JSONObject resObject = resArray.getJSONObject(0); int state = resObject.getInt("state"); - if(state==1){ - //关键帧图片生成成功,删除原视频文件 + if (state == 1) { + // 关键帧图片生成成功,删除原视频文件 FileUtils.deleteFile(srcFileAllPath); - //获取图片列表 + // 获取图片列表 Collection files = FileUtils.listFiles(new File(picFilePath), null, true); String srcPath = null; - for(File f:files){ - if(srcPath==null){ + for (File f : files) { + if (srcPath == null) { srcPath = f.getName(); - }else{ - srcPath += "|"+f.getName(); + } else { + srcPath += "|" + f.getName(); } } - //将图片文件列表赋值给生成样例的源文件路径参数 + // 将图片文件列表赋值给生成样例的源文件路径参数 map.put("srcPath", srcPath); map.put("status", 1); map.put("msg", "success"); - }else{ - if(StringUtil.isEmpty(resObject.getString("message"))){ + } else { + if (StringUtil.isEmpty(resObject.getString("message"))) { map.put("status", 0); - map.put("msg", msgProp.getProperty("call_external_procedures_failed", "Call external procedures failed")); - }else{ + map.put("msg", msgProp.getProperty("call_external_procedures_failed", + "Call external procedures failed")); + } else { map.put("status", 0); map.put("msg", resObject.getString("message")); } } - - }else{ + + } else { map.put("status", 0); - map.put("msg", msgProp.getProperty("call_external_procedures_failed", "Call external procedures failed")); + map.put("msg", + msgProp.getProperty("call_external_procedures_failed", "Call external procedures failed")); } - }else{ + } else { map.put("status", 0); map.put("msg", msgProp.get("exceeds_duration_limit")); } - + } catch (IOException e) { e.printStackTrace(); map.put("status", 0); @@ -693,31 +754,35 @@ public class AvController extends BaseController { } return map; } + /** * 上传图片文件,调用脚本压缩图片,返回图片保存路径 + * * @param cfg * @param functionId * @param redirectAttributes * @return */ @ResponseBody - @RequestMapping(value = {"/sample/faceToPicture"}) - public Map faceToPicture(Model model,@RequestParam("srcFile") CommonsMultipartFile[] srcFile,@RequestParam("faceFilePath")String faceFilePath){ + @RequestMapping(value = { "/sample/faceToPicture" }) + public Map faceToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile[] srcFile, + @RequestParam("faceFilePath") String faceFilePath) { String sep = System.getProperty("file.separator"); - String random = UUID.randomUUID()+""; -// String srcFilePath = Constants.AV_FILE_PATH+"face"+random+sep+"srcFile";//视频源文件保存路径 - String srcFilePath=""; - if(StringUtil.isBlank(faceFilePath)){ - srcFilePath = StringUtils.getUserfilesBaseDir()+"face"+sep+"picFile"+sep+random+sep;//视频生成的关键帧图片文件保存路径 - faceFilePath=srcFilePath; + String random = UUID.randomUUID() + ""; + // String srcFilePath = + // Constants.AV_FILE_PATH+"face"+random+sep+"srcFile";//视频源文件保存路径 + String srcFilePath = ""; + if (StringUtil.isBlank(faceFilePath)) { + srcFilePath = StringUtils.getUserfilesBaseDir() + "face" + sep + "picFile" + sep + random + sep;// 视频生成的关键帧图片文件保存路径 + faceFilePath = srcFilePath; FileUtils.createDirectory(srcFilePath); - }else{ - srcFilePath=faceFilePath; + } else { + srcFilePath = faceFilePath; } - //保存源文件 + // 保存源文件 for (CommonsMultipartFile sinFile : srcFile) { - String r = UUID.randomUUID()+""; - String srcFileAllPath = srcFilePath+sep+r+FileUtils.getSuffix(sinFile.getOriginalFilename(), true);//新的文件名 + String r = UUID.randomUUID() + ""; + String srcFileAllPath = srcFilePath + sep + r + FileUtils.getSuffix(sinFile.getOriginalFilename(), true);// 新的文件名 File uploadSrcFile = new File(srcFileAllPath); try { FileCopyUtils.copy(sinFile.getBytes(), uploadSrcFile); @@ -726,60 +791,61 @@ public class AvController extends BaseController { e.printStackTrace(); } } - - + Map map = new HashMap(); map.put("picFilePath", srcFilePath); map.put("faceFilePath", faceFilePath); - - //获取图片列表 + + // 获取图片列表 Collection files = FileUtils.listFiles(new File(srcFilePath), null, true); - String srcPath = null; - for(File f:files){ - if(srcPath==null){ - srcPath = f.getName(); - }else{ - srcPath += "|"+f.getName(); - } - } - //将图片文件列表赋值给生成样例的源文件路径参数 - map.put("srcPath", srcPath); - map.put("status", 1); - map.put("msg", "success"); - + String srcPath = null; + for (File f : files) { + if (srcPath == null) { + srcPath = f.getName(); + } else { + srcPath += "|" + f.getName(); + } + } + // 将图片文件列表赋值给生成样例的源文件路径参数 + map.put("srcPath", srcPath); + map.put("status", 1); + map.put("msg", "success"); + return map; } - @RequestMapping(value = {"/sample/selectVedioPicture"}) - public String selectVedioPicture(Model model,HttpServletRequest request,String picFilePath,String srcPath){ + + @RequestMapping(value = { "/sample/selectVedioPicture" }) + public String selectVedioPicture(Model model, HttpServletRequest request, String picFilePath, String srcPath) { Collection files = FileUtils.listFiles(new File(picFilePath), null, true); - List> fileList = new ArrayList(); - String picUrl = picFilePath.substring(picFilePath.indexOf(Configurations.getStringProperty("userfiles.basedir", "upload"))); + List> fileList = new ArrayList(); + String picUrl = picFilePath + .substring(picFilePath.indexOf(Configurations.getStringProperty("userfiles.basedir", "upload"))); String sep = System.getProperty("file.separator"); String[] checkedPic = null; - if(srcPath!=null){ + if (srcPath != null) { checkedPic = srcPath.split("\\|"); } - for(File f:files){ + for (File f : files) { Map map = new HashMap(); - map.put("picUrl", StringUtils.replace(picUrl+"/"+f.getName(), "\\", "/")); + map.put("picUrl", StringUtils.replace(picUrl + "/" + f.getName(), "\\", "/")); map.put("picName", f.getName()); boolean checked = false; - if(checkedPic!=null){ - for(String pic:checkedPic){ - if(f.getName().equals(pic)){ + if (checkedPic != null) { + for (String pic : checkedPic) { + if (f.getName().equals(pic)) { checked = true; } } - }else{ - checked = true;//默认全选 + } else { + checked = true;// 默认全选 } - + map.put("checked", checked); fileList.add(map); } model.addAttribute("fileList", fileList); - model.addAttribute("picFilePath",picFilePath); + model.addAttribute("picFilePath", picFilePath); return "/cfg/av/videoPictureList"; } - + } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/BgpCfgController.java b/src/main/java/com/nis/web/controller/configuration/ntc/BgpCfgController.java index 5d2bf2264..e7326b2f7 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/BgpCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/BgpCfgController.java @@ -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 searchPage=new Page(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 searchPage = new Page(request, response, "a"); Page 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 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 searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else { + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 ipList=new ArrayList(); -// List subscribeInfoList=new ArrayList(); - List asInfoList=new ArrayList(); - 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 ipList = new ArrayList(); + // List subscribeInfoList=new + // ArrayList(); + List asInfoList = new ArrayList(); + 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(); + } + } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java b/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java index 6a9b631d1..98d141c71 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java @@ -48,368 +48,365 @@ import com.nis.web.security.UserUtils; /** * 文件传输相关配置控制类 + * * @author dell * */ @Controller @RequestMapping("${adminPath}/ntc/fileTransfer/") -public class FileTransferCfgController extends BaseController{ - @RequestMapping(value = {"ftpList"}) -// @RequiresPermissions(value={"fileTransfer:ftp:config"}) - public String ftpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"a"); +public class FileTransferCfgController extends BaseController { + @RequestMapping(value = { "ftpList" }) + // @RequiresPermissions(value={"fileTransfer:ftp:config"}) + public String ftpList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "a"); Page page = fileTransferCfgService.getFtpList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/fileTransfer/ftpList"; } - @RequestMapping(value = {"ftpForm"}) - @RequiresPermissions(value={"fileTransfer:ftp:config"}) - public String ftpForm(Model model,String compileIds,String ids,CfgIndexInfo entity) { - if(StringUtils.isNotBlank(ids)){ - entity = fileTransferCfgService.getFtpCfg(Long.parseLong(ids),null); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + + @RequestMapping(value = { "ftpForm" }) + @RequiresPermissions(value = { "fileTransfer:ftp:config" }) + public String ftpForm(Model model, String compileIds, String ids, CfgIndexInfo entity) { + if (StringUtils.isNotBlank(ids)) { + entity = fileTransferCfgService.getFtpCfg(Long.parseLong(ids), null); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/fileTransfer/ftpForm"; } - @RequestMapping(value = {"saveFtpCfg"}) - @RequiresPermissions(value={"fileTransfer:ftp:config"}) - public String saveFtpCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids, - CfgIndexInfo entity,RedirectAttributes redirectAttributes) { + + @RequestMapping(value = { "saveFtpCfg" }) + @RequiresPermissions(value = { "fileTransfer:ftp:config" }) + public String saveFtpCfg(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + CfgIndexInfo entity, RedirectAttributes redirectAttributes) { try { fileTransferCfgService.saveFtpCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { - if(e instanceof MaatConvertException) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.error("ftp信息保存失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.error("ftp信息保存失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("ftp信息保存失败",e); - addMessage(redirectAttributes,"error","save_failed"); + logger.error("ftp信息保存失败", e); + addMessage(redirectAttributes, "error", "save_failed"); } } - return "redirect:" + adminPath +"/ntc/fileTransfer/ftpList?functionId="+entity.getFunctionId(); + return "redirect:" + adminPath + "/ntc/fileTransfer/ftpList?functionId=" + entity.getFunctionId(); } - @RequestMapping(value = {"ajaxFtpSubList"}) - public String ajaxFtpSubList(Model model,Long cfgId,Integer index,Integer compileId) { - CfgIndexInfo cfg = fileTransferCfgService.getFtpCfg(cfgId,compileId); + + @RequestMapping(value = { "ajaxFtpSubList" }) + public String ajaxFtpSubList(Model model, Long cfgId, Integer index, Integer compileId) { + CfgIndexInfo cfg = fileTransferCfgService.getFtpCfg(cfgId, compileId); List 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.getStringList()!=null){ + if (cfg.getStringList() != null) { String cfgType = null; - for(BaseStringCfg keyword:cfg.getStringList()){ - if(!keyword.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",keyword.getCfgType()}); + for (BaseStringCfg keyword : cfg.getStringList()) { + 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 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/fileTransfer/ftpSubList"; } - - + /** * 做删除操作 + * * @param isValid * @param ids * @param functionId * @return */ - @RequestMapping(value = {"updateFtpCfgValid"}) - @RequiresPermissions(value={"fileTransfer:ftp:config"}) - public String updateFtpCfgValid(Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + @RequestMapping(value = { "updateFtpCfgValid" }) + @RequiresPermissions(value = { "fileTransfer:ftp:config" }) + public String updateFtpCfgValid(Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { try { - fileTransferCfgService.updateFtpCfgValid(isValid,ids,functionId); - addMessage(redirectAttributes,"success","delete_success"); + fileTransferCfgService.updateFtpCfgValid(isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); } catch (Exception e) { - if(e instanceof MaatConvertException) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.info("ftp配置删除失败:"+e.getMessage());; - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.info("ftp配置删除失败:" + e.getMessage()); + ; + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("ftp配置删除失败",e); - addMessage(redirectAttributes,"error","delete_failed"); + logger.error("ftp配置删除失败", e); + addMessage(redirectAttributes, "error", "delete_failed"); } } - return "redirect:" + adminPath +"/ntc/fileTransfer/ftpList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/fileTransfer/ftpList?functionId=" + functionId; } - @RequestMapping(value = {"auditFtpCfg"}) - @RequiresPermissions(value={"fileTransfer:ftp:confirm"}) - public String auditFtpCfg(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 = { "auditFtpCfg" }) + @RequiresPermissions(value = { "fileTransfer:ftp:confirm" }) + public String auditFtpCfg(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 = fileTransferCfgService.getFtpCfg(Long.parseLong(id),null); + for (String id : idArray) { + entity = fileTransferCfgService.getFtpCfg(Long.parseLong(id), null); entity.setIsAudit(isAudit); entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - fileTransferCfgService.auditFtpCfg(entity,isAudit); - addMessage(redirectAttributes,"success","audit_success"); - } catch ( Exception e) { - if(e instanceof MaatConvertException) { + fileTransferCfgService.auditFtpCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.error("ftp配置下发失败:"+e.getMessage());; - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.error("ftp配置下发失败:" + e.getMessage()); + ; + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("ftp配置下发失败",e); - addMessage(redirectAttributes,"error","audit_failed"); + logger.error("ftp配置下发失败", e); + addMessage(redirectAttributes, "error", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else { + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 ftpList(model, cfg, request, response); } - return "redirect:" + adminPath +"/ntc/fileTransfer/ftpList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/fileTransfer/ftpList?functionId=" + functionId; } - - @RequestMapping(value = {"fileDigestList"}) -// @RequiresPermissions(value={"fileTransfer:fileDigest:config"}) - public String fileDigestList(Model model,@ModelAttribute("cfg")FileDigestCfg cfg - ,HttpServletRequest request,HttpServletResponse response - ,RedirectAttributes redirectAttributes) { - Page searchPage=new Page(request,response,"a"); + + @RequestMapping(value = { "fileDigestList" }) + // @RequiresPermissions(value={"fileTransfer:fileDigest:config"}) + public String fileDigestList(Model model, @ModelAttribute("cfg") FileDigestCfg cfg, HttpServletRequest request, + HttpServletResponse response, RedirectAttributes redirectAttributes) { + Page searchPage = new Page(request, response, "a"); Page page = fileTransferCfgService.getFileDigestList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/fileTransfer/fileDigestList"; } - - @RequestMapping(value = {"fileDigestForm"}) - @RequiresPermissions(value={"fileTransfer:fileDigest:config"}) - public String fileDigestForm(Model model,String ids,FileDigestCfg entity,RedirectAttributes redirectAttributes) { - if(StringUtils.isNotBlank(ids)){ - entity = fileTransferCfgService.getFileDigestCfg(Long.parseLong(ids),null); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + + @RequestMapping(value = { "fileDigestForm" }) + @RequiresPermissions(value = { "fileTransfer:fileDigest:config" }) + public String fileDigestForm(Model model, String ids, FileDigestCfg entity, RedirectAttributes redirectAttributes) { + if (StringUtils.isNotBlank(ids)) { + entity = fileTransferCfgService.getFileDigestCfg(Long.parseLong(ids), null); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/fileTransfer/fileDigestForm"; } - @RequestMapping(value = {"saveFileDigestCfg"}) - @RequiresPermissions(value={"fileTransfer:fileDigest:config"}) - public String saveFileDigestCfg(Model model,HttpServletRequest request - ,HttpServletResponse response,String ids, - FileDigestCfg entity,MultipartFile file - ,@ModelAttribute("areaCfgIds")String areaCfgIds - ,RedirectAttributes redirectAttributes) { - try { - Date fileTime=null; - Date date=new Date(); - if(!StringUtil.isEmpty(entity.getCfgId())){ + + @RequestMapping(value = { "saveFileDigestCfg" }) + @RequiresPermissions(value = { "fileTransfer:fileDigest:config" }) + public String saveFileDigestCfg(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + FileDigestCfg entity, MultipartFile file, @ModelAttribute("areaCfgIds") String areaCfgIds, + RedirectAttributes redirectAttributes) { + try { + Date fileTime = null; + Date date = new Date(); + if (!StringUtil.isEmpty(entity.getCfgId())) { entity.setEditTime(date); - fileTime=entity.getEditTime(); - }else{ + fileTime = entity.getEditTime(); + } else { entity.setCreateTime(date); - fileTime=entity.getCreateTime(); + fileTime = entity.getCreateTime(); } ToMaatResult result = new ToMaatResult(); - if(file!=null && file.getSize()>0 && entity!=null){ + if (file != null && file.getSize() > 0 && entity != null) { 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 fileMap = new HashMap(); + // 获取文件摘要接口调用 + Map fileMap = new HashMap(); fileMap.put("filetype", FileUtils.getSuffix(file.getOriginalFilename(), false)); - fileMap.put("datatype", "dbSystem");//源文件存入数据中心 - - fileMap.put("createTime",fileTime); - fileMap.put("key",FileUtils.getPrefix(file.getOriginalFilename(), false)); + fileMap.put("datatype", "dbSystem");// 源文件存入数据中心 + + fileMap.put("createTime", fileTime); + 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)); - if((result.getData().getRawLen() == null) || (result.getData().getDigest() == null)) { + if ((result.getData().getRawLen() == null) || (result.getData().getDigest() == null)) { logger.error("文件摘要信息获取有误!"); throw new MaatConvertException(""); } - logger.info("获取文件摘要响应信息:"+result); - } - fileTransferCfgService.saveOrUpdateFileDigestCfg(entity,result,areaCfgIds); - addMessage(redirectAttributes,"success","save_success"); - } catch ( Exception e) { - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - - }else { - addMessage(redirectAttributes,"error","save_failed"); + logger.info("获取文件摘要响应信息:" + result); + } + fileTransferCfgService.saveOrUpdateFileDigestCfg(entity, result, areaCfgIds); + addMessage(redirectAttributes, "success", "save_success"); + } catch (Exception e) { + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + + } else { + addMessage(redirectAttributes, "error", "save_failed"); } } - return "redirect:" + adminPath +"/ntc/fileTransfer/fileDigestList?functionId="+entity.getFunctionId(); + return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + entity.getFunctionId(); } - @RequestMapping(value = {"updateFileDigestValid"}) - @RequiresPermissions(value={"fileTransfer:fileDigest:config"}) - public String updateFileDigestValid(Integer isValid,String ids,Integer functionId - ,RedirectAttributes redirectAttributes) { - fileTransferCfgService.updateFileDigestCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/fileTransfer/fileDigestList?functionId="+functionId; + + @RequestMapping(value = { "updateFileDigestValid" }) + @RequiresPermissions(value = { "fileTransfer:fileDigest:config" }) + public String updateFileDigestValid(Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { + fileTransferCfgService.updateFileDigestCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + functionId; } - - @RequestMapping(value = {"auditFileDigestCfg"}) - @RequiresPermissions(value={"fileTransfer:fileDigest:confirm"}) - public String auditFileDigestCfg(Model model,@ModelAttribute("cfg")FileDigestCfg cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + + @RequestMapping(value = { "auditFileDigestCfg" }) + @RequiresPermissions(value = { "fileTransfer:fileDigest:confirm" }) + public String auditFileDigestCfg(Model model, @ModelAttribute("cfg") FileDigestCfg 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 { - fileTransferCfgService.auditFileDigestCfg(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); - } catch ( Exception e) { - logger.error("File Digest配置下发失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - - }else if(e instanceof CallExternalProceduresException) { - addMessage(redirectAttributes,"error","call_external_procedures_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + fileTransferCfgService.auditFileDigestCfg(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { + logger.error("File Digest配置下发失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + + } else if (e instanceof CallExternalProceduresException) { + addMessage(redirectAttributes, "error", "call_external_procedures_failed"); + } else { + addMessage(redirectAttributes, "error", "audit_failed"); } - + } } - - }else { - Page searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + + } else { + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 fileDigestList(model, cfg, request, response, redirectAttributes); } - return "redirect:" + adminPath +"/ntc/fileTransfer/fileDigestList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + functionId; } - @RequestMapping(value = {"ajaxFileDigestSubIdList"}) - public String ajaxFileDigestSubIdList(Model model,Long cfgId,Integer index,Integer compileId) { - FileDigestCfg cfg = fileTransferCfgService.getFileDigestSubIdCfg(cfgId,compileId); + + @RequestMapping(value = { "ajaxFileDigestSubIdList" }) + public String ajaxFileDigestSubIdList(Model model, Long cfgId, Integer index, Integer compileId) { + FileDigestCfg cfg = fileTransferCfgService.getFileDigestSubIdCfg(cfgId, compileId); List tabList = new ArrayList(); - //查询SubscribeId域配置 - if(cfg.getNtcSubscribeIdCfgList()!=null){ + // 查询SubscribeId域配置 + 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/fileTransfer/fileDigestSubList"; } - - @RequestMapping(value = {"ajaxFileDigestLogSubIdList"}) - public String ajaxFileDigestLogSubIdList(Model model,Long cfgId,Integer index,Integer compileId) { - FileDigestCfg cfg = fileTransferCfgService.getFileDigestSubIdCfg(cfgId,compileId); + + @RequestMapping(value = { "ajaxFileDigestLogSubIdList" }) + public String ajaxFileDigestLogSubIdList(Model model, Long cfgId, Integer index, Integer compileId) { + FileDigestCfg cfg = fileTransferCfgService.getFileDigestSubIdCfg(cfgId, compileId); List 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); + 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/fileTransfer/fileDigestLogSubList"; } - - - - - @RequestMapping(value = {"p2pList"}) - public String p2pList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"a"); + + @RequestMapping(value = { "p2pList" }) + public String p2pList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "a"); Page page = fileTransferCfgService.getP2pList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/fileTransfer/p2pList"; } - - @RequestMapping(value = {"p2pForm"}) - @RequiresPermissions(value={"fileTransfer:p2p:config"}) - public String p2pForm(Model model,String ids,CfgIndexInfo entity) { - // 跳转操作页面(根据ids判断是新增 or 修改) - if(StringUtils.isNotBlank(ids)){ - entity = fileTransferCfgService.getP2pCfg(Long.parseLong(ids),null); - + + @RequestMapping(value = { "p2pForm" }) + @RequiresPermissions(value = { "fileTransfer:p2p:config" }) + public String p2pForm(Model model, String ids, CfgIndexInfo entity) { + // 跳转操作页面(根据ids判断是新增 or 修改) + if (StringUtils.isNotBlank(ids)) { + entity = fileTransferCfgService.getP2pCfg(Long.parseLong(ids), null); + // 添加配置域Key,用于修改页面区分各域配置 P2pHashCfg hashCfg = new P2pHashCfg(); hashCfg.setCfgType(Constants.P2P_HASH_BIN_REGION); @@ -420,19 +417,19 @@ public class FileTransferCfgController extends BaseController{ NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID_REGION); entity.setNtcSubscribeIdCfg(subscribeIdCfg); - - if(entity.getP2pHashList().size() == 0) { + + if (entity.getP2pHashList().size() == 0) { entity.getP2pHashList().add(hashCfg); } - if(entity.getP2pKeywordList().size() == 0) { + if (entity.getP2pKeywordList().size() == 0) { entity.getP2pKeywordList().add(keywordCfg); } - if(entity.getNtcSubscribeIdCfgList().size() == 0) { + if (entity.getNtcSubscribeIdCfgList().size() == 0) { entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg); } - - initUpdateFormCondition(model,entity); - }else{ + + initUpdateFormCondition(model, entity); + } else { // 添加配置域Key,用于新增页面区分各域配置 P2pHashCfg hashCfg = new P2pHashCfg(); hashCfg.setCfgType(Constants.P2P_HASH_BIN_REGION); @@ -443,7 +440,7 @@ public class FileTransferCfgController extends BaseController{ NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID_REGION); entity.setNtcSubscribeIdCfg(subscribeIdCfg); - + List hashList = new ArrayList(); hashList.add(hashCfg); entity.setP2pHashList(hashList); @@ -453,366 +450,430 @@ public class FileTransferCfgController extends BaseController{ ArrayList subscribeIdList = new ArrayList(); subscribeIdList.add(subscribeIdCfg); entity.setNtcSubscribeIdCfgList(subscribeIdList); - - initFormCondition(model,entity); + + initFormCondition(model, entity); } - + model.addAttribute("_cfg", entity); return "/cfg/fileTransfer/p2pForm"; } - - @RequestMapping(value = {"saveP2pCfg"}) - @RequiresPermissions(value={"fileTransfer:p2p:config"}) - public String saveP2pCfg(Model model,HttpServletRequest request,HttpServletResponse response, - String ids,CfgIndexInfo entity,RedirectAttributes redirectAttributes) { + + @RequestMapping(value = { "saveP2pCfg" }) + @RequiresPermissions(value = { "fileTransfer:p2p:config" }) + public String saveP2pCfg(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + CfgIndexInfo entity, RedirectAttributes redirectAttributes) { try { fileTransferCfgService.saveP2pCfg(entity); - addMessage(redirectAttributes,"success","save_success"); + addMessage(redirectAttributes, "success", "save_success"); } catch (Exception e) { - if(e instanceof MaatConvertException) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.error("P2P信息保存失败",e); - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.error("P2P信息保存失败", e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("P2P信息保存失败",e); - addMessage(redirectAttributes,"error","save_failed"); + logger.error("P2P信息保存失败", e); + addMessage(redirectAttributes, "error", "save_failed"); } } - return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+entity.getFunctionId(); + return "redirect:" + adminPath + "/ntc/fileTransfer/p2pList?functionId=" + entity.getFunctionId(); } - - @RequestMapping(value = {"updateP2pCfgValid"}) - @RequiresPermissions(value={"fileTransfer:p2p:config"}) - public String updateP2pCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) { + + @RequestMapping(value = { "updateP2pCfgValid" }) + @RequiresPermissions(value = { "fileTransfer:p2p:config" }) + public String updateP2pCfgValid(Integer isValid, String ids, Integer functionId, + RedirectAttributes redirectAttributes) { try { - fileTransferCfgService.updateP2pCfgValid(isValid,ids,functionId); - addMessage(redirectAttributes,"success","delete_success"); + fileTransferCfgService.updateP2pCfgValid(isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); } catch (Exception e) { - if(e instanceof MaatConvertException) { + if (e instanceof MaatConvertException) { e.printStackTrace(); - logger.info("P2P配置删除失败:"+e.getMessage());; - addMessage(redirectAttributes,"error","request_service_failed"); - }else { + logger.info("P2P配置删除失败:" + e.getMessage()); + ; + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { e.printStackTrace(); - logger.error("P2P配置删除失败",e); - addMessage(redirectAttributes,"error","delete_failed"); + logger.error("P2P配置删除失败", e); + addMessage(redirectAttributes, "error", "delete_failed"); } } - return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/fileTransfer/p2pList?functionId=" + functionId; } - - @RequestMapping(value = {"ajaxP2pSubList"}) - public String ajaxP2pSubList(Model model,Long cfgId,Integer index,Integer compileId) { - CfgIndexInfo cfg = fileTransferCfgService.getP2pCfg(cfgId,compileId); + + @RequestMapping(value = { "ajaxP2pSubList" }) + public String ajaxP2pSubList(Model model, Long cfgId, Integer index, Integer compileId) { + CfgIndexInfo cfg = fileTransferCfgService.getP2pCfg(cfgId, compileId); List 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.getP2pHashList()!=null){ + if (cfg.getP2pHashList() != null) { String cfgType = null; - for(BaseStringCfg hash:cfg.getP2pHashList()){ - if(!hash.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",hash.getCfgType()}); + for (BaseStringCfg hash : cfg.getP2pHashList()) { + if (!hash.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "2", hash.getCfgType() }); cfgType = hash.getCfgType(); } } } - if(cfg.getP2pKeywordList()!=null){ + if (cfg.getP2pKeywordList() != null) { String cfgType = null; - for(BaseStringCfg keyword:cfg.getP2pKeywordList()){ - if(!keyword.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",keyword.getCfgType()}); + for (BaseStringCfg keyword : cfg.getP2pKeywordList()) { + 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(BaseStringCfg subscribeId:cfg.getNtcSubscribeIdCfgList()){ - if(!subscribeId.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",subscribeId.getCfgType()}); + for (BaseStringCfg subscribeId : cfg.getNtcSubscribeIdCfgList()) { + if (!subscribeId.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "2", subscribeId.getCfgType() }); cfgType = subscribeId.getCfgType(); } } } - model.addAttribute("_cfg", cfg); + model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); return "/cfg/fileTransfer/p2pSubList"; } - - @RequestMapping(value = {"auditP2pCfg"}) - @RequiresPermissions(value={"fileTransfer:p2p:confirm"}) - public String auditP2pCfg(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 = { "auditP2pCfg" }) + @RequiresPermissions(value = { "fileTransfer:p2p:confirm" }) + public String auditP2pCfg(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 = fileTransferCfgService.getP2pCfg(Long.parseLong(id),null); + for (String id : idArray) { + entity = fileTransferCfgService.getP2pCfg(Long.parseLong(id), null); entity.setIsAudit(isAudit); entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - fileTransferCfgService.auditP2pCfg(entity,isAudit); - addMessage(redirectAttributes,"success","audit_success"); - } catch ( Exception e) { + fileTransferCfgService.auditP2pCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { e.printStackTrace(); - logger.info("p2p配置下发失败:"+e.getMessage()); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - - }else if(e instanceof CallExternalProceduresException) { - addMessage(redirectAttributes,"error","call_external_procedures_failed"); - }else { - addMessage(redirectAttributes,"error","audit_failed"); + logger.info("p2p配置下发失败:" + 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", "audit_failed"); } } } - }else { - Page searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else { + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 p2pList(model, cfg, request, response); } - return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/fileTransfer/p2pList?functionId=" + functionId; } - - //ftp配置导出 - @RequestMapping(value = "exportftp") - public void exportftp(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = fileTransferCfgService.getFtpList(pageInfo, entity); - ipLists=page.getList(); - } - - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_UNIVERSAL_IP"); - titleList.add("NTC_FTP_URL"); - titleList.add("NTC_FTP_CONTENT"); - titleList.add("NTC_SUBSCRIBE_ID"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); - classMap.put("NTC_FTP_URL", BaseStringCfg.class); - classMap.put("NTC_FTP_CONTENT", 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_UNIVERSAL_IP", ipPortInfoNoExport); - noExportMap.put("NTC_FTP_URL", regionCfgNoExport); - noExportMap.put("NTC_FTP_CONTENT", regionCfgNoExport); - noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); - List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - List ftpkeyList=new ArrayList(); - List ftpurlList=new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - Map maps=fileTransferCfgService.exportftp(cfg); - ftpkeyList.addAll(maps.get("NTC_FTP_CONTENT")); - ftpurlList.addAll(maps.get("NTC_FTP_URL")); - ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); - subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); - } - subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); - ftpkeyList=BaseStringCfg.replaceBaseKeyList(ftpkeyList); - ftpurlList=BaseStringCfg.replaceBaseKeyList(ftpurlList); - dataMap.put(entity.getMenuNameCode(), ipLists); - dataMap.put("NTC_UNIVERSAL_IP", ipList); - dataMap.put("NTC_FTP_URL", ftpurlList); - dataMap.put("NTC_FTP_CONTENT", ftpkeyList); - dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); - /*}*/ - this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); - } catch (Exception e) { - logger.error("ftp export failed",e); - addMessage(redirectAttributes,"error","export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + + // ftp配置导出 + @RequestMapping(value = "exportftp") + public void exportftp(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = fileTransferCfgService.getFtpList(pageInfo, entity); + ipLists = page.getList(); + } + + titleList.add(entity.getMenuNameCode()); + titleList.add("NTC_UNIVERSAL_IP"); + titleList.add("NTC_FTP_URL"); + titleList.add("NTC_FTP_CONTENT"); + titleList.add("NTC_SUBSCRIBE_ID"); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); + classMap.put("NTC_FTP_URL", BaseStringCfg.class); + classMap.put("NTC_FTP_CONTENT", 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_UNIVERSAL_IP", ipPortInfoNoExport); + noExportMap.put("NTC_FTP_URL", regionCfgNoExport); + noExportMap.put("NTC_FTP_CONTENT", regionCfgNoExport); + noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); + List ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + List ftpkeyList = new ArrayList(); + List ftpurlList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + Map maps = fileTransferCfgService.exportftp(cfg); + ftpkeyList.addAll(maps.get("NTC_FTP_CONTENT")); + ftpurlList.addAll(maps.get("NTC_FTP_URL")); + ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); + subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); + } + subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList); + ftpkeyList = BaseStringCfg.replaceBaseKeyList(ftpkeyList); + ftpurlList = BaseStringCfg.replaceBaseKeyList(ftpurlList); + dataMap.put(entity.getMenuNameCode(), ipLists); + dataMap.put("NTC_UNIVERSAL_IP", ipList); + dataMap.put("NTC_FTP_URL", ftpurlList); + dataMap.put("NTC_FTP_CONTENT", ftpkeyList); + 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("ftp export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // p2p配置导出 + @RequestMapping(value = "exportP2p") + public void exportP2p(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = fileTransferCfgService.getP2pList(pageInfo, entity); + ipLists = page.getList(); + } + + titleList.add(entity.getMenuNameCode()); + titleList.add("NTC_UNIVERSAL_IP"); + titleList.add("NTC_P2P_KEYWORDS"); + titleList.add("NTC_P2P_HASH_BIN"); + titleList.add("NTC_SUBSCRIBE_ID"); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); + classMap.put("NTC_P2P_KEYWORDS", BaseStringCfg.class); + classMap.put("NTC_P2P_HASH_BIN", 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,ir_type,creator,creator" + + ",config_time,editor,edit_time,auditor,audit_time" + + ",letter,whether_area_block,classification,attribute,label" + + ",userregion2,userregion3,userregion4,userregion5,group_name,&userregion1:p2p_ip_config_type-"; + 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 hashCfgNoExport = ",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" + + ",userregion2,userregion3,userregion4,userregion5,&userregion1:p2p_hash_type-"; + String keyCfgNoExport = ",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_UNIVERSAL_IP", ipPortInfoNoExport); + noExportMap.put("NTC_P2P_KEYWORDS", keyCfgNoExport); + noExportMap.put("NTC_P2P_HASH_BIN", hashCfgNoExport); + noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); + List ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + List hashList = new ArrayList(); + List keywordList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + Map maps = fileTransferCfgService.exportp2p(cfg); + keywordList.addAll(maps.get("NTC_P2P_KEYWORDS")); + hashList.addAll(maps.get("NTC_P2P_HASH_BIN")); + ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); + subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); + } + subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList); + keywordList = BaseStringCfg.replaceBaseKeyList(keywordList); + hashList = BaseStringCfg.replaceBaseKeyList(hashList); + dataMap.put(entity.getMenuNameCode(), ipLists); + dataMap.put("NTC_UNIVERSAL_IP", ipList); + dataMap.put("NTC_P2P_KEYWORDS", keywordList); + dataMap.put("NTC_P2P_HASH_BIN", hashList); + 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("p2p export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // file配置导出 + @RequestMapping(value = "exportFile") + public void exportFile(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") FileDigestCfg entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = fileTransferCfgService.getFileByDigestList(ids); + } else { + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = fileTransferCfgService.getFileDigestList(pageInfo, entity); + ipLists = page.getList(); } - //p2p配置导出 - @RequestMapping(value = "exportP2p") - public void exportP2p(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = fileTransferCfgService.getP2pList(pageInfo, entity); - ipLists=page.getList(); - } - - - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_UNIVERSAL_IP"); - titleList.add("NTC_P2P_KEYWORDS"); - titleList.add("NTC_P2P_HASH_BIN"); - titleList.add("NTC_SUBSCRIBE_ID"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); - classMap.put("NTC_P2P_KEYWORDS", BaseStringCfg.class); - classMap.put("NTC_P2P_HASH_BIN", 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,ir_type,creator,creator" - + ",config_time,editor,edit_time,auditor,audit_time" - +",letter,whether_area_block,classification,attribute,label" - +",userregion2,userregion3,userregion4,userregion5,group_name,&userregion1:p2p_ip_config_type-"; - 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 hashCfgNoExport=",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" - +",userregion2,userregion3,userregion4,userregion5,&userregion1:p2p_hash_type-"; - String keyCfgNoExport=",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_UNIVERSAL_IP", ipPortInfoNoExport); - noExportMap.put("NTC_P2P_KEYWORDS", keyCfgNoExport); - noExportMap.put("NTC_P2P_HASH_BIN", hashCfgNoExport); - noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); - List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - List hashList=new ArrayList(); - List keywordList=new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - Map maps=fileTransferCfgService.exportp2p(cfg); - keywordList.addAll(maps.get("NTC_P2P_KEYWORDS")); - hashList.addAll(maps.get("NTC_P2P_HASH_BIN")); - ipList.addAll(maps.get("NTC_UNIVERSAL_IP")); - subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); - } - subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); - keywordList=BaseStringCfg.replaceBaseKeyList(keywordList); - hashList=BaseStringCfg.replaceBaseKeyList(hashList); - dataMap.put(entity.getMenuNameCode(), ipLists); - dataMap.put("NTC_UNIVERSAL_IP", ipList); - dataMap.put("NTC_P2P_KEYWORDS", keywordList); - dataMap.put("NTC_P2P_HASH_BIN", hashList); - dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); - /*}*/ - this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); - } catch (Exception e) { - logger.error("p2p export failed",e); - addMessage(redirectAttributes,"error","export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); - } + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), FileDigestCfg.class); + String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; - - //file配置导出 - @RequestMapping(value = "exportFile") - public void exportFile(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")FileDigestCfg entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - - /*//导出选中记录 - * if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{*/ - //条件导出数据大于最大导出数,只导出最大导出条数 - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = fileTransferCfgService.getFileDigestList(pageInfo, entity); - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), FileDigestCfg.class); - String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; - noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); - dataMap.put(entity.getMenuNameCode(), page.getList()); - /*}*/ - this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); - } catch (Exception e) { - logger.error("file export failed",e); - addMessage(redirectAttributes,"error","export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + // 时间过滤 + 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("file export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java index 4cd4a0465..801831700 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java @@ -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 classList=new ArrayList(); + 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 classList=new ArrayList(); 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 classList=new ArrayList(); + 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 classList=new ArrayList(); + 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 classList=new ArrayList(); + 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 classList=new ArrayList(); 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 classList=new ArrayList(); + 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 classList=new ArrayList(); + 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 classList=new ArrayList(); + 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 classList=new ArrayList(); 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 classList=new ArrayList(); + 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 classList=new ArrayList(); + 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 classList=new ArrayList(); + 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 classList=new ArrayList(); + 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 classList=new ArrayList(); 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"); diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java b/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java index 0600369d3..2b4d20635 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/MailCfgController.java @@ -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 searchPage=new Page(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 searchPage = new Page(request, response, "a"); Page 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 fileMap = new HashMap(); + // 获取文件摘要接口调用 + Map 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 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 searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else { + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - List mailBodyList=new ArrayList(); - List mailReqHdrList=new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - Map 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + List mailBodyList = new ArrayList(); + List mailReqHdrList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + Map 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(); + } + } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java index b2d57d3fe..6ab6a5608 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java @@ -50,39 +50,43 @@ import com.nis.web.security.UserUtils; /** * 网站配置 + * * @author dell * */ @Controller @RequestMapping("${adminPath}/ntc/website/") -public class WebsiteController extends BaseController{ - - @RequestMapping(value = {"httpList"}) -// @RequiresPermissions(value={"website:http:config"}) - public String httpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"a"); +public class WebsiteController extends BaseController { + + @RequestMapping(value = { "httpList" }) + // @RequiresPermissions(value={"website:http:config"}) + public String httpList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "a"); Page page = websiteCfgService.getWebsiteList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/website/httpList"; } - @RequestMapping(value = {"dnsList"}) -// @RequiresPermissions(value={"website:dns:config"}) - public String dnsList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"a"); + + @RequestMapping(value = { "dnsList" }) + // @RequiresPermissions(value={"website:dns:config"}) + public String dnsList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "a"); Page page = websiteCfgService.getWebsiteList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/website/dnsList"; } - - @RequestMapping(value = {"httpForm"}) - @RequiresPermissions(value={"website:http:config"}) - public String httpForm(Model model,String ids,CfgIndexInfo entity) { - if(StringUtils.isNotBlank(ids)){ - entity = websiteCfgService.getHttpCfg(Long.parseLong(ids),null); - - //设置http各类配置的配置域类型 + + @RequestMapping(value = { "httpForm" }) + @RequiresPermissions(value = { "website:http:config" }) + public String httpForm(Model model, String ids, CfgIndexInfo entity) { + if (StringUtils.isNotBlank(ids)) { + entity = websiteCfgService.getHttpCfg(Long.parseLong(ids), null); + + // 设置http各类配置的配置域类型 IpPortCfg ipCfg = new IpPortCfg(); ipCfg.setCfgType(Constants.HTTP_IP_REGION); entity.setIpPort(ipCfg); @@ -104,39 +108,36 @@ public class WebsiteController extends BaseController{ NtcSubscribeIdCfg subscribeId = new NtcSubscribeIdCfg(); subscribeId.setCfgType(Constants.NTC_SUBSCRIBE_ID); entity.setNtcSubscribeIdCfg(subscribeId); - - int httpReqCfgNum = entity.getIpPortList().size()+ - entity.getHttpUrlList().size()+ - entity.getHttpReqBodyList().size()+ - entity.getHttpReqHdrList().size(); - int httpResCfgNum = entity.getHttpResHdrList().size()+ - entity.getHttpResBodyList().size(); + + int httpReqCfgNum = entity.getIpPortList().size() + entity.getHttpUrlList().size() + + entity.getHttpReqBodyList().size() + entity.getHttpReqHdrList().size(); + int httpResCfgNum = entity.getHttpResHdrList().size() + entity.getHttpResBodyList().size(); model.addAttribute("httpReqCfgNum", httpReqCfgNum); model.addAttribute("httpResCfgNum", httpResCfgNum); - if(entity.getIpPortList().size()==0){ + if (entity.getIpPortList().size() == 0) { entity.getIpPortList().add(ipCfg); } - 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.getNtcSubscribeIdCfgList().size()==0){ + if (entity.getNtcSubscribeIdCfgList().size() == 0) { entity.getNtcSubscribeIdCfgList().add(subscribeId); } - initUpdateFormCondition(model,entity); - }else{ - //设置http各类配置的配置域类型 + initUpdateFormCondition(model, entity); + } else { + // 设置http各类配置的配置域类型 IpPortCfg ipCfg = new IpPortCfg(); ipCfg.setCfgType(Constants.HTTP_IP_REGION); entity.setIpPort(ipCfg); @@ -158,774 +159,826 @@ public class WebsiteController extends BaseController{ NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID); entity.setNtcSubscribeIdCfg(subscribeIdCfg); - - List ipList=new ArrayList(); + + List ipList = new ArrayList(); ipList.add(ipCfg); entity.setIpPortList(ipList); - List urlList=new ArrayList(); + List urlList = new ArrayList(); urlList.add(urlCfg); entity.setHttpUrlList(urlList); - List reqHdrList=new ArrayList(); + List reqHdrList = new ArrayList(); reqHdrList.add(reqHdrCfg); entity.setHttpReqHdrList(reqHdrList); - List resHdrList=new ArrayList(); + List resHdrList = new ArrayList(); resHdrList.add(resHdrCfg); entity.setHttpResHdrList(resHdrList); - List reqBodyList=new ArrayList(); + List reqBodyList = new ArrayList(); reqBodyList.add(reqBodyCfg); entity.setHttpReqBodyList(reqBodyList); - List resBodyList=new ArrayList(); + List resBodyList = new ArrayList(); resBodyList.add(resBodyCfg); entity.setHttpResBodyList(resBodyList); - List subscribeIdList=new ArrayList(); + List subscribeIdList = new ArrayList(); subscribeIdList.add(subscribeIdCfg); entity.setNtcSubscribeIdCfgList(subscribeIdList); - initFormCondition(model,entity); + initFormCondition(model, entity); } - + model.addAttribute("_cfg", entity); return "/cfg/website/httpForm"; } - - @RequestMapping(value = {"saveHttpCfg"}) - @RequiresPermissions(value={"website:http:config"}) - public String saveHttpCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) { + + @RequestMapping(value = { "saveHttpCfg" }) + @RequiresPermissions(value = { "website:http:config" }) + public String saveHttpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response, + String ids, CfgIndexInfo entity) { websiteCfgService.saveHttpCfg(entity); - return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId(); + return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + entity.getFunctionId(); } - @RequestMapping(value = {"ajaxHttpSubList"}) - public String ajaxHttpSubList(Model model,Long cfgId,Integer index,Integer compileId) { - CfgIndexInfo cfg = websiteCfgService.getHttpCfg(cfgId,compileId); - model.addAttribute("_cfg", cfg); + + @RequestMapping(value = { "ajaxHttpSubList" }) + public String ajaxHttpSubList(Model model, Long cfgId, Integer index, Integer compileId) { + CfgIndexInfo cfg = websiteCfgService.getHttpCfg(cfgId, compileId); + model.addAttribute("_cfg", cfg); model.addAttribute("index", index); return "/cfg/website/httpSubList"; } - @RequestMapping(value = {"updateHttpCfgValid"}) - @RequiresPermissions(value={"website:http:config"}) - public String updateHttpCfgValid(Integer isValid,String ids,Integer functionId) { - websiteCfgService.updateHttpCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+functionId; + + @RequestMapping(value = { "updateHttpCfgValid" }) + @RequiresPermissions(value = { "website:http:config" }) + public String updateHttpCfgValid(Integer isValid, String ids, Integer functionId) { + websiteCfgService.updateHttpCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + functionId; } - @RequestMapping(value = {"auditHttpCfg"}) - @RequiresPermissions(value={"website:http:confirm"}) - public String auditHttpCfg(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 = { "auditHttpCfg" }) + @RequiresPermissions(value = { "website:http:confirm" }) + public String auditHttpCfg(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 = websiteCfgService.getHttpCfg(Long.parseLong(id),null); + for (String id : idArray) { + entity = websiteCfgService.getHttpCfg(Long.parseLong(id), null); entity.setIsAudit(isAudit); entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - websiteCfgService.auditHttpCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + websiteCfgService.auditHttpCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (MaatConvertException e) { - logger.error("http配置下发失败:"+e.getMessage()); - addMessage(redirectAttributes,"error", "request_service_failed"); - }catch (Exception e) { - logger.error("http配置下发失败:"+e.getMessage()); - addMessage(redirectAttributes,"error", "audit_failed"); + logger.error("http配置下发失败:" + e.getMessage()); + addMessage(redirectAttributes, "error", "request_service_failed"); + } catch (Exception e) { + logger.error("http配置下发失败:" + e.getMessage()); + addMessage(redirectAttributes, "error", "audit_failed"); } } - }else{//条件下所有配置审核 - Page searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else {// 条件下所有配置审核 + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 httpList(model, cfg, request, response); } - return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + functionId; } - @RequestMapping(value = {"sslList"}) -// @RequiresPermissions(value={"website:ssl:config"}) - public String sslList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { - Page searchPage=new Page(request,response,"a"); + + @RequestMapping(value = { "sslList" }) + // @RequiresPermissions(value={"website:ssl:config"}) + public String sslList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request, + HttpServletResponse response) { + Page searchPage = new Page(request, response, "a"); Page page = websiteCfgService.getWebsiteList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); + initPageCondition(model, cfg); return "/cfg/website/sslList"; } - @RequestMapping(value = {"sslForm"}) - @RequiresPermissions(value={"website:ssl:config"}) - public String sslForm(Model model,String ids,CfgIndexInfo entity) { - if(StringUtils.isNotBlank(ids)){ - entity = websiteCfgService.getSslCfg(Long.parseLong(ids),null); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + + @RequestMapping(value = { "sslForm" }) + @RequiresPermissions(value = { "website:ssl:config" }) + public String sslForm(Model model, String ids, CfgIndexInfo entity) { + if (StringUtils.isNotBlank(ids)) { + entity = websiteCfgService.getSslCfg(Long.parseLong(ids), null); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } model.addAttribute("_cfg", entity); return "/cfg/website/sslForm"; } - @RequestMapping(value = {"saveSslCfg"}) - @RequiresPermissions(value={"website:ssl:config"}) - public String saveSslCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) { + + @RequestMapping(value = { "saveSslCfg" }) + @RequiresPermissions(value = { "website:ssl:config" }) + public String saveSslCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response, + String ids, CfgIndexInfo entity) { websiteCfgService.saveSslCfg(entity); - return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+entity.getFunctionId(); + return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + entity.getFunctionId(); } - @RequestMapping(value = {"ajaxSslSubList"}) - public String ajaxSslSubList(Model model,Long cfgId,Integer index,Integer compileId) { - CfgIndexInfo cfg = websiteCfgService.getSslCfg(cfgId,compileId); - /*List regionList = DictUtils.getFunctionRegionDictList(cfg.getFunctionId()); - model.addAttribute("regionList", regionList);*/ + + @RequestMapping(value = { "ajaxSslSubList" }) + public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) { + CfgIndexInfo cfg = websiteCfgService.getSslCfg(cfgId, compileId); + /* + * List regionList = + * DictUtils.getFunctionRegionDictList(cfg.getFunctionId()); + * model.addAttribute("regionList", regionList); + */ List 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.getSslList()!=null){ + if (cfg.getSslList() != null) { String cfgType = null; - for(BaseStringCfg keyword:cfg.getSslList()){ - if(!keyword.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"2",keyword.getCfgType()}); + for (BaseStringCfg keyword : cfg.getSslList()) { + 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/website/sslSubList"; } - @RequestMapping(value = {"updateSslCfgValid"}) - @RequiresPermissions(value={"website:ssl:config"}) - public String updateSslCfgValid(Integer isValid,String ids,Integer functionId) { - websiteCfgService.updateSslCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+functionId; + + @RequestMapping(value = { "updateSslCfgValid" }) + @RequiresPermissions(value = { "website:ssl:config" }) + public String updateSslCfgValid(Integer isValid, String ids, Integer functionId) { + websiteCfgService.updateSslCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + functionId; } - @RequestMapping(value = {"auditSslCfg"}) - @RequiresPermissions(value={"website:ssl:confirm"}) - public String auditSslCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg, - Integer isAudit, - Integer isValid, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletRequest request, - HttpServletResponse response) { - if(!StringUtil.isEmpty(ids)) { + + @RequestMapping(value = { "auditSslCfg" }) + @RequiresPermissions(value = { "website:ssl:confirm" }) + public String auditSslCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isAudit, Integer isValid, + String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletRequest request, + HttpServletResponse response) { + if (!StringUtil.isEmpty(ids)) { CfgIndexInfo entity = new CfgIndexInfo(); String[] idArray = ids.split(","); - for(String id :idArray){ - entity = websiteCfgService.getSslCfg(Long.parseLong(id),null); + for (String id : idArray) { + entity = websiteCfgService.getSslCfg(Long.parseLong(id), null); entity.setIsAudit(isAudit); entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - websiteCfgService.auditSslCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); - } catch ( Exception e) { + websiteCfgService.auditSslCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); + } catch (Exception e) { e.printStackTrace(); - logger.error("ssl配置下发失败:"+e.getMessage()); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - - }else if(e instanceof CallExternalProceduresException) { - addMessage(redirectAttributes,"error","call_external_procedures_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); + logger.error("ssl配置下发失败:" + 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{//条件下所有配置审核 + } else {// 条件下所有配置审核 try { - Page searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); 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 sslList(model, cfg, request, response); } - return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + functionId; } - - @RequestMapping(value = {"dnsForm"}) - @RequiresPermissions(value={"website:dns:config"}) - public String dnsForm(Model model,String ids,CfgIndexInfo entity) { - if(StringUtils.isNotBlank(ids)){ - entity = websiteCfgService.getDnsCfg(Long.parseLong(ids),null); - initUpdateFormCondition(model,entity); - }else{ - initFormCondition(model,entity); + + @RequestMapping(value = { "dnsForm" }) + @RequiresPermissions(value = { "website:dns:config" }) + public String dnsForm(Model model, String ids, CfgIndexInfo entity) { + if (StringUtils.isNotBlank(ids)) { + entity = websiteCfgService.getDnsCfg(Long.parseLong(ids), null); + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); } - //获取所有响应策略信息 - List resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1); + // 获取所有响应策略信息 + List resStrategys = dnsResStrategyService.findDnsResStrategys(null, 1, 1); model.addAttribute("dnsResStrategys", resStrategys); model.addAttribute("_cfg", entity); return "/cfg/website/dnsForm"; } - @RequestMapping(value = {"saveDnsCfg"}) - @RequiresPermissions(value={"website:dns:config"}) - public String saveDnsCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) { + + @RequestMapping(value = { "saveDnsCfg" }) + @RequiresPermissions(value = { "website:dns:config" }) + public String saveDnsCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response, + String ids, CfgIndexInfo entity) { websiteCfgService.saveDnsCfg(entity); - return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+entity.getFunctionId(); + return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + entity.getFunctionId(); } - @RequestMapping(value = {"ajaxDnsSubList"}) - public String ajaxDnsSubList(Model model,Long cfgId,Integer index,Integer compileId) { - CfgIndexInfo cfg = websiteCfgService.getDnsCfg(cfgId,compileId); + + @RequestMapping(value = { "ajaxDnsSubList" }) + public String ajaxDnsSubList(Model model, Long cfgId, Integer index, Integer compileId) { + CfgIndexInfo cfg = websiteCfgService.getDnsCfg(cfgId, compileId); List 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.getDomainList()!=null){ + if (cfg.getDomainList() != null) { String cfgType = null; - for(ComplexkeywordCfg keyword:cfg.getDomainList()){ - if(!keyword.getCfgType().equals(cfgType)){ - tabList.add(new String[]{"3",keyword.getCfgType()}); + for (ComplexkeywordCfg keyword : cfg.getDomainList()) { + if (!keyword.getCfgType().equals(cfgType)) { + tabList.add(new String[] { "3", 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/website/dnsSubList"; } - @RequestMapping(value = {"updateDnsCfgValid"}) - @RequiresPermissions(value={"website:dns:config"}) - public String updateDnsCfgValid(Integer isValid,String ids,Integer functionId) { - websiteCfgService.updateDnsCfgValid(isValid,ids,functionId); - return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+functionId; + + @RequestMapping(value = { "updateDnsCfgValid" }) + @RequiresPermissions(value = { "website:dns:config" }) + public String updateDnsCfgValid(Integer isValid, String ids, Integer functionId) { + websiteCfgService.updateDnsCfgValid(isValid, ids, functionId); + return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + functionId; } - @RequestMapping(value = {"auditDnsCfg"}) - @RequiresPermissions(value={"website:dns:confirm"}) - public String auditDnsCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg, - Integer isAudit, - Integer isValid, - String ids, - Integer functionId, - HttpServletRequest request, - HttpServletResponse response, - RedirectAttributes redirectAttributes) { - if(!StringUtil.isEmpty(ids)) { + + @RequestMapping(value = { "auditDnsCfg" }) + @RequiresPermissions(value = { "website:dns:confirm" }) + public String auditDnsCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isAudit, Integer isValid, + String ids, Integer functionId, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(ids)) { CfgIndexInfo entity = new CfgIndexInfo(); String[] idArray = ids.split(","); - for(String id :idArray){ - entity = websiteCfgService.getDnsCfg(Long.parseLong(id),null); + for (String id : idArray) { + entity = websiteCfgService.getDnsCfg(Long.parseLong(id), null); entity.setIsAudit(isAudit); entity.setIsValid(isValid); entity.setAuditorId(UserUtils.getUser().getId()); entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - websiteCfgService.auditDnsCfg(entity,isAudit); - addMessage(redirectAttributes,"success", "audit_success"); + websiteCfgService.auditDnsCfg(entity, isAudit); + addMessage(redirectAttributes, "success", "audit_success"); } catch (MaatConvertException e) { e.printStackTrace(); - logger.info("dns配置下发失败:"+e.getMessage()); - addMessage(redirectAttributes,"error", "request_service_failed"); - }catch (Exception e) { + logger.info("dns配置下发失败:" + e.getMessage()); + addMessage(redirectAttributes, "error", "request_service_failed"); + } catch (Exception e) { e.printStackTrace(); - logger.info("dns配置下发失败:"+e.getMessage()); - addMessage(redirectAttributes,"error", "audit_failed"); + logger.info("dns配置下发失败:" + e.getMessage()); + addMessage(redirectAttributes, "error", "audit_failed"); } } - }else{//条件下所有配置审核 - Page searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else {// 条件下所有配置审核 + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 dnsList(model, cfg, request, response); } - return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+functionId; + return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + functionId; } + @Deprecated - //下载导入模板 + // 下载导入模板 @RequestMapping(value = "import/template") - public void importFileTemplate(HttpServletRequest request,HttpServletResponse response, - RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) { + public void importFileTemplate(HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) { this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode); } - //http配置导入 - /*@RequestMapping(value = "importHttp", method=RequestMethod.POST) - public String importHttpFile(HttpServletRequest request,Model model,HttpServletResponse response, RedirectAttributes redirectAttributes, - @RequestParam("file") MultipartFile file,CfgIndexInfo cfgIndex,Integer protocolId) { - try { - ImportExcel ei = new ImportExcel(file, 0, 0); - if(cfgIndex.getCfgType().equals(Constants.HTTP_IP_REGION)){ - List list = ei.getDataList(IpCfgTemplate.class); - for(IpCfgTemplate cfg : list){ - List ipList = new ArrayList(); - BeanUtils.copyProperties(cfg, cfgIndex); - IpPortCfg ip = new IpPortCfg(); - BeanUtils.copyProperties(cfg, ip); - ip.setProtocolId(protocolId); - ip.setCfgRegionCode(cfgIndex.getCfgRegionCode()); - ip.setCfgType(cfgIndex.getCfgType()); - ipList.add(ip); - cfgIndex.setIpPortList(ipList); - cfgIndex.setIsAreaEffective(0); - websiteCfgService.saveHttpCfg(cfgIndex); - } - - }else if(cfgIndex.getCfgType().equals(Constants.HTTP_URL_REGION)){ - List list = ei.getDataList(StringCfgTemplate.class); - for(StringCfgTemplate cfg : list){ - List urlList = new ArrayList(); - BeanUtils.copyProperties(cfg, cfgIndex); - HttpUrlCfg url = new HttpUrlCfg(); - BeanUtils.copyProperties(cfg, url); - url.setCfgRegionCode(cfgIndex.getCfgRegionCode()); - url.setCfgType(cfgIndex.getCfgType()); - urlList.add(url); - cfgIndex.setHttpUrlList(urlList); - cfgIndex.setIsAreaEffective(0); - websiteCfgService.saveHttpCfg(cfgIndex); - } - - }else if(cfgIndex.getCfgType().equals(Constants.HTTP_REQ_HEAD_REGION)){ - List list = ei.getDataList(ComplexStringCfgTemplate.class); - for(ComplexStringCfgTemplate cfg : list){ - List headList = new ArrayList(); - BeanUtils.copyProperties(cfg, cfgIndex); - HttpReqHeadCfg head = new HttpReqHeadCfg(); - BeanUtils.copyProperties(cfg, head); - head.setCfgRegionCode(cfgIndex.getCfgRegionCode()); - head.setCfgType(cfgIndex.getCfgType()); - headList.add(head); - cfgIndex.setHttpReqHdrList(headList); - cfgIndex.setIsAreaEffective(0); - websiteCfgService.saveHttpCfg(cfgIndex); - } - - }else if(cfgIndex.getCfgType().equals(Constants.HTTP_REQ_BODY_REGION)){ - List list = ei.getDataList(StringCfgTemplate.class); - for(StringCfgTemplate cfg : list){ - List bodyList = new ArrayList(); - BeanUtils.copyProperties(cfg, cfgIndex); - HttpBodyCfg body = new HttpBodyCfg(); - BeanUtils.copyProperties(cfg, body); - body.setCfgRegionCode(cfgIndex.getCfgRegionCode()); - body.setCfgType(cfgIndex.getCfgType()); - bodyList.add(body); - cfgIndex.setHttpReqBodyList(bodyList); - cfgIndex.setIsAreaEffective(0); - websiteCfgService.saveHttpCfg(cfgIndex); - } - - }else if(cfgIndex.getCfgType().equals(Constants.HTTP_RES_HEAD_REGION)){ - List list = ei.getDataList(ComplexStringCfgTemplate.class); - for(ComplexStringCfgTemplate cfg : list){ - List headList = new ArrayList(); - BeanUtils.copyProperties(cfg, cfgIndex); - HttpResHeadCfg head = new HttpResHeadCfg(); - BeanUtils.copyProperties(cfg, head); - head.setCfgRegionCode(cfgIndex.getCfgRegionCode()); - head.setCfgType(cfgIndex.getCfgType()); - headList.add(head); - cfgIndex.setHttpResHdrList(headList); - cfgIndex.setIsAreaEffective(0); - websiteCfgService.saveHttpCfg(cfgIndex); - } - - }else if(cfgIndex.getCfgType().equals(Constants.HTTP_RES_BODY_REGION)){ - List list = ei.getDataList(StringCfgTemplate.class); - for(StringCfgTemplate cfg : list){ - List bodyList = new ArrayList(); - BeanUtils.copyProperties(cfg, cfgIndex); - HttpBodyCfg body = new HttpBodyCfg(); - BeanUtils.copyProperties(cfg, body); - body.setCfgRegionCode(cfgIndex.getCfgRegionCode()); - body.setCfgType(cfgIndex.getCfgType()); - bodyList.add(body); - cfgIndex.setHttpResBodyList(bodyList); - cfgIndex.setIsAreaEffective(0); - websiteCfgService.saveHttpCfg(cfgIndex); - } - - } - - - } catch (Exception e) { - addMessage(redirectAttributes, e.getMessage()); - e.printStackTrace(); - } - return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+cfgIndex.getFunctionId(); - - }*/ - - - + // http配置导入 + /* + * @RequestMapping(value = "importHttp", method=RequestMethod.POST) public + * String importHttpFile(HttpServletRequest request,Model + * model,HttpServletResponse response, RedirectAttributes + * redirectAttributes, + * + * @RequestParam("file") MultipartFile file,CfgIndexInfo cfgIndex,Integer + * protocolId) { try { ImportExcel ei = new ImportExcel(file, 0, 0); + * if(cfgIndex.getCfgType().equals(Constants.HTTP_IP_REGION)){ + * List list = ei.getDataList(IpCfgTemplate.class); + * for(IpCfgTemplate cfg : list){ List ipList = new ArrayList(); + * BeanUtils.copyProperties(cfg, cfgIndex); IpPortCfg ip = new IpPortCfg(); + * BeanUtils.copyProperties(cfg, ip); ip.setProtocolId(protocolId); + * ip.setCfgRegionCode(cfgIndex.getCfgRegionCode()); + * ip.setCfgType(cfgIndex.getCfgType()); ipList.add(ip); + * cfgIndex.setIpPortList(ipList); cfgIndex.setIsAreaEffective(0); + * websiteCfgService.saveHttpCfg(cfgIndex); } + * + * }else if(cfgIndex.getCfgType().equals(Constants.HTTP_URL_REGION)){ + * List list = ei.getDataList(StringCfgTemplate.class); + * for(StringCfgTemplate cfg : list){ List urlList = new + * ArrayList(); BeanUtils.copyProperties(cfg, cfgIndex); HttpUrlCfg url = + * new HttpUrlCfg(); BeanUtils.copyProperties(cfg, url); + * url.setCfgRegionCode(cfgIndex.getCfgRegionCode()); + * url.setCfgType(cfgIndex.getCfgType()); urlList.add(url); + * cfgIndex.setHttpUrlList(urlList); cfgIndex.setIsAreaEffective(0); + * websiteCfgService.saveHttpCfg(cfgIndex); } + * + * }else if(cfgIndex.getCfgType().equals(Constants.HTTP_REQ_HEAD_REGION)){ + * List list = + * ei.getDataList(ComplexStringCfgTemplate.class); + * for(ComplexStringCfgTemplate cfg : list){ List headList = + * new ArrayList(); BeanUtils.copyProperties(cfg, cfgIndex); HttpReqHeadCfg + * head = new HttpReqHeadCfg(); BeanUtils.copyProperties(cfg, head); + * head.setCfgRegionCode(cfgIndex.getCfgRegionCode()); + * head.setCfgType(cfgIndex.getCfgType()); headList.add(head); + * cfgIndex.setHttpReqHdrList(headList); cfgIndex.setIsAreaEffective(0); + * websiteCfgService.saveHttpCfg(cfgIndex); } + * + * }else if(cfgIndex.getCfgType().equals(Constants.HTTP_REQ_BODY_REGION)){ + * List list = ei.getDataList(StringCfgTemplate.class); + * for(StringCfgTemplate cfg : list){ List bodyList = new + * ArrayList(); BeanUtils.copyProperties(cfg, cfgIndex); HttpBodyCfg body = + * new HttpBodyCfg(); BeanUtils.copyProperties(cfg, body); + * body.setCfgRegionCode(cfgIndex.getCfgRegionCode()); + * body.setCfgType(cfgIndex.getCfgType()); bodyList.add(body); + * cfgIndex.setHttpReqBodyList(bodyList); cfgIndex.setIsAreaEffective(0); + * websiteCfgService.saveHttpCfg(cfgIndex); } + * + * }else if(cfgIndex.getCfgType().equals(Constants.HTTP_RES_HEAD_REGION)){ + * List list = + * ei.getDataList(ComplexStringCfgTemplate.class); + * for(ComplexStringCfgTemplate cfg : list){ List headList = + * new ArrayList(); BeanUtils.copyProperties(cfg, cfgIndex); HttpResHeadCfg + * head = new HttpResHeadCfg(); BeanUtils.copyProperties(cfg, head); + * head.setCfgRegionCode(cfgIndex.getCfgRegionCode()); + * head.setCfgType(cfgIndex.getCfgType()); headList.add(head); + * cfgIndex.setHttpResHdrList(headList); cfgIndex.setIsAreaEffective(0); + * websiteCfgService.saveHttpCfg(cfgIndex); } + * + * }else if(cfgIndex.getCfgType().equals(Constants.HTTP_RES_BODY_REGION)){ + * List list = ei.getDataList(StringCfgTemplate.class); + * for(StringCfgTemplate cfg : list){ List bodyList = new + * ArrayList(); BeanUtils.copyProperties(cfg, cfgIndex); HttpBodyCfg body = + * new HttpBodyCfg(); BeanUtils.copyProperties(cfg, body); + * body.setCfgRegionCode(cfgIndex.getCfgRegionCode()); + * body.setCfgType(cfgIndex.getCfgType()); bodyList.add(body); + * cfgIndex.setHttpResBodyList(bodyList); cfgIndex.setIsAreaEffective(0); + * websiteCfgService.saveHttpCfg(cfgIndex); } + * + * } + * + * + * } catch (Exception e) { addMessage(redirectAttributes, e.getMessage()); + * e.printStackTrace(); } return "redirect:" + adminPath + * +"/ntc/website/httpList?functionId="+cfgIndex.getFunctionId(); + * + * } + */ - //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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity); - ipLists=page.getList(); - } - //条件导出数据大于最大导出数,只导出最大导出条数 - - String cfgIndexInfoNoExport=",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,ir_type,group_name,"; - List httpUrlList = new ArrayList<>(); - List httpReqHdrList = new ArrayList<>(); - List httpResHdrList = new ArrayList<>(); - List httpReqBodyList = new ArrayList<>(); - List httpResBodyList = new ArrayList<>(); - List ipPortList = new ArrayList<>(); - List subscribeIdList = new ArrayList<>(); - for (CfgIndexInfo cfg : ipLists) { - Map maps=websiteCfgService.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()); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); - dataMap.put(entity.getMenuNameCode(),ipLists); - - if(entity.getFunctionId()!=635){ - titleList.add("NTC_HTTP_URL"); - titleList.add("NTC_HTTP_REQ_HDR"); - titleList.add("NTC_HTTP_RES_HDR"); - classMap.put("NTC_HTTP_URL", HttpUrlCfg.class); - classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class); - classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class); - noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport); - noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport); - noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport); - dataMap.put("NTC_HTTP_URL", httpUrlList); - dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList); - dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList); - } - titleList.add("NTC_HTTP_REQ_BODY"); - titleList.add("NTC_HTTP_RES_BODY"); - classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class); - classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class); - noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport); - noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport); - dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList); - dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList); - if(entity.getFunctionId()!=635){ - 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(); + // 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity); + ipLists = page.getList(); + } + // 条件导出数据大于最大导出数,只导出最大导出条数 + + String cfgIndexInfoNoExport = ",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,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; } - //dns配置导出 + List httpUrlList = new ArrayList<>(); + List httpReqHdrList = new ArrayList<>(); + List httpResHdrList = new ArrayList<>(); + List httpReqBodyList = new ArrayList<>(); + List httpResBodyList = new ArrayList<>(); + List ipPortList = new ArrayList<>(); + List subscribeIdList = new ArrayList<>(); + for (CfgIndexInfo cfg : ipLists) { + Map maps = websiteCfgService.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()); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport); + dataMap.put(entity.getMenuNameCode(), ipLists); + + if (entity.getFunctionId() != 635) { + titleList.add("NTC_HTTP_URL"); + titleList.add("NTC_HTTP_REQ_HDR"); + titleList.add("NTC_HTTP_RES_HDR"); + classMap.put("NTC_HTTP_URL", HttpUrlCfg.class); + classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class); + classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class); + noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport); + noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport); + noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport); + dataMap.put("NTC_HTTP_URL", httpUrlList); + dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList); + dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList); + } + titleList.add("NTC_HTTP_REQ_BODY"); + titleList.add("NTC_HTTP_RES_BODY"); + classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class); + classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class); + noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport); + noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport); + dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList); + dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList); + if (entity.getFunctionId() != 635) { + 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(); + } + + // dns配置导出 @RequestMapping(value = "exportdns") - public void exportdns(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){ + public void exportdns(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) { try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); Properties msgProp = getMsgProp(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = websiteCfgService.getWebsiteList(pageInfo, entity); - ipLists=page.getList(); - } - - for (int i = 0; i < ipLists.size(); i++) { - if(ipLists.get(i).getDnsStrategyId()!=null && ipLists.get(i).getDnsStrategyId()!=0){ - List resStrategys=dnsResStrategyService.findDnsResStrategys(ipLists.get(i).getDnsStrategyId(), 1,1); - if(resStrategys!=null && resStrategys.size()>0){ - String msg= msgProp.getProperty(resStrategys.get(0).getCfgDesc()); - if(!StringUtil.isEmpty(msg)){ - ipLists.get(i).setDnsStrategyName(msg); - }else{ - ipLists.get(i).setDnsStrategyName(resStrategys.get(0).getCfgDesc()); - } - }else{ - ipLists.get(i).setDnsStrategyName(msgProp.getProperty("no_strategy")); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = websiteCfgService.getWebsiteList(pageInfo, entity); + ipLists = page.getList(); + } + + for (int i = 0; i < ipLists.size(); i++) { + if (ipLists.get(i).getDnsStrategyId() != null && ipLists.get(i).getDnsStrategyId() != 0) { + List resStrategys = dnsResStrategyService + .findDnsResStrategys(ipLists.get(i).getDnsStrategyId(), 1, 1); + if (resStrategys != null && resStrategys.size() > 0) { + String msg = msgProp.getProperty(resStrategys.get(0).getCfgDesc()); + if (!StringUtil.isEmpty(msg)) { + ipLists.get(i).setDnsStrategyName(msg); + } else { + ipLists.get(i).setDnsStrategyName(resStrategys.get(0).getCfgDesc()); } - }else{ + } else { ipLists.get(i).setDnsStrategyName(msgProp.getProperty("no_strategy")); } + } else { + ipLists.get(i).setDnsStrategyName(msgProp.getProperty("no_strategy")); } - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_IP"); - titleList.add("NTC_DNS_REGION"); - titleList.add("NTC_SUBSCRIBE_ID"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_IP", IpPortCfg.class); - classMap.put("NTC_DNS_REGION", ComplexkeywordCfg.class); - classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class); - String cfgIndexInfoNoExport=",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_DNS_REGION", regionCfgNoExport); - noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); - List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); - List regionInfoList=new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - CfgIndexInfo cfgIndexInfo=websiteCfgService.exportdns(cfg); - ipList.addAll(cfgIndexInfo.getIpPortList()); - subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList()); - regionInfoList.addAll(cfgIndexInfo.getDomainList()); - } - subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); - regionInfoList=ComplexkeywordCfg.replaceComplexKeyList(regionInfoList); - dataMap.put(entity.getMenuNameCode(),ipLists); - dataMap.put("NTC_IP", ipList); - dataMap.put("NTC_DNS_REGION", regionInfoList); - dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); - - /*}*/ - this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); - } catch (Exception e) { - logger.error("dns export failed",e); - addMessage(redirectAttributes,"error", "export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); - } - - //ssl配置导出 - @RequestMapping(value = "exportSsl") - public void exportSsl(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = websiteCfgService.getWebsiteList(pageInfo, entity); - ipLists=page.getList(); - } - - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_UNIVERSAL_IP"); - titleList.add("NTC_SSL_SNI"); - titleList.add("NTC_SSL_SAN"); - titleList.add("NTC_SSL_CN"); - titleList.add("NTC_SUBSCRIBE_ID"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); - classMap.put("NTC_SSL_SNI", BaseStringCfg.class); - classMap.put("NTC_SSL_SAN", BaseStringCfg.class); - classMap.put("NTC_SSL_CN", BaseStringCfg.class); - classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class); - String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; - String sslNoExport=",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,"; - noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); - noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport); - noExportMap.put("NTC_SSL_SNI", sslNoExport); - noExportMap.put("NTC_SSL_SAN", sslNoExport); - noExportMap.put("NTC_SSL_CN", sslNoExport); - noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); - - List sslSniList = new ArrayList<>(); - List sslSnaList = new ArrayList<>(); - List sslCnList = new ArrayList<>(); - List ipPortList = new ArrayList<>(); - List subscribeIdList = new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - Map maps=websiteCfgService.exportssl(cfg); - sslSniList.addAll(maps.get("NTC_SSL_SNI")); - sslSnaList.addAll(maps.get("NTC_SSL_SAN")); - sslCnList.addAll(maps.get("NTC_SSL_CN")); - ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP")); - subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID")); - } - sslSniList=BaseStringCfg.replaceBaseKeyList(sslSniList); - sslSnaList=BaseStringCfg.replaceBaseKeyList(sslSnaList); - sslCnList=BaseStringCfg.replaceBaseKeyList(sslCnList); - subscribeIdList=BaseStringCfg.baseHexList(subscribeIdList); - dataMap.put(entity.getMenuNameCode(), ipLists); - dataMap.put("NTC_UNIVERSAL_IP", ipPortList); - dataMap.put("NTC_SSL_SNI", sslSniList); - dataMap.put("NTC_SSL_SAN", sslSnaList); - dataMap.put("NTC_SSL_CN", sslCnList); - 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(); + titleList.add(entity.getMenuNameCode()); + titleList.add("NTC_IP"); + titleList.add("NTC_DNS_REGION"); + titleList.add("NTC_SUBSCRIBE_ID"); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + classMap.put("NTC_IP", IpPortCfg.class); + classMap.put("NTC_DNS_REGION", ComplexkeywordCfg.class); + classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class); + String cfgIndexInfoNoExport = ",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_DNS_REGION", regionCfgNoExport); + noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); + List ipList = new ArrayList(); + List subscribeInfoList = new ArrayList(); + List regionInfoList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + CfgIndexInfo cfgIndexInfo = websiteCfgService.exportdns(cfg); + ipList.addAll(cfgIndexInfo.getIpPortList()); + subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList()); + regionInfoList.addAll(cfgIndexInfo.getDomainList()); + } + subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList); + regionInfoList = ComplexkeywordCfg.replaceComplexKeyList(regionInfoList); + dataMap.put(entity.getMenuNameCode(), ipLists); + dataMap.put("NTC_IP", ipList); + dataMap.put("NTC_DNS_REGION", regionInfoList); + 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("dns export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // ssl配置导出 + @RequestMapping(value = "exportSsl") + public void exportSsl(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = websiteCfgService.getWebsiteList(pageInfo, entity); + ipLists = page.getList(); + } + + titleList.add(entity.getMenuNameCode()); + titleList.add("NTC_UNIVERSAL_IP"); + titleList.add("NTC_SSL_SNI"); + titleList.add("NTC_SSL_SAN"); + titleList.add("NTC_SSL_CN"); + titleList.add("NTC_SUBSCRIBE_ID"); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); + classMap.put("NTC_SSL_SNI", BaseStringCfg.class); + classMap.put("NTC_SSL_SAN", BaseStringCfg.class); + classMap.put("NTC_SSL_CN", BaseStringCfg.class); + classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class); + String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; + String sslNoExport = ",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; + } + + noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport); + noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport); + noExportMap.put("NTC_SSL_SNI", sslNoExport); + noExportMap.put("NTC_SSL_SAN", sslNoExport); + noExportMap.put("NTC_SSL_CN", sslNoExport); + noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); + + List sslSniList = new ArrayList<>(); + List sslSnaList = new ArrayList<>(); + List sslCnList = new ArrayList<>(); + List ipPortList = new ArrayList<>(); + List subscribeIdList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + Map maps = websiteCfgService.exportssl(cfg); + sslSniList.addAll(maps.get("NTC_SSL_SNI")); + sslSnaList.addAll(maps.get("NTC_SSL_SAN")); + sslCnList.addAll(maps.get("NTC_SSL_CN")); + ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP")); + subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID")); + } + sslSniList = BaseStringCfg.replaceBaseKeyList(sslSniList); + sslSnaList = BaseStringCfg.replaceBaseKeyList(sslSnaList); + sslCnList = BaseStringCfg.replaceBaseKeyList(sslCnList); + subscribeIdList = BaseStringCfg.baseHexList(subscribeIdList); + dataMap.put(entity.getMenuNameCode(), ipLists); + dataMap.put("NTC_UNIVERSAL_IP", ipPortList); + dataMap.put("NTC_SSL_SNI", sslSniList); + dataMap.put("NTC_SSL_SAN", sslSnaList); + dataMap.put("NTC_SSL_CN", sslCnList); + 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(); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java b/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java index 1794ef977..0f26c49db 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java @@ -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 searchPage=new Page(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 searchPage = new Page(request, response, "a"); Page 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 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 searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else { + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 searchPage=new Page(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 searchPage = new Page(request, response, "a"); Page 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 urlList=new ArrayList(); + List urlList = new ArrayList(); 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 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 searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else {// 条件下所有配置审核 + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); BeanUtils.copyProperties(searchPage, auditPage); - + try { - auditAll(auditPage,isValid , cfg); - addMessage(redirectAttributes,"success", "audit_success"); + 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 ipList=new ArrayList(); - 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 httpurlList=new ArrayList(); - 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 ipList = new ArrayList(); + 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 httpurlList = new ArrayList(); + 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(); + } + } diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/CachePolicyController.java b/src/main/java/com/nis/web/controller/configuration/proxy/CachePolicyController.java index 36c053f0e..44206d84c 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/CachePolicyController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/CachePolicyController.java @@ -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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); - - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - for(String id:ids.split(",")){ - Long.parseLong(id); - } - //List list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids); - }else{ - //条件导出数据大于最大导出数,只导出最大导出条数 - Page pageInfo=new Page(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 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 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 httpUrlList = new ArrayList<>(); - List httpReqHdrList = new ArrayList<>(); - List httpResHdrList = new ArrayList<>(); - List httpReqBodyList = new ArrayList<>(); - List httpResBodyList = new ArrayList<>(); - List ipPortList = new ArrayList<>(); - List subscribeIdList = new ArrayList<>(); - for (CfgIndexInfo cfg : page.getList()) { - Map 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 titleList=new ArrayList(); + Map> classMap=new HashMap>(); + Map dataMap=new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = cachePolicyService.getCachePolicyByUserRegionList(ids); + } else { + Page pageInfo=new Page(request, response,"a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = cachePolicyService.getCachePolicyUserRegionList(pageInfo, entity); + ipLists = page.getList(); } - return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId(); - }*/ + + List 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 urlList=new ArrayList(); + List cookieList=new ArrayList(); + for (CachePolicyUserRegion cfg : ipLists) { + Map 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"); + } + } } diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java b/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java index 0b722959c..7dd206a95 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java @@ -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 searchPage=new Page(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 searchPage = new Page(request, response, "a"); Page page = httpRedirectCfgService.getHttpRedirectList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); - //获取所有的响应文件内容,阻断,或重定向时可以选择 - List allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg()); + initPageCondition(model, cfg); + // 获取所有的响应文件内容,阻断,或重定向时可以选择 + List 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 urlList=new ArrayList(); + + List urlList = new ArrayList(); urlList.add(urlCfg); entity.setHttpUrlList(urlList); - List reqHdrList=new ArrayList(); + List reqHdrList = new ArrayList(); reqHdrList.add(reqHdrCfg); entity.setHttpReqHdrList(reqHdrList); - List resHdrList=new ArrayList(); + List resHdrList = new ArrayList(); resHdrList.add(resHdrCfg); entity.setHttpResHdrList(resHdrList); - List reqBodyList=new ArrayList(); + List reqBodyList = new ArrayList(); reqBodyList.add(reqBodyCfg); entity.setHttpReqBodyList(reqBodyList); - List resBodyList=new ArrayList(); + List resBodyList = new ArrayList(); resBodyList.add(resBodyCfg); entity.setHttpResBodyList(resBodyList); - - List ipPortList=new ArrayList(); + + List ipPortList = new ArrayList(); ipPortList.add(ipPortCfg); entity.setIpPortList(ipPortList); - + List subscribeCfgList = Lists.newArrayList(); subscribeCfgList.add(subscribeIdCfg); entity.setNtcSubscribeIdCfgList(subscribeCfgList); - - initFormCondition(model,entity); + + initFormCondition(model, entity); } - //获取所有的响应文件内容,阻断,或重定向时可以选择 - List allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg()); + // 获取所有的响应文件内容,阻断,或重定向时可以选择 + List 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 searchPage=new Page(request,response,"a"); - Page auditPage=new Page(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 searchPage = new Page(request, response, "a"); + Page auditPage = new Page(request, response, "a"); + BeanUtils.copyProperties(searchPage, auditPage); + try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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 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 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 httpUrlList = new ArrayList<>(); - List httpReqHdrList = new ArrayList<>(); - List httpResHdrList = new ArrayList<>(); - List httpReqBodyList = new ArrayList<>(); - List httpResBodyList = new ArrayList<>(); - List ipPortList = new ArrayList<>(); - List subscribeIdList = new ArrayList<>(); - for (CfgIndexInfo cfg : ipLists) { - Map 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 httpUrlList = new ArrayList<>(); + List httpReqHdrList = new ArrayList<>(); + List httpResHdrList = new ArrayList<>(); + List httpReqBodyList = new ArrayList<>(); + List httpResBodyList = new ArrayList<>(); + List ipPortList = new ArrayList<>(); + List subscribeIdList = new ArrayList<>(); + for (CfgIndexInfo cfg : ipLists) { + Map 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(); + */ + } } diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/InterceptController.java b/src/main/java/com/nis/web/controller/configuration/proxy/InterceptController.java index c96d0c2a3..cec2841c1 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/InterceptController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/InterceptController.java @@ -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 searchPage=new Page(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 searchPage = new Page(request, response, "a"); Page page = websiteCfgService.getWebsiteList(searchPage, cfg); model.addAttribute("page", page); - initPageCondition(model,cfg); - - //获取证书信息 - List certificateList=new ArrayList(); - if(cfg.getFunctionId().equals(200)){ - certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip"); + initPageCondition(model, cfg); + + // 获取证书信息 + List certificateList = new ArrayList(); + 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 policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6); - model.addAttribute("policyGroups", policyGroups); + /*if(cfg.getFunctionId().equals(214)){ + // IP地址仿冒策略使用策略组 + //List policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6); + List 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 certificateList=new ArrayList(); - if(entity.getFunctionId().equals(200)){ - certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip"); + // 获取证书信息 + List certificateList = new ArrayList(); + 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 policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6); - model.addAttribute("policyGroups", policyGroups); - + // IP地址仿冒策略使用策略组 +// List policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6); +// List 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 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 searchPage=new Page(request,response,"a"); - Page auditPage=new Page(request,response,"a"); + } else {// 条件下所有配置审核 + Page searchPage = new Page(request, response, "a"); + Page auditPage = new Page(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 titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - Map replaceExportMap=new HashMap(); - Properties prop = getMsgProp(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=ipCfgService.getByIdsList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"a"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = ipCfgService.getIpCfgList(pageInfo, entity); - ipLists=page.getList(); - } - //获取证书信息 - List certificateList=new ArrayList(); - 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 ipList=new ArrayList(); - List httpUrlList=new ArrayList(); - List pktBinList=new ArrayList(); - for (CfgIndexInfo cfg : ipLists) { - Map 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + Map replaceExportMap = new HashMap(); + Properties prop = getMsgProp(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = ipCfgService.getByIdsList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "a"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = ipCfgService.getIpCfgList(pageInfo, entity); + ipLists = page.getList(); } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + // 获取证书信息 + List certificateList = new ArrayList(); + 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 ipList = new ArrayList(); + List httpUrlList = new ArrayList(); + List pktBinList = new ArrayList(); + for (CfgIndexInfo cfg : ipLists) { + Map 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(); + } + } diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java b/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java index 7ad6a5603..531c5fc9f 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java @@ -61,827 +61,854 @@ import com.nis.web.controller.BaseController; /** * 拦截策略 + * * @author ddm * */ @Controller @RequestMapping("${adminPath}/proxy/intercept/strateagy") -public class PxyObjKeyringController extends BaseController { - public Map certInfoMap=new HashMap<>(); - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - @RequestMapping(value = {"/form"}) - @RequiresPermissions(value={"proxy:intercept:config"}) - public String from(Model model, - HttpServletRequest request, - HttpServletResponse response, - String ids, - @ModelAttribute("cfg")PxyObjKeyring cfg - ,RedirectAttributes redirectAttributes){ - if(cfg == null){ - cfg=new PxyObjKeyring(); +public class PxyObjKeyringController extends BaseController { + public Map certInfoMap = new HashMap<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + @RequestMapping(value = { "/form" }) + @RequiresPermissions(value = { "proxy:intercept:config" }) + public String from(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + @ModelAttribute("cfg") PxyObjKeyring cfg, RedirectAttributes redirectAttributes) { + if (cfg == null) { + cfg = new PxyObjKeyring(); } - if(!StringUtil.isEmpty(ids)){ - cfg = pxyObjKeyringService.getPxyObjKeyring(Long.valueOf(ids),-1); + if (!StringUtil.isEmpty(ids)) { + cfg = pxyObjKeyringService.getPxyObjKeyring(Long.valueOf(ids), -1); initFormCondition(model, cfg); model.addAttribute("isAdd", false); - }else{ + } else { initFormCondition(model, cfg); model.addAttribute("isAdd", true); } - + model.addAttribute("_cfg", cfg); return "/cfg/intercept/strateagy/form"; } - - @RequestMapping(value = {"/saveOrUpdate"}) - @RequiresPermissions(value={"proxy:intercept:config"}) - public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")PxyObjKeyring cfg, - MultipartFile privateKeyFileI, - MultipartFile publicKeyFileI, - RedirectAttributes redirectAttributes){ - File file = null; - boolean validFlag=true; - try { - Properties msgProp = this.getMsgProp(); - boolean publicKeyFileflag=validCertFileContent(publicKeyFileI,"-incert"); - boolean privateKeyFileflag=validCertFileContent(privateKeyFileI,"-inkey"); - if(!publicKeyFileflag && !privateKeyFileflag){ - addMessage(redirectAttributes,"error","save_failed"); - logger.error(publicKeyFileI.getOriginalFilename()+" and "+privateKeyFileI.getOriginalFilename()+" file non certificate file format "); - throw new MultiPartNewException( - msgProp.getProperty("certificate_error") - ); - }else if(!publicKeyFileflag){ - addMessage(redirectAttributes,"error","save_failed"); - logger.error(publicKeyFileI.getOriginalFilename()+" file non public key file format "); - throw new MultiPartNewException(msgProp.getProperty("public_file_error")); - }else if(!privateKeyFileflag){ - addMessage(redirectAttributes,"error","save_failed"); - logger.error(privateKeyFileI.getOriginalFilename()+" file non private key file format "); - throw new MultiPartNewException(msgProp.getProperty("private_file_error")); - } + + @RequestMapping(value = { "/saveOrUpdate" }) + @RequiresPermissions(value = { "proxy:intercept:config" }) + public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") PxyObjKeyring cfg, MultipartFile privateKeyFileI, MultipartFile publicKeyFileI, + RedirectAttributes redirectAttributes) { + File file = null; + boolean validFlag = true; + try { + Properties msgProp = this.getMsgProp(); + boolean publicKeyFileflag = validCertFileContent(publicKeyFileI, "-incert"); + boolean privateKeyFileflag = validCertFileContent(privateKeyFileI, "-inkey"); + if (!publicKeyFileflag && !privateKeyFileflag) { + addMessage(redirectAttributes, "error", "save_failed"); + logger.error(publicKeyFileI.getOriginalFilename() + " and " + privateKeyFileI.getOriginalFilename() + + " file non certificate file format "); + throw new MultiPartNewException(msgProp.getProperty("certificate_error")); + } else if (!publicKeyFileflag) { + addMessage(redirectAttributes, "error", "save_failed"); + logger.error(publicKeyFileI.getOriginalFilename() + " file non public key file format "); + throw new MultiPartNewException(msgProp.getProperty("public_file_error")); + } else if (!privateKeyFileflag) { + addMessage(redirectAttributes, "error", "save_failed"); + logger.error(privateKeyFileI.getOriginalFilename() + " file non private key file format "); + throw new MultiPartNewException(msgProp.getProperty("private_file_error")); + } } catch (Exception e) { - validFlag=false; - logger.error("证书文件校验失败",e); - if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else if(e instanceof MaatConvertException){ - addMessage(redirectAttributes,"error",e.getMessage()); - }else { - addMessage(redirectAttributes,"error","save_failed"); - } + validFlag = false; + logger.error("证书文件校验失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } } - - try{ - if(validFlag){ - validFlag=true; - if(publicKeyFileI != null) { + + try { + if (validFlag) { + validFlag = true; + if (publicKeyFileI != null) { // 获取公钥信息 - if(certInfoMap != null && certInfoMap.size() >0){ - - String issuer=StringUtil.isEmpty(certInfoMap.get("ca issuer")) ? "":certInfoMap.get("ca issuer").toString();//颁发者 - String subject=StringUtil.isEmpty(certInfoMap.get("ca subjectname")) ? "":certInfoMap.get("ca subjectname").toString();//颁发给 - String notBeforeStr=""; + if (certInfoMap != null && certInfoMap.size() > 0) { + + String issuer = StringUtil.isEmpty(certInfoMap.get("ca issuer")) ? "" + : certInfoMap.get("ca issuer").toString();// 颁发者 + String subject = StringUtil.isEmpty(certInfoMap.get("ca subjectname")) ? "" + : certInfoMap.get("ca subjectname").toString();// 颁发给 + String notBeforeStr = ""; if (!StringUtil.isEmpty(certInfoMap.get("ca notbefore"))) { - Date notBeforeTime=new Date(certInfoMap.get("ca notbefore").toString());//开始时间 - notBeforeStr=sdf.format(notBeforeTime); + Date notBeforeTime = new Date(certInfoMap.get("ca notbefore").toString());// 开始时间 + notBeforeStr = sdf.format(notBeforeTime); } - String notAfterStr=""; + String notAfterStr = ""; if (!StringUtil.isEmpty(certInfoMap.get("ca notafter"))) { - Date notAfterTime=new Date(certInfoMap.get("ca notafter").toString());//结束时间 - notAfterStr=sdf.format(notAfterTime); + Date notAfterTime = new Date(certInfoMap.get("ca notafter").toString());// 结束时间 + notAfterStr = sdf.format(notAfterTime); } - String cn="";//CN - //CN精确信息获取 - if(!StringUtil.isEmpty(subject)){ - for (String cnStr : subject.split(",")) { - cnStr=StringUtil.isEmpty(cnStr) ? "":cnStr.trim(); - if(cnStr.split("=").length > 1){ - cn=cnStr.split("=")[1]; - cn=StringUtil.isEmpty(cn) ? "":cn.trim(); + String cn = "";// CN + // CN精确信息获取 + if (!StringUtil.isEmpty(subject)) { + for (String cnStr : subject.split(",")) { + cnStr = StringUtil.isEmpty(cnStr) ? "" : cnStr.trim(); + if (cnStr.split("=").length > 1) { + cn = cnStr.split("=")[1]; + cn = StringUtil.isEmpty(cn) ? "" : cn.trim(); } } } - String altName=StringUtil.isEmpty(certInfoMap.get("ca altname")) ? "":certInfoMap.get("ca altname").toString();//SAN - + String altName = StringUtil.isEmpty(certInfoMap.get("ca altname")) ? "" + : certInfoMap.get("ca altname").toString();// SAN + cfg.setIssuer(issuer); cfg.setSubject(subject); cfg.setCn(cn); cfg.setAltName(altName); cfg.setNotBeforeTime(notBeforeStr); cfg.setNotAfterTime(notAfterStr); - }else{ + } else { logger.info("无证书信息"); } } } - }catch (Exception e) { - validFlag=false; - logger.error("证书信息获取失败",e); - logger.error("证书文件校验失败",e); - if(e instanceof MaatConvertException){ - addMessage(redirectAttributes,"error","request_service_failed"); - }else if(e instanceof MultiPartNewException){ - addMessage(redirectAttributes,"error",e.getMessage()); - }else{ - addMessage(redirectAttributes,"error","save_failed"); - } - } - try{ - if(validFlag){ - if(publicKeyFileI != null) { + } catch (Exception e) { + validFlag = false; + logger.error("证书信息获取失败", e); + logger.error("证书文件校验失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else if (e instanceof MultiPartNewException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } + } + try { + if (validFlag) { + if (publicKeyFileI != null) { String filename = publicKeyFileI.getOriginalFilename(); String prefix = FileUtils.getPrefix(filename, false); String suffix = FileUtils.getSuffix(filename, false); - file = File.createTempFile("file_"+ prefix, suffix); - publicKeyFileI.transferTo(file);//复制文件 + file = File.createTempFile("file_" + prefix, suffix); + publicKeyFileI.transferTo(file);// 复制文件 String md5 = FileUtils.getFileMD5(file); - Map srcMap = Maps.newHashMap(); + Map srcMap = Maps.newHashMap(); srcMap.put("filetype", suffix); - srcMap.put("datatype", "dbSystem");//源文件存入数据中心 - srcMap.put("createTime",new Date()); - srcMap.put("key",prefix); + srcMap.put("datatype", "dbSystem");// 源文件存入数据中心 + srcMap.put("createTime", new Date()); + srcMap.put("key", prefix); srcMap.put("fileName", filename); srcMap.put("checksum", md5); ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap)); - logger.info("proxy 证书文件策略公钥 文件上传响应信息:"+JsonMapper.toJsonString(result)); + logger.info("proxy 证书文件策略公钥 文件上传响应信息:" + JsonMapper.toJsonString(result)); String publicKeyFileAccessUrl = null; - if(!StringUtil.isEmpty(result)){ + if (!StringUtil.isEmpty(result)) { ResponseData data = result.getData(); - publicKeyFileAccessUrl=data.getAccessUrl(); - cfg.setPublicKeyFile(publicKeyFileAccessUrl);; + publicKeyFileAccessUrl = data.getAccessUrl(); + cfg.setPublicKeyFile(publicKeyFileAccessUrl); + ; } - } - if(privateKeyFileI != null) { + } + if (privateKeyFileI != null) { String filename = privateKeyFileI.getOriginalFilename(); String prefix = FileUtils.getPrefix(filename, false); String suffix = FileUtils.getSuffix(filename, false); - file = File.createTempFile("file_"+ prefix, suffix); - privateKeyFileI.transferTo(file);//复制文件 + file = File.createTempFile("file_" + prefix, suffix); + privateKeyFileI.transferTo(file);// 复制文件 String md5 = FileUtils.getFileMD5(file); - Map srcMap = Maps.newHashMap(); + Map srcMap = Maps.newHashMap(); srcMap.put("filetype", suffix); - srcMap.put("datatype", "dbSystem");//源文件存入数据中心 - srcMap.put("createTime",new Date()); - srcMap.put("key",prefix); + srcMap.put("datatype", "dbSystem");// 源文件存入数据中心 + srcMap.put("createTime", new Date()); + srcMap.put("key", prefix); srcMap.put("fileName", filename); srcMap.put("checksum", md5); ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap)); - logger.info("proxy 证书文件策略私钥 上传响应信息:"+JsonMapper.toJsonString(result)); + logger.info("proxy 证书文件策略私钥 上传响应信息:" + JsonMapper.toJsonString(result)); String privateKeyFileAccessUrl = null; - if(!StringUtil.isEmpty(result)){ + if (!StringUtil.isEmpty(result)) { ResponseData data = result.getData(); - privateKeyFileAccessUrl=data.getAccessUrl(); - cfg.setPrivateKeyFile(privateKeyFileAccessUrl);; + privateKeyFileAccessUrl = data.getAccessUrl(); + cfg.setPrivateKeyFile(privateKeyFileAccessUrl); + ; } } pxyObjKeyringService.saveOrUpdate(cfg); - addMessage(redirectAttributes,"success","save_success"); - } - - }catch(Exception e){ - logger.error("证书上传失败",e); - if(e instanceof MaatConvertException){ - addMessage(redirectAttributes,"error","request_service_failed"); - }else if(e instanceof MultiPartNewException){ - addMessage(redirectAttributes,"error",e.getMessage()); - }else{ - addMessage(redirectAttributes,"error","save_failed"); - } - } - - return "redirect:" + adminPath +"/proxy/intercept/strateagy/list?functionId="+cfg.getFunctionId(); + addMessage(redirectAttributes, "success", "save_success"); + } + + } catch (Exception e) { + logger.error("证书上传失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else if (e instanceof MultiPartNewException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } + } + + return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId(); } - + /** * * @param file - * @param validateType --incert证书校验 --inkey 私钥 - * @param certType 证书类型 + * @param validateType + * --incert证书校验 --inkey 私钥 + * @param certType + * 证书类型 * @return * @throws Exception */ - public boolean validCertFileContent(MultipartFile file,String validateType)throws Exception{ + public boolean validCertFileContent(MultipartFile file, String validateType) throws Exception { String os = System.getProperty("os.name").toLowerCase(); - if(!os.contains("windows") && file != null){ - //证书文件临时保存路径 + if (!os.contains("windows") && file != null) { + // 证书文件临时保存路径 String certFilePath = Constants.CERT_FILE_PATH; FileUtils.createDirectory(certFilePath); - String filePath=certFilePath - +File.separator - +UUID.randomUUID() - +FileUtils.getSuffix(file.getOriginalFilename(), true); + String filePath = certFilePath + File.separator + UUID.randomUUID() + + FileUtils.getSuffix(file.getOriginalFilename(), true); File uploadFile = new File(filePath); FileCopyUtils.copy(file.getBytes(), uploadFile); - //加载x509脚本 - String x509Shell=Thread.currentThread() - .getContextClassLoader() - .getResource( - File.separator+"shell" - +File.separator - +Constants.CERT_VALIDATE_FILE).getPath(); - //x509脚本分配可执行权限 - Map resultMap1=this.execShell("","chmod","+x",x509Shell); - logger.info("x509 chmod +x :"+resultMap1.get("out").toString()); - logger.info("x509脚本分配可执行权限:"+"chmod"+" "+"+x"+" "+x509Shell); - //验证文件 - logger.info(x509Shell+" "+validateType+" "+filePath); - Map resultMap=this.execShell(x509Shell,validateType,filePath); - - if(resultMap == null || StringUtil.isEmpty(resultMap.get("out"))){ - //临时文件删除 - logger.info("delete file"+filePath); + // 加载x509脚本 + String x509Shell = Thread.currentThread().getContextClassLoader() + .getResource(File.separator + "shell" + File.separator + Constants.CERT_VALIDATE_FILE).getPath(); + // x509脚本分配可执行权限 + Map resultMap1 = this.execShell("", "chmod", "+x", x509Shell); + logger.info("x509 chmod +x :" + resultMap1.get("out").toString()); + logger.info("x509脚本分配可执行权限:" + "chmod" + " " + "+x" + " " + x509Shell); + // 验证文件 + logger.info(x509Shell + " " + validateType + " " + filePath); + Map resultMap = this.execShell(x509Shell, validateType, filePath); + + if (resultMap == null || StringUtil.isEmpty(resultMap.get("out"))) { + // 临时文件删除 + logger.info("delete file" + filePath); FileUtils.deleteFile(filePath); return false; - }else{ - /*logger.info("x509 Out Info:"+resultMap.get("out").toString()); - Pattern p = Pattern.compile("\\s*|\t|\r|\n"); - Matcher m = p.matcher(resultMap.get("out").toString()); - logger.info(m.replaceAll("test"));*/ - } - if(resultMap != null - && !StringUtil.isEmpty(resultMap.get("out")) - && (!(resultMap.get("out").toString().indexOf(Constants.CERT_VALIDATE_SUCCESS_INFO) > -1)) - ){ - logger.error("x509 Out Info:"+resultMap.get("out").toString()); - //临时文件删除 - logger.info("delete file"+filePath); + } else { + /* + * logger.info("x509 Out Info:"+resultMap.get("out").toString()) + * ; Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Matcher m = + * p.matcher(resultMap.get("out").toString()); + * logger.info(m.replaceAll("test")); + */ + } + if (resultMap != null && !StringUtil.isEmpty(resultMap.get("out")) + && (!(resultMap.get("out").toString().indexOf(Constants.CERT_VALIDATE_SUCCESS_INFO) > -1))) { + logger.error("x509 Out Info:" + resultMap.get("out").toString()); + // 临时文件删除 + logger.info("delete file" + filePath); FileUtils.deleteFile(filePath); - + return false; } - //临时文件删除 - logger.info("delete file"+filePath); + // 临时文件删除 + logger.info("delete file" + filePath); FileUtils.deleteFile(filePath); } return true; } - @RequestMapping(value = {"/list"}) - public String list(Model model,HttpServletRequest request,HttpServletResponse response - ,@ModelAttribute("cfg")PxyObjKeyring entity - ,RedirectAttributes redirectAttributes){ - //查询时left join policyGroup - Page page = pxyObjKeyringService.findPage(new Page(request, response,"r"), entity); + + @RequestMapping(value = { "/list" }) + public String list(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") PxyObjKeyring entity, RedirectAttributes redirectAttributes) { + // 查询时left join policyGroup + Page page = pxyObjKeyringService.findPage(new Page(request, response, "r"), + entity); model.addAttribute("page", page); - initPageCondition(model,entity); + initPageCondition(model, entity); return "/cfg/intercept/strateagy/list"; } - - @RequestMapping(value = {"/delete"}) - @RequiresPermissions(value={"proxy:intercept:config"}) - public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId - ,Model model,HttpServletRequest request - ,HttpServletResponse response - ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(ids)){ - pxyObjKeyringService.delete(isAudit,isValid,ids,functionId); + + @RequestMapping(value = { "/delete" }) + @RequiresPermissions(value = { "proxy:intercept:config" }) + public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(ids)) { + pxyObjKeyringService.delete(isAudit, isValid, ids, functionId); } - - return "redirect:" + adminPath +"/proxy/intercept/strateagy/list?functionId="+functionId; + + return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + functionId; } - - @RequestMapping(value = {"/audit"}) - @RequiresPermissions(value={"proxy:intercept:confirm"}) - public String audit(Model model,@ModelAttribute("cfg")PxyObjKeyring cfg, - Integer isValid, - Integer isAudit, - String ids, - Integer functionId, - RedirectAttributes redirectAttributes, - HttpServletResponse response, - HttpServletRequest request) { - if(!StringUtil.isEmpty(ids)){ + + @RequestMapping(value = { "/audit" }) + @RequiresPermissions(value = { "proxy:intercept:confirm" }) + public String audit(Model model, @ModelAttribute("cfg") PxyObjKeyring 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 { - pxyObjKeyringService.audit(isAudit,isValid,functionId,id,auditTime); - addMessage(redirectAttributes,"success", "audit_success"); + pxyObjKeyringService.audit(isAudit, isValid, functionId, id, auditTime); + addMessage(redirectAttributes, "success", "audit_success"); } catch (MaatConvertException e) { logger.error(e); - addMessage(redirectAttributes,"error", "request_service_failed"); - }catch (Exception e) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } catch (Exception e) { logger.error(e); - addMessage(redirectAttributes,"error", "audit_failed"); + addMessage(redirectAttributes, "error", "audit_failed"); } } - - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(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 +"/proxy/intercept/strateagy/list?functionId="+functionId; + return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + functionId; } + @ResponseBody @RequestMapping(value = "/validCfgId") public boolean validCfgId(Long cfgId) { - PxyObjKeyring dns=pxyObjKeyringService.getPxyObjKeyring(cfgId,null); - if(dns == null ){ + PxyObjKeyring dns = pxyObjKeyringService.getPxyObjKeyring(cfgId, null); + if (dns == null) { return false; - }else{ + } else { return true; } } - - - //pxyObjKeyring配置导出 - @RequestMapping(value = "exportPxy") - public void exportPxy(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")PxyObjKeyring entity,String ids,RedirectAttributes redirectAttributes){ - try { - //export data info - List titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=pxyObjKeyringService.findByList(ids); - }else{ - entity.setTableName(IpPortCfg.getTablename()); - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = pxyObjKeyringService.findPage(pageInfo, entity); - ipLists=page.getList(); - } - - for (int i = 0; i titleList=new ArrayList(); - Map> classMap=new HashMap>(); - Map dataMap=new HashMap(); - Map noExportMap=new HashMap(); - List ipLists=new ArrayList(); - //导出选中记录 - if(!StringUtil.isEmpty(ids)){ - ipLists=pxyObjKeyringService.findByCertList(ids); - }else{ - Page pageInfo=new Page(request, response,"r"); - pageInfo.setPageNo(1); - pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); - Page page = pxyObjKeyringService.findTrustedCertPage(pageInfo, entity); - ipLists=page.getList(); - } - for (PxyObjTrustedCaCert cert:ipLists) { - if(!StringUtil.isEmpty(cert.getCompileId())){ - cert.setCrlFile(ConfigDictUtils.getTrustedCrlByCerId(cert.getCompileId())); - } - } - titleList.add(entity.getMenuNameCode()); - classMap.put(entity.getMenuNameCode(), PxyObjTrustedCaCert.class); - String cfgIndexInfoNoExport=",whether_area_block,block_type,valid_identifier,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,&config_describe:cert_name-"; - 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("pxyObjKeyring export failed",e); - addMessage(redirectAttributes, "error","export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); - } - - - @RequestMapping(value = {"/trustedCertList"}) - public String trustedCertList(Model model,HttpServletRequest request,HttpServletResponse response - ,@ModelAttribute("cfg")PxyObjTrustedCaCert entity - ,RedirectAttributes redirectAttributes){ - Page page = pxyObjKeyringService.findTrustedCertPage(new Page(request, response,"r"), entity); - model.addAttribute("page", page); - initPageCondition(model,entity); - return "/cfg/intercept/strateagy/trustedCertList"; - } - - @RequestMapping(value = {"/trustedCertForm"}) - @RequiresPermissions(value={"proxy:trustedCert:config"}) - public String trustedCertFrom(Model model, - HttpServletRequest request, - HttpServletResponse response, - String ids, - @ModelAttribute("cfg")PxyObjTrustedCaCert cfg - ,RedirectAttributes redirectAttributes){ - if(cfg == null){ - cfg=new PxyObjTrustedCaCert(); - } - if(!StringUtil.isEmpty(ids)){ - cfg = pxyObjKeyringService.getPxyObjTrustedCaCert(Long.valueOf(ids)); - initFormCondition(model, cfg); - model.addAttribute("isAdd", false); - }else{ - initFormCondition(model, cfg); - model.addAttribute("isAdd", true); - } - - model.addAttribute("_cfg", cfg); - return "/cfg/intercept/strateagy/trustedCertForm"; - } - - @RequestMapping(value = {"/trustedCertSaveOrUpdate"}) - @RequiresPermissions(value={"proxy:trustedCert:config"}) - public String trustedCertSaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")PxyObjTrustedCaCert cfg, - MultipartFile certFileI, - RedirectAttributes redirectAttributes){ - File file = null; - boolean validFlag=true; - try { - boolean certFileflag=validCertFileContent(certFileI,"-incert"); - if(!certFileflag){ - addMessage(redirectAttributes,"error","save_failed"); - logger.error(certFileI.getOriginalFilename()+" file non Certificate file format "); - throw new MultiPartNewException(this.getMsgProp().getProperty("certificate_file_error")); - } - } catch (Exception e) { - validFlag=false; - logger.error("证书文件校验失败",e); - if(e instanceof MaatConvertException){ - addMessage(redirectAttributes,"error",e.getMessage()); - }else{ - addMessage(redirectAttributes,"error","save_failed"); - } - } - - try{ - if(validFlag){ - validFlag=true; - if(certFileI != null) { - // 获取公钥信息 - if(certInfoMap != null && certInfoMap.size() >0){ - String issuer=StringUtil.isEmpty(certInfoMap.get("ca issuer")) ? "":certInfoMap.get("ca issuer").toString();//颁发者 - logger.info("issuer:"+issuer); - cfg.setIssuer(issuer); - }else{ - logger.info("无证书信息"); - } - } - } - }catch (Exception e) { - validFlag=false; - logger.error("证书信息获取失败",e); - addMessage(redirectAttributes,"error","save_failed"); - } - try{ - if(validFlag){ - if(certFileI != null) { - String filename = certFileI.getOriginalFilename(); - String prefix = FileUtils.getPrefix(filename, false); - String suffix = FileUtils.getSuffix(filename, false); - file = File.createTempFile("file_"+ prefix, suffix); - certFileI.transferTo(file);//复制文件 - String md5 = FileUtils.getFileMD5(file); - Map srcMap = Maps.newHashMap(); - srcMap.put("filetype", suffix); - srcMap.put("datatype", "dbSystem");//源文件存入数据中心 - srcMap.put("createTime",new Date()); - srcMap.put("key",prefix); - srcMap.put("fileName", filename); - srcMap.put("checksum", md5); - ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap)); - logger.info("proxy 可信证书 文件上传响应信息:"+JsonMapper.toJsonString(result)); - String certFileAccessUrl = null; - if(!StringUtil.isEmpty(result)){ - ResponseData data = result.getData(); - certFileAccessUrl=data.getAccessUrl(); - cfg.setCertFile(certFileAccessUrl);; - } - } - pxyObjKeyringService.trustedCertsaveOrUpdate(cfg); - addMessage(redirectAttributes,"success","save_success"); - } - - }catch(Exception e){ - logger.error("证书上传失败",e); - if(e instanceof MultiPartNewException) { - addMessage(redirectAttributes,"error",e.getMessage()); - }else if(e instanceof MaatConvertException) { - addMessage(redirectAttributes,"error","request_service_failed"); - }else { - addMessage(redirectAttributes,"error","save_failed"); - } - } - - return "redirect:" + adminPath +"/proxy/intercept/strateagy/trustedCertList?functionId="+cfg.getFunctionId(); - } - @RequestMapping(value = {"/addOrAuditCrl"}) - /*@RequiresPermissions(value={"proxy:trustedCert:config","proxy:trustedCert:confirm"})*/ - public String trustedCrlSaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response, - @ModelAttribute("cfg")PxyObjTrustedCaCrl cfg, - MultipartFile crlFileI, - RedirectAttributes redirectAttributes){ - File file = null; - boolean validFlag=true; - try { - if( crlFileI != null){ - boolean certFileflag=validCertFileContent(crlFileI,"-incrl"); - if(!certFileflag){ - addMessage(redirectAttributes,"error","save_failed"); - logger.error(crlFileI.getOriginalFilename()+" file non crl file format "); - throw new MultiPartNewException(this.getMsgProp().getProperty("crl_file_error")); - } - } - } catch (Exception e) { - validFlag=false; - logger.error("证书文件校验失败",e); - if(e instanceof MaatConvertException){ - addMessage(redirectAttributes,"error","request_service_failed"); - }else if(e instanceof MultiPartNewException){ - addMessage(redirectAttributes,"error",e.getMessage()); - }else{ - addMessage(redirectAttributes,"error","save_failed"); - } - } - - try{ - if(validFlag){ - validFlag=true; - if(crlFileI != null) { - // 获取issuer - if(certInfoMap != null && certInfoMap.size() >0){ - String issuer=StringUtil.isEmpty(certInfoMap.get("crl issuer")) ? "":certInfoMap.get("crl issuer").toString();//颁发者 - if(cfg != null){ - if((cfg.getCertId() != null && cfg.getCertId() > 0) && (!cfg.getIssuer().equals(issuer))){ - logger.error("cert 和 crl的issuser不符合"); - throw new MultiPartNewException(this.getMsgProp().getProperty("crl_issuer_error")); - }else{ - cfg.setIssuer(issuer); - } - - } - }else{ - logger.error("crl的issuser为空"); - throw new MultiPartNewException(this.getMsgProp().getProperty("crl_issuer_null")); - } - } - } - }catch (Exception e) { - validFlag=false; - logger.error("crl issuer比对失败",e); - if(e instanceof MultiPartNewException){ - addMessage(redirectAttributes,"error",e.getMessage()); - }else{ - addMessage(redirectAttributes,"error","save_failed"); - } - } - try{ - if(validFlag){ - if(crlFileI != null) { - String filename = crlFileI.getOriginalFilename(); - String prefix = FileUtils.getPrefix(filename, false); - String suffix = FileUtils.getSuffix(filename, false); - file = File.createTempFile("file_"+ prefix, suffix); - crlFileI.transferTo(file);//复制文件 - String md5 = FileUtils.getFileMD5(file); - Map srcMap = Maps.newHashMap(); - srcMap.put("filetype", suffix); - srcMap.put("datatype", "dbSystem");//源文件存入数据中心 - srcMap.put("createTime",new Date()); - srcMap.put("key",prefix); - srcMap.put("fileName", filename); - srcMap.put("checksum", md5); - ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap)); - logger.info("可信证书crl 文件上传响应信息:"+JsonMapper.toJsonString(result)); - String crlFileAccessUrl = null; - if(!StringUtil.isEmpty(result)){ - ResponseData data = result.getData(); - crlFileAccessUrl=data.getAccessUrl(); - cfg.setCrlFile(crlFileAccessUrl); - } - } - pxyObjKeyringService.trustedCrlsaveOrUpdate(cfg); - - addMessage(redirectAttributes,"success","save_success"); - } - - }catch(Exception e){ - logger.error("crl上传失败",e); - if(e instanceof MaatConvertException){ - addMessage(redirectAttributes,"error","request_service_failed"); - }else if(e instanceof MultiPartNewException){ - addMessage(redirectAttributes,"error",e.getMessage()); - }else{ - addMessage(redirectAttributes,"error","save_failed"); - } - } - - return "redirect:" + adminPath +"/proxy/intercept/strateagy/trustedCertList?functionId="+cfg.getFunctionId(); - } - - /** - * 调用shell脚本 返回运行结果 - * - * @param shellName - * @param params - * @return - */ - public Map execShell(String shellName, - String... params) { - Map result = new HashMap(); - StringBuilder sb = new StringBuilder(); - sb.append(shellName); - for (String temp : params) { - sb.append(" " + temp); - } - String os = System.getProperty("os.name").toLowerCase(); - String cmd1 = ""; - String cmd2 = ""; - if(os.contains("windows")){ - cmd1 = "cmd.exe"; - cmd2 = "/c"; - }else{ - cmd1 = "/bin/sh"; - cmd2 = "-c"; - } - logger.info("调用脚本信息,cmd1:"+cmd1+",cmd2:"+cmd2); - String cmdarray[] = new String[] {cmd1, cmd2 ,sb.toString() }; - BufferedReader br = null; - BufferedReader bre = null; - Process exec=null; - try { - exec = Runtime.getRuntime().exec(cmdarray); - exec.getInputStream(); - br = new BufferedReader( - new InputStreamReader(exec.getInputStream())); - bre = new BufferedReader(new InputStreamReader( - exec.getErrorStream())); - String s = null; - StringBuilder out = new StringBuilder(); - String key=""; - String value=""; - if((sb.toString().indexOf("inlist") > -1) - || ( sb.toString().indexOf("incrl") > -1 ) - || ( sb.toString().indexOf("incert") > -1 )){ - certInfoMap=new HashMap<>(); - } - while ((s = br.readLine()) != null) { - logger.info(s); - //可信证书pem信息收集 - if(sb.toString().indexOf("inlist") > -1){ - if(s.indexOf(":") > -1){ - key=s.substring(0, s.indexOf(":", 0)); - key=StringUtil.isEmpty(key) ?"": key.toLowerCase().trim(); - value=s.substring(s.indexOf(":", 0)+1, s.length()); - value=StringUtil.isEmpty(value) ?"": value.trim(); - certInfoMap.put(key, value); - - } - } - //crl信息收集 - if(sb.toString().indexOf("incrl") > -1){ - if(s.indexOf(":") > -1){ - key=s.substring(0, s.indexOf(":", 0)); - key=StringUtil.isEmpty(key) ?"": key.toLowerCase().trim(); - value=s.substring(s.indexOf(":", 0)+1, s.length()); - value=StringUtil.isEmpty(value) ?"": value.trim(); - certInfoMap.put(key, value); - } - } - //证书信息收集 - if(sb.toString().indexOf("incert") > -1){ - if(s.indexOf(":") > -1){ - key=s.substring(0, s.indexOf(":", 0)); - key=StringUtil.isEmpty(key) ?"": key.toLowerCase().trim(); - value=s.substring(s.indexOf(":", 0)+1, s.length()); - value=StringUtil.isEmpty(value) ?"": value.trim(); - certInfoMap.put(key, value); - } - } - out.append(s); - } - result.put("out", out.toString());//输出参数 - out.setLength(0);//清空 - while ((s = bre.readLine()) != null) { - out.append(s); - } - result.put("error", out.toString());//错误信息 - int waitFor = exec.waitFor(); - logger.info("调用脚本:"+sb.toString()+",执行返回状态值:"+waitFor); - result.put("exitStatus", waitFor);//执行状态 - } catch (Exception e) { - e.printStackTrace(); - logger.error("调用 " + shellName + " 脚本异常", e); - } finally { - if (br != null) - try { - br.close(); - } catch (IOException e) { - e.printStackTrace(); - } - if (bre != null) - try { - bre.close(); - } catch (IOException e) { - e.printStackTrace(); - } - if (exec != null) - exec.destroy(); - - } - return result; - } - - @RequestMapping(value = {"/trustedCertDelete"}) - @RequiresPermissions(value={"proxy:trustedCert:config"}) - public String trustedCertDelete(Integer isAudit,Integer isValid,String ids,Integer functionId - ,Model model,HttpServletRequest request - ,HttpServletResponse response - ,RedirectAttributes redirectAttributes){ - if(!StringUtil.isEmpty(ids)){ - pxyObjKeyringService.trustedCertDelete(isAudit,isValid,ids,functionId); + // pxyObjKeyring配置导出 + @RequestMapping(value = "exportPxy") + public void exportPxy(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") PxyObjKeyring entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = pxyObjKeyringService.findByList(ids); + } else { + entity.setTableName(IpPortCfg.getTablename()); + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = pxyObjKeyringService.findPage(pageInfo, entity); + ipLists = page.getList(); } - - return "redirect:" + adminPath +"/proxy/intercept/strateagy/trustedCertList?functionId="+functionId; + + for (int i = 0; i < ipLists.size(); i++) { + ipLists.get(i).setKeyringName(ipLists.get(i).getCfgDesc()); + } + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), PxyObjKeyring.class); + String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,valid_identifier,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("pxyObjKeyring export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); } - - @RequestMapping(value = {"/trustedCertAudit"}) - @RequiresPermissions(value={"proxy:trustedCert:confirm"}) - public String trustedCertAudit(Model model,@ModelAttribute("cfg")PxyObjTrustedCaCert 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){ - try { - pxyObjKeyringService.trustedCertAudit(isAudit,isValid,functionId,id,auditTime); - } catch (MaatConvertException e) { - e.printStackTrace(); - logger.error(e); - addMessage(redirectAttributes,"error", "request_service_failed"); - }catch (Exception e) { - e.printStackTrace(); - logger.error(e); - addMessage(redirectAttributes,"error", "audit_failed"); + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + // pxyObjTrustedCert配置导出 + @RequestMapping(value = "exportCert") + public void exportCert(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") PxyObjTrustedCaCert entity, String ids, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = pxyObjKeyringService.findByCertList(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page page = pxyObjKeyringService.findTrustedCertPage(pageInfo, entity); + ipLists = page.getList(); + } + for (PxyObjTrustedCaCert cert : ipLists) { + if (!StringUtil.isEmpty(cert.getCompileId())) { + cert.setCrlFile(ConfigDictUtils.getTrustedCrlByCerId(cert.getCompileId())); + } + } + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), PxyObjTrustedCaCert.class); + String cfgIndexInfoNoExport = ",whether_area_block,block_type,valid_identifier,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,&config_describe:cert_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); + 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("pxyObjKeyring export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + // return "redirect:" + adminPath + // +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + @RequestMapping(value = { "/trustedCertList" }) + public String trustedCertList(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") PxyObjTrustedCaCert entity, RedirectAttributes redirectAttributes) { + Page page = pxyObjKeyringService + .findTrustedCertPage(new Page(request, response, "r"), entity); + model.addAttribute("page", page); + initPageCondition(model, entity); + return "/cfg/intercept/strateagy/trustedCertList"; + } + + @RequestMapping(value = { "/trustedCertForm" }) + @RequiresPermissions(value = { "proxy:trustedCert:config" }) + public String trustedCertFrom(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + @ModelAttribute("cfg") PxyObjTrustedCaCert cfg, RedirectAttributes redirectAttributes) { + if (cfg == null) { + cfg = new PxyObjTrustedCaCert(); + } + if (!StringUtil.isEmpty(ids)) { + cfg = pxyObjKeyringService.getPxyObjTrustedCaCert(Long.valueOf(ids)); + initFormCondition(model, cfg); + model.addAttribute("isAdd", false); + } else { + initFormCondition(model, cfg); + model.addAttribute("isAdd", true); + } + + model.addAttribute("_cfg", cfg); + return "/cfg/intercept/strateagy/trustedCertForm"; + } + + @RequestMapping(value = { "/trustedCertSaveOrUpdate" }) + @RequiresPermissions(value = { "proxy:trustedCert:config" }) + public String trustedCertSaveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") PxyObjTrustedCaCert cfg, MultipartFile certFileI, + RedirectAttributes redirectAttributes) { + File file = null; + boolean validFlag = true; + try { + boolean certFileflag = validCertFileContent(certFileI, "-incert"); + if (!certFileflag) { + addMessage(redirectAttributes, "error", "save_failed"); + logger.error(certFileI.getOriginalFilename() + " file non Certificate file format "); + throw new MultiPartNewException(this.getMsgProp().getProperty("certificate_file_error")); + } + } catch (Exception e) { + validFlag = false; + logger.error("证书文件校验失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } + } + + try { + if (validFlag) { + validFlag = true; + if (certFileI != null) { + // 获取公钥信息 + if (certInfoMap != null && certInfoMap.size() > 0) { + String issuer = StringUtil.isEmpty(certInfoMap.get("ca issuer")) ? "" + : certInfoMap.get("ca issuer").toString();// 颁发者 + logger.info("issuer:" + issuer); + cfg.setIssuer(issuer); + } else { + logger.info("无证书信息"); } } - - }else { - Page searchPage=new Page(request,response,"r"); - Page auditPage=new Page(request,response,"r"); + } + } catch (Exception e) { + validFlag = false; + logger.error("证书信息获取失败", e); + addMessage(redirectAttributes, "error", "save_failed"); + } + try { + if (validFlag) { + if (certFileI != null) { + String filename = certFileI.getOriginalFilename(); + String prefix = FileUtils.getPrefix(filename, false); + String suffix = FileUtils.getSuffix(filename, false); + file = File.createTempFile("file_" + prefix, suffix); + certFileI.transferTo(file);// 复制文件 + String md5 = FileUtils.getFileMD5(file); + Map srcMap = Maps.newHashMap(); + srcMap.put("filetype", suffix); + srcMap.put("datatype", "dbSystem");// 源文件存入数据中心 + srcMap.put("createTime", new Date()); + srcMap.put("key", prefix); + srcMap.put("fileName", filename); + srcMap.put("checksum", md5); + ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap)); + logger.info("proxy 可信证书 文件上传响应信息:" + JsonMapper.toJsonString(result)); + String certFileAccessUrl = null; + if (!StringUtil.isEmpty(result)) { + ResponseData data = result.getData(); + certFileAccessUrl = data.getAccessUrl(); + cfg.setCertFile(certFileAccessUrl); + ; + } + } + pxyObjKeyringService.trustedCertsaveOrUpdate(cfg); + addMessage(redirectAttributes, "success", "save_success"); + } + } catch (Exception e) { + logger.error("证书上传失败", e); + if (e instanceof MultiPartNewException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } + } + + return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId(); + } + + @RequestMapping(value = { "/addOrAuditCrl" }) + /* + * @RequiresPermissions(value={"proxy:trustedCert:config", + * "proxy:trustedCert:confirm"}) + */ + public String trustedCrlSaveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg") PxyObjTrustedCaCrl cfg, MultipartFile crlFileI, + RedirectAttributes redirectAttributes) { + File file = null; + boolean validFlag = true; + try { + if (crlFileI != null) { + boolean certFileflag = validCertFileContent(crlFileI, "-incrl"); + if (!certFileflag) { + addMessage(redirectAttributes, "error", "save_failed"); + logger.error(crlFileI.getOriginalFilename() + " file non crl file format "); + throw new MultiPartNewException(this.getMsgProp().getProperty("crl_file_error")); + } + } + } catch (Exception e) { + validFlag = false; + logger.error("证书文件校验失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else if (e instanceof MultiPartNewException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } + } + + try { + if (validFlag) { + validFlag = true; + if (crlFileI != null) { + // 获取issuer + if (certInfoMap != null && certInfoMap.size() > 0) { + String issuer = StringUtil.isEmpty(certInfoMap.get("crl issuer")) ? "" + : certInfoMap.get("crl issuer").toString();// 颁发者 + if (cfg != null) { + if ((cfg.getCertId() != null && cfg.getCertId() > 0) && (!cfg.getIssuer().equals(issuer))) { + logger.error("cert 和 crl的issuser不符合"); + throw new MultiPartNewException(this.getMsgProp().getProperty("crl_issuer_error")); + } else { + cfg.setIssuer(issuer); + } + + } + } else { + logger.error("crl的issuser为空"); + throw new MultiPartNewException(this.getMsgProp().getProperty("crl_issuer_null")); + } + } + } + } catch (Exception e) { + validFlag = false; + logger.error("crl issuer比对失败", e); + if (e instanceof MultiPartNewException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } + } + try { + if (validFlag) { + if (crlFileI != null) { + String filename = crlFileI.getOriginalFilename(); + String prefix = FileUtils.getPrefix(filename, false); + String suffix = FileUtils.getSuffix(filename, false); + file = File.createTempFile("file_" + prefix, suffix); + crlFileI.transferTo(file);// 复制文件 + String md5 = FileUtils.getFileMD5(file); + Map srcMap = Maps.newHashMap(); + srcMap.put("filetype", suffix); + srcMap.put("datatype", "dbSystem");// 源文件存入数据中心 + srcMap.put("createTime", new Date()); + srcMap.put("key", prefix); + srcMap.put("fileName", filename); + srcMap.put("checksum", md5); + ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap)); + logger.info("可信证书crl 文件上传响应信息:" + JsonMapper.toJsonString(result)); + String crlFileAccessUrl = null; + if (!StringUtil.isEmpty(result)) { + ResponseData data = result.getData(); + crlFileAccessUrl = data.getAccessUrl(); + cfg.setCrlFile(crlFileAccessUrl); + } + } + pxyObjKeyringService.trustedCrlsaveOrUpdate(cfg); + + addMessage(redirectAttributes, "success", "save_success"); + } + + } catch (Exception e) { + logger.error("crl上传失败", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else if (e instanceof MultiPartNewException) { + addMessage(redirectAttributes, "error", e.getMessage()); + } else { + addMessage(redirectAttributes, "error", "save_failed"); + } + } + + return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId(); + } + + /** + * 调用shell脚本 返回运行结果 + * + * @param shellName + * @param params + * @return + */ + public Map execShell(String shellName, String... params) { + Map result = new HashMap(); + StringBuilder sb = new StringBuilder(); + sb.append(shellName); + for (String temp : params) { + sb.append(" " + temp); + } + String os = System.getProperty("os.name").toLowerCase(); + String cmd1 = ""; + String cmd2 = ""; + if (os.contains("windows")) { + cmd1 = "cmd.exe"; + cmd2 = "/c"; + } else { + cmd1 = "/bin/sh"; + cmd2 = "-c"; + } + logger.info("调用脚本信息,cmd1:" + cmd1 + ",cmd2:" + cmd2); + String cmdarray[] = new String[] { cmd1, cmd2, sb.toString() }; + BufferedReader br = null; + BufferedReader bre = null; + Process exec = null; + try { + exec = Runtime.getRuntime().exec(cmdarray); + exec.getInputStream(); + br = new BufferedReader(new InputStreamReader(exec.getInputStream())); + bre = new BufferedReader(new InputStreamReader(exec.getErrorStream())); + String s = null; + StringBuilder out = new StringBuilder(); + String key = ""; + String value = ""; + if ((sb.toString().indexOf("inlist") > -1) || (sb.toString().indexOf("incrl") > -1) + || (sb.toString().indexOf("incert") > -1)) { + certInfoMap = new HashMap<>(); + } + while ((s = br.readLine()) != null) { + logger.info(s); + // 可信证书pem信息收集 + if (sb.toString().indexOf("inlist") > -1) { + if (s.indexOf(":") > -1) { + key = s.substring(0, s.indexOf(":", 0)); + key = StringUtil.isEmpty(key) ? "" : key.toLowerCase().trim(); + value = s.substring(s.indexOf(":", 0) + 1, s.length()); + value = StringUtil.isEmpty(value) ? "" : value.trim(); + certInfoMap.put(key, value); + + } + } + // crl信息收集 + if (sb.toString().indexOf("incrl") > -1) { + if (s.indexOf(":") > -1) { + key = s.substring(0, s.indexOf(":", 0)); + key = StringUtil.isEmpty(key) ? "" : key.toLowerCase().trim(); + value = s.substring(s.indexOf(":", 0) + 1, s.length()); + value = StringUtil.isEmpty(value) ? "" : value.trim(); + certInfoMap.put(key, value); + } + } + // 证书信息收集 + if (sb.toString().indexOf("incert") > -1) { + if (s.indexOf(":") > -1) { + key = s.substring(0, s.indexOf(":", 0)); + key = StringUtil.isEmpty(key) ? "" : key.toLowerCase().trim(); + value = s.substring(s.indexOf(":", 0) + 1, s.length()); + value = StringUtil.isEmpty(value) ? "" : value.trim(); + certInfoMap.put(key, value); + } + } + out.append(s); + } + result.put("out", out.toString());// 输出参数 + out.setLength(0);// 清空 + while ((s = bre.readLine()) != null) { + out.append(s); + } + result.put("error", out.toString());// 错误信息 + int waitFor = exec.waitFor(); + logger.info("调用脚本:" + sb.toString() + ",执行返回状态值:" + waitFor); + result.put("exitStatus", waitFor);// 执行状态 + } catch (Exception e) { + e.printStackTrace(); + logger.error("调用 " + shellName + " 脚本异常", e); + } finally { + if (br != null) try { - BeanUtils.copyProperties(searchPage, auditPage); - 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"); - } - + br.close(); + } catch (IOException e) { + e.printStackTrace(); } - - return trustedCertList(model, request, response, cfg, redirectAttributes); - } - return "redirect:" + adminPath +"/proxy/intercept/strateagy/trustedCertList?functionId="+functionId; + if (bre != null) + try { + bre.close(); + } catch (IOException e) { + e.printStackTrace(); + } + if (exec != null) + exec.destroy(); + } + return result; + } + + @RequestMapping(value = { "/trustedCertDelete" }) + @RequiresPermissions(value = { "proxy:trustedCert:config" }) + public String trustedCertDelete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + if (!StringUtil.isEmpty(ids)) { + pxyObjKeyringService.trustedCertDelete(isAudit, isValid, ids, functionId); + } + + return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId; + } + + @RequestMapping(value = { "/trustedCertAudit" }) + @RequiresPermissions(value = { "proxy:trustedCert:confirm" }) + public String trustedCertAudit(Model model, @ModelAttribute("cfg") PxyObjTrustedCaCert 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) { + try { + pxyObjKeyringService.trustedCertAudit(isAudit, isValid, functionId, id, auditTime); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.error(e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } catch (Exception e) { + e.printStackTrace(); + logger.error(e); + addMessage(redirectAttributes, "error", "audit_failed"); + } + } + + } else { + Page searchPage = new Page(request, response, "r"); + Page auditPage = new Page(request, response, "r"); + + try { + BeanUtils.copyProperties(searchPage, auditPage); + 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 trustedCertList(model, request, response, cfg, redirectAttributes); + } + return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId; + } } diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjSpoofingIpPoolController.java b/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjSpoofingIpPoolController.java index 081957466..50bba33a1 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjSpoofingIpPoolController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjSpoofingIpPoolController.java @@ -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 groups=policyGroupInfoService.findPolicyGroupInfosByType(6); + /*List groups=policyGroupInfoService.findPolicyGroupInfosByType(6); List 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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + List ipLists = new ArrayList(); + // 导出选中记录 + if (!StringUtil.isEmpty(ids)) { + ipLists = pxyObjSpoofingIpPoolService.findByPage(ids); + } else { + Page pageInfo = new Page(request, response, "r"); + pageInfo.setPageNo(1); + pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE); + Page 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(); + } + + } diff --git a/src/main/java/com/nis/web/controller/configuration/statistics/ConfigureStatisticsController.java b/src/main/java/com/nis/web/controller/configuration/statistics/ConfigureStatisticsController.java index 523e918d9..06941c9be 100644 --- a/src/main/java/com/nis/web/controller/configuration/statistics/ConfigureStatisticsController.java +++ b/src/main/java/com/nis/web/controller/configuration/statistics/ConfigureStatisticsController.java @@ -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 serviceDictList = DictUtils.getFunctionServiceDictList(); + //2、查询所有菜单 + List 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 requestInfos=requestPage.getList(); + //4、根据当前页的requestInfo信息查询request统计信息 + List requestStatisticList=new ArrayList(); + 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 maps=new HashMap(); + maps.put("menuList", menuList); + maps.put("requestStatisticList", requestStatisticList); + return maps; + } } diff --git a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java index 4ef22df78..a85f0886a 100644 --- a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java +++ b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java @@ -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 fromJsonList = new HashMap(); + 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(){}.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>(){}.getType()); logger.debug("活跃IP1小时"+fromJsonList); list = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken>() {}.getType()) ; + Collections.sort(list, new Comparator() { + + @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"); diff --git a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java index e8e002ddd..b1e531660 100644 --- a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java +++ b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java @@ -67,27 +67,26 @@ public class TrafficStatisticsInfoController extends BaseController { HashMap m = new HashMap(); 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(){}.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(){}.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 fromJsonList = new HashMap(); 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(){}.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 fromJsonList = new HashMap(); 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(){}.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 fromJsonList = new HashMap(); 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 fromJsonList = new HashMap(); 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 fromJsonList = new HashMap(); + 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>(){}.getType()); + logger.debug("动作详情统计一小时"+fromJsonList); + map = (Map) fromJsonList.get("data"); + + } catch (Exception e) { + e.printStackTrace(); + logger.error("动作详情统计一小时数据获取错误"+e); + } + return map; + } } diff --git a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java index 9d38654be..affcc53fd 100644 --- a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java +++ b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java @@ -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 fromJsonList = new HashMap(); Map userJsonList = new HashMap(); Map ipJsonList = new HashMap(); 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(){}.getType()); + fromJsonList = gson.fromJson(string, new TypeToken() { + }.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(){}.getType()); + userJsonList = usergson.fromJson(userString, new TypeToken() { + }.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(){}.getType()); + ipJsonList = ipgson.fromJson(ipString, new TypeToken() { + }.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(){}.getType()); + userJsonList = usergson.fromJson(userString, new TypeToken() { + }.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(){}.getType()); + ipJsonList = ipgson.fromJson(ipString, new TypeToken() { + }.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 exportList = new ArrayList(); + + Map fromJsonList = new HashMap(); + Map userJsonList = new HashMap(); + Map ipJsonList = new HashMap(); + 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() { + }.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() { + }.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() { + }.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() { + }.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() { + }.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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + + 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; + } } diff --git a/src/main/java/com/nis/web/controller/dynamicpage/DynamicIndexController.java b/src/main/java/com/nis/web/controller/dynamicpage/DynamicIndexController.java index 270c2e129..678c320d2 100644 --- a/src/main/java/com/nis/web/controller/dynamicpage/DynamicIndexController.java +++ b/src/main/java/com/nis/web/controller/dynamicpage/DynamicIndexController.java @@ -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 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 params = new HashMap(); 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 point = new ArrayList<>();//每个点 [时间戳, 数值] point.add(DateUtils.parseDate(entity.getReportTime()).getTime()); - point.add(entity.getSum()); + /*if(0> 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 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 params = new HashMap(); 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(); diff --git a/src/main/java/com/nis/web/controller/log/manipulation/DkBehaviorLogController.java b/src/main/java/com/nis/web/controller/log/manipulation/DkBehaviorLogController.java index 12aefd626..df3c3dc4f 100644 --- a/src/main/java/com/nis/web/controller/log/manipulation/DkBehaviorLogController.java +++ b/src/main/java/com/nis/web/controller/log/manipulation/DkBehaviorLogController.java @@ -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); diff --git a/src/main/java/com/nis/web/controller/log/ntc/BgpLogController.java b/src/main/java/com/nis/web/controller/log/ntc/BgpLogController.java index eb0125fa9..5c0d5c205 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/BgpLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/BgpLogController.java @@ -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, diff --git a/src/main/java/com/nis/web/controller/log/ntc/CollectVoipLogController.java b/src/main/java/com/nis/web/controller/log/ntc/CollectVoipLogController.java index 057c42b21..9a8d6a7d1 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/CollectVoipLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/CollectVoipLogController.java @@ -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() { // // 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 fromJson = gson.fromJson(jsonString, new TypeToken>() { @@ -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 getList() { List list = new ArrayList(); diff --git a/src/main/java/com/nis/web/controller/log/ntc/DdosLogController.java b/src/main/java/com/nis/web/controller/log/ntc/DdosLogController.java index fa11f78f1..09379299c 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/DdosLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/DdosLogController.java @@ -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); diff --git a/src/main/java/com/nis/web/controller/log/ntc/DnsLogController.java b/src/main/java/com/nis/web/controller/log/ntc/DnsLogController.java index 72da7d9be..90b39ff4e 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/DnsLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/DnsLogController.java @@ -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, diff --git a/src/main/java/com/nis/web/controller/log/ntc/FtpLogController.java b/src/main/java/com/nis/web/controller/log/ntc/FtpLogController.java index 533f495a3..5da87e518 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/FtpLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/FtpLogController.java @@ -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, diff --git a/src/main/java/com/nis/web/controller/log/ntc/HttpKeyLogController.java b/src/main/java/com/nis/web/controller/log/ntc/HttpKeyLogController.java index d2a0eda84..d41662a61 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/HttpKeyLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/HttpKeyLogController.java @@ -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, diff --git a/src/main/java/com/nis/web/controller/log/ntc/HttpLogController.java b/src/main/java/com/nis/web/controller/log/ntc/HttpLogController.java index b81a6a001..a134cde6a 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/HttpLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/HttpLogController.java @@ -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, diff --git a/src/main/java/com/nis/web/controller/log/ntc/IpLogController.java b/src/main/java/com/nis/web/controller/log/ntc/IpLogController.java index 26eefdb35..c3c98872e 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/IpLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/IpLogController.java @@ -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 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 list = new ArrayList(); @@ -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) { diff --git a/src/main/java/com/nis/web/controller/log/ntc/IrDnatLogController.java b/src/main/java/com/nis/web/controller/log/ntc/IrDnatLogController.java index 918efb828..d83bd04e1 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/IrDnatLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/IrDnatLogController.java @@ -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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + List list = new ArrayList(); + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + initLogSearchValue(log, params); + + List 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 fromJson = gson.fromJson(recv, new TypeToken>(){}.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page 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"); + } + } + } diff --git a/src/main/java/com/nis/web/controller/log/ntc/IrSnatLogController.java b/src/main/java/com/nis/web/controller/log/ntc/IrSnatLogController.java index fd4f901b8..4860bf557 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/IrSnatLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/IrSnatLogController.java @@ -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 titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + List list = new ArrayList(); + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + initLogSearchValue(log, params); + + List 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 fromJson = gson.fromJson(recv, new TypeToken>(){}.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page 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"); + } + } + + } diff --git a/src/main/java/com/nis/web/controller/log/ntc/MailLogController.java b/src/main/java/com/nis/web/controller/log/ntc/MailLogController.java index 91a085d3a..ec8df1b33 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MailLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MailLogController.java @@ -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, diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmAvUrlLogController.java b/src/main/java/com/nis/web/controller/log/ntc/MmAvUrlLogController.java index 688e8dbaf..586959fc3 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmAvUrlLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmAvUrlLogController.java @@ -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, diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmFileDigestLogController.java b/src/main/java/com/nis/web/controller/log/ntc/MmFileDigestLogController.java index 4a8711f88..aaae8f60e 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmFileDigestLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmFileDigestLogController.java @@ -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); diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmPornAvSampleController.java b/src/main/java/com/nis/web/controller/log/ntc/MmPornAvSampleController.java index d6843ad90..19137f428 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmPornAvSampleController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmPornAvSampleController.java @@ -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); diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmSampleAudioController.java b/src/main/java/com/nis/web/controller/log/ntc/MmSampleAudioController.java index cdc4949d1..8945e4e49 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmSampleAudioController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmSampleAudioController.java @@ -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); diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmSamplePicController.java b/src/main/java/com/nis/web/controller/log/ntc/MmSamplePicController.java index 000109e0f..de9b96ca8 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmSamplePicController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmSamplePicController.java @@ -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); diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmSampleVideoController.java b/src/main/java/com/nis/web/controller/log/ntc/MmSampleVideoController.java index 7e584bbd3..431db7c9c 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmSampleVideoController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmSampleVideoController.java @@ -123,7 +123,8 @@ public class MmSampleVideoController extends BaseController{ String cfgIndexInfoNoExport = ",direction," + hColumns; noExportMap.put("av_sample_video_control", cfgIndexInfoNoExport); dataMap.put("av_sample_video_control", list); - + String timeRange= initLogMap(log,"av_sample_video_control"); + noExportMap.put("timeRange", timeRange); if ("csv".equals(type)) { this._exportCsv(model, request, response, redirectAttributes, "av_sample_video_control", titleList, classMap, dataMap, noExportMap); diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmSampleVoipLogController.java b/src/main/java/com/nis/web/controller/log/ntc/MmSampleVoipLogController.java index 124ff3d2e..7eb385a2c 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmSampleVoipLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmSampleVoipLogController.java @@ -131,6 +131,8 @@ public class MmSampleVoipLogController extends BaseController { String cfgIndexInfoNoExport=","+hColumns; noExportMap.put("av_sample_voip_control",cfgIndexInfoNoExport); dataMap.put("av_sample_voip_control",list); + String timeRange= initLogMap(log,"av_sample_voip_control"); + noExportMap.put("timeRange", timeRange); /*}*/ if("csv".equals(type)){ this._exportCsv(model, request, response, redirectAttributes,"av_sample_voip_control",titleList,classMap,dataMap,noExportMap); diff --git a/src/main/java/com/nis/web/controller/log/ntc/MmVoipIpLogController.java b/src/main/java/com/nis/web/controller/log/ntc/MmVoipIpLogController.java index 84000937c..eb7ab0876 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/MmVoipIpLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/MmVoipIpLogController.java @@ -142,6 +142,8 @@ public class MmVoipIpLogController extends BaseController { String cfgIndexInfoNoExport = "," + hColumns; noExportMap.put("av_voip_control", cfgIndexInfoNoExport); dataMap.put("av_voip_control", list); + String timeRange= initLogMap(log,"av_voip_control"); + noExportMap.put("timeRange", timeRange); /* } */ if ("csv".equals(type)) { this._exportCsv(model, request, response, redirectAttributes, "av_voip_control", titleList, classMap, diff --git a/src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java b/src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java index 0cc9c7d53..ef7db0e73 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java @@ -127,6 +127,9 @@ public class NtcCollectRadiusLogController extends BaseController { String cfgIndexInfoNoExport=",cfg_id,action,"+hColumns; noExportMap.put("radius_log",cfgIndexInfoNoExport); dataMap.put("radius_log",list); + String timeRange= initLogMap(log,"radius_log"); + noExportMap.put("timeRange", timeRange); + /*}*/ if("csv".equals(type)){ this._exportCsv(model, request, response, redirectAttributes,"radius_log",titleList,classMap,dataMap,noExportMap); diff --git a/src/main/java/com/nis/web/controller/log/ntc/NtcConnRecordLogController.java b/src/main/java/com/nis/web/controller/log/ntc/NtcConnRecordLogController.java index c9e455bf1..f04c2d4e9 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/NtcConnRecordLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/NtcConnRecordLogController.java @@ -180,6 +180,8 @@ public class NtcConnRecordLogController extends BaseController { String cfgIndexInfoNoExport = ",cfg_id,action," + hColumns; noExportMap.put("conn_record", cfgIndexInfoNoExport); dataMap.put("conn_record", list); + String timeRange= initLogMap(log,"conn_record"); + noExportMap.put("timeRange", timeRange); /* } */ if ("csv".equals(type)) { this._exportCsv(model, request, response, redirectAttributes, "conn_record", titleList, classMap, diff --git a/src/main/java/com/nis/web/controller/log/ntc/OpenVpnLogController.java b/src/main/java/com/nis/web/controller/log/ntc/OpenVpnLogController.java index 75d0f48e2..3f0d4d2ad 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/OpenVpnLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/OpenVpnLogController.java @@ -25,6 +25,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.DkBehaviorLog; import com.nis.domain.log.MmVoipLog; import com.nis.domain.log.NtcCollectRadiusLog; import com.nis.domain.log.NtcOpenVpnLog; @@ -32,6 +33,7 @@ import com.nis.domain.log.NtcOpenVpnLog; import com.nis.domain.maat.LogRecvData; import com.nis.util.Constants; import com.nis.util.DictUtils; +import com.nis.util.StringUtil; import com.nis.util.httpclient.HttpClientUtil; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; @@ -56,14 +58,20 @@ public class OpenVpnLogController extends BaseController{ PageLog page = new PageLog(request, response); Map params=new HashMap<>(); + + List serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId()); + model.addAttribute("serviceList", serviceList); + if(StringUtil.isEmpty(entry.getAction())){ + for(int i=0;i serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId()); - model.addAttribute("serviceList", serviceList); - String url = ""; url = Constants.LOG_BASE_URL+Constants.NTC_OPENVPN_LOG; //url = Constants.LOG_BASE_URL+Constants.NTC_IP_LOG; @@ -104,6 +112,15 @@ public class OpenVpnLogController extends BaseController{ Map noExportMap=new HashMap(); //--------------------------- PageLog page = new PageLog(request, response); + List serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId()); + model.addAttribute("serviceList", serviceList); + if(StringUtil.isEmpty(log.getAction())){ + for(int i=0;i params = new HashMap(); @@ -121,23 +138,29 @@ public class OpenVpnLogController extends BaseController{ Page data = fromJson.getData(); list= data.getList(); } + for (NtcOpenVpnLog l : list) { + l.setFunctionId(log.getFunctionId()); + setLogAction(l, serviceList); + } } - titleList.add("openVpn_log"); - classMap.put("openVpn_log", NtcOpenVpnLog.class); + titleList.add("spoofing_ip_policy"); + classMap.put("spoofing_ip_policy", NtcOpenVpnLog.class); SysUser user =UserUtils.getUser(); if (!user.isAdmin()){ hColumns+=",scene_file,"; }else{ hColumns+=","; } - String cfgIndexInfoNoExport=",cfg_id,action,"+hColumns; - noExportMap.put("openVpn_log",cfgIndexInfoNoExport); - dataMap.put("openVpn_log",list); + String cfgIndexInfoNoExport=","+hColumns; + noExportMap.put("spoofing_ip_policy",cfgIndexInfoNoExport); + dataMap.put("spoofing_ip_policy",list); + String timeRange= initLogMap(log,"spoofing_ip_policy"); + noExportMap.put("timeRange", timeRange); /*}*/ if("csv".equals(type)){ - this._exportCsv(model, request, response, redirectAttributes,"openVpn_log",titleList,classMap,dataMap,noExportMap); + this._exportCsv(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap); }else{ - this._export(model, request, response, redirectAttributes,"openVpn_log",titleList,classMap,dataMap,noExportMap); + this._export(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap); } } catch (Exception e) { logger.error("openVpn export failed",e); diff --git a/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java b/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java index 16483b582..55f38c9cd 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java @@ -128,6 +128,8 @@ public class P2pLogController extends BaseController { String cfgIndexInfoNoExport = "," + hColumns; noExportMap.put("p2p_control", cfgIndexInfoNoExport); dataMap.put("p2p_control", list); + String timeRange= initLogMap(log,"p2p_control"); + noExportMap.put("timeRange", timeRange); /* } */ if ("csv".equals(type)) { this._exportCsv(model, request, response, redirectAttributes, "p2p_control", titleList, classMap, diff --git a/src/main/java/com/nis/web/controller/log/ntc/SslLogController.java b/src/main/java/com/nis/web/controller/log/ntc/SslLogController.java index 5f97fda33..eda70858f 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/SslLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/SslLogController.java @@ -138,6 +138,8 @@ public class SslLogController extends BaseController { String cfgIndexInfoNoExport = "," + hColumns; noExportMap.put("ssl_control", cfgIndexInfoNoExport); dataMap.put("ssl_control", list); + String timeRange= initLogMap(log,"ssl_control"); + noExportMap.put("timeRange", timeRange); /* } */ if ("csv".equals(type)) { this._exportCsv(model, request, response, redirectAttributes, "ssl_control", titleList, classMap, diff --git a/src/main/java/com/nis/web/controller/log/pxy/PxyHttpLogController.java b/src/main/java/com/nis/web/controller/log/pxy/PxyHttpLogController.java index 5cb6054ba..6b7742694 100644 --- a/src/main/java/com/nis/web/controller/log/pxy/PxyHttpLogController.java +++ b/src/main/java/com/nis/web/controller/log/pxy/PxyHttpLogController.java @@ -178,8 +178,8 @@ public class PxyHttpLogController extends BaseController { String cfgIndexInfoNoExport = "," + hColumns; noExportMap.put(pxyName, cfgIndexInfoNoExport); dataMap.put(pxyName, list); - /*String timeRange= initLogMap(log,pxyName); - noExportMap.put("timeRange", timeRange);*/ + String timeRange= initLogMap(log,pxyName); + noExportMap.put("timeRange", timeRange); if ("csv".equals(type)) { this._exportCsv(model, request, response, redirectAttributes, pxyName, titleList, classMap, dataMap, noExportMap); diff --git a/src/main/java/com/nis/web/controller/report/NtcEventBlockController.java b/src/main/java/com/nis/web/controller/report/NtcEventBlockController.java new file mode 100644 index 000000000..70990a7df --- /dev/null +++ b/src/main/java/com/nis/web/controller/report/NtcEventBlockController.java @@ -0,0 +1,406 @@ +package com.nis.web.controller.report; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +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.commons.lang3.StringUtils; +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.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; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.configuration.TaskInfo; +import com.nis.domain.maat.LogRecvData; +import com.nis.domain.report.NtcEventMonitorOrBlockReport; +import com.nis.util.Constants; +import com.nis.util.TimeConstants; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; +import com.nis.web.service.configuration.RequestInfoService; + +@Controller +@RequestMapping("${adminPath}/eventBlock") +public class NtcEventBlockController extends BaseController { + + protected static Logger logger = LoggerFactory.getLogger(NtcEventBlockController.class); + + @Autowired + private RequestInfoService requestInfoService; + + /** + * EventBlock + * + * @param log + * @param model + * @param request + * @param response + * @return + */ + @RequestMapping(value = { "/eventBlockList", "" }) + public String eventBlockList(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, + HttpServletRequest request, HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + params.put("reportType", 1); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock"; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + model.addAttribute("page", page); + // 获取专项列表 + List taskList = requestInfoService.showTask(new TaskInfo()); + model.addAttribute("taskList", taskList); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + } + + return "/report/eventBlockList"; + } + + // eventMonitorExport + @RequestMapping(value = "eventBlockExport") + public void eventBlockExport(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, String hColumns, + String type, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + params.put("reportType", 1); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + + // + titleList.add("ntc_event_block_report"); + classMap.put("ntc_event_block_report", NtcEventMonitorOrBlockReport.class); + + String cfgIndexInfoNoExport = "," + hColumns + ","; + noExportMap.put("ntc_event_block_report", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcEventMonitorOrBlockReport ntcEventMonitorOrBlockReport = new NtcEventMonitorOrBlockReport(); + long ipNum = 0; + long httpNum = 0; + long mailNum = 0; + long vedioNum = 0; + long agentNum = 0; + for (NtcEventMonitorOrBlockReport entity : list) { + ipNum += entity.getIpNum(); + httpNum += entity.getHttpNum(); + mailNum += entity.getMailNum(); + vedioNum += entity.getVedioNum(); + agentNum += entity.getAgentNum(); + } + String report_total = msgProp.getProperty("report_total"); + ntcEventMonitorOrBlockReport.setIpNum(ipNum); + ntcEventMonitorOrBlockReport.setHttpNum(httpNum); + ntcEventMonitorOrBlockReport.setMailNum(mailNum); + ntcEventMonitorOrBlockReport.setVedioNum(vedioNum); + ntcEventMonitorOrBlockReport.setAgentNum(agentNum); + ntcEventMonitorOrBlockReport.setTaskIds(report_total); + ntcEventMonitorOrBlockReport.setTaskName("    一   "); + ntcEventMonitorOrBlockReport.setTaskTime("    一   "); + ntcEventMonitorOrBlockReport.setReportTime("    一   "); + list.add(ntcEventMonitorOrBlockReport); + + dataMap.put("ntc_event_block_report", list); + + String timeRange = initHttpMap(log, "ntc_event_block_report"); + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "ntc_event_block_report", titleList, + classMap, dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "ntc_event_block_report", titleList, + classMap, dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("ntc_event_block_report export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + } + + public String initHttpMap(NtcEventMonitorOrBlockReport log, String title) { + Properties msgProp = getMsgProp(); + String logTime = msgProp.getProperty(title, title); + ; + if (StringUtils.isNotBlank(log.getSearchReportStartTime())) { + logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime(); + } + if (StringUtils.isNotBlank(log.getSearchReportEndTime())) { + logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) { + logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskStartTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskEndTime(); + } + return logTime; + } + + /** + * 用来判断界面传来的时间参数是否为空来决定默认值与否 + * + * @param startTime + * @param endTime + * @return + */ + public String[] getSerachTimes(String startTime, String endTime) { + String[] times = new String[2]; + if (StringUtils.isNotBlank(startTime)) { + times[0] = startTime; + if (StringUtils.isNotBlank(endTime)) { + times[1] = endTime; + } else { + times[1] = getSomeDate(startTime, 7); + } + } else { + if (StringUtils.isNotBlank(endTime)) { + times[0] = getSomeDate(endTime, -7); + times[1] = endTime; + } else { + String searchReportEndTime = getCurrentDate(); + times[0] = getSomeDate(searchReportEndTime, -7); + times[1] = searchReportEndTime; + } + } + return times; + } + + /** + * 对日期Day的加/减 + * + * @param date + * @param offset + * @return + */ + public static String getSomeDate(String date, int offset) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date time = null; + try { + time = format.parse(date); + } catch (ParseException e) { + logger.error("日期格式转换出现异常,{}", e); + } + DateTime dateTime = new DateTime(time); + return dateTime.plusDays(offset).toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS); + } + + /** + * 得到当前时间 + * + * @return + */ + public static String getCurrentDate() { + + DateTime dateTime = DateTime.now(); + + return dateTime.toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS); + } + + // eventBlockPrint + @ResponseBody + @RequestMapping(value = "eventBlockPrint") + public List eventBlockPrint(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, + Model model, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + params.put("reportType", 1); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + + return list; + } catch (Exception e) { + logger.error("ntc_event_block_report print failed", e); + addMessage(redirectAttributes, "error", "print_failed"); + } + return null; + } +} diff --git a/src/main/java/com/nis/web/controller/report/NtcEventKeyProtectionController.java b/src/main/java/com/nis/web/controller/report/NtcEventKeyProtectionController.java new file mode 100644 index 000000000..b770b667e --- /dev/null +++ b/src/main/java/com/nis/web/controller/report/NtcEventKeyProtectionController.java @@ -0,0 +1,396 @@ +package com.nis.web.controller.report; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +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.commons.lang3.StringUtils; +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.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; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.configuration.TaskInfo; +import com.nis.domain.maat.LogRecvData; +import com.nis.domain.report.NtcEventKeyProtectionReport; +import com.nis.util.Constants; +import com.nis.util.TimeConstants; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; +import com.nis.web.service.configuration.RequestInfoService; + +@Controller +@RequestMapping("${adminPath}/eventKeyProtection") +public class NtcEventKeyProtectionController extends BaseController { + + protected static Logger logger = LoggerFactory.getLogger(NtcEventKeyProtectionController.class); + + @Autowired + private RequestInfoService requestInfoService; + + /** + * EventBlock + * + * @param log + * @param model + * @param request + * @param response + * @return + */ + @RequestMapping(value = { "/eventKeyProtectionList", "" }) + public String eventKeyProtectionList(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model, + HttpServletRequest request, HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_KEYPROTECTION_Report; + // String url = + // "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventKeyProtection"; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + model.addAttribute("page", page); + // 获取专项列表 + List taskList = requestInfoService.showTask(new TaskInfo()); + model.addAttribute("taskList", taskList); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + } + + return "/report/eventKeyProtectionList"; + } + + // eventMonitorExport + @RequestMapping(value = "eventKeyProtectionExport") + public void eventKeyProtectionExport(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model, + String hColumns, String type, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_KEYPROTECTION_Report; + // String url = + // "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventKeyProtection"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + + // + titleList.add("ntc_event_key_protection_report"); + classMap.put("ntc_event_key_protection_report", NtcEventKeyProtectionReport.class); + + String cfgIndexInfoNoExport = "," + hColumns + ","; + noExportMap.put("ntc_event_key_protection_report", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcEventKeyProtectionReport ntcEventKeyProtectionReport = new NtcEventKeyProtectionReport(); + long letterNum = 0; + long configNum = 0; + long monitorNum = 0; + long controlNum = 0; + for (NtcEventKeyProtectionReport entity : list) { + letterNum += entity.getLetterNum(); + configNum += entity.getConfigNum(); + monitorNum += entity.getMonitorNum(); + controlNum += entity.getControlNum(); + } + String report_total = msgProp.getProperty("report_total"); + ntcEventKeyProtectionReport.setLetterNum(letterNum); + ntcEventKeyProtectionReport.setConfigNum(configNum); + ntcEventKeyProtectionReport.setMonitorNum(monitorNum); + ntcEventKeyProtectionReport.setControlNum(controlNum); + ntcEventKeyProtectionReport.setTaskIds(report_total); + ntcEventKeyProtectionReport.setTaskName("     一     "); + ntcEventKeyProtectionReport.setTaskTime("     一     "); + ntcEventKeyProtectionReport.setReportTime("    一     "); + list.add(ntcEventKeyProtectionReport); + + dataMap.put("ntc_event_key_protection_report", list); + + String timeRange = initHttpMap(log, "ntc_event_key_protection_report"); + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "ntc_event_key_protection_report", + titleList, classMap, dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "ntc_event_key_protection_report", titleList, + classMap, dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("ntc_event_key_protection_report export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + } + + public String initHttpMap(NtcEventKeyProtectionReport log, String title) { + Properties msgProp = getMsgProp(); + String logTime = msgProp.getProperty(title, title); + ; + if (StringUtils.isNotBlank(log.getSearchReportStartTime())) { + logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime(); + } + if (StringUtils.isNotBlank(log.getSearchReportEndTime())) { + logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) { + logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskStartTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskEndTime(); + } + return logTime; + } + + /** + * 用来判断界面传来的时间参数是否为空来决定默认值与否 + * + * @param startTime + * @param endTime + * @return + */ + public String[] getSerachTimes(String startTime, String endTime) { + String[] times = new String[2]; + if (StringUtils.isNotBlank(startTime)) { + times[0] = startTime; + if (StringUtils.isNotBlank(endTime)) { + times[1] = endTime; + } else { + times[1] = getSomeDate(startTime, 7); + } + } else { + if (StringUtils.isNotBlank(endTime)) { + times[0] = getSomeDate(endTime, -7); + times[1] = endTime; + } else { + String searchReportEndTime = getCurrentDate(); + times[0] = getSomeDate(searchReportEndTime, -7); + times[1] = searchReportEndTime; + } + } + return times; + } + + /** + * 对日期Day的加/减 + * + * @param date + * @param offset + * @return + */ + public static String getSomeDate(String date, int offset) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date time = null; + try { + time = format.parse(date); + } catch (ParseException e) { + logger.error("日期格式转换出现异常,{}", e); + } + DateTime dateTime = new DateTime(time); + return dateTime.plusDays(offset).toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS); + } + + /** + * 得到当前时间 + * + * @return + */ + public static String getCurrentDate() { + + DateTime dateTime = DateTime.now(); + + return dateTime.toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS); + } + + //eventKeyProtectionPrint + @ResponseBody + @RequestMapping(value = "eventKeyProtectionPrint") + public List eventKeyProtectionPrint(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model, + HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_KEYPROTECTION_Report; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + return list; + } catch (Exception e) { + logger.error("ntc_event_key_protection_report print failed", e); + addMessage(redirectAttributes, "error", "print_failed"); + } + return null; + } +} diff --git a/src/main/java/com/nis/web/controller/report/NtcEventMonitorController.java b/src/main/java/com/nis/web/controller/report/NtcEventMonitorController.java new file mode 100644 index 000000000..5f4d29f2e --- /dev/null +++ b/src/main/java/com/nis/web/controller/report/NtcEventMonitorController.java @@ -0,0 +1,403 @@ +package com.nis.web.controller.report; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +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.commons.lang3.StringUtils; +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.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; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.configuration.TaskInfo; +import com.nis.domain.maat.LogRecvData; +import com.nis.domain.report.NtcEventMonitorOrBlockReport; +import com.nis.util.Constants; +import com.nis.util.TimeConstants; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; +import com.nis.web.service.configuration.RequestInfoService; + +@Controller +@RequestMapping("${adminPath}/eventMonitor") +public class NtcEventMonitorController extends BaseController { + + protected static Logger logger = LoggerFactory.getLogger(NtcEventMonitorController.class); + + @Autowired + private RequestInfoService requestInfoService; + + /** + * EventMonitor + * + * @param log + * @param model + * @param request + * @param response + * @return + */ + @RequestMapping(value = { "/eventMonitorList", "" }) + public String eventMonitorList(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, + HttpServletRequest request, HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + params.put("reportType", 2); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; +// String url = +// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock"; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + model.addAttribute("page", page); + List taskList = requestInfoService.showTask(new TaskInfo()); + model.addAttribute("taskList", taskList); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + } + + return "/report/eventMonitorList"; + } + + // eventMonitorExport + @RequestMapping(value = "eventMonitorExport") + public void eventMonitorExport(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, + String hColumns, String type, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + params.put("reportType", 2); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; +// String url = +// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + // + titleList.add("ntc_event_monitor_report"); + classMap.put("ntc_event_monitor_report", NtcEventMonitorOrBlockReport.class); + + String cfgIndexInfoNoExport = "," + hColumns + ","; + noExportMap.put("ntc_event_monitor_report", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcEventMonitorOrBlockReport ntcEventMonitorOrBlockReport = new NtcEventMonitorOrBlockReport(); + long ipNum = 0; + long httpNum = 0; + long mailNum = 0; + long vedioNum = 0; + long agentNum = 0; + for (NtcEventMonitorOrBlockReport entity : list) { + ipNum += entity.getIpNum(); + httpNum += entity.getHttpNum(); + mailNum += entity.getMailNum(); + vedioNum += entity.getVedioNum(); + agentNum += entity.getAgentNum(); + } + String report_total = msgProp.getProperty("report_total"); + ntcEventMonitorOrBlockReport.setIpNum(ipNum); + ntcEventMonitorOrBlockReport.setHttpNum(httpNum); + ntcEventMonitorOrBlockReport.setMailNum(mailNum); + ntcEventMonitorOrBlockReport.setVedioNum(vedioNum); + ntcEventMonitorOrBlockReport.setAgentNum(agentNum); + ntcEventMonitorOrBlockReport.setTaskIds(report_total); + ntcEventMonitorOrBlockReport.setTaskName("    一   "); + ntcEventMonitorOrBlockReport.setTaskTime("    一   "); + ntcEventMonitorOrBlockReport.setReportTime("    一   "); + list.add(ntcEventMonitorOrBlockReport); + + dataMap.put("ntc_event_monitor_report", list); + + String timeRange = initHttpMap(log, "ntc_event_monitor_report"); + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "ntc_event_monitor_report", titleList, + classMap, dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "ntc_event_monitor_report", titleList, + classMap, dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("ntc_event_monitor_report export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + } + + public String initHttpMap(NtcEventMonitorOrBlockReport log, String title) { + Properties msgProp = getMsgProp(); + String logTime = msgProp.getProperty(title, title); + ; + if (StringUtils.isNotBlank(log.getSearchReportStartTime())) { + logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime(); + } + if (StringUtils.isNotBlank(log.getSearchReportEndTime())) { + logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) { + logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskStartTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskEndTime(); + } + return logTime; + } + + /** + * 用来判断界面传来的时间参数是否为空来决定默认值与否 + * + * @param startTime + * @param endTime + * @return + */ + public String[] getSerachTimes(String startTime, String endTime) { + String[] times = new String[2]; + if (StringUtils.isNotBlank(startTime)) { + times[0] = startTime; + if (StringUtils.isNotBlank(endTime)) { + times[1] = endTime; + } else { + times[1] = getSomeDate(startTime, 7); + } + } else { + if (StringUtils.isNotBlank(endTime)) { + times[0] = getSomeDate(endTime, -7); + times[1] = endTime; + } else { + String searchReportEndTime = getCurrentDate(); + times[0] = getSomeDate(searchReportEndTime, -7); + times[1] = searchReportEndTime; + } + } + return times; + } + + /** + * 对日期Day的加/减 + * + * @param date + * @param offset + * @return + */ + public static String getSomeDate(String date, int offset) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date time = null; + try { + time = format.parse(date); + } catch (ParseException e) { + logger.error("日期格式转换出现异常,{}", e); + } + DateTime dateTime = new DateTime(time); + return dateTime.plusDays(offset).toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS); + } + + /** + * 得到当前时间 + * + * @return + */ + public static String getCurrentDate() { + + DateTime dateTime = DateTime.now(); + + return dateTime.toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS); + } + + // eventMonitorPrint + @ResponseBody + @RequestMapping(value = "eventMonitorPrint") + public List eventMonitorPrint(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, + HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + String searchReportStartTime = null; + String searchReportEndTime = null; + String searchTaskStartTime = null; + String searchTaskEndTime = null; + + /** + * 对统计时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime()); + searchReportStartTime = serachReportTimes[0]; + searchReportEndTime = serachReportTimes[1]; + + /** + * 对报送时间参数进行处理 开始-结束(一周内[7天]) + */ + String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime()); + searchTaskStartTime = serachTaskTimes[0]; + searchTaskEndTime = serachTaskTimes[1]; + + params.put("searchReportStartTime", searchReportStartTime); + params.put("searchReportEndTime", searchReportEndTime); + params.put("searchTaskStartTime", searchTaskStartTime); + params.put("searchTaskEndTime", searchTaskEndTime); + + if (StringUtils.isNotBlank(log.getTaskIds())) { + params.put("taskIds", log.getTaskIds()); + } + + log.setSearchReportStartTime(searchReportStartTime); + log.setSearchReportEndTime(searchReportEndTime); + log.setSearchTaskStartTime(searchTaskStartTime); + log.setSearchTaskEndTime(searchTaskEndTime); + + params.put("reportType", 2); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + return list; + } catch (Exception e) { + logger.error("ntc_event_monitor_report print failed", e); + addMessage(redirectAttributes, "error", "print_failed"); + } + return null; + } +} diff --git a/src/main/java/com/nis/web/controller/report/ReportController.java b/src/main/java/com/nis/web/controller/report/ReportController.java index 6e529f963..6b2921094 100644 --- a/src/main/java/com/nis/web/controller/report/ReportController.java +++ b/src/main/java/com/nis/web/controller/report/ReportController.java @@ -5,6 +5,7 @@ import java.util.Calendar; 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; @@ -14,6 +15,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.bind.annotation.ResponseBody; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.google.gson.Gson; @@ -22,6 +24,7 @@ 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.log.BaseLogEntity; import com.nis.domain.log.SearchReport; import com.nis.domain.maat.LogRecvData; import com.nis.domain.report.NtcAsnRecord; @@ -29,6 +32,7 @@ import com.nis.domain.report.NtcIpRangeReport; import com.nis.domain.report.NtcURLReport; 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; @@ -37,22 +41,25 @@ import com.nis.web.security.UserUtils; @RequestMapping("${adminPath}/report") public class ReportController extends BaseController { @RequestMapping("/list") - public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) { + public String list(@ModelAttribute("bean") SearchReport bean, Model model, HttpServletRequest request, + HttpServletResponse response) { initReportCondition(model, bean); return "/report/list"; } - //asn - @RequestMapping(value = {"/asnConnList", ""}) - public String asnConnLists(@ModelAttribute("log") NtcAsnRecord log, Model model, HttpServletRequest request, HttpServletResponse response) { + + // asn + @RequestMapping(value = { "/asnConnList", "" }) + public String asnConnLists(@ModelAttribute("log") NtcAsnRecord log, Model model, HttpServletRequest request, + HttpServletResponse response) { try { PageLog page = new PageLog(request, response); Map params = new HashMap(); params.put("pageSize", page.getPageSize()); params.put("pageNo", page.getPageNo()); - //判断请求参数 - if(StringUtils.isNotEmpty(log.getSearchAsnType())){ + // 判断请求参数 + if (StringUtils.isNotEmpty(log.getSearchAsnType())) { params.put("searchAsnType", log.getSearchAsnType()); - }else{ + } else { params.put("searchAsnType", 1); } if (StringUtils.isNotBlank(log.getSearchFoundStartTime()) @@ -60,40 +67,43 @@ public class ReportController extends BaseController { params.put("searchFoundStartTime", log.getSearchFoundStartTime()); params.put("searchFoundEndTime", log.getSearchFoundEndTime()); } else { - Calendar time = Calendar.getInstance(); - String searchEndTime = DateUtils.formatDateTime(time.getTime()); - time.add(Calendar.HOUR_OF_DAY, -1); - String searchStartTime = DateUtils.formatDateTime(time.getTime()); - - params.put("searchFoundStartTime", searchStartTime); - params.put("searchFoundEndTime", searchEndTime); - log.setSearchFoundStartTime(searchStartTime); - log.setSearchFoundEndTime(searchEndTime); - } - if(StringUtils.isNotBlank(log.getAsn())){ + Calendar time = Calendar.getInstance(); + String searchEndTime = DateUtils.formatDateTime(time.getTime()); + time.add(Calendar.HOUR_OF_DAY, -1); + String searchStartTime = DateUtils.formatDateTime(time.getTime()); + + params.put("searchFoundStartTime", searchStartTime); + params.put("searchFoundEndTime", searchEndTime); + log.setSearchFoundStartTime(searchStartTime); + log.setSearchFoundEndTime(searchEndTime); + } + if (StringUtils.isNotBlank(log.getAsn())) { params.put("searchAsn", log.getAsn()); } - String url =Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD; + String url = Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD; String recv = HttpClientUtil.getMsg(url, params, request); -// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":" -// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+ -// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+ -// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+ -// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}"; - //recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121722070122546049\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":24466,\"last\":816,\"list\":[{\"bps\":\"20.21\",\"pps\":\"0.17\",\"asn\":\"6858\"},{\"bps\":\"48662.31\",\"pps\":\"91.27\",\"asn\":\"60476\"},{\"bps\":\"3770.41\",\"pps\":\"5.38\",\"asn\":\"49963\"},{\"bps\":\"1.74\",\"pps\":\"0.01\",\"asn\":\"327892\"},{\"bps\":\"72.96\",\"pps\":\"0.13\",\"asn\":\"20598\"},{\"bps\":\"3.76\",\"pps\":\"0.03\",\"asn\":\"266106\"},{\"bps\":\"889.16\",\"pps\":\"1.28\",\"asn\":\"21928\"},{\"bps\":\"109274.80\",\"pps\":\"160.89\",\"asn\":\"200052\"},{\"bps\":\"3269.08\",\"pps\":\"4.85\",\"asn\":\"196977\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"42643\"},{\"bps\":\"872.50\",\"pps\":\"1.22\",\"asn\":\"35017\"},{\"bps\":\"51079.66\",\"pps\":\"0\",\"asn\":\"57701\"},{\"bps\":\"1.25\",\"pps\":\"0.05\",\"asn\":\"58000\"},{\"bps\":\"0.45\",\"pps\":\"0.02\",\"asn\":\"266022\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"43246\"},{\"bps\":\"5180.62\",\"pps\":\"9.11\",\"asn\":\"57172\"},{\"bps\":\"145.86\",\"pps\":\"0.29\",\"asn\":\"36994\"},{\"bps\":\"31.96\",\"pps\":\"0.06\",\"asn\":\"48536\"},{\"bps\":\"1009.25\",\"pps\":\"1.67\",\"asn\":\"4795\"},{\"bps\":\"0.86\",\"pps\":\"0.02\",\"asn\":\"196924\"},{\"bps\":\"0.5\",\"pps\":\"0\",\"asn\":\"21275\"},{\"bps\":\"13432.03\",\"pps\":\"0.28\",\"asn\":\"198640\"},{\"bps\":\"9.47\",\"pps\":\"0.33\",\"asn\":\"197287\"},{\"bps\":\"5.84\",\"pps\":\"0.02\",\"asn\":\"197155\"},{\"bps\":\"1890.60\",\"pps\":\"2.86\",\"asn\":\"29208\"},{\"bps\":\"18.26\",\"pps\":\"0.37\",\"asn\":\"51078\"},{\"bps\":\"1.53\",\"pps\":\"0.02\",\"asn\":\"5390\"},{\"bps\":\"16074.91\",\"pps\":\"30.44\",\"asn\":\"34974\"},{\"bps\":\"1695.46\",\"pps\":\"2.51\",\"asn\":\"31103\"},{\"bps\":\"42.18\",\"pps\":\"0.24\",\"asn\":\"6407\"}]}}"; + // String + // recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":" + // +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+ + // "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+ + // "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+ + // "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}"; + // recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121722070122546049\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":24466,\"last\":816,\"list\":[{\"bps\":\"20.21\",\"pps\":\"0.17\",\"asn\":\"6858\"},{\"bps\":\"48662.31\",\"pps\":\"91.27\",\"asn\":\"60476\"},{\"bps\":\"3770.41\",\"pps\":\"5.38\",\"asn\":\"49963\"},{\"bps\":\"1.74\",\"pps\":\"0.01\",\"asn\":\"327892\"},{\"bps\":\"72.96\",\"pps\":\"0.13\",\"asn\":\"20598\"},{\"bps\":\"3.76\",\"pps\":\"0.03\",\"asn\":\"266106\"},{\"bps\":\"889.16\",\"pps\":\"1.28\",\"asn\":\"21928\"},{\"bps\":\"109274.80\",\"pps\":\"160.89\",\"asn\":\"200052\"},{\"bps\":\"3269.08\",\"pps\":\"4.85\",\"asn\":\"196977\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"42643\"},{\"bps\":\"872.50\",\"pps\":\"1.22\",\"asn\":\"35017\"},{\"bps\":\"51079.66\",\"pps\":\"0\",\"asn\":\"57701\"},{\"bps\":\"1.25\",\"pps\":\"0.05\",\"asn\":\"58000\"},{\"bps\":\"0.45\",\"pps\":\"0.02\",\"asn\":\"266022\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"43246\"},{\"bps\":\"5180.62\",\"pps\":\"9.11\",\"asn\":\"57172\"},{\"bps\":\"145.86\",\"pps\":\"0.29\",\"asn\":\"36994\"},{\"bps\":\"31.96\",\"pps\":\"0.06\",\"asn\":\"48536\"},{\"bps\":\"1009.25\",\"pps\":\"1.67\",\"asn\":\"4795\"},{\"bps\":\"0.86\",\"pps\":\"0.02\",\"asn\":\"196924\"},{\"bps\":\"0.5\",\"pps\":\"0\",\"asn\":\"21275\"},{\"bps\":\"13432.03\",\"pps\":\"0.28\",\"asn\":\"198640\"},{\"bps\":\"9.47\",\"pps\":\"0.33\",\"asn\":\"197287\"},{\"bps\":\"5.84\",\"pps\":\"0.02\",\"asn\":\"197155\"},{\"bps\":\"1890.60\",\"pps\":\"2.86\",\"asn\":\"29208\"},{\"bps\":\"18.26\",\"pps\":\"0.37\",\"asn\":\"51078\"},{\"bps\":\"1.53\",\"pps\":\"0.02\",\"asn\":\"5390\"},{\"bps\":\"16074.91\",\"pps\":\"30.44\",\"asn\":\"34974\"},{\"bps\":\"1695.46\",\"pps\":\"2.51\",\"asn\":\"31103\"},{\"bps\":\"42.18\",\"pps\":\"0.24\",\"asn\":\"6407\"}]}}"; if (StringUtils.isNotBlank(recv)) { Gson gson = new GsonBuilder().create(); - LogRecvData fromJson = gson.fromJson(recv, new TypeToken>(){}.getType()); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { + }.getType()); if (fromJson.getStatus().intValue() == 200) { Page data = fromJson.getData(); page.setCount(data.getCount()); page.setLast(data.getLast()); page.setList(data.getList()); - /*List list = page.getList(); - for (NtcConnRecordLog l : list) { - l.setFunctionId(log.getFunctionId()); - setLogAction(l,serviceList); - }*/ + /* + * List list = page.getList(); for + * (NtcConnRecordLog l : list) { + * l.setFunctionId(log.getFunctionId()); + * setLogAction(l,serviceList); } + */ model.addAttribute("page", page); } } @@ -101,56 +111,90 @@ public class ReportController extends BaseController { logger.error("查询失败", e); addMessageLog(model, e.getMessage()); } - + return "/report/asnRecordList"; } - - + // - @RequestMapping(value = {"/httpsUrlList", ""}) - public String httpsUrlLists(@ModelAttribute("log") NtcURLReport log, Model model, HttpServletRequest request, HttpServletResponse response) { + @RequestMapping(value = { "/httpsUrlList", "" }) + public String httpsUrlLists(@ModelAttribute("log") NtcURLReport log, Model model, HttpServletRequest request, + HttpServletResponse response) { try { PageLog page = new PageLog(request, response); Map params = new HashMap(); params.put("pageSize", page.getPageSize()); params.put("pageNo", page.getPageNo()); - //判断请求参数 + // 判断请求参数 if (StringUtils.isNotBlank(log.getSearchReportStartTime()) && StringUtils.isNotBlank(log.getSearchReportEndTime())) { params.put("searchReportStartTime", log.getSearchReportStartTime()); params.put("searchReportEndTime", log.getSearchReportEndTime()); } else { - Calendar time = Calendar.getInstance(); - String searchEndTime = DateUtils.formatDateTime(time.getTime()); - time.add(Calendar.HOUR_OF_DAY, -1); - String searchStartTime = DateUtils.formatDateTime(time.getTime()); - - params.put("searchReportStartTime", searchStartTime); - params.put("searchReportEndTime", searchEndTime); - log.setSearchReportStartTime(searchStartTime); - log.setSearchReportEndTime(searchEndTime); + Calendar time = Calendar.getInstance(); + String searchEndTime = DateUtils.formatDateTime(time.getTime()); + time.add(Calendar.HOUR_OF_DAY, -1); + String searchStartTime = DateUtils.formatDateTime(time.getTime()); + + params.put("searchReportStartTime", searchStartTime); + params.put("searchReportEndTime", searchEndTime); + log.setSearchReportStartTime(searchStartTime); + log.setSearchReportEndTime(searchEndTime); } - //url参数 + // url参数 if (StringUtils.isNotBlank(log.getSearchUrl())) { params.put("searchUrl", log.getSearchUrl()); } - String url =Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT; + String url = Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT; String recv = HttpClientUtil.getMsg(url, params, request); -// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121610374649425419\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":174,\"last\":6,\"list\":[{\"url\":\"142.44.167.226/eventproxy/v1/bulk\",\"urlCount\":1686,\"dataList\":[{\"sum\":1686,\"ipAddr\":\"100.101.129.6\"}]},{\"url\":\"188.0.145.98/YZ/e1cib/dlist?cmd=query\",\"urlCount\":2652,\"dataList\":[{\"sum\":1248,\"ipAddr\":\"188.0.145.98\"},{\"sum\":1404,\"ipAddr\":\"89.218.9.2\"}]},{\"url\":\"cdn7.alpha-ag.ru/1c1233923d1a6/c51e872ab5861be256408f6cafa99ed8/luckypatcher_v7.5.9.apk\",\"urlCount\":882,\"dataList\":[{\"sum\":882,\"ipAddr\":\"100.81.118.193\"}]}]}}"; - // recv = "{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121721092486282928\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":11193,\"last\":374,\"list\":[{\"reportTime\":\"2018-12-17 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 16:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17 16:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17 18:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17 18:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 20:00:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F50460\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-16 20:15:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 21:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 22:30:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 22:45:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 14:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 19:45:00\",\"url\":\"185.203.72.28/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 15:30:00\",\"url\":\"biboba.ru/\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 17:00:00\",\"url\":\"biboba.ru/porno_video/style/img/logo.gif\",\"ipCount\":1,\"connCount\":1},{\"reportTime\":\"2018-12-17 01:15:00\",\"url\":\"bilimsite.kz/\",\"ipCount\":1,\"connCount\":1}]}}"; + // String + // recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121610374649425419\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":174,\"last\":6,\"list\":[{\"url\":\"142.44.167.226/eventproxy/v1/bulk\",\"urlCount\":1686,\"dataList\":[{\"sum\":1686,\"ipAddr\":\"100.101.129.6\"}]},{\"url\":\"188.0.145.98/YZ/e1cib/dlist?cmd=query\",\"urlCount\":2652,\"dataList\":[{\"sum\":1248,\"ipAddr\":\"188.0.145.98\"},{\"sum\":1404,\"ipAddr\":\"89.218.9.2\"}]},{\"url\":\"cdn7.alpha-ag.ru/1c1233923d1a6/c51e872ab5861be256408f6cafa99ed8/luckypatcher_v7.5.9.apk\",\"urlCount\":882,\"dataList\":[{\"sum\":882,\"ipAddr\":\"100.81.118.193\"}]}]}}"; + // recv = + // "{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121721092486282928\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":11193,\"last\":374,\"list\":[{\"reportTime\":\"2018-12-17 + // 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 16:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17 + // 16:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17 + // 18:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17 + // 18:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17 + // 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 20:00:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 + // 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 + // 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 + // 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 + // 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17 + // 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17 + // 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 + // 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F50460\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-16 + // 20:15:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 + // 21:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 + // 22:30:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 + // 22:45:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 + // 14:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 + // 19:45:00\",\"url\":\"185.203.72.28/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 + // 15:30:00\",\"url\":\"biboba.ru/\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 + // 17:00:00\",\"url\":\"biboba.ru/porno_video/style/img/logo.gif\",\"ipCount\":1,\"connCount\":1},{\"reportTime\":\"2018-12-17 + // 01:15:00\",\"url\":\"bilimsite.kz/\",\"ipCount\":1,\"connCount\":1}]}}"; if (StringUtils.isNotBlank(recv)) { Gson gson = new GsonBuilder().create(); - LogRecvData fromJson = gson.fromJson(recv, new TypeToken>(){}.getType()); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { + }.getType()); if (fromJson.getStatus().intValue() == 200) { Page data = fromJson.getData(); page.setCount(data.getCount()); page.setLast(data.getLast()); page.setList(data.getList()); - /*List list = page.getList(); - for (NtcConnRecordLog l : list) { - l.setFunctionId(log.getFunctionId()); - setLogAction(l,serviceList); - }*/ + /* + * List list = page.getList(); for + * (NtcConnRecordLog l : list) { + * l.setFunctionId(log.getFunctionId()); + * setLogAction(l,serviceList); } + */ model.addAttribute("page", page); } } @@ -158,25 +202,25 @@ public class ReportController extends BaseController { logger.error("查询失败", e); addMessageLog(model, e.getMessage()); } - + return "/report/urlReportList"; } - - - //IP范围统计 - @RequestMapping(value = {"/ipRangeList", ""}) - public String ipRangeLists(@ModelAttribute("log") NtcIpRangeReport log, Model model, HttpServletRequest request, HttpServletResponse response) { + + // IP范围统计 + @RequestMapping(value = { "/ipRangeList", "" }) + public String ipRangeLists(@ModelAttribute("log") NtcIpRangeReport log, Model model, HttpServletRequest request, + HttpServletResponse response) { try { PageLog page = new PageLog(request, response); Map params = new HashMap(); params.put("pageSize", page.getPageSize()); params.put("pageNo", page.getPageNo()); - //判断请求参数 - //查询国家 + // 判断请求参数 + // 查询国家 if (StringUtils.isNotBlank(log.getSearchCountry())) { params.put("searchCountry", log.getSearchCountry()); } - //查询开始IP + // 查询开始IP if (StringUtils.isNotBlank(log.getSearchIp())) { params.put("searchIp", log.getSearchIp()); } @@ -187,24 +231,28 @@ public class ReportController extends BaseController { if (StringUtils.isNotBlank(log.getSearchAreaType())) { params.put("searchDesc", log.getSearchDesc()); } - - String url =Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT; + + String url = Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT; String recv = HttpClientUtil.getMsg(url, params, request); -// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}"; - + // String + // recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}"; + if (StringUtils.isNotBlank(recv)) { Gson gson = new GsonBuilder().create(); - LogRecvData fromJson = gson.fromJson(recv, new TypeToken>(){}.getType()); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); if (fromJson.getStatus().intValue() == 200) { Page data = fromJson.getData(); page.setCount(data.getCount()); page.setLast(data.getLast()); page.setList(data.getList()); - /*List list = page.getList(); - for (NtcConnRecordLog l : list) { - l.setFunctionId(log.getFunctionId()); - setLogAction(l,serviceList); - }*/ + /* + * List list = page.getList(); for + * (NtcConnRecordLog l : list) { + * l.setFunctionId(log.getFunctionId()); + * setLogAction(l,serviceList); } + */ model.addAttribute("page", page); } } @@ -212,10 +260,11 @@ public class ReportController extends BaseController { logger.error("查询失败", e); addMessageLog(model, e.getMessage()); } - + return "/report/ipRangeReportList"; } - //asnExport + + // asnExport @RequestMapping(value = "asnExport") public void asnExport(@ModelAttribute("log") NtcAsnRecord log, Model model, String hColumns, String type, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { @@ -232,10 +281,10 @@ public class ReportController extends BaseController { Map params = new HashMap(); params.put("pageSize", page.getPageSize()); params.put("pageNo", page.getPageNo()); - //判断请求参数 - if(StringUtils.isNotEmpty(log.getSearchAsnType())){ + // 判断请求参数 + if (StringUtils.isNotEmpty(log.getSearchAsnType())) { params.put("searchAsnType", log.getSearchAsnType()); - }else{ + } else { params.put("searchAsnType", 1); } if (StringUtils.isNotBlank(log.getSearchFoundStartTime()) @@ -243,22 +292,23 @@ public class ReportController extends BaseController { params.put("searchFoundStartTime", log.getSearchFoundStartTime()); params.put("searchFoundEndTime", log.getSearchFoundEndTime()); } else { - Calendar time = Calendar.getInstance(); - String searchEndTime = DateUtils.formatDateTime(time.getTime()); - time.add(Calendar.HOUR_OF_DAY, -1); - String searchStartTime = DateUtils.formatDateTime(time.getTime()); - - params.put("searchFoundStartTime", searchStartTime); - params.put("searchFoundEndTime", searchEndTime); - log.setSearchFoundStartTime(searchStartTime); - log.setSearchFoundEndTime(searchEndTime); + Calendar time = Calendar.getInstance(); + String searchEndTime = DateUtils.formatDateTime(time.getTime()); + time.add(Calendar.HOUR_OF_DAY, -1); + String searchStartTime = DateUtils.formatDateTime(time.getTime()); + + params.put("searchFoundStartTime", searchStartTime); + params.put("searchFoundEndTime", searchEndTime); + log.setSearchFoundStartTime(searchStartTime); + log.setSearchFoundEndTime(searchEndTime); } - String url =Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD; -// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":" -// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+ -// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+ -// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+ -// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}"; + String url = Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD; + // String + // recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":" + // +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+ + // "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+ + // "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+ + // "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}"; String recv = HttpClientUtil.getMsg(url, params, request); List list = new ArrayList(); if (StringUtils.isNotBlank(recv)) { @@ -270,35 +320,59 @@ public class ReportController extends BaseController { list = data.getList(); } } -// + // titleList.add("Ntc_Asn_Record"); classMap.put("Ntc_Asn_Record", NtcAsnRecord.class); SysUser user = UserUtils.getUser(); hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip," - + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," - + "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,"; - + + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," + + "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,"; + String cfgIndexInfoNoExport = "," + hColumns; noExportMap.put("Ntc_Asn_Record", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcAsnRecord ntcAsnRecord = new NtcAsnRecord(); + double pps = 0; + double bps = 0; + for (NtcAsnRecord entity : list) { + if (null != entity.getBps() && !"".equals(entity.getBps())) { + bps += Double.valueOf(entity.getBps()); + } + if (null != entity.getPps() && !"".equals(entity.getPps())) { + pps += Double.valueOf(entity.getPps()); + } + } + String report_total = msgProp.getProperty("report_total"); + ntcAsnRecord.setAsn(report_total); + ntcAsnRecord.setBps(String.format("%.2f", bps)); + ntcAsnRecord.setPps(String.format("%.2f", pps)); + list.add(ntcAsnRecord); + dataMap.put("Ntc_Asn_Record", list); + + String timeRange = initLogMap(log, "Ntc_Asn_Record"); + noExportMap.put("timeRange", timeRange); + /* } */ if ("csv".equals(type)) { this._exportCsv(model, request, response, redirectAttributes, "Ntc_Asn_Record", titleList, classMap, dataMap, noExportMap); } else { - this._export(model, request, response, redirectAttributes, "Ntc_Asn_Record", titleList, classMap, dataMap, - noExportMap); + this._export(model, request, response, redirectAttributes, "Ntc_Asn_Record", titleList, classMap, + dataMap, noExportMap); } } catch (Exception e) { logger.error("Ntc_Asn_Record export failed", e); addMessage(redirectAttributes, "error", "export_failed"); } } - - //ipRangeExport + + // ipRangeExport @RequestMapping(value = "ipRangeExport") public void ipRangeExport(@ModelAttribute("log") NtcIpRangeReport log, Model model, String hColumns, String type, - HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + HttpServletRequest request, HttpServletResponse response, String seType, + RedirectAttributes redirectAttributes) { try { // export data info List titleList = new ArrayList(); @@ -312,12 +386,13 @@ public class ReportController extends BaseController { Map params = new HashMap(); params.put("pageSize", page.getPageSize()); params.put("pageNo", page.getPageNo()); - //判断请求参数 - //查询国家 + log.setSearchAreaType(seType); + // 判断请求参数 + // 查询国家 if (StringUtils.isNotBlank(log.getSearchCountry())) { params.put("searchCountry", log.getSearchCountry()); } - //查询开始IP + // 查询开始IP if (StringUtils.isNotBlank(log.getSearchStartIp())) { params.put("searchIp", log.getSearchIp()); } @@ -328,123 +403,323 @@ public class ReportController extends BaseController { if (StringUtils.isNotBlank(log.getSearchAreaType())) { params.put("searchDesc", log.getSearchDesc()); } - - String url =Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT; + + String url = Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT; String recv = HttpClientUtil.getMsg(url, params, request); -// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}"; + // String + // recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}"; List list = new ArrayList(); if (StringUtils.isNotBlank(recv)) { Gson gson = new GsonBuilder().create(); - LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { - }.getType()); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); if (fromJson.getStatus().intValue() == 200) { Page data = fromJson.getData(); list = data.getList(); } - } + } titleList.add("Ntc_Ip_Range_Report"); classMap.put("Ntc_Ip_Range_Report", NtcIpRangeReport.class); SysUser user = UserUtils.getUser(); hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip," - + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," - + "stream_type,nest_addr_list,server_locate,client_locate,s_asn,d_asn,s_subscribe_id,d_subscribe_id," - + "user_region,scene_file,"; - + + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," + + "stream_type,nest_addr_list,server_locate,client_locate,s_asn,d_asn,s_subscribe_id,d_subscribe_id," + + "user_region,scene_file,"; + String cfgIndexInfoNoExport = "," + hColumns; + noExportMap.put("Ntc_Ip_Range_Report", cfgIndexInfoNoExport); dataMap.put("Ntc_Ip_Range_Report", list); - + + String timeRange = initLogMap(log, "Ntc_Ip_Range_Report"); + noExportMap.put("timeRange", timeRange); + if ("csv".equals(type)) { - this._exportCsv(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList, classMap, - dataMap, noExportMap); + this._exportCsv(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList, + classMap, dataMap, noExportMap); } else { - this._export(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList, classMap, dataMap, - noExportMap); + this._export(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList, classMap, + dataMap, noExportMap); } } catch (Exception e) { logger.error("Ntc_Ip_Range_Report export failed", e); addMessage(redirectAttributes, "error", "export_failed"); } } - //asnExport - @RequestMapping(value = "httpsExport") - public void httpsExport(@ModelAttribute("log") NtcURLReport log, Model model, String hColumns, String type, - HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { - try { - // export data info - List titleList = new ArrayList(); - Map> classMap = new HashMap>(); - Map dataMap = new HashMap(); - Map noExportMap = new HashMap(); - // --------------------------- - PageLog page = new PageLog(request, response); - page.setPageNo(1); - page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); - Map params = new HashMap(); - params.put("pageSize", page.getPageSize()); - params.put("pageNo", page.getPageNo()); - //判断请求参数 - if (StringUtils.isNotBlank(log.getSearchReportStartTime()) - && StringUtils.isNotBlank(log.getSearchReportEndTime())) { - params.put("searchReportStartTime", log.getSearchReportStartTime()); - params.put("searchReportEndTime", log.getSearchReportEndTime()); - } else { - Calendar time = Calendar.getInstance(); - String searchEndTime = DateUtils.formatDateTime(time.getTime()); - time.add(Calendar.HOUR_OF_DAY, -1); - String searchStartTime = DateUtils.formatDateTime(time.getTime()); - - params.put("searchReportStartTime", searchStartTime); - params.put("searchReportEndTime", searchEndTime); - log.setSearchReportStartTime(searchStartTime); - log.setSearchReportEndTime(searchEndTime); - } - //url参数 - if (StringUtils.isNotBlank(log.getSearchUrl())) { - params.put("searchUrl", log.getSearchUrl()); - } - String url =Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT; -// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":" -// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+ -// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+ -// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+ -// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}"; - String recv = HttpClientUtil.getMsg(url, params, request); - List list = new ArrayList(); - if (StringUtils.isNotBlank(recv)) { - Gson gson = new GsonBuilder().create(); - LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { - }.getType()); - if (fromJson.getStatus().intValue() == 200) { - Page data = fromJson.getData(); - list = data.getList(); - } - } -// - titleList.add("Ntc_HTTPS_Report"); - classMap.put("Ntc_HTTPS_Report", NtcURLReport.class); - //SysUser user = UserUtils.getUser(); - /*hColumns += "s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip," - + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," - + "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,";*/ - hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip," - + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," - + "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,reportTime,"; - String cfgIndexInfoNoExport = "," + hColumns; - noExportMap.put("Ntc_HTTPS_Report", cfgIndexInfoNoExport); - dataMap.put("Ntc_HTTPS_Report", list); - /* } */ - if ("csv".equals(type)) { - this._exportCsv(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap, - dataMap, noExportMap); - } else { - this._export(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap, dataMap, - noExportMap); - } - } catch (Exception e) { - logger.error("Ntc_HTTPS_Report export failed", e); - addMessage(redirectAttributes, "error", "export_failed"); - } + public String initHttpMap(NtcURLReport log, String title) { + Properties msgProp = getMsgProp(); + String logTime = msgProp.getProperty(title, title); + ; + if (log.getSearchReportStartTime() != null) { + logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime(); } + if (log.getSearchReportEndTime() != null) { + logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime(); + } + return logTime; + } + + // asnExport + @RequestMapping(value = "httpsExport") + public void httpsExport(@ModelAttribute("log") NtcURLReport log, Model model, String hColumns, String type, + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } else { + Calendar time = Calendar.getInstance(); + String searchEndTime = DateUtils.formatDateTime(time.getTime()); + time.add(Calendar.HOUR_OF_DAY, -1); + String searchStartTime = DateUtils.formatDateTime(time.getTime()); + + params.put("searchReportStartTime", searchStartTime); + params.put("searchReportEndTime", searchEndTime); + log.setSearchReportStartTime(searchStartTime); + log.setSearchReportEndTime(searchEndTime); + } + // url参数 + if (StringUtils.isNotBlank(log.getSearchUrl())) { + params.put("searchUrl", log.getSearchUrl()); + } + + String url = Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT; + // String + // recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":" + // +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+ + // "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+ + // "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+ + // "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + // + titleList.add("Ntc_HTTPS_Report"); + classMap.put("Ntc_HTTPS_Report", NtcURLReport.class); + // SysUser user = UserUtils.getUser(); + /* + * hColumns += + * "s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip," + * + + * "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," + * + + * "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,"; + */ + hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip," + + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," + + "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,reportTime,"; + String cfgIndexInfoNoExport = "," + hColumns; + noExportMap.put("Ntc_HTTPS_Report", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcURLReport ntcURLReport = new NtcURLReport(); + long ipCount=0; + long connCount=0; + for (NtcURLReport entity : list) { + ipCount += entity.getIpCount(); + connCount += entity.getConnCount(); + } + String report_total = msgProp.getProperty("report_total"); + ntcURLReport.setIpCount(ipCount); + ntcURLReport.setConnCount(connCount); + ntcURLReport.setUrl(report_total); + list.add(ntcURLReport); + + + dataMap.put("Ntc_HTTPS_Report", list); + + String timeRange = initHttpMap(log, "Ntc_HTTPS_Report"); + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap, + dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap, + dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("Ntc_HTTPS_Report export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + } + // asnPrint + @ResponseBody + @RequestMapping(value = "asnPrint") + public List asnPrint(@ModelAttribute("log") NtcAsnRecord log, Model model, + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + try { + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + // 判断请求参数 + if (StringUtils.isNotEmpty(log.getSearchAsnType())) { + params.put("searchAsnType", log.getSearchAsnType()); + } else { + params.put("searchAsnType", 1); + } + if (StringUtils.isNotBlank(log.getSearchFoundStartTime()) + && StringUtils.isNotBlank(log.getSearchFoundEndTime())) { + params.put("searchFoundStartTime", log.getSearchFoundStartTime()); + params.put("searchFoundEndTime", log.getSearchFoundEndTime()); + } else { + Calendar time = Calendar.getInstance(); + String searchEndTime = DateUtils.formatDateTime(time.getTime()); + time.add(Calendar.HOUR_OF_DAY, -1); + String searchStartTime = DateUtils.formatDateTime(time.getTime()); + + params.put("searchFoundStartTime", searchStartTime); + params.put("searchFoundEndTime", searchEndTime); + log.setSearchFoundStartTime(searchStartTime); + log.setSearchFoundEndTime(searchEndTime); + } + String url = Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + return list; + } catch (Exception e) { + logger.error("Ntc_Asn_Record print failed", e); + addMessage(redirectAttributes, "error", "print_failed"); + } + return null; + } + // httpsPrint + @ResponseBody + @RequestMapping(value = "httpsPrint") + public List httpsPrint(@ModelAttribute("log") NtcURLReport log, Model model, + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + try { + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } else { + Calendar time = Calendar.getInstance(); + String searchEndTime = DateUtils.formatDateTime(time.getTime()); + time.add(Calendar.HOUR_OF_DAY, -1); + String searchStartTime = DateUtils.formatDateTime(time.getTime()); + + params.put("searchReportStartTime", searchStartTime); + params.put("searchReportEndTime", searchEndTime); + log.setSearchReportStartTime(searchStartTime); + log.setSearchReportEndTime(searchEndTime); + } + // url参数 + if (StringUtils.isNotBlank(log.getSearchUrl())) { + params.put("searchUrl", log.getSearchUrl()); + } + String url = Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + return list; + } catch (Exception e) { + logger.error("Ntc_HTTPS_Report print failed", e); + addMessage(redirectAttributes, "error", "print_failed"); + } + return null; + } + + // ipRangePrint + @ResponseBody + @RequestMapping(value = "ipRangePrint") + public List ipRangePrint(@ModelAttribute("log") NtcIpRangeReport log, Model model, + HttpServletRequest request, HttpServletResponse response, String seType,RedirectAttributes redirectAttributes) { + try { + PageLog page = new PageLog(request, response); + page.setPageNo(1); + page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + log.setSearchAreaType(seType); + // 判断请求参数 + // 查询国家 + if (StringUtils.isNotBlank(log.getSearchCountry())) { + params.put("searchCountry", log.getSearchCountry()); + } + // 查询开始IP + if (StringUtils.isNotBlank(log.getSearchStartIp())) { + params.put("searchIp", log.getSearchIp()); + } + // + if (StringUtils.isNotBlank(log.getSearchAreaType())) { + params.put("searchType", log.getSearchAreaType()); + } + if (StringUtils.isNotBlank(log.getSearchAreaType())) { + params.put("searchDesc", log.getSearchDesc()); + } + + String url = Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + return list; + } catch (Exception e) { + logger.error("Ntc_Ip_Range_Report print failed", e); + addMessage(redirectAttributes, "error", "print_failed"); + } + return null; + } } diff --git a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java index 6f4fba9b0..e3fca435d 100644 --- a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java +++ b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java @@ -1,7 +1,9 @@ package com.nis.web.controller.specific; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; @@ -23,12 +25,19 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.nis.domain.Page; import com.nis.domain.SysDataDictionaryItem; +import com.nis.domain.SysUser; +import com.nis.domain.basics.ServiceDictInfo; import com.nis.domain.specific.SpecificServiceCfg; 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.DictUtils; +import com.nis.util.StringUtil; import com.nis.util.StringUtils; import com.nis.web.controller.BaseController; +import com.nis.web.dao.dashboard.codedic.CodeResult; import com.nis.web.security.UserUtils; @Controller @@ -490,4 +499,117 @@ public class SpecificServiceCfgController extends BaseController { return false; } + // Specific配置导出 + @RequestMapping(value = "exportSpec") + public void exportDict(String itType, SpecificServiceCfg specificServiceCfg, Model model, HttpServletRequest request, + HttpServletResponse response, String ids, RedirectAttributes redirectAttributes, String exType, + String hColumns) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + //-------------------------------------------- + List list = Lists.newArrayList(); + //处理数据 + if (!StringUtil.isEmpty(ids)) { + list = specificServiceCfgService.findBySpecificServiceCfg(ids); + } else { + if(specificServiceCfg.getCfgType()==null){ + specificServiceCfg.setCfgType(1); + } + Page pageCondition = new Page(request, response); + pageCondition.setPageNo(1); + pageCondition.setPageSize(Constants.MAX_EXPORT_SIZE); + List allList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,pageCondition.getOrderBy()); + Page page = specificServiceCfgService.findTopPage(pageCondition, specificServiceCfg); + // 删除顶层数据、取出id + List intList = Lists.newArrayList(); + for (int i = allList.size() - 1; i >= 0; i--) { + SpecificServiceCfg ss = allList.get(i); + if ((ss != null && intList.contains(ss.getSpecServiceId())) || (ss != null && ss.getParent().getSpecServiceId() == 0)) { + allList.remove(ss); + } + } + allList.addAll(page.getList()); + SpecificServiceCfg.sortList(list, allList, 0, true); + SpecificServiceCfg.addChildrenSeq(list, 0); + } + List app=DictUtils.getDictList("APP_BUSINESS_TYPE"); + List tunnel=DictUtils.getDictList("TUNNEL_BEHAV_BUSINESS_TYPE"); + List basic=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE"); + Properties msgProp = getMsgProp(); + for (SpecificServiceCfg spec : list) { + if (!StringUtils.isEmpty(spec.getBusinessType())) { + if (spec.getCfgType() == 1) { + spec.setBusinessType(getName(spec.getBusinessType(),app,msgProp)); + } else if (spec.getCfgType() == 2) { + spec.setBusinessType(getName(spec.getBusinessType(),tunnel,msgProp)); + } else if (spec.getCfgType() == 3) { + spec.setBusinessType(getName(spec.getBusinessType(),basic,msgProp)); + } + } + } + String dictName = "specific_service_cfg"; + titleList.add(dictName); + classMap.put(dictName, SpecificServiceCfg.class); + String cfgIndexInfoNoExport = ""; + if (specificServiceCfg.getCfgType() != null) { + if (specificServiceCfg.getCfgType() == 2) { + cfgIndexInfoNoExport = ",&app_code:tunnel_code-app_name:tunnel_name-app_desc:tunnel_desc-"; + } else if (specificServiceCfg.getCfgType() == 3) { + cfgIndexInfoNoExport = ",&app_code:protocol_code-app_name:protocol_name-app_desc:protocol_desc-"; + } + } + if (specificServiceCfg.getBeginDate() == null) { + cfgIndexInfoNoExport = ",operate_time," + cfgIndexInfoNoExport; + } + + if (!StringUtil.isEmpty(hColumns)) { + cfgIndexInfoNoExport = "," + hColumns + "," + cfgIndexInfoNoExport; + } + noExportMap.put(dictName, cfgIndexInfoNoExport); + dataMap.put(dictName, list); + String timeRange = initDictMap(specificServiceCfg, dictName,msgProp); + 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 getName(String id,List list,Properties msgProp){ + String name=id; + for (int i = 0; i < list.size(); i++) { + if(id.equals(list.get(i).getItemCode())){ + name=msgProp.getProperty(list.get(i).getItemValue(),list.get(i).getItemValue()); + break; + } + } + return name; + } + + + public String initDictMap(SpecificServiceCfg cfg, String dictName,Properties msgProp) { + String titleTime =msgProp.getProperty(dictName,dictName) ; + if (cfg.getBeginDate() != null) { + titleTime += " " + msgProp.getProperty("operate_time") + ":" + DateUtils.formatDateTime(cfg.getBeginDate()); + if (cfg.getEndDate() != null) { + titleTime += "—" + DateUtils.formatDateTime(cfg.getEndDate()); + } else { + titleTime += "—" + DateUtils.getDateTime(); + } + } + return titleTime; + } + } diff --git a/src/main/java/com/nis/web/dao/FunctionServiceDictDao.xml b/src/main/java/com/nis/web/dao/FunctionServiceDictDao.xml index 4662b37b8..34eab36c5 100644 --- a/src/main/java/com/nis/web/dao/FunctionServiceDictDao.xml +++ b/src/main/java/com/nis/web/dao/FunctionServiceDictDao.xml @@ -32,6 +32,7 @@ AND action=#{action,jdbcType=INTEGER} + order by sort \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/SysMenuDao.java b/src/main/java/com/nis/web/dao/SysMenuDao.java index 76dff1bb4..87af932e3 100644 --- a/src/main/java/com/nis/web/dao/SysMenuDao.java +++ b/src/main/java/com/nis/web/dao/SysMenuDao.java @@ -25,5 +25,7 @@ public interface SysMenuDao extends CrudDao{ Integer getServiceId(@Param("functionId")Integer functionId, @Param("action")Integer action); List findAllCfgList(@Param("policiesMenuId")String policiesMenuId); + + String getMenuCodeByFunctionId(@Param("functionId")Integer functionId, @Param("parentId")String id); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/SysMenuDao.xml b/src/main/java/com/nis/web/dao/SysMenuDao.xml index 3d4114539..28ff2734f 100644 --- a/src/main/java/com/nis/web/dao/SysMenuDao.xml +++ b/src/main/java/com/nis/web/dao/SysMenuDao.xml @@ -218,4 +218,13 @@ WHERE s.function_id = #{functionId} AND s.action = #{action} AND s.is_valid = 1 + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java index 8830e6f96..ea319f613 100644 --- a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java +++ b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.java @@ -12,6 +12,7 @@ import com.nis.web.dao.MyBatisDao; public interface AsnIpCfgDao extends CrudDao{ public List findPage(AsnIpCfg cfg); //public void updateValid(@Param("isValid")Integer isValid,@Param("ids")String ids); + public List findByPage(@Param("ids")String ids); public void delete(@Param("ids")String ids); public void updateIssued(AsnIpCfg cfg); public List getByIds(@Param("ids")String ids); diff --git a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml index 6f00e58b4..a410a0451 100644 --- a/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/basics/AsnIpCfgDao.xml @@ -60,7 +60,7 @@ select - ,s.name as creator_name,e.name as editor_name,u.name as auditor_name + ,s.name as creator_name,e.name as editor_name,u.name as auditor_name,d.group_name as asnIpGroupName from asn_ip_cfg r @@ -68,6 +68,7 @@ left join sys_user s on r.creator_id=s.id left join sys_user e on r.editor_id=e.id left join sys_user u on r.auditor_id=u.id + left join policy_group_info d on r.asn_ip_group = d.service_group_id AND ${page.where} @@ -471,4 +472,24 @@ #{asnIp.userRegion5,jdbcType=VARCHAR}) + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java index efeb90a0a..26cb0e9ec 100644 --- a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java +++ b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java @@ -2,6 +2,7 @@ package com.nis.web.dao.basics; import java.util.List; +import org.apache.ibatis.annotations.Param; import com.nis.domain.basics.PolicyGroupInfo; import com.nis.web.dao.CrudDao; @@ -23,4 +24,6 @@ public interface PolicyGroupInfoDao extends CrudDao { Integer getGroupIdByGroupName(String groupName); PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo); + + List findPolicyByGroupInfoList(@Param("ids")String ids); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml index 145a2306d..54db24a59 100644 --- a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml +++ b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml @@ -250,4 +250,20 @@ + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.java b/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.java index 924e2278e..6cd6dcc8d 100644 --- a/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.java +++ b/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.java @@ -27,6 +27,10 @@ public interface ServiceDictInfoDao extends CrudDao { * @return */ List findAllServiceDictInfo(@Param("serviceDictInfo")ServiceDictInfo serviceDictInfo,@Param("orderBy")String orderBy); + + List findByDictInfo(@Param("ids")String ids,@Param("itemType")String itemType); + + /** * 查出所有有效数据父级(!=0) */ diff --git a/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.xml b/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.xml index 12cf5d6c0..1ca9a94c2 100644 --- a/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.xml +++ b/src/main/java/com/nis/web/dao/basics/ServiceDictInfoDao.xml @@ -207,7 +207,16 @@ - + diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml index 89895b804..e5f448047 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml @@ -682,10 +682,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -826,10 +826,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -956,10 +956,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1059,10 +1059,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1159,10 +1159,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1260,10 +1260,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1360,10 +1360,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1455,10 +1455,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy}, r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1558,10 +1558,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1661,10 +1661,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc diff --git a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java index 544cedd5f..37beaed0c 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java @@ -63,6 +63,7 @@ public interface AppMultiFeatureCfgDao { public void deleteAppTcpCfg(BaseCfg entity); public int insertAppComplexFeatureCfg(AppComplexFeatureCfg entity); + public int insertAppComplexFeatureCfgBatch(AppComplexFeatureCfg entity); public void deleteAppComplexFeatureCfg(BaseCfg entity); //IP RANGE配置 public List getAppIpRangeCfg(@Param("compileId")Integer compileId,@Param("functionId")Integer functionId) ; diff --git a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml index 8c2bb17ed..0997b2ee1 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml @@ -104,6 +104,17 @@ + + + + + + + + + + + @@ -191,7 +202,9 @@ r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY, r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE, - r.DISTRICT,r.CFG_KEYWORDS,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG + r.DISTRICT,r.CFG_KEYWORDS,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG, + r.ver,r.ihl,r.tos,r.total_length,r.flags,r.fragment_offset,r.protocol,r.icmp_type,r.icmp_code,r.icmp_identifier, + r.header_type @@ -339,10 +352,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy}, r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -526,16 +539,43 @@ CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME, SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY, ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE, - DISTRICT,CFG_KEYWORDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5 + DISTRICT,CFG_KEYWORDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5, + ver,ihl,tos,total_length,flags,fragment_offset,protocol,icmp_type,icmp_code,icmp_identifier,header_type )values ( , #{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}, #{district,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR}, #{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER}, #{doLog,jdbcType=INTEGER},#{userRegion1,jdbcType=VARCHAR},#{userRegion2,jdbcType=VARCHAR}, - #{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR} + #{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}, + #{ver,jdbcType=VARCHAR},#{ihl,jdbcType=VARCHAR},#{tos,jdbcType=VARCHAR},#{totalLength,jdbcType=VARCHAR}, + #{flags,jdbcType=VARCHAR},#{fragmentOffset,jdbcType=VARCHAR},#{protocol,jdbcType=VARCHAR},#{icmpType,jdbcType=VARCHAR}, + #{icmpCode,jdbcType=VARCHAR},#{icmpIdentifier,jdbcType=VARCHAR},#{headerType,jdbcType=VARCHAR} ) + + + + insert into app_complex_feature_cfg ( + APP_CODE,BEHAV_CODE,SPEC_SERVICE_ID,CFG_DESC,ACTION,IS_VALID,IS_AUDIT, + CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME, + SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY, + ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE, + DISTRICT,CFG_KEYWORDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5, + ver,ihl,tos,total_length,flags,fragment_offset,protocol,icmp_type,icmp_code,icmp_identifier,header_type + )values ( + , + #{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}, + #{district,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR}, + #{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER}, + #{doLog,jdbcType=INTEGER},#{userRegion1,jdbcType=VARCHAR},#{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}, + #{ver,jdbcType=VARCHAR},#{ihl,jdbcType=VARCHAR},#{tos,jdbcType=VARCHAR},#{totalLength,jdbcType=VARCHAR}, + #{flags,jdbcType=VARCHAR},#{fragmentOffset,jdbcType=VARCHAR},#{protocol,jdbcType=VARCHAR},#{icmpType,jdbcType=VARCHAR}, + #{icmpCode,jdbcType=VARCHAR},#{icmpIdentifier,jdbcType=VARCHAR},#{headerType,jdbcType=VARCHAR} + ) + + diff --git a/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml index 1ca23e1cd..0c91f1df8 100644 --- a/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AsnPolicyCfgDao.xml @@ -28,6 +28,7 @@ + @@ -35,7 +36,7 @@ r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY, r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id,r.user_region1, - r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.do_log + r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.do_log,r.do_blacklist @@ -172,7 +173,8 @@ user_region3, user_region4, user_region5, - do_log + do_log, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -199,7 +201,8 @@ #{userRegion3,jdbcType=VARCHAR}, #{userRegion4,jdbcType=VARCHAR}, #{userRegion5,jdbcType=VARCHAR}, - #{doLog,jdbcType=INTEGER} + #{doLog,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -254,6 +257,9 @@ function_id = #{functionId,jdbcType=INTEGER}, + + + do_blacklist = #{doBlackList,jdbcType=INTEGER}, user_region1 = #{userRegion1,jdbcType=VARCHAR}, user_region2 = #{userRegion2,jdbcType=VARCHAR}, diff --git a/src/main/java/com/nis/web/dao/configuration/AvCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AvCfgDao.java index cb4593bc3..ff82c26ff 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AvCfgDao.java @@ -23,4 +23,6 @@ public interface AvCfgDao { public void updateAvSignSampleValid(AvSignSampleCfg entity); public void auditAvFileSample(AvFileSampleCfg entity); public void auditAvSignSample(AvSignSampleCfg entity); + + public List getAvFileBySampleList(@Param("ids")String ids); } diff --git a/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml index eccc12071..b3d1a0426 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvCfgDao.xml @@ -190,10 +190,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -289,10 +289,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -560,4 +560,20 @@ where cfg_id = #{cfgId,jdbcType=BIGINT} + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml index 0e0ae771d..44d539907 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml @@ -24,6 +24,7 @@ + @@ -234,7 +235,7 @@ r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT, r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY, - r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id,r.do_log + r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id,r.do_log,r.do_blacklist r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port @@ -410,10 +411,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -537,10 +538,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -743,7 +744,8 @@ LABLE, AREA_EFFECTIVE_IDS, function_id, - do_log + do_log, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -764,7 +766,8 @@ #{lable,jdbcType=VARCHAR}, #{areaEffectiveIds,jdbcType=VARCHAR}, #{functionId,jdbcType=INTEGER}, - #{doLog,jdbcType=INTEGER} + #{doLog,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -1133,6 +1136,9 @@ do_log = #{doLog,jdbcType=INTEGER}, + + do_blacklist = #{doBlackList,jdbcType=INTEGER}, + @@ -1571,10 +1577,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -1880,10 +1886,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc diff --git a/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml index ea4150a37..0629d63aa 100644 --- a/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml @@ -24,6 +24,7 @@ + @@ -158,7 +159,7 @@ a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT, a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, - a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log + a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log,a.do_blacklist a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port @@ -284,10 +285,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy}, a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -360,7 +361,8 @@ LABLE, AREA_EFFECTIVE_IDS, function_id, - do_log + do_log, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -381,7 +383,8 @@ #{lable,jdbcType=VARCHAR}, #{areaEffectiveIds,jdbcType=VARCHAR}, #{functionId,jdbcType=INTEGER}, - #{doLog,jdbcType=INTEGER} + #{doLog,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -629,6 +632,9 @@ do_log = #{doLog,jdbcType=INTEGER}, + + + do_blacklist = #{doBlackList,jdbcType=INTEGER}, diff --git a/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.java b/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.java index 11cdc8e03..72e786fdf 100644 --- a/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.java +++ b/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.java @@ -1,13 +1,11 @@ package com.nis.web.dao.configuration; -import java.util.Date; import java.util.List; - import org.apache.ibatis.annotations.Param; - import com.nis.domain.configuration.BaseCfg; 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.IpPortCfg; @@ -39,4 +37,8 @@ public interface CommonPolicyDao { public void deleteHttpUrlCfg(@Param("tableName")String tableName, @Param("entity")BaseCfg baseCfg, @Param("compileIds")List compileIds); + + public List getCachePolicyUserRegionList(CachePolicyUserRegion entity); + + public List getCachePolicyByUserRegionList(@Param("ids")String ids); } diff --git a/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml b/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml index 326f79570..70564e398 100644 --- a/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml @@ -32,7 +32,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -131,7 +168,8 @@ a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1, - a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id + a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id, + a.do_blacklist a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port @@ -272,10 +310,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy}, a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -372,7 +410,8 @@ user_region4, user_region5, do_log, - source_compile_id + source_compile_id, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -400,7 +439,8 @@ #{userRegion4,jdbcType=VARCHAR}, #{userRegion5,jdbcType=VARCHAR}, #{doLog,jdbcType=INTEGER}, - #{sourceCompileId,jdbcType=INTEGER} + #{sourceCompileId,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -677,6 +717,9 @@ function_id = #{functionId,jdbcType=INTEGER}, + + + do_blacklist = #{doBlackList,jdbcType=INTEGER}, user_region1 = #{userRegion1,jdbcType=VARCHAR}, user_region2 = #{userRegion2,jdbcType=VARCHAR}, @@ -807,4 +850,119 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml index 6f8ff863a..e325c0507 100644 --- a/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml @@ -286,10 +286,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy}, r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -303,7 +303,7 @@ - from ${tableName} + from ${tableName} a AND ${page.where} @@ -311,10 +311,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc diff --git a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java index 6654b272d..887173001 100644 --- a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java +++ b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.java @@ -35,6 +35,7 @@ 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.PxyObjSpoofingIpPool; import com.nis.domain.configuration.PxyObjTrustedCaCert; import com.nis.domain.configuration.PxyObjTrustedCaCrl; import com.nis.domain.configuration.WebsiteDomainTopic; @@ -88,6 +89,7 @@ public interface ConfigSynchronizationDao { public List getDnsIpCfgList(BaseCfg entity); public List getIpPortListByService(BaseCfg entity); public List getIpDropList(@Param("tableName")String tableName,@Param("compileIds")List compileIds); + List getSpoofingIpPoolList(BaseCfg entity); public List getAppPolicyList(BaseCfg entity); public List getAppFeatureIndexList(BaseCfg entity); @@ -95,4 +97,6 @@ public interface ConfigSynchronizationDao { public List getComplexStrListByService(BaseCfg entity); public List getAppIpPortList(@Param("tableName")String tableName,@Param("compileIds")List compileIds); public List getAppIpFeatureList(BaseCfg entity); + + public void updateCfgStatus(BaseCfg entity); } diff --git a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml index b68e07106..9b76df62b 100644 --- a/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/ConfigSynchronizationDao.xml @@ -36,6 +36,7 @@ + @@ -374,6 +375,7 @@ + @@ -502,6 +504,7 @@ + @@ -734,14 +737,14 @@ a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time, a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable, a.area_effective_ids,a.function_id,a.do_log,a.dns_strategy_id,a.user_region1,a.user_region2, - a.user_region3,a.user_region4,a.user_region5 + a.user_region3,a.user_region4,a.user_region5,a.do_blacklist a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time, a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable, a.area_effective_ids,a.function_id,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port ,a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.pps_threadshold, - a.antiddos_protocol,a.bps_threadshold + a.antiddos_protocol,a.bps_threadshold,a.do_blacklist a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port, @@ -780,7 +783,6 @@ a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time, a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable, a.area_effective_ids,a.function_id,a.do_log,a.user_region1,a.user_region2, - a.user_region3,a.user_region4,a.user_region5,a.raw_len,a.digest,a.cfds_level,a.file_url a.cfg_id,a.cfg_desc @@ -875,6 +877,13 @@ a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port ,a.protocol,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id + + a.CFG_ID, a.CFG_DESC,a.CFG_REGION_CODE, a.IP_TYPE, a.IP_ADDRESS, + a.DIRECTION,a.PROTOCOL,a.IS_VALID,a.IS_AUDIT,a.location,a.port, + a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, + a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, + a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.FUNCTION_ID,a.GROUP_ID,a.user_region + ORDER BY a.CFG_ID @@ -1007,7 +1026,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1139,7 +1166,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1163,7 +1198,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 and (cert_id is null or cert_id == 0) @@ -1199,7 +1242,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1223,7 +1274,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1244,7 +1303,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1269,7 +1336,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1295,7 +1370,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1322,7 +1405,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1346,7 +1437,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1385,7 +1484,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1416,7 +1523,15 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID @@ -1445,11 +1560,48 @@ AND a.action=#{action,jdbcType=INTEGER} - and a.is_valid=#{isValid} and a.is_audit=#{isAudit} + + AND a.is_valid=#{isValid,jdbcType=INTEGER} + + + AND a.is_audit=#{isAudit,jdbcType=INTEGER} + + + AND a.compile_id=#{compileId,jdbcType=INTEGER} + and a.is_valid!=-1 ORDER BY a.CFG_ID + + + + + + + update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, + edit_time = #{editTime,jdbcType=TIMESTAMP} + + ,is_audit = #{isAudit,jdbcType=INTEGER} + ,audit_time=#{auditTime,jdbcType=TIMESTAMP} + + + + AND cfg_id = #{cfgId,jdbcType=BIGINT} + + + AND compile_id = #{compileId,jdbcType=INTEGER} + + and function_id=#{functionId,jdbcType=INTEGER} + + @@ -536,7 +540,10 @@ function_id = #{functionId,jdbcType=INTEGER}, - do_log = #{doLog,jdbcType=INTEGER} + do_log = #{doLog,jdbcType=INTEGER}, + + + do_blacklist = #{doBlackList,jdbcType=INTEGER} @@ -758,10 +765,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -1146,10 +1153,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -1260,4 +1267,20 @@ where cfg_id = #{cfgId,jdbcType=BIGINT} + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java index a31492f26..91236942f 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java @@ -36,6 +36,8 @@ public interface IpAddrPoolCfgDao extends CrudDao{ Long getAddrPoolIdByName(String addrPoolName); IpReuseIpCfg checkAddrPoolIp(@Param("srcIpAddress")String ip); + + List findByPage(@Param("ids")String ids); diff --git a/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml index 859c119db..eb17f8a87 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml @@ -135,10 +135,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.cfg_id DESC + ORDER BY r.is_audit,r.CFG_ID desc @@ -163,7 +163,7 @@ AND r.is_audit = #{isAudit,jdbcType=INTEGER} - ORDER BY r.cfg_id + ORDER BY r.is_audit,r.CFG_ID desc @@ -489,4 +489,28 @@ r.is_audit != 3 AND r.user_region1 IS NOT NULL + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml index fbcda475f..9f923529f 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml @@ -74,6 +74,7 @@ + @@ -197,7 +198,7 @@ a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1, - a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log + a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port @@ -530,10 +531,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -547,7 +548,7 @@ - from ${tableName} + from ${tableName} r AND ${page.where} @@ -555,10 +556,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -809,7 +810,8 @@ user_region3, user_region4, user_region5, - do_log + do_log, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -836,7 +838,8 @@ #{userRegion3,jdbcType=VARCHAR}, #{userRegion4,jdbcType=VARCHAR}, #{userRegion5,jdbcType=VARCHAR}, - #{doLog,jdbcType=INTEGER} + #{doLog,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -866,7 +869,8 @@ user_region3, user_region4, user_region5, - do_log + do_log, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -893,7 +897,8 @@ #{userRegion3,jdbcType=VARCHAR}, #{userRegion4,jdbcType=VARCHAR}, #{userRegion5,jdbcType=VARCHAR}, - #{doLog,jdbcType=INTEGER} + #{doLog,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -984,6 +989,7 @@ cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, action = #{action,jdbcType=INTEGER}, do_log = #{doLog,jdbcType=INTEGER}, + do_blacklist = #{doBlackList,jdbcType=INTEGER}, is_valid = #{isValid,jdbcType=INTEGER}, is_audit = #{isAudit,jdbcType=INTEGER}, @@ -1135,10 +1141,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc diff --git a/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.java b/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.java index 549e736c9..5bd15336f 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.java +++ b/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.java @@ -44,4 +44,8 @@ public interface IpMultiplexDao extends CrudDao{ IpReusePolicyCfg getSnatCfg(@Param("cfgId")Long cfgId,@Param("compileId")Integer compileId); IpReuseDnatPolicyCfg getDnatCfg(@Param("cfgId")Long cfgId,@Param("compileId")Integer compileId); + + List findByPage(@Param("ids")String ids); + + List findPageByDnat(@Param("ids")String ids); } diff --git a/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.xml b/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.xml index 603256054..a672f431c 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.xml @@ -188,10 +188,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.cfg_id DESC + ORDER BY r.is_audit,r.CFG_ID desc @@ -213,7 +213,7 @@ AND r.is_valid != -1 - ORDER BY r.cfg_id + ORDER BY r.is_audit,r.CFG_ID desc @@ -684,10 +684,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY a.cfg_id DESC + ORDER BY a.is_audit,a.CFG_ID desc @@ -709,7 +709,7 @@ AND a.is_valid != -1 - ORDER BY a.cfg_id + ORDER BY a.is_audit,a.CFG_ID desc + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml index 019981f1b..5e379dffe 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml @@ -168,10 +168,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc diff --git a/src/main/java/com/nis/web/dao/configuration/MailCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/MailCfgDao.xml index 16eb823eb..b33ce612b 100644 --- a/src/main/java/com/nis/web/dao/configuration/MailCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/MailCfgDao.xml @@ -23,6 +23,7 @@ + @@ -120,7 +121,7 @@ a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT, a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, - a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log + a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log,a.do_blacklist a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port @@ -242,10 +243,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -312,7 +313,8 @@ LABLE, AREA_EFFECTIVE_IDS, function_id, - do_log + do_log, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -333,7 +335,8 @@ #{lable,jdbcType=VARCHAR}, #{areaEffectiveIds,jdbcType=VARCHAR}, #{functionId,jdbcType=INTEGER}, - #{doLog,jdbcType=INTEGER} + #{doLog,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -460,6 +463,9 @@ do_log = #{doLog,jdbcType=INTEGER}, + + do_blacklist = #{doBlackList,jdbcType=INTEGER} + where cfg_id = #{cfgId,jdbcType=BIGINT} diff --git a/src/main/java/com/nis/web/dao/configuration/ProxyFileStrategyDao.xml b/src/main/java/com/nis/web/dao/configuration/ProxyFileStrategyDao.xml index 51f832b34..1b64e30fb 100644 --- a/src/main/java/com/nis/web/dao/configuration/ProxyFileStrategyDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/ProxyFileStrategyDao.xml @@ -127,10 +127,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc diff --git a/src/main/java/com/nis/web/dao/configuration/PxyObjKeyringDao.xml b/src/main/java/com/nis/web/dao/configuration/PxyObjKeyringDao.xml index 2971e2990..8e4ea49a9 100644 --- a/src/main/java/com/nis/web/dao/configuration/PxyObjKeyringDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/PxyObjKeyringDao.xml @@ -213,10 +213,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -296,10 +296,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_valid desc, r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_valid desc, r.is_audit,r.CFG_ID desc diff --git a/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.java b/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.java index b36b2cab5..75ffe3093 100644 --- a/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.java +++ b/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.java @@ -18,4 +18,6 @@ public interface PxyObjSpoofingIpPoolDao extends CrudDao{ PxyObjSpoofingIpPool getPxyObjSpoofingIpPool(Long cfgId); int insert(PxyObjSpoofingIpPool spoofingPool); int update(PxyObjSpoofingIpPool spoofingPool); + + List findByPage(@Param("ids")String ids); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.xml b/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.xml index 5fb39f261..399c7a143 100644 --- a/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/PxyObjSpoofingIpPoolDao.xml @@ -121,10 +121,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.CFG_ID desc - ORDER BY r.CFG_ID desc + ORDER BY r.is_audit,r.CFG_ID desc @@ -138,7 +138,7 @@ + SELECT + + + ,s.name as creator_name,e.name as editor_name,u.name as auditor_name + ,ri.request_title as requestName,p.group_name as group_name + + FROM pxy_obj_spoofing_ip_pool r + left join policy_group_info p on p.group_id=r.group_id + left join sys_user s on r.creator_id=s.id + left join sys_user e on r.editor_id=e.id + left join sys_user u on r.auditor_id=u.id + left join request_info ri on r.request_id=ri.id + where r.CFG_ID in (${ids}) + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/RequestInfoDao.xml b/src/main/java/com/nis/web/dao/configuration/RequestInfoDao.xml index b18d65812..8c0e0c100 100644 --- a/src/main/java/com/nis/web/dao/configuration/RequestInfoDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/RequestInfoDao.xml @@ -86,10 +86,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.create_time desc - ORDER BY r.create_time desc + ORDER BY r.is_audit,r.create_time desc @@ -99,7 +99,7 @@ select from request_info - where request_number = #{requestNumber,jdbcType=VARCHAR} + where request_number = #{requestNumber,jdbcType=VARCHAR} and is_valid !=-1 @@ -363,7 +363,7 @@ - from ${tableName} + from ${tableName} r AND ${page.where} @@ -371,10 +371,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.cfg_id desc - ORDER BY CFG_ID desc + ORDER BY r.is_audit,r.cfg_id desc diff --git a/src/main/java/com/nis/web/dao/configuration/TaskInfoDao.xml b/src/main/java/com/nis/web/dao/configuration/TaskInfoDao.xml index 93032cba3..89ffda0ef 100644 --- a/src/main/java/com/nis/web/dao/configuration/TaskInfoDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/TaskInfoDao.xml @@ -84,10 +84,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},r.is_audit,r.create_time desc - ORDER BY r.create_time desc + ORDER BY r.is_audit,r.create_time desc @@ -96,7 +96,7 @@ select from task_info - where task_name = #{taskName,jdbcType=VARCHAR} + where task_name = #{taskName,jdbcType=VARCHAR} and is_valid !=-1 + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml index c8c5d2e21..ae5586621 100644 --- a/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml @@ -33,6 +33,7 @@ + @@ -132,7 +133,8 @@ a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1, - a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id + a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id, + a.do_blacklist a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port @@ -331,10 +333,10 @@ - ORDER BY ${page.orderBy} + ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc - ORDER BY a.CFG_ID desc + ORDER BY a.is_audit,a.CFG_ID desc @@ -476,7 +478,8 @@ user_region4, user_region5, do_log, - source_compile_id + source_compile_id, + do_blacklist )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -504,7 +507,8 @@ #{userRegion4,jdbcType=VARCHAR}, #{userRegion5,jdbcType=VARCHAR}, #{doLog,jdbcType=INTEGER}, - #{sourceCompileId,jdbcType=INTEGER} + #{sourceCompileId,jdbcType=INTEGER}, + #{doBlackList,jdbcType=INTEGER} ) @@ -923,6 +927,9 @@ function_id = #{functionId,jdbcType=INTEGER}, + + + do_blacklist = #{doBlackList,jdbcType=INTEGER}, user_region1 = #{userRegion1,jdbcType=VARCHAR}, user_region2 = #{userRegion2,jdbcType=VARCHAR}, diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java index 47a47e210..13974d1f4 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java @@ -49,4 +49,6 @@ public interface SpecificServiceCfgDao extends CrudDao { SpecificServiceCfg getRepeat(@Param("specServiceCode")Integer code, @Param("cfgType")Integer cfgType,@Param("parentId")Integer parentId); Integer getMaxServiceCode(@Param("maxCode")Integer code, @Param("cfgType")Integer cfgType,@Param("addFlag")Integer addFlag); + List findBySpecificServiceCfg(@Param("ids")String ids); + } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml index 031bcc105..772c4222d 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml @@ -213,4 +213,13 @@ + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/BaseService.java b/src/main/java/com/nis/web/service/BaseService.java index e84df21e6..f4902b221 100644 --- a/src/main/java/com/nis/web/service/BaseService.java +++ b/src/main/java/com/nis/web/service/BaseService.java @@ -46,7 +46,9 @@ import com.nis.domain.callback.InlineIp; import com.nis.domain.callback.NtcDnsResStrategy; import com.nis.domain.callback.ProxyObjKeyring; import com.nis.domain.callback.ProxyObjTrustedCa; +import com.nis.domain.configuration.AppComplexFeatureCfg; import com.nis.domain.configuration.AppDomainCfg; +import com.nis.domain.configuration.AppFeatureIndex; import com.nis.domain.configuration.AppHttpCfg; import com.nis.domain.configuration.AppIpCfg; import com.nis.domain.configuration.AppPolicyCfg; @@ -80,12 +82,14 @@ import com.nis.domain.specific.SpecificServiceCfg; import com.nis.util.ConfigServiceUtil; import com.nis.util.Configurations; import com.nis.util.Constants; +import com.nis.util.DictUtils; import com.nis.util.IpUtil; import com.nis.util.Reflections; import com.nis.util.StringUtil; import com.nis.util.StringUtils; import com.nis.web.dao.basics.AsnIpCfgDao; import com.nis.web.dao.configuration.AppCfgDao; +import com.nis.web.dao.configuration.AppMultiFeatureCfgDao; import com.nis.web.dao.configuration.DdosCfgDao; import com.nis.web.dao.configuration.DnsIpCfgDao; import com.nis.web.dao.configuration.DnsResStrategyDao; @@ -204,7 +208,8 @@ public abstract class BaseService { } else { // 如果包含全部权限,则去掉之前添加的所有条件但增加配置审核取消以及删除的配置,并跳出循环。 sqlString = new StringBuilder(); - sqlString.append(" OR " + configAlias + ".is_audit !=3"); +// sqlString.append(" OR " + configAlias + ".is_audit !=3"); + sqlString.append(" OR " + configAlias + ".creator_id <> 1"); } } if (StringUtils.isNotBlank(sqlString.toString())) { @@ -271,11 +276,14 @@ public abstract class BaseService { + ".type>1)"); } else if (SysRole.DATA_SCOPE_CREATOR.equals(dataScope)) { - scopeSql.append(" OR " + configAlias + ".is_audit !=3"); +// scopeSql.append(" OR " + configAlias + ".is_audit !=3"); + scopeSql.append(" OR " + configAlias + ".creator_id <>1 "); } else if (SysRole.DATA_SCOPE_AUDITOR.equals(dataScope)) { scopeSql.append(" OR " + configAlias + ".is_audit = 0 or " + configAlias + ".is_audit = 1"); + scopeSql.append(" OR " + configAlias + ".creator_id <>1 "); } else if (SysRole.DATA_SCOPE_SHOWER.equals(dataScope)) { scopeSql.append(" OR " + configAlias + ".is_audit = 1"); + scopeSql.append(" OR " + configAlias + ".creator_id <>1 "); } return scopeSql.toString(); @@ -600,7 +608,12 @@ public abstract class BaseService { if (baseIpCfg.getProtocolId() != null && baseIpCfg.getProtocolId() != 0) { if (numGroupId == 0) { GroupCfg group1 = new GroupCfg(); - group1.setGroupId(groupId); + //group1.setGroupId(groupId); + if(baseIpCfg.getNumberRegionGroupId()!=null) { + group1.setGroupId(baseIpCfg.getNumberRegionGroupId()); + }else { + group1.setGroupId(ConfigServiceUtil.getId(2, 1).get(0)); + } group1.setCompileId(baseIpCfg.getCompileId()); group1.setAuditTime(baseIpCfg.getAuditTime()); group1.setIsValid(baseIpCfg.getIsValid()); @@ -1585,7 +1598,9 @@ public abstract class BaseService { public void saveAndSend(FunctionRegionDict regionDict,FunctionServiceDict serviceDict, SpecificServiceCfg specificServiceCfg, List list,List cfgIndexInfos, - List appPolicyCfgs,boolean send){ + List appPolicyCfgs, + List appFeatureCfgs, + boolean send){ if(list!=null&&list.size()>0) { String type=null; if (list.get(0) instanceof BaseIpCfg) { @@ -1598,6 +1613,8 @@ public abstract class BaseService { type="DnsResStrategy"; }else if(list.get(0) instanceof AsnIpCfg) { type="AsnIpCfg"; + }else if(list.get(0) instanceof AppComplexFeatureCfg) { + type="AppComplexFeature"; } if (cfgIndexInfos != null && cfgIndexInfos.size() > 0) { this.saveCfgIndexOf(cfgIndexInfos); @@ -1605,16 +1622,23 @@ public abstract class BaseService { if (appPolicyCfgs != null && appPolicyCfgs.size() > 0) { this.savePolicyList(appPolicyCfgs); } + if (appFeatureCfgs != null && appFeatureCfgs.size() > 0) { + this.saveAppFeatureList(appFeatureCfgs); + } + if("BaseIpCfg".equals(type)) { List listPage = (List) list; if (specificServiceCfg!=null&®ionDict.getFunctionId().equals(405)) { - this.saveAppIpCfg((List)listPage,specificServiceCfg); + this.saveAppIpCfg((List)listPage,specificServiceCfg,send); }else { this.saveIpBatch(regionDict,serviceDict,(List)listPage,send); } }else if("AsnIpCfg".equals(type)) { List listPage = (List) list; this.saveAsnIpBatch(listPage); + }else if("AppComplexFeature".equals(type)) { + List listPage = (List) list; + this.saveAppComplexFeatureBatch(listPage); }else if("BaseStringCfg".equals(type)) { List> listPage = (List>) list; // 调用对应配置的service @@ -1680,6 +1704,19 @@ public abstract class BaseService { else if("subscribe_id".equals(regionDict.getConfigServiceType())){ this.saveStringCfgBatch(regionDict,serviceDict,listPage, "ntc_subscribe_id_cfg",send); } + // HTTP(s) URL + else if(regionDict.getDictId().intValue()==97 || regionDict.getDictId().intValue()==79 || + regionDict.getDictId().intValue()==85 || regionDict.getDictId().intValue()==91 || + regionDict.getDictId().intValue()==99){ + this.saveStringCfgBatch(regionDict,serviceDict,listPage, "http_url_cfg",send); + } + // HTTP(s) 请求/应答内容 + else if(regionDict.getDictId().intValue()==94 || regionDict.getDictId().intValue()==95 || + regionDict.getDictId().intValue()==88 || regionDict.getDictId().intValue()==89 || + regionDict.getDictId().intValue()==82 || regionDict.getDictId().intValue()==83 || + regionDict.getDictId().intValue()==103 || regionDict.getDictId().intValue()==104){ + this.saveStringCfgBatch(regionDict,serviceDict,listPage, "http_body_cfg",send); + } }else if("ComplexkeywordCfg".equals(type)) { List listPage = (List) list; // DNS @@ -1706,6 +1743,21 @@ public abstract class BaseService { if(regionDict.getDictId().intValue()==63) { // appCfgService.saveAppHttpCfg(listPage); this.saveComplexkeywordCfgBatch(regionDict,serviceDict,listPage, AppHttpCfg.getTablename(),send); + }else + //app Http特征 + if(regionDict.getDictId().intValue()==220 || regionDict.getDictId().intValue()==216 || regionDict.getDictId().intValue()==224){ + this.saveComplexkeywordCfgBatch(regionDict,serviceDict,listPage,"app_complex_feature_cfg",send); + } + // HTTP(s)请求头域 + if(regionDict.getDictId().intValue()==98 || regionDict.getDictId().intValue()==80 || + regionDict.getDictId().intValue()==86 || regionDict.getDictId().intValue()==92 || + regionDict.getDictId().intValue()==100) { + this.saveComplexkeywordCfgBatch(regionDict,serviceDict,listPage, "http_req_head_cfg",send); + }else + // HTTP(s)响应头域 + if(regionDict.getDictId().intValue()==102 || regionDict.getDictId().intValue()==81 || + regionDict.getDictId().intValue()==87 || regionDict.getDictId().intValue()==93) { + this.saveComplexkeywordCfgBatch(regionDict,serviceDict,listPage, "http_res_head_cfg",send); } }else if("DnsResStrategy".equals(type)) { List listPage = (List) list; @@ -1768,6 +1820,30 @@ public abstract class BaseService { } } + + /** + * APP Payload导入配置时数据批量入库 + * @param data + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void saveAppComplexFeatureBatch(List data) { + SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class); + SqlSession batchSqlSession = null; + try{ + batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); + for(int index = 0; index < data.size();index++){ + AppComplexFeatureCfg cfg = data.get(index); + ((AppMultiFeatureCfgDao) batchSqlSession.getMapper(AppMultiFeatureCfgDao.class)).insertAppComplexFeatureCfgBatch(cfg); + } + batchSqlSession.commit(); + }finally { + if(batchSqlSession != null){ + batchSqlSession.close(); + } + } + + } + /** * 同一个app下的ip批量保存 * @param cfgs @@ -1775,7 +1851,7 @@ public abstract class BaseService { * @throws Exception */ @Transactional(readOnly = false, rollbackFor = RuntimeException.class) - public void saveAppIpCfg(List cfgs,SpecificServiceCfg specificServiceCfg){ + public void saveAppIpCfg(List cfgs,SpecificServiceCfg specificServiceCfg,boolean send){ logger.warn("Start to save IP"); ConfigGroupInfoDao configGroupInfoDao=SpringContextHolder.getBean(ConfigGroupInfoDao.class); SpecificServiceCfgDao specificServiceCfgDao=SpringContextHolder.getBean(SpecificServiceCfgDao.class); @@ -1800,25 +1876,182 @@ public abstract class BaseService { Integer compileId = configGroupInfo.getCompileId(); // Varibles maxPacket=asnIpCfgDao.getVaribles("max_allowed_packet"); List tempList=Lists.newArrayList(); + int len=0; + int index=0; for(BaseIpCfg cfg:cfgs) { AppIpCfg entity=new AppIpCfg(); BeanUtils.copyProperties(cfg, entity); entity.setCompileId(compileId); + cfg.setCompileId(compileId); + cfg.setGroupId(specificServiceCfg.getGroupId()); int tempLen=entity.toString().getBytes(Charset.forName("UTF-8")).length; if((len+tempLen) configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + if(configGroupInfo.getIsIssued()==0) {//未下发,下发region compile,group. + MaatCfg maatCfg = new MaatCfg(); + ToMaatBean maatBean = new ToMaatBean(); + maatCfg.initDefaultValue(); + //group + GroupCfg groupCfg=new GroupCfg(); + groupCfg.setCompileId(compileId); + groupCfg.setGroupId(configGroupInfo.getGroupId()); + groupCfg.setIsValid(Constants.VALID_YES); + groupCfg.setAuditTime(tempList.get(0).getAuditTime()); + groupRelationList.add(groupCfg); + BeanUtils.copyProperties(cfgs.get(0), maatCfg); + ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId())); + maatCfg.setAction(tempList.get(0).getAction()); + maatCfg.setAuditTime(tempList.get(0).getAuditTime()); + maatCfg.setIpRegionList(ipRegionList); + maatCfg.setStrRegionList(strRegionList); + maatCfg.setNumRegionList(numRegionList); + maatCfg.setDigestRegionList(digestRegionList); + maatCfg.setGroupRelationList(groupRelationList); + maatCfg.setGroupNum(groupRelationList.size()); + maatCfg.setAreaIpRegionList(areaIpRegionList); + maatCfg.setIsValid(tempList.get(0).getIsValid()); + // 设置APP自定义域 + String userRegion = "APP_ID=" + tempList.get(0).getAppCode()/*+Constants.USER_REGION_SPLIT+"ASEV_ID="+businessType*/; + maatCfg.setUserRegion(userRegion); + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(tempList.get(0).getAuditTime()); + maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app协议IP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("app协议IP配置下发响应信息:" + result.getMsg()); + configGroupInfo.setIsIssued(1); + configGroupInfo.setUpdateTime(new Date()); + configGroupInfoDao.updateConfigGroupInfobyGroupId(configGroupInfo); + }else if(configGroupInfo.getIsIssued()==1) {//已经下发,分组复用下发 + GroupReuseAddBean maatBean = new GroupReuseAddBean(); + List groupReuseList=new ArrayList<>(); + GroupReuseCfg groupReuseCfg=new GroupReuseCfg(); + /*groupReuseCfg.setUserRegion(userRegion);*/ + groupReuseCfg.setServiceId(tempList.get(0).getServiceId()); + ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId())); + groupReuseCfg.setIpRegionList(ipRegionList); + groupReuseCfg.setStrRegionList(strRegionList); + groupReuseCfg.setNumRegionList(numRegionList); + groupReuseList.add(groupReuseCfg); + maatBean.setGroupReuseCfgList(groupReuseList); + maatBean.setAuditTime(tempList.get(0).getAuditTime()); + maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + //调用服务接口下发配置数据 + String json=gsonToJson(maatBean); + logger.info("app协议IP域新增配置下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json); + logger.info("app协议IP域新增配置响应信息:"+result.getMsg()); + }else { + throw new RuntimeException("Unknown configGroupInfo isIssued value"); + } + } tempList.clear(); tempList.add(entity); len=tempLen; } + index ++; } if(tempList.size()>0) { logger.warn("save ip size:"+tempList.size()); appCfgDao.insertAppIpCfgBatch(tempList); + if(send) { + if(send) { + List configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + if(configGroupInfo.getIsIssued()==0) {//未下发,下发region compile,group. + MaatCfg maatCfg = new MaatCfg(); + ToMaatBean maatBean = new ToMaatBean(); + maatCfg.initDefaultValue(); + //group + GroupCfg groupCfg=new GroupCfg(); + groupCfg.setCompileId(compileId); + groupCfg.setGroupId(configGroupInfo.getGroupId()); + groupCfg.setIsValid(Constants.VALID_YES); + groupCfg.setAuditTime(tempList.get(0).getAuditTime()); + groupRelationList.add(groupCfg); + BeanUtils.copyProperties(cfgs.get(0), maatCfg); + ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId())); + maatCfg.setAction(tempList.get(0).getAction()); + maatCfg.setAuditTime(tempList.get(0).getAuditTime()); + maatCfg.setIpRegionList(ipRegionList); + maatCfg.setStrRegionList(strRegionList); + maatCfg.setNumRegionList(numRegionList); + maatCfg.setDigestRegionList(digestRegionList); + maatCfg.setGroupRelationList(groupRelationList); + maatCfg.setGroupNum(groupRelationList.size()); + maatCfg.setAreaIpRegionList(areaIpRegionList); + maatCfg.setIsValid(tempList.get(0).getIsValid()); + // 设置APP自定义域 + String userRegion = "APP_ID=" + tempList.get(0).getAppCode()/*+Constants.USER_REGION_SPLIT+"ASEV_ID="+businessType*/; + maatCfg.setUserRegion(userRegion); + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(tempList.get(0).getAuditTime()); + maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app协议IP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("app协议IP配置下发响应信息:" + result.getMsg()); + configGroupInfo.setIsIssued(1); + configGroupInfo.setUpdateTime(new Date()); + configGroupInfoDao.updateConfigGroupInfobyGroupId(configGroupInfo); + }else if(configGroupInfo.getIsIssued()==1) {//已经下发,分组复用下发 + GroupReuseAddBean maatBean = new GroupReuseAddBean(); + List groupReuseList=new ArrayList<>(); + GroupReuseCfg groupReuseCfg=new GroupReuseCfg(); + /*groupReuseCfg.setUserRegion(userRegion);*/ + groupReuseCfg.setServiceId(tempList.get(0).getServiceId()); + ipRegionList.addAll(groupReuseCfgAddRemoveConvert(tempList,Constants.VALID_YES,configGroupInfo.getGroupId())); + groupReuseCfg.setIpRegionList(ipRegionList); + groupReuseCfg.setStrRegionList(strRegionList); + groupReuseCfg.setNumRegionList(numRegionList); + groupReuseList.add(groupReuseCfg); + maatBean.setGroupReuseCfgList(groupReuseList); + maatBean.setAuditTime(tempList.get(0).getAuditTime()); + maatBean.setCreatorName(tempList.get(0).getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + //调用服务接口下发配置数据 + String json=gsonToJson(maatBean); + logger.info("app协议IP域新增配置下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postGroupReuseSources(json); + logger.info("app协议IP域新增配置响应信息:"+result.getMsg()); + }else { + throw new RuntimeException("Unknown configGroupInfo isIssued value"); + } + } + } tempList.clear(); } long end=System.currentTimeMillis(); @@ -1867,6 +2100,31 @@ public abstract class BaseService { } } } + + + /** + * 导入配置保存App特征 + * @param appPolicyCfgs + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void saveAppFeatureList(List appFeatures){ + SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class); + SqlSession batchSqlSession = null; + try{ + batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); + for(int index = 0; index < appFeatures.size();index++){ + AppFeatureIndex _cfg = appFeatures.get(index); + ((AppMultiFeatureCfgDao) batchSqlSession.getMapper(AppMultiFeatureCfgDao.class)).insertAppFeatureIndex(_cfg); + } + batchSqlSession.commit(); + }finally { + if(batchSqlSession != null){ + batchSqlSession.close(); + } + } + } + + /** * 导入配置时数据批量入库(IP配置) * @@ -1896,7 +2154,12 @@ public abstract class BaseService { BeanUtils.copyProperties(_cfg, dnsIpCfg); //如果insert加入了select last_insert_id,会拖慢6~7倍以上的效率 ((DnsIpCfgDao) batchSqlSession.getMapper(DnsIpCfgDao.class)).insert(dnsIpCfg); - }else { + } else if(regionDict.getFunctionId().equals(565) || regionDict.getFunctionId().equals(566) || regionDict.getFunctionId().equals(563)){ + AppIpCfg app =new AppIpCfg(); + BeanUtils.copyProperties(_cfg, app); + ((AppMultiFeatureCfgDao) batchSqlSession.getMapper(AppMultiFeatureCfgDao.class)).insertAppIpRangeCfg(app); + } + else { batchSqlSession.getMapper(IpCfgDao.class).insertForBatch(_cfg); } @@ -1913,7 +2176,43 @@ public abstract class BaseService { _cfg.setUserRegion3(StringUtil.isEmpty(_cfg.getUserRegion3()) ? "":_cfg.getUserRegion3()); maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY+"="+_cfg.getUserRegion3()); } + }else if(regionDict.getFunctionId()==510) { + maatCfg.setUserRegion(Constants.P2P_IP_TYPE_USER_REGION_KEY+"="+_cfg.getUserRegion2()); + }else if(regionDict.getFunctionId()==7) { + if(!StringUtil.isEmpty(_cfg.getDnsStrategyId())){ +// maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT); + maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+_cfg.getDnsStrategyId()); + } + }else if(regionDict.getFunctionId()==407) {// Protocol Identify + maatCfg.setUserRegion(Constants.PROTO_ID_REGION + "=" + _cfg.getAppCode()); + }else if(regionDict.getFunctionId()==63) {// APP Policy + maatCfg.setUserRegion(Constants.APP_ID_REGION + "=" + _cfg.getAppCode()+Constants.USER_REGION_SPLIT+Constants.APP_VIGNORE_USER_REGION_KEY+"=1"); + }else if(regionDict.getFunctionId()==408) {// Behavior Identify + maatCfg.setUserRegion(Constants.PROTO_ID_REGION + "=" + _cfg.getAppCode()+Constants.USER_REGION_SPLIT+Constants.APP_VIGNORE_USER_REGION_KEY+"=1"); + }else if(regionDict.getFunctionId()==301) {// Anti DDOS + Map umap= new HashMap(); + umap.put("protocol", _cfg.getAntiddosProtocol()); + umap.put("bps_threadshold", _cfg.getBpsThreadshold()); + umap.put("pps_threadshold", _cfg.getPpsThreadshold()); + maatCfg.setUserRegion(new Gson().toJson(umap)); + }else if(regionDict.getFunctionId()==200) {// IP Intercept + maatCfg.setUserRegion(Constants.USER_REGION_PLACEHOLDER); + if(_cfg.getAction().equals(Constants.MONIT_ACTION)) { + maatCfg.setUserRegion(Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"="+Constants.USER_REGION_PLACEHOLDER); + } + }else if(regionDict.getFunctionId()==207 || regionDict.getFunctionId()==208 || regionDict.getFunctionId()==209) {// HTTP(s)阻断、重定向、替换 + String userRegion = Constants.USER_REGION_PLACEHOLDER; + if(_cfg.getAction().equals(Constants.REJECT_ACTION)) {// 阻断 + userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+_cfg.getUserRegion1()+";"+Constants.REDIRECT_CONTENT_KEY+"="+_cfg.getUserRegion2(); + }else if(_cfg.getAction().equals(48)) {// 重定向 + userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+_cfg.getUserRegion1()+";"+Constants.REDIRECT_URL_KEY+"="+_cfg.getUserRegion2();; + }else if(_cfg.getAction().equals(Constants.REPLACE_ACTION)) {// 替换 + String substitute = "/"+_cfg.getUserRegion2()+"/"+_cfg.getUserRegion3(); + userRegion = Constants.REPLACE_ZONE_KEY+"="+_cfg.getUserRegion1()+";"+Constants.REPLACE_SUBSTITUTE_KEY+"="+substitute; + } + maatCfg.setUserRegion(userRegion); } + configCompileList.add(maatCfg); }else { //根据具体情况判断 @@ -1931,7 +2230,7 @@ public abstract class BaseService { maatBean.setOpAction(Constants.INSERT_ACTION); // 调用服务接口下发配置数据 String json = BaseService.gsonToJson(maatBean); - if(configCompileList.size()>100) { + if(configCompileList.size()>10) { logger.info("IP 配置下发配置条数:" + configCompileList.size()); }else { logger.info("IP 配置下发配置参数:" + json); @@ -1994,8 +2293,36 @@ public abstract class BaseService { } if (send) { if(regionDict.getIsMaat().intValue()==1) { - configCompileList.add(convertMaatCfg(_cfg,2)); + MaatCfg maatCfg=convertMaatCfg(_cfg,2); //userregion处理 + if(regionDict.getFunctionId()==7) { + if(!StringUtil.isEmpty(_cfg.getDnsStrategyId())){ + // maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT); + maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+_cfg.getDnsStrategyId()); + } + }else if(regionDict.getDictId()==159) { + maatCfg.setUserRegion(Constants.P2P_HASH_TYPE_USER_REGION_KEY+"="+_cfg.getUserRegion1()); + }else if(regionDict.getFunctionId()==201) {// Domain Intercept + String userRegion = Constants.USERREGION_DOMAIN_ID+"="+_cfg.getCompileId()+";"+Constants.USERREGION_DOMAIN_STR+"="+_cfg.getCfgKeywords(); + if(_cfg.getAction().equals(Constants.MONIT_ACTION)) {// 监测 需要发keyring_id、拦截强度 + userRegion = Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"=0"+";"+Constants.INTERCEPT_DOMAN_INTENSITY_USER_REGION_KEY+"="+_cfg.getUserRegion5()+";" + userRegion; + }else if(_cfg.getAction().equals(Constants.RATELIMIT_ACTION)) {// 限速 需要发Droprate + userRegion = Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+_cfg.getUserRegion2()+";" + userRegion; + } + maatCfg.setUserRegion(userRegion); + }else if(regionDict.getFunctionId()==207 || regionDict.getFunctionId()==208 || regionDict.getFunctionId()==209) {// HTTP(s)阻断、重定向、替换 + String userRegion = Constants.USER_REGION_PLACEHOLDER; + if(_cfg.getAction().equals(Constants.REJECT_ACTION)) {// 阻断 + userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+_cfg.getUserRegion1()+";"+Constants.REDIRECT_CONTENT_KEY+"="+_cfg.getUserRegion2(); + }else if(_cfg.getAction().equals(48)) {// 重定向 + userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+_cfg.getUserRegion1()+";"+Constants.REDIRECT_URL_KEY+"="+_cfg.getUserRegion2();; + }else if(_cfg.getAction().equals(Constants.REPLACE_ACTION)) {// 替换 + String substitute = "/"+_cfg.getUserRegion2()+"/"+_cfg.getUserRegion3(); + userRegion = Constants.REPLACE_ZONE_KEY+"="+_cfg.getUserRegion1()+";"+Constants.REPLACE_SUBSTITUTE_KEY+"="+substitute; + } + maatCfg.setUserRegion(userRegion); + } + configCompileList.add(maatCfg); } } @@ -2009,7 +2336,7 @@ public abstract class BaseService { maatBean.setOpAction(Constants.INSERT_ACTION); // 调用服务接口下发配置数据 String json = BaseService.gsonToJson(maatBean); - if(configCompileList.size()>100) { + if(configCompileList.size()>10) { logger.info("字符串配置下发配置条数:" + configCompileList.size()); }else { logger.info("字符串配置下发配置参数:" + json); @@ -2037,29 +2364,94 @@ public abstract class BaseService { */ @Transactional(readOnly=false,rollbackFor=RuntimeException.class) public void saveComplexkeywordCfgBatch(FunctionRegionDict regionDict, FunctionServiceDict serviceDict,List data, String tableName,boolean send) { - SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class); - SqlSession batchSqlSession = null; - try{ - batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); - for(int index = 0; index < data.size();index++){ - ComplexkeywordCfg cfg = data.get(index); - cfg.setTableName(tableName); - if(regionDict.getDictId().intValue()==63) { - AppHttpCfg _cfg=new AppHttpCfg(); - BeanUtils.copyProperties(cfg, _cfg); - ((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppHttpCfgBatch(_cfg); - }else { - ((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).saveComplexkeywordCfgBatch(cfg); - } - - - } - batchSqlSession.commit(); - }finally { - if(batchSqlSession != null){ - batchSqlSession.close(); + if (regionDict != null) { + Integer regionType = regionDict.getRegionType(); + if (3 == regionType.intValue()) { + SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class); + List configCompileList = new ArrayList(); + SqlSession batchSqlSession = null; + try{ + batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); + for(int index = 0; index < data.size();index++){ + ComplexkeywordCfg cfg = data.get(index); + cfg.setTableName(tableName); + if(regionDict.getDictId().intValue()==63) { + AppHttpCfg _cfg=new AppHttpCfg(); + BeanUtils.copyProperties(cfg, _cfg); + ((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppHttpCfgBatch(_cfg); + }else if(regionDict.getDictId().intValue()==220 || regionDict.getDictId().intValue()==216 || regionDict.getDictId().intValue()==224){ + AppComplexFeatureCfg appCfg=new AppComplexFeatureCfg(); + BeanUtils.copyProperties(cfg, appCfg); + ((AppMultiFeatureCfgDao) batchSqlSession.getMapper(AppMultiFeatureCfgDao.class)).insertAppComplexFeatureCfg(appCfg); + } + else { + ((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).saveComplexkeywordCfgBatch(cfg); + } + if (send) { + if(regionDict.getIsMaat().intValue()==1) { + MaatCfg maatCfg=convertMaatCfg(cfg,3); + //userregion处理 + if(regionDict.getFunctionId()==7) { + if(!StringUtil.isEmpty(cfg.getDnsStrategyId())){ + // maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT); + maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+cfg.getDnsStrategyId()); + } + }else if(regionDict.getDictId()==10) { + String dictValue = DictUtils.getDictCode(Constants.HTTP_HEADER_DICT_MODULE, cfg.getDistrict()); + if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){ + maatCfg.setUserRegion(Constants.HTTP_HEADER_USER_REGION_KEY+"="+cfg.getDistrict()); + } + }else if(regionDict.getDictId()==11) { + String dictValue = DictUtils.getDictCode(Constants.HTTP_HEADER_DICT_MODULE, cfg.getDistrict()); + if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){ + maatCfg.setUserRegion(Constants.HTTP_HEADER_USER_REGION_KEY+"="+cfg.getDistrict()); + } + }else if(regionDict.getFunctionId()==207 || regionDict.getFunctionId()==208 || regionDict.getFunctionId()==209) {// HTTP(s)阻断、重定向、替换 + String userRegion = Constants.USER_REGION_PLACEHOLDER; + if(cfg.getAction().equals(Constants.REJECT_ACTION)) {// 阻断 + userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+";"+Constants.REDIRECT_CONTENT_KEY+"="+cfg.getUserRegion2(); + }else if(cfg.getAction().equals(48)) {// 重定向 + userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+";"+Constants.REDIRECT_URL_KEY+"="+cfg.getUserRegion2();; + }else if(cfg.getAction().equals(Constants.REPLACE_ACTION)) {// 替换 + String substitute = "/"+cfg.getUserRegion2()+"/"+cfg.getUserRegion3(); + userRegion = Constants.REPLACE_ZONE_KEY+"="+cfg.getUserRegion1()+";"+Constants.REPLACE_SUBSTITUTE_KEY+"="+substitute; + } + maatCfg.setUserRegion(userRegion); + } + configCompileList.add(maatCfg); + } + } + + } + if (send && configCompileList.size() > 0) { + ToMaatBean maatBean = new ToMaatBean(); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(new Date()); + maatBean.setCreatorName(UserUtils.getUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + // 调用服务接口下发配置数据 + String json = BaseService.gsonToJson(maatBean); + if(configCompileList.size()>10) { + logger.info("增强字符串配置下发配置条数:" + configCompileList.size()); + }else { + logger.info("增强字符串配置下发配置参数:" + json); + } + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("增强字符串配置下发响应信息:" + result.getMsg()); + + } + batchSqlSession.commit(); + }finally { + if(batchSqlSession != null){ + batchSqlSession.close(); + } + } } + } + } /** * asn ip分组复用新增 diff --git a/src/main/java/com/nis/web/service/LogService.java b/src/main/java/com/nis/web/service/LogService.java index ef1691366..87216ef73 100644 --- a/src/main/java/com/nis/web/service/LogService.java +++ b/src/main/java/com/nis/web/service/LogService.java @@ -15,27 +15,24 @@ public class LogService extends CrudService { @Autowired protected SysLogDao sysLogDao; public Page findPage(Page page, SysLog sysLog) { - // 设置默认时间范围,默认当前月 - if (sysLog.getBeginDate() == null){ - sysLog.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1)); - } if (sysLog.getEndDate() == null){ - sysLog.setEndDate(DateUtils.addMonths(sysLog.getBeginDate(), 1)); + sysLog.setEndDate(DateUtils.parseDate(DateUtils.getDate())); + } + if (sysLog.getBeginDate() == null){ + sysLog.setBeginDate(DateUtils.addMonths(sysLog.getEndDate(), -1)); } - return super.findPage(page, sysLog); } public Page findCfgOperationLogPage(Page page, SysLog sysLog) { - // 设置默认时间范围,默认当前月 - if (sysLog.getBeginDate() == null){ - sysLog.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1)); - } if (sysLog.getEndDate() == null){ - sysLog.setEndDate(DateUtils.addMonths(sysLog.getBeginDate(), 1)); + sysLog.setEndDate(DateUtils.parseDate(DateUtils.getDate())); + } + if (sysLog.getBeginDate() == null){ + sysLog.setBeginDate(DateUtils.addMonths(sysLog.getEndDate(), -1)); } sysLog.setPage(page); List list = sysLogDao.findCfgOperationLogList(sysLog); diff --git a/src/main/java/com/nis/web/service/MenuService.java b/src/main/java/com/nis/web/service/MenuService.java index 4b5bec9a0..d8313e250 100644 --- a/src/main/java/com/nis/web/service/MenuService.java +++ b/src/main/java/com/nis/web/service/MenuService.java @@ -107,5 +107,9 @@ public class MenuService extends BaseService { public Integer getServiceId(Integer functionId, Integer action) { return menuDao.getServiceId(functionId,action); } - + + // 获取菜单code + public String getMenuCodeByFunctionId(Integer functionId) { + return menuDao.getMenuCodeByFunctionId(functionId,",86,"); + } } diff --git a/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java b/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java index 790fc367a..f472a960c 100644 --- a/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java +++ b/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java @@ -61,6 +61,13 @@ public class AsnIpCfgService extends CrudService, AsnIpCfg> { page.setList(list); return page; } + + public List findByPage(String ids) { + List list=asnIpCfgDao.findByPage(ids); + return list; + } + + public AsnIpCfg get(Long id ) { return asnIpCfgDao.get(id); } diff --git a/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java b/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java index 6a1caf43f..579e48ab8 100644 --- a/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java +++ b/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java @@ -44,6 +44,13 @@ public class PolicyGroupInfoService extends BaseService{ page.setList(list); return page; } + + public List findPolicyByGroupInfoList(String ids) { + List list=policyGroupInfoDao.findPolicyByGroupInfoList(ids); + return list; + } + + public List findPolicyGroupInfos() { List list=policyGroupInfoDao.findPolicyGroupInfos(); return list; diff --git a/src/main/java/com/nis/web/service/basics/ServiceDictInfoService.java b/src/main/java/com/nis/web/service/basics/ServiceDictInfoService.java index 9f2b29279..96ae961b7 100644 --- a/src/main/java/com/nis/web/service/basics/ServiceDictInfoService.java +++ b/src/main/java/com/nis/web/service/basics/ServiceDictInfoService.java @@ -51,15 +51,33 @@ public class ServiceDictInfoService extends BaseService{ * @return */ public List findAllServiceDictInfo(ServiceDictInfo serviceDictInfo,List itType,String orderBy){ - - serviceDictInfo.setConditionType(itType);; + serviceDictInfo.setConditionType(itType); return serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy); } + public List findByDictInfo(String ids,List itType){ + String itemType=String.valueOf(itType.get(0)); + return serviceDictInfoDao.findByDictInfo(ids,itemType); + } + /** + * 根据条件查询所有数据 + * @param serviceDictInfo + * @param itType + * @return + */ + public Page findAllPageServiceDictInfo(Page page, ServiceDictInfo serviceDictInfo,List itType,String orderBy){ + serviceDictInfo.setPage(page); + serviceDictInfo.setConditionType(itType); + List parentList =serviceDictInfoDao.findAllServiceDictInfo(serviceDictInfo,orderBy); + page.setList(parentList); + return page; + } + + @@ -331,6 +349,5 @@ public class ServiceDictInfoService extends BaseService{ } - } diff --git a/src/main/java/com/nis/web/service/basics/TaskInfoService.java b/src/main/java/com/nis/web/service/basics/TaskInfoService.java index 9442e11d8..343508e82 100644 --- a/src/main/java/com/nis/web/service/basics/TaskInfoService.java +++ b/src/main/java/com/nis/web/service/basics/TaskInfoService.java @@ -18,90 +18,101 @@ import com.nis.web.security.UserUtils; import com.nis.web.service.BaseService; @Service -@Transactional(readOnly=true) -public class TaskInfoService extends BaseService{ +@Transactional(readOnly = true) +public class TaskInfoService extends BaseService { @Autowired private TaskInfoDao taskInfoDao; - + public Page findTaskInfo(Page page, TaskInfo taskInfo) { - taskInfo.getSqlMap().put("dsf", configScopeFilter(taskInfo.getCurrentUser(),"r")); + taskInfo.getSqlMap().put("dsf", configScopeFilter(taskInfo.getCurrentUser(), "r")); // 设置分页参数 taskInfo.setPage(page); // 执行分页查询 page.setList(taskInfoDao.findTaskInfo(taskInfo)); return page; } - - @Transactional(readOnly=false,rollbackFor=DataAccessException.class) + + public List findTaskInfo(TaskInfo taskInfo) { + List list = taskInfoDao.findTaskInfo(taskInfo); + return list; + } + + @Transactional(readOnly = false, rollbackFor = DataAccessException.class) public void saveOrUpdate(TaskInfo taskInfo) { if (StringUtil.isEmpty(taskInfo.getId())) { - //设置默认参数值 - taskInfo.setIsValid(0);//无效 - taskInfo.setIsAudit(0);//未审核 - taskInfo.setCreatorId((UserUtils.getUser().getId()).intValue());//创建人员 - taskInfo.setCreateTime(new Date());//创建时间 + // 设置默认参数值 + taskInfo.setIsValid(0);// 无效 + taskInfo.setIsAudit(0);// 未审核 + taskInfo.setCreatorId((UserUtils.getUser().getId()).intValue());// 创建人员 + taskInfo.setCreateTime(new Date());// 创建时间 taskInfoDao.insert(taskInfo); - }else{ - taskInfo.setIsAudit(0);//修改后状态为未审核 - taskInfo.setEditorId((UserUtils.getUser().getId()).intValue());//修改人员 - taskInfo.setEditTime(new Date());//修改时间 + } else { + taskInfo.setIsAudit(0);// 修改后状态为未审核 + taskInfo.setEditorId((UserUtils.getUser().getId()).intValue());// 修改人员 + taskInfo.setEditTime(new Date());// 修改时间 taskInfoDao.update(taskInfo); } - + } public TaskInfo getTaskInfoByTaskName(String taskName) { - + return taskInfoDao.getTaskInfoByTaskName(taskName); } + public TaskInfo getTaskInfoById(Long id) { - + return taskInfoDao.getTaskInfoById(id); } + public List getTaskInfoByIds(String ids) { - + return taskInfoDao.getTaskInfoByIds(ids); } - @Transactional(readOnly=false,rollbackFor=DataAccessException.class) - public void taskExamine(String[] exId){ + + @Transactional(readOnly = false, rollbackFor = DataAccessException.class) + public void taskExamine(String[] exId) { TaskInfo taskInfo = new TaskInfo(); for (int i = 0; i < exId.length; i++) { taskInfo.setId(Long.valueOf(exId[i])); - taskInfo.setIsAudit(1);//审核通过 - taskInfo.setIsValid(1);//审核通过 + taskInfo.setIsAudit(1);// 审核通过 + taskInfo.setIsValid(1);// 审核通过 taskInfo.setAuditTime(new Date()); - taskInfo.setAuditorId((UserUtils.getUser().getId()).intValue());//审核人员 + taskInfo.setAuditorId((UserUtils.getUser().getId()).intValue());// 审核人员 taskInfoDao.update(taskInfo); } } - @Transactional(readOnly=false,rollbackFor=DataAccessException.class) - public void taskExamineNo(String[] noId){ + + @Transactional(readOnly = false, rollbackFor = DataAccessException.class) + public void taskExamineNo(String[] noId) { TaskInfo taskInfo = new TaskInfo(); for (int i = 0; i < noId.length; i++) { taskInfo.setId(Long.valueOf(noId[i])); - taskInfo.setIsAudit(2);//审核未通过 + taskInfo.setIsAudit(2);// 审核未通过 taskInfo.setAuditTime(new Date()); - taskInfo.setAuditorId((UserUtils.getUser().getId()).intValue());//审核人员 + taskInfo.setAuditorId((UserUtils.getUser().getId()).intValue());// 审核人员 taskInfoDao.update(taskInfo); } } - @Transactional(readOnly=false,rollbackFor=DataAccessException.class) - public void taskCancelExamine(String[] cancelId){ + + @Transactional(readOnly = false, rollbackFor = DataAccessException.class) + public void taskCancelExamine(String[] cancelId) { TaskInfo taskInfo = new TaskInfo(); for (int i = 0; i < cancelId.length; i++) { taskInfo.setId(Long.valueOf(cancelId[i])); - taskInfo.setIsAudit(3);//取消审核通过 + taskInfo.setIsAudit(3);// 取消审核通过 taskInfo.setIsValid(0); taskInfo.setAuditTime(new Date()); - taskInfo.setAuditorId((UserUtils.getUser().getId()).intValue());//审核人员 + taskInfo.setAuditorId((UserUtils.getUser().getId()).intValue());// 审核人员 taskInfoDao.update(taskInfo); } } - @Transactional(readOnly=false,rollbackFor=DataAccessException.class) - public void delete(String[] delId){ + + @Transactional(readOnly = false, rollbackFor = DataAccessException.class) + public void delete(String[] delId) { for (int i = 0; i < delId.length; i++) { - taskInfoDao.delete(Long.valueOf(delId[i]));//删除 + taskInfoDao.delete(Long.valueOf(delId[i]));// 删除 } } } diff --git a/src/main/java/com/nis/web/service/configuration/AppCfgService.java b/src/main/java/com/nis/web/service/configuration/AppCfgService.java index 543ddaee9..32d8d0b49 100644 --- a/src/main/java/com/nis/web/service/configuration/AppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppCfgService.java @@ -1025,7 +1025,7 @@ public class AppCfgService extends BaseService { if(StringUtil.isEmpty(entity.getUserRegion4())){ userRegion+=Constants.USER_REGION_SPLIT +Constants.APP_VIGNORE_USER_REGION_KEY+"=1"; } - + userRegion+=Constants.USER_REGION_SPLIT+"config_id="+entity.getCompileId(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); diff --git a/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java b/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java index 1d8e2bbe3..52b9c744a 100644 --- a/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java @@ -5,6 +5,8 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; +import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -20,6 +22,7 @@ import com.nis.domain.configuration.AppIpCfg; import com.nis.domain.configuration.AppStringFeatureCfg; import com.nis.domain.configuration.AppTcpCfg; import com.nis.domain.configuration.CfgIndexInfo; +import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; @@ -105,8 +108,18 @@ public class AppMultiFeatureCfgService extends BaseService { } if(entity.getComplexList()!=null){ for(AppComplexFeatureCfg cfg:entity.getComplexList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("L3_header")){ BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setIsHexbin(1); + cfg.setIsCaseInsenstive(0); + cfg.setExprType(3); + cfg.setMatchMethod(0); + this.setL3HeaderKeyword(cfg); + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + + }else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setHeaderType(null); appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); } @@ -155,9 +168,19 @@ public class AppMultiFeatureCfgService extends BaseService { } if(entity.getComplexList()!=null){ for(AppComplexFeatureCfg cfg:entity.getComplexList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("L3_header")){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setIsHexbin(1); + cfg.setIsCaseInsenstive(0); + cfg.setExprType(3); + cfg.setMatchMethod(0); + this.setL3HeaderKeyword(cfg); + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + + }else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setHeaderType(null); + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); } } } @@ -171,6 +194,46 @@ public class AppMultiFeatureCfgService extends BaseService { } } } + + public void setL3HeaderKeyword(AppComplexFeatureCfg cfg) { + String keyword = ""; + if(cfg.getHeaderType().equals("IP_header")){ + if(StringUtils.isNoneBlank(cfg.getVer())){ + keyword += "0-3:"+cfg.getVer()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getIhl())){ + keyword += "4-7:"+cfg.getIhl()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getTos())){ + keyword += "8-15:"+cfg.getTos()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getTotalLength())){ + keyword += "16-31:"+cfg.getTotalLength()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getFlags())){ + keyword += "48-50:"+cfg.getFlags()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getFragmentOffset())){ + keyword += "56-63:"+cfg.getFragmentOffset()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getProtocol())){ + keyword += "72-79:"+cfg.getProtocol()+Constants.KEYWORD_EXPR; + } + }else{ + if(StringUtils.isNoneBlank(cfg.getIcmpType())){ + keyword += "0-7:"+cfg.getIcmpType()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getIcmpCode())){ + keyword += "8-15:"+cfg.getIcmpCode()+Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getIcmpIdentifier())){ + keyword += "32-47:"+cfg.getIcmpIdentifier()+Constants.KEYWORD_EXPR; + } + } + keyword=keyword.substring(0,keyword.lastIndexOf(Constants.KEYWORD_EXPR)); + cfg.setCfgKeywords(keyword); + } + public void auditAppFeatureCfg(AppFeatureIndex entity, Integer isAudit) { ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); @@ -372,4 +435,219 @@ public class AppMultiFeatureCfgService extends BaseService { return dataMap; } + /** + * APP Payload L3_HEADER导入操作特殊属性限制 + * @param baseStringCfg + * @param errInfo + * @param prop + */ + public void checkImportAppPayload(AppComplexFeatureCfg baseStringCfg, StringBuffer errInfo, Properties prop) { + String headerType = baseStringCfg.getHeaderType(); + String ver = baseStringCfg.getVer(); + String ihl = baseStringCfg.getIhl(); + String tos = baseStringCfg.getTos(); + String totalLength = baseStringCfg.getTotalLength(); + String flags = baseStringCfg.getFlags(); + String fragmentOffset = baseStringCfg.getFragmentOffset(); + String protocol = baseStringCfg.getProtocol(); + String icmpType = baseStringCfg.getIcmpType(); + String icmpCode = baseStringCfg.getIcmpCode(); + String icmpIdentifier = baseStringCfg.getIcmpIdentifier(); + + boolean errorFlag = false;// 除“can_not_null”外其它错误 标识 + Pattern pattern = Pattern.compile("^([0-9|a-f|A-F]*)$"); + StringBuffer errInfoCopy = new StringBuffer(); + errInfoCopy.append(errInfo); + + if("IP_header".equals(headerType)) { + boolean ipHeaderFlag = false; + List ipHeaderList = new ArrayList<>(); + if(StringUtils.isNotBlank(baseStringCfg.getVer())) { ipHeaderList.add(baseStringCfg.getVer()); } + if(StringUtils.isNotBlank(baseStringCfg.getIhl())) { ipHeaderList.add(baseStringCfg.getIhl()); } + if(StringUtils.isNotBlank(baseStringCfg.getTos())) { ipHeaderList.add(baseStringCfg.getTos()); } + if(StringUtils.isNotBlank(baseStringCfg.getTotalLength())) { ipHeaderList.add(baseStringCfg.getTotalLength()); } + if(StringUtils.isNotBlank(baseStringCfg.getFlags())) { ipHeaderList.add(baseStringCfg.getFlags()); } + if(StringUtils.isNotBlank(baseStringCfg.getFragmentOffset())) { ipHeaderList.add(baseStringCfg.getFragmentOffset()); } + if(StringUtils.isNotBlank(baseStringCfg.getProtocol())) { ipHeaderList.add(baseStringCfg.getProtocol()); } + if(ipHeaderList.size() > 4) {// IP_header最多填写四个属性值 + errInfo.append("IP_header " + prop.getProperty("l3_header_error")+";"); + }else { + ipHeaderFlag = true; + } + + int count = 0; + if(StringUtils.isBlank(ver) && ipHeaderFlag) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "VER ") + ";"); + }else if(ver.trim().length() != 4 && ipHeaderFlag){ + errInfo.append( + "VER "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(ver).matches() && ipHeaderFlag) { + errInfo.append( + "VER "+ " '" + ver + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(ihl) && ipHeaderFlag) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "IHL ") + ";"); + }else if(ihl.trim().length() != 4 && ipHeaderFlag){ + errInfo.append( + "IHL "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(ihl).matches() && ipHeaderFlag) { + errInfo.append( + "IHL "+ " '" + ihl + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(tos) && ipHeaderFlag) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "TOS ") + ";"); + }else if(tos.trim().length() != 8 && ipHeaderFlag){ + errInfo.append( + "TOS "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(tos).matches() && ipHeaderFlag) { + errInfo.append( + "TOS "+ " '" + tos + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(totalLength) && ipHeaderFlag) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "Total Length ") + ";"); + }else if(totalLength.trim().length() != 16 && ipHeaderFlag){ + errInfo.append( + "Total Length "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(totalLength).matches() && ipHeaderFlag) { + errInfo.append( + "Total Length "+ " '" + totalLength + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(flags) && ipHeaderFlag) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "Flags ") + ";"); + }else if(flags.trim().length() != 3 && ipHeaderFlag){ + errInfo.append( + "Flags "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(flags).matches() && ipHeaderFlag) { + errInfo.append( + "Flags "+ " '" + flags + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(fragmentOffset) && ipHeaderFlag) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "fragment offset ") + ";"); + }else if(fragmentOffset.trim().length() != 8 && ipHeaderFlag){ + errInfo.append( + "fragment offset "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(fragmentOffset).matches() && ipHeaderFlag) { + errInfo.append( + "fragment offset "+ " '" + fragmentOffset + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(protocol) && ipHeaderFlag) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "Protocol ") + ";"); + }else if(protocol.trim().length() != 8 && ipHeaderFlag){ + errInfo.append( + "Protocol "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(protocol).matches() && ipHeaderFlag) { + errInfo.append( + "Protocol "+ " '" + protocol + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if((count >0 || count <5) && (!errorFlag) && (ipHeaderFlag)) {// 清空错误信息 + errInfo.setLength(0);; + errInfo.append(errInfoCopy); + } + baseStringCfg.setIcmpType(null); + baseStringCfg.setIcmpCode(null); + baseStringCfg.setIcmpIdentifier(null); + }else { + int count = 0; + if(StringUtils.isBlank(icmpType)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "ICMP type ") + ";"); + }else if(icmpType.trim().length() != 8){ + errInfo.append( + "ICMP type "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(icmpType).matches()) { + errInfo.append( + "ICMP type "+ " '" + icmpType + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(icmpCode)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "ICMP code ") + ";"); + }else if(icmpCode.trim().length() != 8){ + errInfo.append( + "ICMP code "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(icmpCode).matches()) { + errInfo.append( + "ICMP code "+ " '" + icmpCode + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if(StringUtils.isBlank(icmpIdentifier)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), "ICMP identifier ") + ";"); + }else if(icmpIdentifier.trim().length() != 16){ + errInfo.append( + "ICMP identifier "+prop.getProperty("length_error") + ";"); + errorFlag = true; + }else if(!pattern.matcher(icmpIdentifier).matches()) { + errInfo.append( + "ICMP identifier "+ " '" + icmpIdentifier + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + errorFlag = true; + }else { + count++; + } + + if((count >0) && (!errorFlag)) {// 清空错误信息 + errInfo.setLength(0);; + errInfo.append(errInfoCopy); + } + baseStringCfg.setVer(null); + baseStringCfg.setIhl(null); + baseStringCfg.setTos(null); + baseStringCfg.setTotalLength(null); + baseStringCfg.setFlags(null); + baseStringCfg.setFragmentOffset(null); + baseStringCfg.setProtocol(null); + } + + } + } diff --git a/src/main/java/com/nis/web/service/configuration/AvCfgService.java b/src/main/java/com/nis/web/service/configuration/AvCfgService.java index bf93033f5..49994ac48 100644 --- a/src/main/java/com/nis/web/service/configuration/AvCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvCfgService.java @@ -66,6 +66,12 @@ public class AvCfgService extends BaseService{ page.setList(list); return page; } + + public List getAvFileBySampleList(String ids){ + List list = avCfgDao.getAvFileBySampleList(ids); + return list; + } + public Page getAvSignSampleList(Page page, AvSignSampleCfg entity){ // 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL) entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a")); diff --git a/src/main/java/com/nis/web/service/configuration/CachePolicyService.java b/src/main/java/com/nis/web/service/configuration/CachePolicyService.java index 205519007..718e32325 100644 --- a/src/main/java/com/nis/web/service/configuration/CachePolicyService.java +++ b/src/main/java/com/nis/web/service/configuration/CachePolicyService.java @@ -16,9 +16,11 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.nis.domain.FunctionServiceDict; import com.nis.domain.Page; import com.nis.domain.configuration.AreaIpCfg; import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.CachePolicyUserRegion; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.CommonStringCfg; import com.nis.domain.configuration.HttpBodyCfg; @@ -38,6 +40,7 @@ import com.nis.domain.maat.ToMaatResult; import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; +import com.nis.util.DictUtils; import com.nis.util.StringUtil; import com.nis.web.dao.configuration.AreaIpCfgDao; import com.nis.web.dao.configuration.CommonPolicyDao; @@ -69,26 +72,81 @@ public class CachePolicyService extends CrudService return entity; } - /*public Map exportCachePolicy(CfgIndexInfo entity){ + public Page getCachePolicyUserRegionList(Page page, CachePolicyUserRegion entity){ + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a")); + entity.setPage(page); + List list = commonPolicyDao.getCachePolicyUserRegionList(entity); + for (CachePolicyUserRegion c : list) { + JSONObject jsonObject=JSONObject.fromObject(c.getUserRegion1()); + CachePolicyUserRegion stu=(CachePolicyUserRegion)JSONObject.toBean(jsonObject, CachePolicyUserRegion.class); + c.setCache_cookied_cont(stu.getCache_cookied_cont()); + c.setCache_dyn_url(stu.getCache_dyn_url()); + c.setForce_caching(stu.getForce_caching()); + c.setIgnore_req_nocache(stu.getIgnore_req_nocache()); + c.setIgnore_res_nocache(stu.getIgnore_res_nocache()); + c.setInactive_time(stu.getInactive_time()); + c.setMax_cache_obj_size(stu.getMax_cache_obj_size()); + c.setMax_cache_size(stu.getMax_cache_size()); + c.setMin_use(stu.getMin_use()); + c.setNo_revalidate(stu.getNo_revalidate()); + c.setPinning_time(stu.getPinning_time()); + if(stu.getCache_key()!=null){ + String ignore=String.valueOf(stu.getCache_key().get("ignore_qs")); + String cookie=String.valueOf(stu.getCache_key().get("cookie")); + if(!ignore.equals("null") && ignore!=null){ + c.setIgnore_qs(ignore); + } + if(!cookie.equals("null") && cookie!=null){ + c.setCookie(cookie); + } + } + } + page.setList(list); + return page; + } + + + public List getCachePolicyByUserRegionList(String ids){ + List list = commonPolicyDao.getCachePolicyByUserRegionList(ids); + for (CachePolicyUserRegion c : list) { + JSONObject jsonObject=JSONObject.fromObject(c.getUserRegion1()); + CachePolicyUserRegion stu=(CachePolicyUserRegion)JSONObject.toBean(jsonObject, CachePolicyUserRegion.class); + c.setCache_cookied_cont(stu.getCache_cookied_cont()); + c.setCache_dyn_url(stu.getCache_dyn_url()); + c.setForce_caching(stu.getForce_caching()); + c.setIgnore_req_nocache(stu.getIgnore_req_nocache()); + c.setIgnore_res_nocache(stu.getIgnore_res_nocache()); + c.setInactive_time(stu.getInactive_time()); + c.setMax_cache_obj_size(stu.getMax_cache_obj_size()); + c.setMax_cache_size(stu.getMax_cache_size()); + c.setMin_use(stu.getMin_use()); + c.setNo_revalidate(stu.getNo_revalidate()); + c.setPinning_time(stu.getPinning_time()); + if(stu.getCache_key()!=null){ + String ignore=String.valueOf(stu.getCache_key().get("ignore_qs")); + String cookie=String.valueOf(stu.getCache_key().get("cookie")); + if(!ignore.equals("null") && ignore!=null){ + c.setIgnore_qs(ignore); + } + if(!cookie.equals("null") && cookie!=null){ + c.setCookie(cookie); + } + } + } + return list; + } + + public Map getExport(Long cfgId){ Map dataMap=new HashMap(); - List httpUrlList = commonPolicyDao.getHttpUrlList(entity); - List httpReqHdrList = commonPolicyDao.getHttpReqHdrList(entity); - List httpResHdrList = commonPolicyDao.getHttpResHdrList(entity); - List ipPortCfgList = commonPolicyDao.getIpPortList(entity); - entity.setCfgType(Constants.HTTP_REDIRECT_REQ_BODY_REGION); - List httpReqBodyList = commonPolicyDao.getHttpReqBodyList(entity); - entity.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION); - List httpResBodyList = commonPolicyDao.getHttpResBodyList(entity); - List subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); - dataMap.put("NTC_UNIVERSAL_IP", ipPortCfgList); - dataMap.put("NTC_CACHE_URL", httpUrlList); - dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList); - dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList); - dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList); - dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList); - dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList); + CfgIndexInfo entity = commonPolicyDao.getPolicyById(cfgId); + entity.setCfgType("PXY_CACHE_HTTP_URL"); + List urlList = commonPolicyDao.getCommonStringList(entity); + entity.setCfgType("PXY_CACHE_HTTP_COOKIE"); + List cookieList = commonPolicyDao.getCommonStringList(entity); + dataMap.put("PXY_CACHE_HTTP_URL", urlList); + dataMap.put("PXY_CACHE_HTTP_COOKIE", cookieList); return dataMap; - }*/ + } public Page getCachePolicyList(Page page, CfgIndexInfo entity){ // 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL) diff --git a/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java b/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java index b571e16ea..6a7fcf8f9 100644 --- a/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java @@ -401,6 +401,15 @@ public class FileTransferCfgService extends CrudService getFileByDigestList(String ids){ + List list = fileTransferCfgDao.getFileByDigestList(ids); + return list; + } + + + + + public FileDigestCfg getFileDigestCfg(Long cfgId,Integer compileId){ FileDigestCfg entity = fileTransferCfgDao.getFileDigest(cfgId,compileId); List subscribeidList = fileTransferCfgDao.getFileDigestSubscribeidList(entity); diff --git a/src/main/java/com/nis/web/service/configuration/InterceptCfgService.java b/src/main/java/com/nis/web/service/configuration/InterceptCfgService.java index 2817ca4f3..071c1eca2 100644 --- a/src/main/java/com/nis/web/service/configuration/InterceptCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/InterceptCfgService.java @@ -18,6 +18,7 @@ import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.InterceptPktBin; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.PxyObjSpoofingIpPool; import com.nis.domain.maat.MaatCfg; import com.nis.domain.maat.MaatCfg.NumBoundaryCfg; import com.nis.domain.maat.ToMaatBean; @@ -33,6 +34,7 @@ import com.nis.util.Constants; import com.nis.util.StringUtil; import com.nis.web.dao.configuration.AreaIpCfgDao; import com.nis.web.dao.configuration.InterceptCfgDao; +import com.nis.web.dao.configuration.PxyObjSpoofingIpPoolDao; import com.nis.web.dao.configuration.WebsiteCfgDao; import com.nis.web.security.UserUtils; import com.nis.web.service.BaseService; @@ -51,6 +53,8 @@ public class InterceptCfgService extends CrudService protected InterceptCfgDao interceptCfgDao; @Autowired protected AreaIpCfgDao areaIpCfgDao; + @Autowired + protected PxyObjSpoofingIpPoolDao pxyObjSpoofingIpPoolDao; public CfgIndexInfo getInterceptCfg(Long cfgId,Integer compileId){ CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId,compileId); @@ -107,20 +111,57 @@ public class InterceptCfgService extends CrudService setAreaEffectiveIds(entity); if(entity.getCfgId()==null){ Integer compileId = 0; + Integer spoofingPoolId = 0 ; try { - List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + List idList = new ArrayList(); + if(entity.getServiceId().equals(518)){//ip仿冒策略 + idList= ConfigServiceUtil.getId(1, 2); compileId = idList.get(0); - } + spoofingPoolId = idList.get(1); + }else{ + idList= ConfigServiceUtil.getId(1, 1); + compileId = idList.get(0); + } } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(":"+e.getMessage()); } + if(entity.getServiceId().equals(518)){//ip仿冒策略 + //保存IP仿冒池 + PxyObjSpoofingIpPool spoofingPool = new PxyObjSpoofingIpPool(); + spoofingPool.setIpType(4);//ipv4 + spoofingPool.setIpAddress(entity.getUserRegion2());//仿冒IP + spoofingPool.setProtocol(0); + if("dnat".equals(entity.getUserRegion1().toLowerCase())){//spoofing server ip->dnat + spoofingPool.setDirection(1); + }else{ + spoofingPool.setDirection(2);//spoofing client ip->snat + } + + spoofingPool.setPort("0"); + spoofingPool.setUserRegion("0"); + spoofingPool.setLocation(0); + spoofingPool.setServiceId(642); + spoofingPool.setAreaEffectiveIds("0"); + spoofingPool.setIsAreaEffective(0); + spoofingPool.setCreateTime(new Date()); + spoofingPool.setCreatorId(UserUtils.getUser().getId()); + spoofingPool.setCompileId(spoofingPoolId); + spoofingPool.setAction(1); + spoofingPool.setFunctionId(666); + spoofingPool.setRequestId(0); + pxyObjSpoofingIpPoolDao.insert(spoofingPool);//保存仿冒IP池配置 + + entity.setUserRegion3(String.valueOf(spoofingPool.getCfgId()));//将仿冒IP池配置ID作为策略组ID + + } + entity.setCompileId(compileId); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); websiteCfgDao.saveCfgIndex(entity); + if(entity.getIpPortList()!=null){ for(IpPortCfg cfg:entity.getIpPortList()){ BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); @@ -155,6 +196,30 @@ public class InterceptCfgService extends CrudService }else{ + if(entity.getServiceId().equals(518)){//ip仿冒策略 + //保存IP仿冒池 + Long cfgId = Long.parseLong(entity.getUserRegion3()); + PxyObjSpoofingIpPool spoofingPool = pxyObjSpoofingIpPoolDao.getPxyObjSpoofingIpPool(cfgId); + spoofingPool.setIpType(4);//ipv4 + spoofingPool.setIpAddress(entity.getUserRegion2());//仿冒IP + spoofingPool.setProtocol(0); + if("dnat".equals(entity.getUserRegion1())){//spoofing server ip->dnat + spoofingPool.setDirection(1); + }else{ + spoofingPool.setDirection(2);//spoofing client ip->snat + } + + spoofingPool.setPort("0"); + spoofingPool.setUserRegion("0"); + spoofingPool.setLocation(0); + spoofingPool.setServiceId(642); + spoofingPool.setAreaEffectiveIds("0"); + spoofingPool.setIsAreaEffective(0); + spoofingPool.setEditTime(new Date()); + spoofingPool.setEditorId(UserUtils.getUser().getId()); + pxyObjSpoofingIpPoolDao.update(spoofingPool);//保存仿冒IP池配置 + + } entity.setEditTime(new Date()); entity.setEditorId(entity.getCurrentUser().getId()); @@ -220,6 +285,20 @@ public class InterceptCfgService extends CrudService websiteCfgDao.updateCfgValid(entity); //查询子配置 entity = this.getInterceptCfg(Long.parseLong(id),entity.getCompileId()); + + //IP仿冒策略下的仿冒IP池也失效 + if(entity.getServiceId().equals(518)){ + PxyObjSpoofingIpPool pool = new PxyObjSpoofingIpPool(); + if(StringUtils.isNotEmpty(entity.getUserRegion3())){ + pool.setCfgId(Long.parseLong(entity.getUserRegion3())); + pool.setIsValid(isValid); + pool.setIsAudit(entity.getIsAudit()); + pool.setEditTime(new Date()); + pool.setEditorId(UserUtils.getUser().getId()); + pxyObjSpoofingIpPoolDao.update(pool); + } + } + if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ IpPortCfg cfg = new IpPortCfg(); BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); @@ -274,6 +353,56 @@ public class InterceptCfgService extends CrudService //查询子配置并修改审核状态 entity = this.getInterceptCfg(entity.getCfgId(),entity.getCompileId()); + if(entity.getServiceId().equals(518)){//IP仿冒策略 + //仿冒IP池配置匹配下发或者取消 + PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool(); + pool.setCfgId(Long.valueOf(entity.getUserRegion3())); + pool.setIsValid(entity.getIsValid()); + pool.setIsAudit(isAudit); + pool.setAuditorId(UserUtils.getUser().getId()); + pool.setAuditTime(new Date()); + pxyObjSpoofingIpPoolDao.update(pool); + pool = pxyObjSpoofingIpPoolDao.getPxyObjSpoofingIpPool(pool.getCfgId()); + List list = new ArrayList(); + String json=""; + String areaEffectiveIds="0"; + if(entity.getIsAudit()==1){ + pool.setAreaEffectiveIds(areaEffectiveIds); + pool.setGroupId(pool.getCfgId().intValue());//界面端的配置ID作为策略分组ID + list.add(pool); + //调用服务接口下发配置数据 + json=gsonToJson(list); + logger.info("欺骗IP池配置下发配置参数:"+json); + //调用服务接口下发配置 + try { + ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); + if(result!=null){ + logger.info("欺骗IP池配置下发响应信息:"+result.getMsg()); + } + } catch (Exception e) { + logger.error("欺骗IP池配置配置下发失败",e); + throw e; + } + }else if(entity.getIsAudit()==3){ + PxyObjSpoofingIpPool cfg = new PxyObjSpoofingIpPool(); + cfg.setIsValid(0); + cfg.setCompileId(pool.getCompileId()); + cfg.setServiceId(pool.getServiceId()); + list.add(cfg); + //调用服务接口取消配置 + json=gsonToJson(list); + logger.info("欺骗IP池配置配置参数:"+json); + //调用服务接口取消配置 + try { + ToMaatResult result = ConfigServiceUtil.put(json, 2); + logger.info("欺骗IP池配置响应信息:"+result.getMsg()); + } catch (Exception e) { + e.printStackTrace(); + logger.info("欺骗IP池配置配置失败"); + throw e; + } + } + } if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ IpPortCfg cfg = new IpPortCfg(); BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); @@ -357,7 +486,7 @@ public class InterceptCfgService extends CrudService entity.setUserRegion1(StringUtil.isEmpty(entity.getUserRegion1()) ? "0":entity.getUserRegion1()); maatCfg.setUserRegion(Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"="+entity.getUserRegion1()); //监测的域名需下发拦截强度 - if(entity.getFunctionId().equals(201)){ + if(entity.getFunctionId().equals(200)){ entity.setUserRegion5(StringUtil.isEmpty(entity.getUserRegion5()) ? "1":entity.getUserRegion5()); if(StringUtil.isEmpty(maatCfg.getUserRegion())) { maatCfg.setUserRegion(Constants.INTERCEPT_DOMAN_INTENSITY_USER_REGION_KEY+"="+entity.getUserRegion5()); @@ -398,7 +527,7 @@ public class InterceptCfgService extends CrudService if(entity.getAction().equals(48)){ //HTTP replace: replace type is not null ;find is not null;replace with is not null(userRegion is not null) userRegion="nat_type="+entity.getUserRegion1(); - userRegion+=";spoofing_ip_pool="+entity.getUserRegion2(); + userRegion+=";spoofing_ip_pool="+entity.getUserRegion3(); maatCfg.setUserRegion(userRegion); } diff --git a/src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java b/src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java index eadb57e4c..93db450f4 100644 --- a/src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java @@ -54,6 +54,11 @@ public class IpAddrPoolCfgService extends BaseService{ return page; } + public List findByPage(String ids) { + List list=ipAddrPoolCfgDao.findByPage(ids); + return list; + } + /** * 获取数据跳转表单 * @param id diff --git a/src/main/java/com/nis/web/service/configuration/IpMultiplexService.java b/src/main/java/com/nis/web/service/configuration/IpMultiplexService.java index a6de5c52a..4e7f2f8d3 100644 --- a/src/main/java/com/nis/web/service/configuration/IpMultiplexService.java +++ b/src/main/java/com/nis/web/service/configuration/IpMultiplexService.java @@ -43,6 +43,11 @@ public class IpMultiplexService extends BaseService{ page.setList(list); return page; } + + public List findByPage(String ids) { + List list=ipMultiplexDao.findByPage(ids); + return list; + } public IpReusePolicyCfg getPolicyCfg(Long cfgId, Integer isValid) { List list=ipMultiplexDao.findList(cfgId,isValid); @@ -284,6 +289,12 @@ public class IpMultiplexService extends BaseService{ page.setList(list); return page; } + + public List findPageByDnat(String ids) { + List list=ipMultiplexDao.findPageByDnat(ids); + return list; + } + public IpReuseDnatPolicyCfg getDnatPolicyCfg(Long cfgId, Integer isValid) { List list=ipMultiplexDao.findDnatList(cfgId,isValid); diff --git a/src/main/java/com/nis/web/service/configuration/PxyObjSpoofingIpPoolService.java b/src/main/java/com/nis/web/service/configuration/PxyObjSpoofingIpPoolService.java index b7b8630e6..ddceb2d5a 100644 --- a/src/main/java/com/nis/web/service/configuration/PxyObjSpoofingIpPoolService.java +++ b/src/main/java/com/nis/web/service/configuration/PxyObjSpoofingIpPoolService.java @@ -73,6 +73,11 @@ public class PxyObjSpoofingIpPoolService extends BaseService{ return page; } + public List findByPage(String ids) { + List list=pxyObjSpoofingIpPoolDao.findByPage(ids); + return list; + } + public List findPxyObjSpoofingIpPools(PxyObjSpoofingIpPool entity) { List list=pxyObjSpoofingIpPoolDao.findList(entity); @@ -160,6 +165,7 @@ public class PxyObjSpoofingIpPoolService extends BaseService{ areaEffectiveIds = this.setEffectiveRange(entity.getAreaEffectiveIds()); } entity.setAreaEffectiveIds(areaEffectiveIds); + entity.setGroupId(entity.getCfgId().intValue());//界面的配置ID作为策略分组ID list.add(entity); //调用服务接口下发配置数据 json=gsonToJson(list); @@ -212,7 +218,7 @@ public class PxyObjSpoofingIpPoolService extends BaseService{ if(!ispList.contains(ispCode)){ ispList.add(ispCode); } - map.replace(areaCode, ispList); + //map.replace(areaCode, ispList); } }else { // 区域 diff --git a/src/main/java/com/nis/web/service/configuration/UserManageService.java b/src/main/java/com/nis/web/service/configuration/UserManageService.java index 296ef4a81..a2c3c96d0 100644 --- a/src/main/java/com/nis/web/service/configuration/UserManageService.java +++ b/src/main/java/com/nis/web/service/configuration/UserManageService.java @@ -47,6 +47,13 @@ public class UserManageService extends BaseService{ page.setList(list); return page; } + + public List findByPage(String ids ) { + List list=userManageDao.findByList(ids); + return list; + } + + public UserManage getUserByLoginName(String userName) { return userManageDao.getUserByLoginName(userName); } diff --git a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java index 9adf35760..06c4b4f66 100644 --- a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java +++ b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java @@ -68,6 +68,12 @@ public class SpecificServiceCfgService extends BaseService{ public List findAllSpecificServiceCfg(SpecificServiceCfg specificServiceCfg, String orderBy) { return specificServiceCfgDao.findAllSpecificServiceCfg(specificServiceCfg,orderBy); } + + + public List findBySpecificServiceCfg(String ids) { + return specificServiceCfgDao.findBySpecificServiceCfg(ids); + } + /** * 保存或修改 * @param specificServiceCfg diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 095d07b17..27aac9641 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1154,8 +1154,8 @@ area_group_manage=Grouping Area Manage stream_media_protocol=Stream Media Protocol new_link=New Link active_link=Close Link -traffic_ipactive_hour_trend=Active IP TOP10 Trend In Nearly One Hour -traffic_ipactive_hour_max=Active IP TOP10 Maximum In Nearly One Hour +traffic_ipactive_hour_trend=Active IP TOP10 Trend +traffic_ipactive_hour_max=Active IP TOP10 Maximum ip_addr=IP area_id=Area link_num=Link Times @@ -1226,7 +1226,7 @@ cfg_operation_log=Configuration Operation Log function_name=Operation Module config_service_statistics=Config Statistics ruleLimitTip=The number of effective rules has reached the limit(%s). -av_protocol_note=Note:Recognizable Protocols Include RTSP,RTMP. +av_protocol_note=Note:Recognizable Protocols Include RTSP,RTMP,MMS. ip_range_in_the_same=Start IP and end IP in a IP range must with in the same subnet log_to_url=To HTTP URL source_compile_id=Configuration Source @@ -1355,13 +1355,13 @@ translated_dest_ip=Translated destination address translated_dest_port=Translated destination port show_ips=View all IP show_available_ips=View available IP -radius_log=Radius Identify +radius_log=Radius Record message_type=Code nas_ip=NAS IP Address framed_ip=Framed IP Address log_user_name=User Name av_tips=The system does not support the index information of audio and video coding in the tail of the audio and video files. The system does not support video with resolution greater than 1080P. -asn_ip_group_delete=\uFF08IP configuration under this ASN group will also be deleted.) +asn_ip_group_delete=\uff08IP configuration under this ASN group will also be deleted.) keyword_log_tips=Deduplicate http body keywords log,for the control status of http body keywords is not ideal, configure the http url of the hit keyword as URL control configuration. conn_record=Connection Records bps=Gbps @@ -1407,4 +1407,41 @@ ip=IP country=Country desc=Desc unique_num=Unique -import_limit_is=The maximum import size is \ No newline at end of file +import_limit_is=The maximum import size is +upload_limit_is=The limitation of file uplaod is +count=Count +do_blacklist=Blacklist Option +l3_header_error=Only four attribute values are allowed to be entered at most +IP_HEADER=IP Header +ICMP_HEADER=ICMP Header +offset_expression=Offset Expression +cfg_custom=Custom Columns +event_report=Event Report +ntc_event_monitor_report=Event Monitor Report +ntc_event_block_report=Event Block Report +ntc_event_key_protection_report=Event Key Protection Report +task_id=Task ID +http_num=HTTP +mail_num=MAIL +vedio_count=VEDIO +agent_count=AGENT +letter_num=LETTER +config_num=CONFIG +monitor_num=MONITOR +control_num=CONTROL +contains_non_hex_char=Contains non-hexadecimal characters +max_length=Maximum Length +min_length=Minimum Length +length_error=Length Error +duplicate=Duplicate +print=Print +traffic_connect_log=Traffic Log +keyword_log_to_url=KeywordLogToURL +http_log=HTTP Logs +cut_sample_tool=Cut Sample Tool +hex_minlength_3=Please enter a hexadecimal string of length 3 +hex_minlength_4=Please enter a hexadecimal string of length 4 +hex_minlength_8=Please enter a hexadecimal string of length 8 +hex_minlength_16=Please enter a hexadecimal string of length 16 +need_input=Attributes need to be filled in +max_input=Fill in at most four \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 2d9fc407b..0cb27f12d 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1097,7 +1097,7 @@ ASN_POLICY_MONIT=\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u p2p_monit=\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 P2P av_content_url_whitelist=\u0411\u0435\u043b\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a URL \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0439\u043d\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f av_content_ip_whitelist=\u0411\u0435\u043b\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0438 -active_port=\u041F\u043E\u0440\u0442\u044B \u0442\u0440\u0430\u0444\u0438\u043A\u0430 +active_port=\u041f\u043e\u0440\u0442\u044b \u0442\u0440\u0430\u0444\u0438\u043a\u0430 visits=\u041f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u043e\u0441\u0442\u044c percentage=\u041f\u0440\u043e\u0446\u0435\u043d\u0442 APP_SSL=\u041f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 SSL \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f @@ -1154,8 +1154,8 @@ area_group_manage=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \ stream_media_protocol=\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0430 new_link=\u041d\u043e\u0432\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 active_link=\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 -traffic_ipactive_hour_trend=\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0439 IP \u0422\u041e\u041f 10 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0430\u0441\u0430 -traffic_ipactive_hour_max=\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0439 IP TOP10 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0437\u0430 \u043e\u0434\u0438\u043d \u0447\u0430\u0441 +traffic_ipactive_hour_trend=\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0422\u041e\u041f 10 \u0422\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u044f +traffic_ipactive_hour_max=\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0422\u041e\u041f 10 \u041c\u0430\u043a\u0441. \u041f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u043e\u0441\u0442\u044c ip_addr=IP area_id=\u0420\u0435\u0433\u0438\u043e\u043d link_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 @@ -1226,7 +1226,7 @@ cfg_operation_log=\u0416\u0443\u0440\u043d\u0430\u043b \u043e\u043f\u0435\u0440\ function_name=\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c config_service_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 ruleLimitTip=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430 (%s). -av_protocol_note=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 RTSP, RTMP. +av_protocol_note=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 RTSP, RTMP,MMS. ip_range_in_the_same=\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 IP-\u0430\u0434\u0440\u0435\u0441 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 IP-\u0430\u0434\u0440\u0435\u0441 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 log_to_url=\u0414\u043e HTTP URL source_compile_id=\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 @@ -1359,56 +1359,93 @@ translated_dest_ip=\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043d\ translated_dest_port=\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u041f\u043e\u0440\u0442 \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f show_ips=\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0412\u0441\u0435 IP show_available_ips=\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 IP -radius_log=Radius Identify -message_type=Code -nas_ip=NAS IP Address -framed_ip=Framed IP Address -log_user_name=User Name -av_tips=\u041a\u043e\u0433\u0434\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0432\u0438\u0434\u0435\u043e \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u043e\u043b\u0435\u0435 1080p.\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. -asn_ip_group_delete=\uff08IP configuration under this ASN group will also be deleted.) -keyword_log_tips=\u041A\u043E\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043A\u043B\u044E\u0447\u0435\u0432\u044B\u043C\u0438 \u0441\u043B\u043E\u0432\u0430\u043C\u0438 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u043F\u043B\u043E\u0445\u0438\u043C, \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u0434\u0435\u0434\u0443\u043F\u043B\u0438\u043A\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u0433\u043E \u0436\u0443\u0440\u043D\u0430\u043B\u0430 \u0434\u0430\u043D\u043D\u043E\u0439 \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044E \u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 URL \u0434\u043B\u044F \u043F\u043E\u0434\u0430\u0432\u0448\u0435\u0433\u043E \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430. -conn_record=Connection Records +radius_log=\u0417\u0430\u043F\u0438\u0441\u0438 Radius +message_type=\u041a\u043e\u0434 +nas_ip=NAS IP-\u0430\u0434\u0440\u0435\u0441 +framed_ip=Framed IP-\u0430\u0434\u0440\u0435\u0441 +log_user_name=\u0418\u043c\u044f \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f +av_tips=\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0445\u0432\u043e\u0441\u0442\u0435 \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e \u0444\u0430\u0439\u043b\u043e\u0432. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0438\u0434\u0435\u043e \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0448\u0435 1080P. +asn_ip_group_delete=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f IP \u0432 \u044d\u0442\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 ASN \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0430. +keyword_log_tips=\u041A\u043E\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043A\u043B\u044E\u0447\u0435\u0432\u044B\u043C\u0438 \u0441\u043B\u043E\u0432\u0430\u043C\u0438 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u043F\u043B\u043E\u0445\u0438\u043C, \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u043E\u0447\u0438\u0441\u0442\u043A\u0438 \u0436\u0443\u0440\u043D\u0430\u043B\u0430 \u0434\u0430\u043D\u043D\u043E\u0439 \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u0434\u0430\u0432\u0448\u0438\u0439 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442 \u043D\u0430 \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044E ''\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 URL''. +conn_record=\u0417\u0430\u043f\u0438\u0441\u0438 \u041f\u043e\u0434\u043a\u044e\u0447\u0435\u043d\u0438\u0439 bps=Gbps bps_percent=Bps Percent pps=PPS pps_percent=pps Percent -spoofing_ip_object=Spoofing IP Pool -spoofing_ip_policy=IP Spoofing -action_spoofing=Spoofing -spoofing=spoofing +spoofing_ip_object=\u041f\u0443\u043b IP \u0421\u043f\u0443\u0444\u0438\u043d\u0433 +spoofing_ip_policy=IP \u0421\u043f\u0443\u0444\u0438\u043d\u0433 +action_spoofing=\u0421\u043f\u0443\u0444\u0438\u043d\u0433 +spoofing=\u0421\u043f\u0443\u0444\u0438\u043d\u0433 service=\u0421\u0435\u0440\u0432\u0438\u0441 s_asn=SASN d_asn=DASN -asn_conn_report=ASN Statistics -https_url_report=Http(s) URL Statistics +asn_conn_report=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 ASN +https_url_report=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 Http(s) URL url=URL sum=SUM -url_count=URL Count -ip_range_report=IN/EX Host Identity -ip_start=Start IP -ip_end=End IP +url_count=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e URL +ip_range_report=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0425\u043e\u0441\u0442\u043e\u0432 \u0432 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u0445 \u0438 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 +ip_start=\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 IP +ip_end=\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 IP ip_start_num=IP Start Num ip_end_num=IP End Num -ip_sub=IP Subnet -start_ip=Start IP -end_ip=End IP -action_detail=Action Detail -pass=\u041F\u0430\u0441 -live_link=\u0410\u043A\u0442\u0438\u0432\u043D\u0430\u044F \u0421\u0441\u044B\u043B\u043A\u0430 -area_type=Area Type -dns_group_manage=DNS Group Manage -asn_group_manage=ASN Group Manage -ip_group_manage=IP Group Manage -ip_spoofing_group_manage=IP Spoofing Group Manage -min_tcp=Min -max_tcp=Max -APP_TCP_SESSION_BYTE=Session -ip_count=Unique IP Count -counnection_count=Connection Count +ip_sub=IP-\u043f\u043e\u0434\u0441\u0435\u0442\u044c +start_ip=\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 IP +end_ip=\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 IP +action_detail=\u0414\u0435\u0442\u0430\u043b\u044c \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f +pass=\u041f\u0430\u0441 +live_link=\u0410\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0421\u0441\u044b\u043b\u043a\u0430 +area_type=\u0422\u0438\u043f \u0417\u043e\u043d\u044b +dns_group_manage=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 DNS \u0433\u0440\u0443\u043f\u043f\u043e\u0439 +asn_group_manage=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ASN \u0433\u0440\u0443\u043f\u043f\u043e\u0439 +ip_group_manage=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 IP \u0433\u0440\u0443\u043f\u043f\u043e\u0439 +ip_spoofing_group_manage=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u041f\u0443\u043b\u043e\u043c IP \u0421\u043f\u0443\u0444\u0438\u043d\u0433 +min_tcp=\u041c\u0438\u043d. +max_tcp=\u041c\u0430\u043a\u0441. +APP_TCP_SESSION_BYTE=\u0421\u0435\u0430\u043d\u0441 +ip_count=Uniq-IP +counnection_count=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 asn=ASN Unique_num=Unique ip=IP -country=Country +country=\u0421\u0442\u0440\u0430\u043d\u0430 desc=Desc unique_num=Unique -import_limit_is=The maximum import size is \ No newline at end of file +import_limit_is=The maximum import size is +upload_limit_is=The limitation of file uplaod is +count=Count +do_blacklist=Blacklist Option +l3_header_error=Only four attribute values are allowed to be entered at most +IP_HEADER=IP Headerx +ICMP_HEADER=ICMP Header +offset_expression=Offset Expression +cfg_custom=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0421\u0442\u043e\u043b\u0431\u0446\u044b +event_report=\u041e\u0442\u0447\u0435\u0442 \u043e \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0438 +ntc_event_monitor_report=\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u041c\u043e\u043d\u0438\u0442\u043e\u0440 \u041e\u0442\u0447\u0435\u0442 +ntc_event_block_report=\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0411\u043b\u043e\u043a \u041e\u0442\u0447\u0435\u0442 +ntc_event_key_protection_report=\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u041e\u0442\u0447\u0435\u0442 +task_id=\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 ID +http_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e HTTP +mail_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041f\u043e\u0447\u0442 +vedio_count=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0412\u0438\u0434\u0435\u043e +agent_count=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0410\u0433\u0435\u043d\u0442\u043e\u0432 +letter_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041f\u0438\u0441\u0435\u043c +config_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 +monitor_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 +control_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f +contains_non_hex_char=Contains non-hexadecimal characters +max_length=Maximum Length +min_length=Minimum Length +length_error=Length Error +duplicate=Duplicate +print=Print +traffic_connect_log=\u0416\u0443\u0440\u043D\u0430\u043B \u0422\u0440\u0430\u0444\u0438\u043A\u0430 +keyword_log_to_url=KeywordLogToURL +http_log=HTTP Logs +cut_sample_tool=Cut Sample Tool +hex_minlength_3=Please enter a hexadecimal string of length 3 +hex_minlength_4=Please enter a hexadecimal string of length 4 +hex_minlength_8=Please enter a hexadecimal string of length 8 +hex_minlength_16=Please enter a hexadecimal string of length 16 +need_input=Attributes need to be filled in +max_input=Fill in at most four \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index af0ecbaac..710d6f28b 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1149,8 +1149,8 @@ area_group_manage=\u5206\u7ec4\u5730\u7406\u4fe1\u606f\u7ba1\u7406 stream_media_protocol=\u6d41\u5a92\u4f53\u534f\u8bae new_link=\u65b0\u5efa active_link=\u5173\u95ed -traffic_ipactive_hour_trend=\u6d3b\u8dc3IP TOP10\u8fd1\u4e00\u5c0f\u65f6\u5185\u8d8b\u52bf -traffic_ipactive_hour_max=\u6d3b\u8dc3IP TOP10\u8fd1\u4e00\u5c0f\u65f6\u5185\u6700\u5927\u503c +traffic_ipactive_hour_trend=\u6d3b\u8dc3IP TOP10 \u8d8b\u52bf +traffic_ipactive_hour_max=\u6d3b\u8dc3IP TOP10 \u6700\u5927\u503c ip_addr=IP\u5730\u5740 area_id=\u5730\u57df link_num=\u8fde\u63a5\u6b21\u6570 @@ -1221,7 +1221,7 @@ cfg_operation_log=\u914d\u7f6e\u64cd\u4f5c\u65e5\u5fd7 function_name=\u64cd\u4f5c\u6a21\u5757 config_service_statistics=\u914d\u7f6e\u7edf\u8ba1 ruleLimitTip=\u6709\u6548\u89c4\u5219\u91cf\u5df2\u8fbe\u5230\u9650\u5236(%s). -av_protocol_note=\u6ce8\uff1a\u53ef\u8bc6\u522b\u534f\u8bae\u5305\u62ec RTSP\u3001RTMP\u3002 +av_protocol_note=\u6ce8\uff1a\u53ef\u8bc6\u522b\u534f\u8bae\u5305\u62ec RTSP\u3001RTMP\u3001MMS\u3002 ip_range_in_the_same=IP\u8303\u56f4\u7684\u8d77\u59cbIP\u4e0e\u7ec8\u6b62IP\u5fc5\u987b\u5728\u76f8\u540c\u7f51\u6bb5 log_to_url=\u8f6cHTTP URL\u914d\u7f6e source_compile_id=\u914d\u7f6e\u6765\u6e90 @@ -1355,7 +1355,7 @@ show_ips=\u67e5\u770b\u6240\u6709IP show_available_ips=\u67e5\u770b\u53ef\u7528IP website_keyword_monit=\u5173\u952e\u5b57\u76d1\u6d4b website_keyword_reject=\u5173\u952e\u5b57\u963b\u65ad -radius_log=Radius \u534f\u8bae +radius_log=Radius \u65E5\u5FD7 message_type=Code nas_ip=NAS IP Address framed_ip=Framed IP Address @@ -1392,10 +1392,10 @@ action_detail=\u52a8\u4f5c\u8be6\u60c5 pass=Pass live_link=Live Link area_type=Area Type -dns_group_manage=DNS\u5206\u7EC4\u7BA1\u7406 -asn_group_manage=ASN\u5206\u7EC4\u7BA1\u7406 -ip_group_manage=IP\u5206\u7EC4\u7BA1\u7406 -ip_spoofing_group_manage=IP Spoofing\u5206\u7EC4\u7BA1\u7406 +dns_group_manage=DNS\u5206\u7ec4\u7ba1\u7406 +asn_group_manage=ASN\u5206\u7ec4\u7ba1\u7406 +ip_group_manage=IP\u5206\u7ec4\u7ba1\u7406 +ip_spoofing_group_manage=IP Spoofing\u5206\u7ec4\u7ba1\u7406 min_tcp=Min max_tcp=Max APP_TCP_SESSION_BYTE=Session @@ -1407,4 +1407,41 @@ ip=IP country=Country desc=Desc unique_num=Unique -import_limit_is=\u5BFC\u5165\u9650\u5236\u6700\u5927\u6761\u6570 \ No newline at end of file +import_limit_is=\u5bfc\u5165\u9650\u5236\u6700\u5927\u6761\u6570 +upload_limit_is=\u6587\u4ef6\u4e0a\u4f20\u4e2a\u6570\u9650\u5236 +count=\u6570\u91cf +do_blacklist=Blacklist Option +l3_header_error=Only four attribute values are allowed to be entered at most +IP_HEADER=IP Header +ICMP_HEADER=ICMP Header +offset_expression=Offset Expression +cfg_custom=Custom Columns +event_report=\u4e8b\u4ef6\u62a5\u8868 +ntc_event_monitor_report=\u4e8b\u4ef6\u76d1\u6d4b\u62a5\u8868 +ntc_event_block_report=\u4e8b\u4ef6\u5c01\u5835\u62a5\u8868 +ntc_event_key_protection_report=\u91cd\u70b9\u4fdd\u969c\u4e8b\u4ef6\u62a5\u8868 +task_id=\u4e13\u9879ID +http_num=HTTP\u6570\u91cf +mail_num=\u90ae\u4ef6\u6570\u91cf +vedio_count=\u89c6\u9891\u6b21\u6570 +agent_count=\u4ee3\u7406\u6b21\u6570 +letter_num=\u6765\u51fd\u4ef6\u6570 +config_num=\u914d\u7f6e\u603b\u6570 +monitor_num=\u76d1\u6d4b\u6570\u91cf +control_num=\u7ba1\u63a7\u6570\u91cf +contains_non_hex_char=\u5305\u542b\u975e\u5341\u516d\u8fdb\u5236\u5b57\u7b26 +max_length=\u6700\u5927\u957f\u5ea6 +min_length=\u6700\u5c0f\u957f\u5ea6 +length_error=\u957f\u5ea6\u9519\u8bef +duplicate=\u91cd\u590d\u7684 +print=\u6253\u5370 +traffic_connect_log=\u6D41\u91CF\u65E5\u5FD7 +keyword_log_to_url=\u5173\u952E\u5B57\u65E5\u5FD7\u8F6CURL +http_log=HTTP \u65E5\u5FD7 +cut_sample_tool=\u6837\u4F8B\u526A\u5207\u5DE5\u5177 +hex_minlength_3=\u8BF7\u8F93\u5165\u957F\u5EA6\u4E3A3\u7684\u5341\u516D\u8FDB\u5236\u5B57\u7B26\u4E32 +hex_minlength_4=\u8BF7\u8F93\u5165\u957F\u5EA6\u4E3A4\u7684\u5341\u516D\u8FDB\u5236\u5B57\u7B26\u4E32 +hex_minlength_8=\u8BF7\u8F93\u5165\u957F\u5EA6\u4E3A8\u7684\u5341\u516D\u8FDB\u5236\u5B57\u7B26\u4E32 +hex_minlength_16=\u8BF7\u8F93\u5165\u957F\u5EA6\u4E3A16\u7684\u5341\u516D\u8FDB\u5236\u5B57\u7B26\u4E32 +need_input=\u9700\u8981\u586B\u5199\u5C5E\u6027 +max_input=\u6700\u591A\u586B\u5199\u56DB\u4E2A \ No newline at end of file diff --git a/src/main/resources/service/service_config.xml b/src/main/resources/service/service_config.xml index 7765259a9..98273fb75 100644 --- a/src/main/resources/service/service_config.xml +++ b/src/main/resources/service/service_config.xml @@ -14,24 +14,33 @@ - + - + - + + + + + + + + + + - + - + + @@ -255,29 +266,34 @@ + + + + + @@ -285,18 +301,21 @@ + + + @@ -304,6 +323,7 @@ + diff --git a/src/main/resources/sql/20181222/add_app_feature_column b/src/main/resources/sql/20181222/add_app_feature_column new file mode 100644 index 000000000..9054704b5 --- /dev/null +++ b/src/main/resources/sql/20181222/add_app_feature_column @@ -0,0 +1,11 @@ +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `header_type` varchar(16) NULL DEFAULT '' AFTER `user_region5`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `ver` varchar(4) NULL DEFAULT '' AFTER `header_type`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `ihl` varchar(4) NULL DEFAULT '' AFTER `ver`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `tos` varchar(8) NULL DEFAULT '' AFTER `ihl`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `total_length` varchar(16) NULL DEFAULT '' AFTER `tos`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `flags` varchar(3) NULL DEFAULT '' AFTER `total_length`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `fragment_offset` varchar(8) NULL DEFAULT '' AFTER `flags`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `protocol` varchar(8) NULL DEFAULT '' AFTER `fragment_offset`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `icmp_type` varchar(8) NULL DEFAULT '' AFTER `protocol`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `icmp_code` varchar(8) NULL DEFAULT '' AFTER `icmp_type`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `icmp_identifier` varchar(16) NULL DEFAULT '' AFTER `icmp_code`; \ No newline at end of file diff --git a/src/main/resources/sql/20181222/add_doblacklist_column.sql b/src/main/resources/sql/20181222/add_doblacklist_column.sql new file mode 100644 index 000000000..6d477ea09 --- /dev/null +++ b/src/main/resources/sql/20181222/add_doblacklist_column.sql @@ -0,0 +1,6 @@ +ALTER TABLE `cfg_index_info` ADD COLUMN `do_blacklist` int(11) NOT NULL DEFAULT 1 AFTER `source_compile_id`; + +INSERT INTO `sys_data_dictionary_name` (`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`) VALUES ('153', 'DO_BLACKLIST', 'DO_BLACKLIST', '', '', '2018-12-22 12:39:06', '2018-12-22 12:39:06', '1'); +INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('4075', '0', 'no', '', '0', '1', '1', '153'); +INSERT INTO `sys_data_dictionary_item` (`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`) VALUES ('4077', '1', 'yes', '', '0', '1', '1', '153'); + diff --git a/src/main/resources/sql/20181223/add_function_service_dict_column.sql b/src/main/resources/sql/20181223/add_function_service_dict_column.sql new file mode 100644 index 000000000..1e9387e26 --- /dev/null +++ b/src/main/resources/sql/20181223/add_function_service_dict_column.sql @@ -0,0 +1,149 @@ +ALTER TABLE `function_service_dict` ADD COLUMN `sort` int(11) NOT NULL DEFAULT 0 AFTER `is_import`; + +INSERT INTO `function_service_dict` VALUES ('1', '28', '0', '16', 'reject', '261', 'audio_sample_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '0', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('2', '28', '0', '1', 'monit', '389', 'audio_sample_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('3', '29', '0', '16', 'reject', '262', 'video_sample_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('4', '29', '0', '1', 'monit', '390', 'video_sample_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('5', '30', '0', '16', 'reject', '263', 'pic_sample_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('6', '30', '0', '1', 'monit', '391', 'pic_sample_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('7', '31', '0', '16', 'reject', '264', 'voip_sample_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('8', '31', '0', '1', 'monit', '392', 'voip_sample_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('9', '32', '0', '16', 'reject', '266', 'video_pornography_sample_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('10', '32', '0', '1', 'monit', '394', 'video_pornography_sample_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('11', '33', '0', '16', 'reject', '266', 'video_pornography_sample_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('12', '33', '0', '1', 'monit', '394', 'video_pornography_sample_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('13', '3', '0', '1', 'monit', '13', 'ip_white_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('14', '3', '0', '16', 'reject', '14', 'ip_white_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('15', '3', '0', '128', 'whitelist', '1', 'ip_white_whitelist', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('16', '24', '22', '16', 'reject', '38', 'av_voip_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('17', '24', '22', '1', 'monit', '150', 'av_voip_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('18', '8', '4', '16', 'reject', '17', 'website_advanced_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('19', '8', '4', '1', 'monit', '129', 'website_advanced_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('20', '6', '0', '128', 'whitelist', '2', 'domain_white_whitelist', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('21', '20', '0', '16', 'reject', '271', 'av_content_ip_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('22', '20', '0', '1', 'monit', '384', 'av_content_ip_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('23', '5', '0', '16', 'reject', '16', 'ip_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('24', '5', '0', '1', 'monit', '128', 'ip_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('25', '5', '0', '32', 'drop', '3', 'ip_drop', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2', '1', '4'); +INSERT INTO `function_service_dict` VALUES ('26', '34', '10', '1', 'monit', '131', 'ssl_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('27', '34', '10', '16', 'reject', '19', 'ssl_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('28', '21', '0', '16', 'reject', '258', 'av_pic_ip_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('29', '21', '0', '1', 'monit', '386', 'av_pic_ip_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('30', '22', '23', '16', 'reject', '39', 'av_content_url_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('31', '22', '23', '1', 'monit', '151', 'av_content_url_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('32', '23', '0', '16', 'reject', '259', 'av_pic_url_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('33', '23', '0', '1', 'monit', '387', 'av_pic_url_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('34', '5', '0', '96', 'loop', '4', 'ip_loop', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('35', '7', '6', '16', 'reject', '18', 'website_dns_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('36', '7', '6', '1', 'monit', '130', 'website_dns_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('37', '35', '5', '16', 'reject', '20', 'mail_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('38', '35', '5', '1', 'monit', '132', 'mail_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('39', '41', '11', '1', 'monit', '138', 'ssh_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('40', '41', '11', '16', 'reject', '26', 'ssh_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('41', '51', '7', '1', 'monit', '133', 'ftp_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('42', '51', '7', '16', 'reject', '21', 'ftp_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('43', '42', '14', '16', 'reject', '24', 'openvpn_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('44', '42', '14', '1', 'monit', '136', 'openvpn_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('45', '43', '13', '16', 'reject', '23', 'l2tp_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('46', '43', '13', '1', 'monit', '135', 'l2tp_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('47', '44', '12', '16', 'reject', '22', 'pptp_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('48', '44', '12', '1', 'monit', '134', 'pptp_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('49', '45', '16', '16', 'reject', '27', 'socks_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('50', '45', '16', '1', 'monit', '139', 'socks_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('51', '46', '15', '32', 'drop', '28', 'gre_drop', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('52', '46', '15', '1', 'monit', '140', 'gre_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('53', '47', '8', '32', 'drop', '29', 'ike_drop', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('55', '48', '0', '32', 'drop', '25', 'ipsec_drop', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('56', '48', '8', '1', 'monit', '137', 'ipsec_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('57', '61', '20', '16', 'reject', '31', 'bgp_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('58', '61', '20', '1', 'monit', '143', 'bgp_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('59', '52', '0', '1', 'monit', '399', 'file_transfer_digest_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('60', '52', '0', '16', 'reject', '273', 'file_transfer_digest_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('61', '62', '17', '1', 'monit', '142', 'xmpp_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('62', '62', '17', '16', 'reject', '30', 'xmpp_reject', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('63', '200', '0', '1', 'monit', '512', 'ip_intercepter_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('64', '201', '0', '1', 'monit', '513', 'domain_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('65', '400', '0', '16', 'reject', '65', 'dns_strategy_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('66', '205', '0', '80', 'replace', '560', 'proxy_http_req_body_replace', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('67', '203', '0', '80', 'replace', '561', 'proxy_http_res_body_replace', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('68', '401', '0', '16', 'reject', '64', 'dns_fake_ip_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('69', '63', '21', '16', 'reject', '33', 'app_strategy_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('70', '63', '21', '64', 'ratelimit', '1056', 'app_strategy_ratelimit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '3'); +INSERT INTO `function_service_dict` VALUES ('71', '202', '0', '48', 'redirect', '528', 'proxy_ip_redirect', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('72', '202', '0', '2', 'forward', '544', 'proxy_ip_forward', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('73', '405', '0', '1', 'monit', '1028', 'app_protocol_ip_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('74', '402', '0', '1', 'monit', '1024', 'app_http_feature_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('75', '403', '0', '1', 'monit', '1026', 'app_domain_feature_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('76', '404', '0', '1', 'monit', '1027', 'app_byte_feature_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('77', '204', '0', '2', 'forward', '545', 'proxy_domain_forward', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('78', '302', '0', '64', 'ratelimit', '1057', 'ip_ratelimit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('79', '303', '0', '64', 'ratelimit', '1058', 'domain_ratelimit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('80', '300', '0', '80', 'loop', '835', 'snat_ip_complex_loop', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('81', '206', '0', '48', 'redirect', '529', 'http_redirect', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('82', '301', '0', '96', 'loop', '5', 'ddos_ip_drop', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('83', '406', '0', '96', 'loop', '832', 'dnat_ip_reuse_adress_pool_loop', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('84', '63', '21', '1', 'monit', '145', 'app_strategy_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('85', '63', '21', '32', 'drop', '1040', 'app_strategy_drop', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('86', '207', '0', '16', 'reject', '576', 'ctrl_http_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('87', '208', '0', '48', 'redirect', '528', 'ctrl_http_redirect', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('88', '209', '0', '80', 'replace', '560', 'ctrl_http_replace', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('89', '210', '0', '1', 'monit', '592', 'ctrl_http_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5,6', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('90', '211', '0', '128', 'whitelist', '750', 'ctrl_http_whitelist', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('91', '407', '21', '16', 'reject', '35', 'basic_protocol_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('92', '407', '21', '64', 'ratelimit', '1059', 'basic_protocol_ratelimit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '3'); +INSERT INTO `function_service_dict` VALUES ('93', '407', '21', '1', 'monit', '147', 'basic_protocol_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('94', '407', '21', '32', 'drop', '1041', 'basic_protocol_drop', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('95', '408', '21', '16', 'reject', '36', 'encrypted_tunnel_behavior_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('96', '408', '21', '64', 'ratelimit', '1060', 'encrypted_tunnel_behavior_ratelimit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('97', '408', '21', '1', 'monit', '148', 'encrypted_tunnel_behavior_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '1', '3'); +INSERT INTO `function_service_dict` VALUES ('98', '408', '21', '32', 'drop', '1042', 'encrypted_tunnel_behavior_drop', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('99', '200', '0', '128', 'whitelist', '521', 'ip_intercepter_whitelist', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('100', '201', '0', '128', 'whitelist', '521', 'domain_whitelist', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('101', '510', '0', '16', 'reject', '34', 'p2p_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('102', '25', '0', '1', 'monit', '395', 'av_voip_account_monit', '', '0', null, '2018-08-16 20:53:44', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('103', '25', '0', '16', 'reject', '267', 'av_voip_account_reject', '', '0', null, '2018-08-16 20:55:38', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('104', '520', '0', '1', 'monit', '1029', 'app_ssl_cert_feature_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('105', '530', '0', '1', 'monit', '1031', 'APP_LAYER_HEADER', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('108', '5', '0', '64', 'ratelimit', '514', 'ip_intercepter_ratelimit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '4', '1', '3'); +INSERT INTO `function_service_dict` VALUES ('109', '201', '0', '64', 'ratelimit', '515', 'domain_intercepter_ratelimit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '3'); +INSERT INTO `function_service_dict` VALUES ('110', '212', '0', '80', 'replace', '517', 'ip_intercepter_replace', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('114', '550', '0', '1', 'monit', '1030', 'app_session_feature_monit', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('115', '560', '0', '1', 'monit', '1152', 'app_topic_domain_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('116', '570', '0', '1', 'monit', '520', 'intercept_file_strategy', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('118', '601', '0', '16', 'reject', '37', 'ANS_POLICY_REJECT', 'ANS_POLICY_REJECT', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('119', '601', '0', '1', 'monit', '149', 'ANS_POLICY_MONIT', 'ANS_POLICY_MONIT', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('120', '510', '0', '1', 'monit', '146', 'p2p_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('121', '630', '0', '16', 'reject', '268', 'mm_speaker_recognization_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('122', '630', '0', '1', 'monit', '396', 'mm_speaker_recognization_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('123', '631', '0', '1', 'monit', '397', 'mm_logo_detection_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('124', '631', '0', '16', 'reject', '269', 'mm_logo_detection_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('125', '632', '0', '1', 'monit', '398', 'mm_face_recognization_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('126', '632', '0', '16', 'reject', '270', 'mm_face_recognization_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('127', '561', '0', '1', 'monit', '1025', 'APP_PAYLOAD', null, '1', '1', null, null, null, '1', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('129', '562', '0', '1', 'monit', '1027', 'APP_DNS', null, '1', null, null, null, null, '1', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('130', '22', '0', '128', 'whitelist', '257', 'av_content_url_whitelist', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('131', '20', '0', '128', 'whitelist', '256', 'av_content_ip_whitelist', '', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('132', '563', '0', '1', 'monit', '1025', 'APP_PAYLOAD_ADMIN', '', '1', '1', '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2,3,4,5', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('133', '564', '0', '1', 'monit', '1027', 'APP_DNS_ADMIN', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '1,2', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('134', '565', '0', '1', 'monit', '1024', 'APP_HTTP_ADMIN', '', '1', '1', '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2,3,4,5', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('135', '566', '0', '1', 'monit', '1029', 'APP_SSL_ADMIN', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2,3,4,5', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('136', '567', '0', '1', 'monit', '1030', 'APP_DK_GL', '', '1', '1', '2018-09-20 11:14:07', null, '2018-09-20 11:14:10', '2', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('137', '5', '0', '64', 'ratelimit', '514', 'ip_ratelimit', 'ip地址限速', '0', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '4', '0', '0'); +INSERT INTO `function_service_dict` VALUES ('138', '6', '4', '16', 'reject', '17', 'website_http_reject', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2', '1', '3'); +INSERT INTO `function_service_dict` VALUES ('139', '6', '4', '1', 'monit', '129', 'website_http_monit', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '2', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('140', '5', '0', '16', 'reject', '37', 'asn_reject', 'ANS_REJECT', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '5', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('141', '5', '0', '1', 'monit', '149', 'asn_monit', 'ANS_MONIT', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '5', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('142', '633', '0', '96', 'loop', '834', 'snat_ip_reuse_adress_pool_loop', '', '1', null, '0000-00-00 00:00:00', null, '0000-00-00 00:00:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('143', '304', '0', '80', 'loop', '836', 'dnat_ip_complex_loop', '', '1', null, '2018-09-30 13:00:00', null, '2018-09-30 14:00:00', '1', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('147', '37', '5', '128', 'whitelist', '66', 'mail_address_whitelist', null, '1', null, '2018-10-15 14:01:32', null, null, '1,2', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('148', '37', '5', '1', 'monit', '132', 'mail_address_monit', null, '1', null, '2018-10-15 14:01:35', null, null, '1,2', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('149', '37', '5', '16', 'reject', '20', 'mail_address_reject', null, '1', null, '2018-10-15 14:01:38', null, null, '1,2', '1', '3'); +INSERT INTO `function_service_dict` VALUES ('150', '635', '4', '1', 'monit', '152', 'http_keyword_monit', null, '1', null, null, null, null, '', '1', '1'); +INSERT INTO `function_service_dict` VALUES ('151', '635', '4', '16', 'reject', '40', 'http_keyword_reject', null, '1', null, null, null, null, '', '1', '2'); +INSERT INTO `function_service_dict` VALUES ('152', '571', '0', '1', 'monit', '640', 'PXY_OBJ_TRUSTED_CA_CERT', '', '1', null, '2018-10-06 14:21:00', null, '2018-10-06 14:21:00', '', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('153', '0', '0', '0', '', '0', '', null, '0', null, null, null, null, null, '0', '0'); +INSERT INTO `function_service_dict` VALUES ('154', '213', '0', '48', 'cache', '625', 'proxy_cache_policy_redirect', null, '1', null, '2018-11-08 11:14:30', null, '2018-11-08 11:14:33', '2', '0', '2'); +INSERT INTO `function_service_dict` VALUES ('155', '213', '0', '128', 'cache_whitelist', '624', 'proxy_cache_policy_whitelist', null, '1', null, '2018-11-08 11:16:18', null, '2018-11-08 11:16:23', null, '0', '1'); +INSERT INTO `function_service_dict` VALUES ('157', '301', '0', '1', 'monit', '6', 'ddos_ip_monit', '', '1', '1', '2018-12-15 09:47:57', '1', '2018-12-15 09:47:57', '1', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('159', '666', '0', '1', 'monit', '642', 'PXY_OBJ_SPOOFING_IP_POOL', null, '1', null, '2018-12-16 15:04:45', null, '2018-12-16 15:04:47', '1', '0', '1'); +INSERT INTO `function_service_dict` VALUES ('161', '214', '0', '48', 'spoofing', '518', 'ip_intercept_spoofing', 'ip仿冒', '1', null, '2018-12-16 17:27:32', null, '2018-12-16 17:27:34', '1', '0', '1'); \ No newline at end of file diff --git a/src/main/resources/sql/20181225/add_sys_menu.sql b/src/main/resources/sql/20181225/add_sys_menu.sql new file mode 100644 index 000000000..955718da2 --- /dev/null +++ b/src/main/resources/sql/20181225/add_sys_menu.sql @@ -0,0 +1,5 @@ +#ʵʱ +INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1200', '780', '0,1,780,', 'event_report', '¼', '5030', '', '', '', '1', '', '1', '2018-12-25 17:28:17', '1', '2018-12-25 17:28:17', '', '1', NULL, '0', '0', NULL); +INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1199', '1200', '0,1,780,1200,', 'ntc_event_key_protection_report', 'ص㱣¼', '5030', '/eventKeyProtection/eventKeyProtectionList', '', '', '1', '', '1', '2018-12-25 14:13:08', '1', '2018-12-25 17:31:02', '', '1', NULL, '0', '0', NULL); +INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1198', '1200', '0,1,780,1200,', 'ntc_event_block_report', '¼±', '5030', '/eventBlock/eventBlockList', '', '', '1', '', '1', '2018-12-25 14:10:15', '1', '2018-12-25 17:30:35', '', '1', NULL, '0', '0', NULL); +INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1197', '1200', '0,1,780,1200,', 'ntc_event_monitor_report', '¼ⱨ', '5030', '/eventMonitor/eventMonitorList', '', '', '1', '', '1', '2018-12-25 14:06:15', '1', '2018-12-25 17:29:57', '', '1', NULL, '0', '0', NULL); diff --git a/src/main/resources/sql/20181226/update_function_dicts.sql b/src/main/resources/sql/20181226/update_function_dicts.sql new file mode 100644 index 000000000..deef084a0 --- /dev/null +++ b/src/main/resources/sql/20181226/update_function_dicts.sql @@ -0,0 +1,8 @@ +-- 代理 控制策略导入字典表修改 +UPDATE function_region_dict SET is_import = 1 WHERE function_id = 210 AND dict_id != 184; +UPDATE function_region_dict SET is_import = 1 WHERE function_id = 207 AND dict_id != 181; +UPDATE function_region_dict SET is_import = 1 WHERE function_id = 208 AND dict_id != 182; +UPDATE function_region_dict SET is_import = 1 WHERE function_id = 209 AND dict_id != 183; +UPDATE function_region_dict SET is_import = 1 WHERE function_id = 211 AND dict_id != 185; + +UPDATE function_service_dict SET is_import = 1 WHERE function_id IN(210,207,208,209,211); \ No newline at end of file diff --git a/src/main/resources/sql/20181228/add_sys_user b/src/main/resources/sql/20181228/add_sys_user new file mode 100644 index 000000000..3f1d32138 --- /dev/null +++ b/src/main/resources/sql/20181228/add_sys_user @@ -0,0 +1,4 @@ +-- 修改admin账号ID +UPDATE `sys_user` SET `ID`='6' WHERE (`ID`='1'); +-- 新增管理员账号为ceiec,密码为admin!@# +INSERT INTO `sys_user` (`ID`, `photo`, `LOGIN_ID`, `NAME`, `EMAIL`, `IDENTITY`, `PASSWORD`, `CREATE_TIME`, `STATUS`, `COMPANY_ID`, `ENTITY_ID`, `OFFICE_ID`) VALUES ('1', '', 'ceiec', 'ceiec', '0', '1', '0793d0c8f2e5187b9cb415baf1ac9a1c58d32dd47cfbc534d260f60c', '2018-12-28 16:49:13', '1', '0', '0', '0'); \ No newline at end of file diff --git a/src/main/resources/sql/20181228/sys_menu_icons.sql b/src/main/resources/sql/20181228/sys_menu_icons.sql new file mode 100644 index 000000000..99ea910f5 --- /dev/null +++ b/src/main/resources/sql/20181228/sys_menu_icons.sql @@ -0,0 +1,78 @@ +update sys_menu set icon='fa fa-sticky-note-o' where id=639; +update sys_menu set icon='fa fa-sticky-note-o' where id=606; +update sys_menu set icon='fa fa-sticky-note-o' where id=807; +update sys_menu set icon='fa fa-globe' where id=1166; +update sys_menu set icon='icon-user' where id=20; +update sys_menu set icon='icon-user' where id=29; +update sys_menu set icon='icon-user-md' where id=28; +update sys_menu set icon='icon-lock' where id=30; +update sys_menu set icon='fa fa-users' where id=1156; +update sys_menu set icon='fa fa-exclamation-triangle' where id=801; +update sys_menu set icon='fa fa-exclamation-triangle' where id=759; +update sys_menu set icon='fa fa-exclamation-triangle' where id=887; +update sys_menu set icon='fa fa-exclamation-triangle' where id=861; +update sys_menu set icon='fa fa-exclamation-triangle' where id=731; +update sys_menu set icon='icon-pencil' where id=43; +update sys_menu set icon='icon-list-alt' where id=42; +update sys_menu set icon='icon-cogs' where id=2; +update sys_menu set icon='icon-check ' where id=3; +update sys_menu set icon='fa fa-exchange' where id=933; +update sys_menu set icon='fa fa-exchange' where id=1133; +update sys_menu set icon='fa fa-exchange' where id=936; +update sys_menu set icon='fa fa-exchange' where id=930; +update sys_menu set icon='fa fa-exchange' where id=1130; +update sys_menu set icon='fa fa-server' where id=207; +update sys_menu set icon='fa fa-tasks' where id=112; +update sys_menu set icon='icon-lock' where id=7; +update sys_menu set icon='icon-envelope-open' where id=85; +update sys_menu set icon='fa fa-institution' where id=850; +update sys_menu set icon='fa fa-institution' where id=719; +update sys_menu set icon='fa fa-institution' where id=951; +update sys_menu set icon='fa fa-institution' where id=956; +update sys_menu set icon='fa fa-institution' where id=748; +update sys_menu set icon='fa fa-inbox' where id=931; +update sys_menu set icon='fa fa-inbox' where id=934; +update sys_menu set icon='fa fa-inbox' where id=937; +update sys_menu set icon='fa fa-inbox' where id=1131; +update sys_menu set icon='fa fa-inbox' where id=1134; +update sys_menu set icon='icon-tablet' where id=27; +update sys_menu set icon='fa fa-th' where id=1096; +update sys_menu set icon='fa fa-th' where id=1098; +update sys_menu set icon='fa fa-th' where id=1097; +update sys_menu set icon='fa fa-th' where id=943; +update sys_menu set icon='fa fa-th' where id=940; +update sys_menu set icon='icon-th-large' where id=17; +update sys_menu set icon='fa fa-television' where id=945; +update sys_menu set icon='fa fa-television' where id=942; +update sys_menu set icon='fa fa-television' where id=938; +update sys_menu set icon='fa fa-television' where id=932; +update sys_menu set icon='fa fa-television' where id=935; +update sys_menu set icon='icon-list-alt' where id=4; +update sys_menu set icon='fa fa-cubes' where id=750; +update sys_menu set icon='fa fa-cubes' where id=865; +update sys_menu set icon='fa fa-cubes' where id=717; +update sys_menu set icon='icon-tag' where id=113; +update sys_menu set icon='icon-globe' where id=182; +update sys_menu set icon='fa fa-gear' where id=1203; +update sys_menu set icon='fa fa-sitemap' where id=117; +update sys_menu set icon='fa fa-clone' where id=973; +update sys_menu set icon='fa fa-clone' where id=972; +update sys_menu set icon='fa fa-clone' where id=948; +update sys_menu set icon='fa fa-indent' where id=1184; +update sys_menu set icon='fa fa-tasks' where id=1205; +update sys_menu set icon='fa fa-reorder' where id=1183; +update sys_menu set icon='fa fa-link' where id=1198; +update sys_menu set icon='icon-question' where id=23; +update sys_menu set icon='fa fa-th-large' where id=716; +update sys_menu set icon='icon-th-list' where id=10; +update sys_menu set icon='fa fa-dashboard' where id=875; +update sys_menu set icon='fa fa-calculator' where id=1155; +update sys_menu set icon='fa fa-map' where id=1185; +update sys_menu set icon='fa fa-delicious' where id=111; +update sys_menu set icon='icon-wrench' where id=13; +update sys_menu set icon='fa fa-soccer-ball-o' where id=181; +update sys_menu set icon='fa fa-industry' where id=1039; +update sys_menu set icon='fa fa-sitemap' where id=1197; +update sys_menu set icon='fa fa-random' where id=1182; +update sys_menu set icon='icon-pointer' where id=115; +update sys_menu set icon='fa fa-map' where id=1136; diff --git a/src/main/resources/sql/20181228/update_pxy_intercept_policy.sql b/src/main/resources/sql/20181228/update_pxy_intercept_policy.sql new file mode 100644 index 000000000..94cecc286 --- /dev/null +++ b/src/main/resources/sql/20181228/update_pxy_intercept_policy.sql @@ -0,0 +1,22 @@ +UPDATE `function_service_dict` SET `dict_id`='63', `function_id`='200', `protocol_id`='0', `action`='1', `action_code`='monit', `service_id`='512', `service_name`='ip_intercepter_monit', `service_desc`='', `is_valid`='1', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `region_code`='1,2', `is_import`='0', `sort`='2' WHERE (`dict_id`='63'); +UPDATE `function_service_dict` SET `dict_id`='64', `function_id`='200', `protocol_id`='0', `action`='1', `action_code`='monit', `service_id`='512', `service_name`='domain_monit', `service_desc`='', `is_valid`='0', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `region_code`='', `is_import`='0', `sort`='2' WHERE (`dict_id`='64'); +UPDATE `function_service_dict` SET `dict_id`='99', `function_id`='200', `protocol_id`='0', `action`='128', `action_code`='whitelist', `service_id`='521', `service_name`='ip_intercepter_whitelist', `service_desc`='', `is_valid`='1', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `region_code`='1,2', `is_import`='0', `sort`='1' WHERE (`dict_id`='99'); +UPDATE `function_service_dict` SET `dict_id`='100', `function_id`='200', `protocol_id`='0', `action`='128', `action_code`='whitelist', `service_id`='521', `service_name`='domain_whitelist', `service_desc`='', `is_valid`='0', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `region_code`='', `is_import`='0', `sort`='1' WHERE (`dict_id`='100'); +UPDATE `function_service_dict` SET `dict_id`='108', `function_id`='200', `protocol_id`='0', `action`='64', `action_code`='ratelimit', `service_id`='514', `service_name`='ip_intercepter_ratelimit', `service_desc`='', `is_valid`='1', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `region_code`='1,2', `is_import`='1', `sort`='3' WHERE (`dict_id`='108'); +UPDATE `function_service_dict` SET `dict_id`='109', `function_id`='200', `protocol_id`='0', `action`='64', `action_code`='ratelimit', `service_id`='515', `service_name`='domain_intercepter_ratelimit', `service_desc`='', `is_valid`='0', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `region_code`='', `is_import`='0', `sort`='3' WHERE (`dict_id`='109'); + + +UPDATE `function_region_dict` SET `dict_id`='53', `function_id`='200', `config_district`='', `config_region_code`='1', `config_region_value`='PXY_INTERCEPT_IP', `config_desc`='PXY拦截IP', `is_valid`='1', `is_maat`='1', `region_type`='1', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `config_service_type`='intercept_ratelimit_ip', `config_expr_type`='', `config_match_method`='', `config_ip_type`='4,6', `config_hex`='', `config_multi_keywords`='', `config_ip_pattern`='1,2,3', `config_port_pattern`='1,2', `config_direction`='0', `config_protocol`='6,17', `config_ip_port_show`='1,2,3,4', `config_region_sort`='1', `is_import`='0' WHERE (`dict_id`='53'); +UPDATE `function_region_dict` SET `dict_id`='56', `function_id`='200', `config_district`='', `config_region_code`='2', `config_region_value`='PXY_INTERCEPT_DOMAIN', `config_desc`='PXY拦截域名', `is_valid`='1', `is_maat`='1', `region_type`='2', `creator_id`=NULL, `create_time`='0000-00-00 00:00:00', `editor_id`=NULL, `edit_time`='0000-00-00 00:00:00', `config_service_type`='intercept_domain', `config_expr_type`='0', `config_match_method`='1', `config_ip_type`='', `config_hex`='2', `config_multi_keywords`='0', `config_ip_pattern`='', `config_port_pattern`='', `config_direction`='', `config_protocol`='', `config_ip_port_show`='', `config_region_sort`='1', `is_import`='0' WHERE (`dict_id`='56'); + + + +UPDATE `sys_menu` SET `id`='721', `parent_id`='719', `parent_ids`='0,1,86,719,', `code`='intercept_policy', `name`='拦截策略', `sort`='30', `href`='', `target`='', `icon`='', `is_show`='0', `permission`='', `create_by`='1', `create_date`='2018-06-19 17:29:52', `update_by`='1', `update_date`='2018-12-28 14:21:42', `remarks`='', `del_flag`='1', `menu_bg`='/online-help/proxy/intercept_policy', `quick_action`='0', `is_top`='0', `function_id`='0' WHERE (`id`='721'); +UPDATE `sys_menu` SET `id`='722', `parent_id`='719', `parent_ids`='0,1,86,719,', `code`='intercept_policy', `name`='拦截策略', `sort`='30', `href`='/proxy/intercept/ip/list?cfgName=ip_intercept', `target`='', `icon`='', `is_show`='1', `permission`='intercept:ip:config', `create_by`='1', `create_date`='2018-06-19 17:38:06', `update_by`='1', `update_date`='2018-12-28 14:26:45', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='200' WHERE (`id`='722'); +UPDATE `sys_menu` SET `id`='756', `parent_id`='748', `parent_ids`='0,1,150,748,', `code`='intercept_policy', `name`='拦截策略', `sort`='30', `href`='', `target`='', `icon`='', `is_show`='0', `permission`='', `create_by`='1', `create_date`='2018-06-19 17:29:52', `update_by`='1', `update_date`='2018-12-28 14:21:07', `remarks`='', `del_flag`='1', `menu_bg`='', `quick_action`='0', `is_top`='0', `function_id`=NULL WHERE (`id`='756'); +UPDATE `sys_menu` SET `id`='768', `parent_id`='748', `parent_ids`='0,1,150,748,', `code`='intercept_policy', `name`='拦截策略', `sort`='30', `href`='/proxy/intercept/ip/list?cfgName=ip_intercept', `target`='', `icon`='', `is_show`='1', `permission`='intercept:ip:confirm', `create_by`='1', `create_date`='2018-07-04 10:16:24', `update_by`='1', `update_date`='2018-12-28 14:19:04', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='200' WHERE (`id`='768'); +UPDATE `sys_menu` SET `id`='851', `parent_id`='850', `parent_ids`='0,1,151,850,', `code`='intercept_policy', `name`='拦截策略', `sort`='30', `href`='', `target`='', `icon`='', `is_show`='0', `permission`='', `create_by`='1', `create_date`='2018-07-13 16:27:49', `update_by`='1', `update_date`='2018-12-28 14:21:27', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`=NULL WHERE (`id`='851'); +UPDATE `sys_menu` SET `id`='853', `parent_id`='850', `parent_ids`='0,1,151,850,', `code`='intercept_policy', `name`='拦截策略', `sort`='30', `href`='/proxy/intercept/ip/list?cfgName=ip_intercept', `target`='', `icon`='', `is_show`='1', `permission`='intercept:ip:audit', `create_by`='1', `create_date`='2018-07-13 16:29:26', `update_by`='1', `update_date`='2018-12-28 14:20:02', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='200' WHERE (`id`='853'); +UPDATE `sys_menu` SET `id`='1187', `parent_id`='717', `parent_ids`='0,1,86,717,', `code`='spoofing_ip_object', `name`='Spoofing IP Object', `sort`='5030', `href`='/proxy/spoofing/pool/list', `target`='', `icon`='', `is_show`='0', `permission`='proxy:spoofing:pool:config', `create_by`='1', `create_date`='2018-12-16 11:21:04', `update_by`='1', `update_date`='2018-12-27 20:25:31', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='666' WHERE (`id`='1187'); +UPDATE `sys_menu` SET `id`='1189', `parent_id`='750', `parent_ids`='0,1,150,750,', `code`='spoofing_ip_object', `name`='Spoofing IP Object', `sort`='450', `href`='/proxy/spoofing/pool/list', `target`='', `icon`='', `is_show`='0', `permission`='proxy:spoofing:pool:confirm', `create_by`='1', `create_date`='2018-12-16 15:16:44', `update_by`='1', `update_date`='2018-12-27 20:25:50', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='666' WHERE (`id`='1189'); +UPDATE `sys_menu` SET `id`='1190', `parent_id`='865', `parent_ids`='0,1,151,865,', `code`='spoofing_ip_object', `name`='Spoofing IP Object', `sort`='450', `href`='/proxy/spoofing/pool/list', `target`='', `icon`='', `is_show`='0', `permission`='', `create_by`='1', `create_date`='2018-12-16 15:16:44', `update_by`='1', `update_date`='2018-12-27 20:27:12', `remarks`='', `del_flag`='1', `menu_bg`='', `quick_action`='0', `is_top`='0', `function_id`='666' WHERE (`id`='1190'); diff --git a/src/main/resources/sql/20181229/add_sys_menu.sql b/src/main/resources/sql/20181229/add_sys_menu.sql new file mode 100644 index 000000000..52957f68f --- /dev/null +++ b/src/main/resources/sql/20181229/add_sys_menu.sql @@ -0,0 +1,8 @@ +-- 新增ip payload日志菜单,以及ip spoofing,ip payload实时统计菜单 +INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('940', '0,1,152,940,', 'ip_payload', 'IP Payload', '64', '/log/ntc/ntcOpenvpnLogs/list', '', '', '1', '', '1', '2018-12-29 14:59:51', '1', '2018-12-29 14:59:51', '', '1', NULL, '0', '0', '212'); +INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ( '943', '0,1,780,943,', 'ip_payload', 'IP Payload', '60', '/report/list?cfgName=ip_payload&reportType=1', '', '', '1', '', '1', '2018-12-29 15:05:12', '1', '2018-12-29 15:05:12', '', '1', NULL, '0', '0', '212'); +INSERT INTO `sys_menu` ( `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ( '943', '0,1,780,943,', 'spoofing_ip_policy', 'IP Spoofing', '90', '/report/list?cfgName=spoofing_ip_policy&reportType=1', '', '', '1', '', '1', '2018-12-29 15:06:02', '1', '2018-12-29 16:02:03', '', '1', NULL, '0', '0', '214'); +-- 新增流量日志菜单,并修改通联关系域radius日志为流量日志下的子菜单 +INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1217', '152', '0,1,152,', 'traffic_connect_log', 'Traffic Connect Log', '190', '', '', '', '1', '', '1', '2018-12-29 14:06:08', '1', '2018-12-29 14:06:08', '', '1', NULL, '0', '0', NULL); +UPDATE `sys_menu` SET `id`='1179', `parent_id`='1217', `parent_ids`='0,1,152,1217,', `code`='radius_log', `name`='RADIUS协议日志', `sort`='80', `href`='/log/ntc/radiusLogs', `target`='', `icon`='', `is_show`='1', `permission`='', `create_by`='1', `create_date`='2018-12-12 15:14:37', `update_by`='1', `update_date`='2018-12-29 14:06:33', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='0' WHERE (`id`='1179'); +UPDATE `sys_menu` SET `id`='1181', `parent_id`='1217', `parent_ids`='0,1,152,1217,', `code`='conn_record', `name`='通联关系', `sort`='110', `href`='/log/ntc/connRecordLogs', `target`='', `icon`='', `is_show`='1', `permission`='', `create_by`='1', `create_date`='2018-12-15 15:47:32', `update_by`='1', `update_date`='2018-12-29 14:06:55', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`=NULL WHERE (`id`='1181'); diff --git a/src/main/resources/sql/20181229/update_region_import.sql b/src/main/resources/sql/20181229/update_region_import.sql new file mode 100644 index 000000000..805bf9244 --- /dev/null +++ b/src/main/resources/sql/20181229/update_region_import.sql @@ -0,0 +1,12 @@ +# App Httpñ״̬ +update function_region_dict set is_import='1' where dict_id='220'; +update function_region_dict set is_import='1' where dict_id='223'; +update function_service_dict set is_import='1' where dict_id='134'; +#dnsñ״̬ +update function_region_dict set is_import='1' where dict_id='216'; +update function_service_dict set is_import='1' where dict_id='133'; +#sslñ״̬ +update function_region_dict set is_import='1' where dict_id='224'; +update function_region_dict set is_import='1' where dict_id='227'; +update function_service_dict set is_import='1' where dict_id='135'; + diff --git a/src/main/resources/sql/20181230/update_sys_menu.sql b/src/main/resources/sql/20181230/update_sys_menu.sql new file mode 100644 index 000000000..64576747b --- /dev/null +++ b/src/main/resources/sql/20181230/update_sys_menu.sql @@ -0,0 +1,3 @@ +-- 修改菜单国际化编码 +UPDATE `sys_menu` SET `id`='1151', `parent_id`='706', `parent_ids`='0,1,152,1131,706,', `code`='keyword_log_to_url', `name`='网页关键字', `sort`='30', `href`='/log/ntc/httpkey/list', `target`='', `icon`='', `is_show`='1', `permission`='', `create_by`='1', `create_date`='2018-10-25 18:22:36', `update_by`='1', `update_date`='2018-12-30 12:34:10', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='635' WHERE (`id`='1151'); +UPDATE `sys_menu` SET `id`='1152', `parent_id`='706', `parent_ids`='0,1,152,1131,706,', `code`='http_log', `name`='HTTP', `sort`='20', `href`='/log/ntc/http/list', `target`='', `icon`='', `is_show`='1', `permission`='', `create_by`='1', `create_date`='2018-10-25 18:24:43', `update_by`='1', `update_date`='2018-12-30 12:34:31', `remarks`='', `del_flag`='1', `menu_bg`=NULL, `quick_action`='0', `is_top`='0', `function_id`='8' WHERE (`id`='1152'); diff --git a/src/main/resources/sql/20190102/update_function_dicts.sql b/src/main/resources/sql/20190102/update_function_dicts.sql new file mode 100644 index 000000000..2b3c60455 --- /dev/null +++ b/src/main/resources/sql/20190102/update_function_dicts.sql @@ -0,0 +1,6 @@ +-- APP Payload -- +UPDATE function_region_dict SET is_import = 1 WHERE function_id = 563 AND dict_id = 211; +UPDATE function_region_dict SET is_import = 1 WHERE function_id = 563 AND dict_id = 212; +UPDATE function_service_dict SET is_import = 1 WHERE function_id = 563; + + diff --git a/src/main/webapp/WEB-INF/include/excel/importModal.jsp b/src/main/webapp/WEB-INF/include/excel/importModal.jsp index a72b2da63..2b5297212 100644 --- a/src/main/webapp/WEB-INF/include/excel/importModal.jsp +++ b/src/main/webapp/WEB-INF/include/excel/importModal.jsp @@ -94,11 +94,11 @@
- - + + - - - - - - - - - - -
- @@ -275,27 +259,27 @@ <%-- --%> - + - + - + - - + + - - - + + + + <%-- --%> - + <%-- --%> <%-- --%> - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp index 84df18145..352503204 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgList.jsp @@ -83,6 +83,7 @@ + diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp index 5cd9f029d..b66cdfb08 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp @@ -108,6 +108,7 @@ + @@ -151,8 +152,20 @@ - +<%-- --%> + +
+ + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp index 8748aa669..0c9d50acc 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp @@ -109,6 +109,7 @@ + @@ -152,8 +153,20 @@ - +<%-- --%> + +
+ + +
+
@@ -155,8 +156,20 @@ - +<%-- --%> + +
+ + +
+
+ + + + + + + + + + + + + + + + + +
@@ -150,6 +170,7 @@ + @@ -201,8 +222,20 @@ - +<%-- --%> + +
+ + +
+
- - - - - + + + + + <%-- --%> - - - - - - + + + + + + @@ -409,5 +442,8 @@ + + + <%@include file="/WEB-INF/include/excel/importModal.jsp" %> \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp index cb1df23c7..e36d740c3 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appPolicyCfgList.jsp @@ -155,6 +155,7 @@ + @@ -215,8 +216,20 @@ - +<%-- --%> + +
+ + +
+
@@ -134,8 +135,20 @@ - +<%-- --%> + +
+ + +
+
-
-
-
- + + +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
-
-
+ +
@@ -271,6 +347,7 @@ +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appTcpCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appTcpCfgList.jsp index b8407622b..af3715357 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appTcpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appTcpCfgList.jsp @@ -81,6 +81,7 @@ +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgList.jsp index 04a5bb2ba..0f71bc7a9 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgList.jsp @@ -89,6 +89,7 @@ +
@@ -132,8 +133,20 @@ - +<%-- --%> + +
+ + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/asnPolicyCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/asnPolicyCfgList.jsp index af2010bde..2e9dd7119 100644 --- a/src/main/webapp/WEB-INF/views/cfg/asnPolicyCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/asnPolicyCfgList.jsp @@ -120,6 +120,7 @@ +
diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp index 800fe3940..f5c11ef7c 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp @@ -137,7 +137,7 @@ - <%-- --%> +
diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp index 44b7e558e..102091528 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp @@ -237,6 +237,26 @@ +
+
+ + + + + + + + + + + + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp index 394f88dec..2bd49ceb2 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp @@ -167,6 +167,7 @@ + @@ -213,8 +214,20 @@ - +<%-- --%> + +
+ + +
+ <%-- --%>
@@ -373,6 +386,7 @@
+ @@ -421,6 +435,13 @@ + - - - - <%-- --%> - - - - - - - - - - - - - - - - - <%-- --%> + + + + <%-- --%> + + + + + + + + + + + + + + + + + <%-- --%> diff --git a/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpList.jsp index 842597f93..937451867 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpList.jsp @@ -137,7 +137,7 @@ - <%-- --%> + diff --git a/src/main/webapp/WEB-INF/views/cfg/av/picUrl/picUrlList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/picUrl/picUrlList.jsp index a3cde41b0..fb29aa1e6 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/picUrl/picUrlList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/picUrl/picUrlList.jsp @@ -136,7 +136,7 @@ - <%-- --%> + diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp index 2aa5d678d..031fb57de 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp @@ -237,6 +237,26 @@ +
+
+ + + + + + + + + + + + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp index 3d4ce186c..de9b7d484 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp @@ -158,6 +158,7 @@ + @@ -205,8 +206,20 @@ - +<%-- --%> + +
+ + +
+ <%-- --%>
@@ -361,23 +374,24 @@
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -411,6 +425,13 @@ + + - <%-- --%> - - - - - - - + <%-- --%> + + + + + + + - - - + + + - - <%-- - --%> - - - - - - + + <%-- + --%> + + + + + + - - - - - - - - - - - - <%-- --%> + + + + + + + + + + + + <%-- --%> diff --git a/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgList.jsp index 64346fb4c..76718c95a 100644 --- a/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/dnsIpCfgList.jsp @@ -116,7 +116,7 @@ - <%-- --%> + @@ -161,8 +161,20 @@ - +<%-- --%> + +
+ + +
+
- <%-- --%> - - - - - - - <%-- --%> - - <%-- --%> - - - - - - - <%-- --%> - - - - - - - <%-- --%> + <%-- --%> + + + + + + + <%-- --%> + + <%-- --%> + + + + + + + <%-- --%> + + + + + + + <%-- --%> diff --git a/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/list.jsp b/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/list.jsp index 25d8c42d9..3fe6b8035 100644 --- a/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/list.jsp @@ -155,6 +155,7 @@ + @@ -215,8 +216,20 @@ - +<%-- --%> + +
+ + +
+
@@ -216,6 +217,18 @@ <%-- --%>
+ +
+ + +
+
+
+
+ + + + + + + + + + + + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/ftpList.jsp b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/ftpList.jsp index db63b5bc1..ab48b12bf 100644 --- a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/ftpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/ftpList.jsp @@ -140,6 +140,7 @@ + @@ -186,8 +187,20 @@ - +<%-- --%> + +
+ + +
+
+ @@ -391,6 +405,13 @@ + + @@ -404,6 +418,13 @@ + + - - - <%-- --%> - - + <%-- --%> - + + + <%-- + + + --%> - - - + + + - - - - - + + + <%-- + + --%> <%-- --%> @@ -425,7 +442,7 @@ - + @@ -438,7 +455,7 @@ - + + - - <%-- --%> + - + --%> - + <%-- - + --%> - + + @@ -413,6 +427,13 @@ + + @@ -407,6 +421,13 @@ + - - - - + + + + - <%-- --%> - - - <%-- --%> - - - - - - - - - - - + <%-- --%> + + + <%-- --%> + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/maintenance/userManage/list.jsp b/src/main/webapp/WEB-INF/views/cfg/maintenance/userManage/list.jsp index 993d4ef74..603c75ed5 100644 --- a/src/main/webapp/WEB-INF/views/cfg/maintenance/userManage/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/maintenance/userManage/list.jsp @@ -171,6 +171,18 @@ + +
+ + +
+ href="javascript:;"> @@ -227,13 +239,13 @@ - - - - - - - + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList.jsp b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList.jsp index 0c05f1ea2..facbf44a1 100644 --- a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList.jsp @@ -86,6 +86,7 @@ + diff --git a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList2.jsp b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList2.jsp index 72e7f5154..52911f557 100644 --- a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList2.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/dnatPolicyList2.jsp @@ -91,6 +91,7 @@ + @@ -139,6 +140,18 @@ <%-- --%> + +
+ + +
+
- - - <%-- --%> - - - - - - + + + <%-- --%> + + + + + + - - - <%-- --%> - <%-- --%> - - - - - <%-- --%> - - - - - - + + + <%-- --%> + <%-- --%> + + + + + <%-- --%> + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList.jsp b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList.jsp index de62cab5e..6ea0f1d5b 100644 --- a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList.jsp @@ -86,6 +86,7 @@ + diff --git a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList2.jsp b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList2.jsp index dd977e393..d2d3b9fee 100644 --- a/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList2.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/manipulation/ipmulitiplex/snatPolicyList2.jsp @@ -112,6 +112,7 @@ + @@ -159,6 +160,18 @@ <%-- --%> + +
+ + +
+
- - - - - - - - - <%-- --%> - - - <%-- --%> - <%-- --%> - - - - - - - - - - + + + + + + + + <%-- --%> + + + <%-- --%> + <%-- --%> + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/other/bgpForm.jsp b/src/main/webapp/WEB-INF/views/cfg/other/bgpForm.jsp index 703d6b6f3..b7548e56d 100644 --- a/src/main/webapp/WEB-INF/views/cfg/other/bgpForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/other/bgpForm.jsp @@ -140,6 +140,7 @@ + @@ -207,6 +208,26 @@ + <%--
+
+ + + + + + + + + + + + +
+
--%> diff --git a/src/main/webapp/WEB-INF/views/cfg/other/bgpList.jsp b/src/main/webapp/WEB-INF/views/cfg/other/bgpList.jsp index 48d4c3bdf..87d6b929b 100644 --- a/src/main/webapp/WEB-INF/views/cfg/other/bgpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/other/bgpList.jsp @@ -154,6 +154,7 @@ + @@ -200,8 +201,20 @@ - +<%-- --%> + +
+ + +
+
+ <%-- --%> @@ -405,6 +419,13 @@ + <%-- --%> - - - + + + - - + + - - + + - - - + + + - + - + - + - - - - - - + + + + + + - - - - - - + + + + + + @@ -762,6 +792,8 @@ - + + +<%@include file="/WEB-INF/include/excel/importModal.jsp" %> \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceList.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceList.jsp index 61301572b..316f86dda 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpReqReplaceList.jsp @@ -73,7 +73,7 @@ - <%-- --%> + diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceList.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceList.jsp index 4bed7fb79..1c5c5ceb5 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpResReplaceList.jsp @@ -74,7 +74,7 @@ - <%-- --%> + diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/form.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/form.jsp index 89d184c8c..9e2559c3e 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/form.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/form.jsp @@ -89,11 +89,12 @@ $(function(){
- + <%-- + --%>
diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/list.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/list.jsp index 0909070b7..9f1b8b643 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/spoofingIpPool/list.jsp @@ -146,6 +146,18 @@ + +
+ + +
+
- <%-- --%> - - - - - - - - - - - - <%-- --%> - - - - - - - <%-- --%> + <%-- --%> + + + + + + + + + + + + <%-- --%> + + + + + + + <%-- --%> diff --git a/src/main/webapp/WEB-INF/views/cfg/requestList.jsp b/src/main/webapp/WEB-INF/views/cfg/requestList.jsp index 5ff4f5d4b..40df67070 100644 --- a/src/main/webapp/WEB-INF/views/cfg/requestList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/requestList.jsp @@ -75,10 +75,22 @@ - +<%-- --%> + +
+ + +
+
- - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/stringCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/stringCfgList.jsp index ecc6ea515..d74da82e9 100644 --- a/src/main/webapp/WEB-INF/views/cfg/stringCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/stringCfgList.jsp @@ -90,6 +90,7 @@ + diff --git a/src/main/webapp/WEB-INF/views/cfg/website/dnsForm.jsp b/src/main/webapp/WEB-INF/views/cfg/website/dnsForm.jsp index 2119a0a41..fff8b3634 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/dnsForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/dnsForm.jsp @@ -154,6 +154,7 @@ + @@ -219,6 +220,27 @@ +
+
+ + + + + + + + + + + + +
+
+
@@ -198,8 +199,20 @@ - +<%-- --%> + +
+ + +
+
- - - - - - - - - - - - - - - - - - - + + + + + + + <%-- --%> + + + + + + + + + + + + + @@ -409,6 +423,13 @@ + <%-- --%> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -560,6 +574,13 @@ + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -402,6 +416,13 @@ + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -383,6 +397,13 @@ + + - - - - <%-- - - - - - --%> + + + + <%-- + + + + + --%> - - - <%-- --%> - - - - - - + + + <%-- --%> + + + + + + diff --git a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp index 75356164d..430d229ad 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp @@ -23,22 +23,35 @@ body { color: #fff } .fa-arrow-circle-up { - color: #fe392e; - background-color: white; - border-radius: 10px; - font-size: 13px; - width: 10px; - height: 10px; - line-height: 9px !important; + color: #001029; + background-color: #fe392e; +/* border-radius: 10px; */ +/* font-size: 13px; */ +/* width: 10px; */ +/* height: 10px; */ +/* line-height: 9px !important; */ + border-radius: 12px; + font-size: 15px; + width: 11px; + height: 9px; + line-height: 10px !important } .fa-arrow-circle-down { - color: #42DEEB; - background-color: white; - border-radius: 10px; - font-size: 13px; - width: 10px; - height: 10px; - line-height: 9px !important; + color: #001029; + background-color: #009966; +/* border-radius: 10px; */ +/* font-size: 13px; */ +/* width: 10px; */ +/* height: 10px; */ +/* line-height: 9px !important; */ + border-radius: 12px; + font-size: 15px; + width: 11px; + height: 9px; + line-height: 10px !important +} +.tooltip-inner { + white-space: nowrap; } @@ -56,7 +69,7 @@ body {
-
+
@@ -70,9 +83,9 @@ body { 0 bps
-
+
- +

@@ -81,7 +94,7 @@ body {

-

0

+

0

@@ -90,87 +103,86 @@ body {
- +

" class="tooltips" data-flag="false" data-html="true" data-placement="top">

-

0

+

0

- +

" class="tooltips" data-flag="false" data-html="true" data-placement="top">

-

0

- +

0

- +

" class="tooltips" data-flag="false" data-html="true" data-placement="top">

-

0

+

0

- +
-

" +

" class="tooltips" data-flag="false" data-html="true" data-placement="top">

-

0

+

0

- +

" class="tooltips" data-flag="false" data-html="true" data-placement="top">

-

0

+

0

- +

" class="tooltips" data-flag="false" data-html="true" data-placement="top">

-

0

+

0

@@ -178,8 +190,8 @@ body {
- - +<%-- --%> +<%-- --%>
@@ -217,9 +229,12 @@ body {
- + + + +
@@ -422,7 +437,7 @@ function ajaxinfo(){ var monitorNum =data.monitorNum; var dropConnNum =data.dropConnNum; var newUniConnNum=data.newUniConnNum; - var liveConnNum=data.liveConnNum; + var closeConnNum=data.closeConnNum; if(loopConnNum==null||loopConnNum==""){ loopConnNum=0; @@ -439,17 +454,17 @@ function ajaxinfo(){ if(newUniConnNum==null||newUniConnNum==""){ newUniConnNum=0; } - if(liveConnNum==null||liveConnNum==""){ - liveConnNum=0; + if(closeConnNum==null||closeConnNum==""){ + closeConnNum=0; } dataScroll(".numberRun",Math.round(loopConnNum)); dataScroll(".numberRun1",Math.round(rejectNum)); dataScroll(".numberRun2",Math.round(monitorNum)); dataScroll(".numberRun3",Math.round(dropConnNum)); dataScroll(".numberRun5",Math.round(newUniConnNum)); - dataScroll(".numberRun6",Math.round(liveConnNum)); - dataScroll(".numberRun7",Math.round(newUniConnNum-rejectNum)); - dataScroll(".numberRun8",Math.round(newUniConnNum-rejectNum-dropConnNum)); + dataScroll(".numberRun6",Math.round(closeConnNum)); + dataScroll(".numberRun7",Math.round(newUniConnNum+closeConnNum-rejectNum)); + dataScroll(".numberRun8",Math.round(newUniConnNum-rejectNum)); //计算带宽进出口流量百分比 @@ -457,10 +472,14 @@ function ajaxinfo(){ var inoctetsNumK=inoctetsNum/1024; var inoctetsNumM=inoctetsNumK/1024; var inoctetsNumG=inoctetsNumM/1024; + var inoctetsNumT=inoctetsNumG/1024; + var inoctetsNumP=inoctetsNumT/1024; var outoctetsNum=Math.round(data.outoctetsNum); var outoctetsNumK=outoctetsNum/1024; var outoctetsNumM=outoctetsNumK/1024; var outoctetsNumG=outoctetsNumM/1024; + var outoctetsNumT=outoctetsNumG/1024; + var outoctetsNumP=outoctetsNumT/1024; var unit="bps"; var bandwidth=inoctetsNum+outoctetsNum; if(inoctetsNumK>1||outoctetsNumK>1){ @@ -478,6 +497,16 @@ function ajaxinfo(){ outoctetsNum=outoctetsNumG.toFixed(2); unit="Gbps"; }; + if(inoctetsNumT>1||outoctetsNumT>1){ + inoctetsNum=inoctetsNumT.toFixed(2); + outoctetsNum=outoctetsNumT.toFixed(2); + unit="Tbps"; + }; + if(inoctetsNumP>1||outoctetsNumP>1){ + inoctetsNum=inoctetsNumP.toFixed(2); + outoctetsNum=outoctetsNumP.toFixed(2); + unit="Pbps"; + }; $(".c2sNum").text(inoctetsNum); $(".s2cNum").text(outoctetsNum); @@ -594,7 +623,7 @@ function portActiveList(){ $("#tbodyDataPort").html(""); var n=rs.length; if(rs!=null&&rs.length>0&&rs[0].error!=null){ - $("#tbodyDataPort").prepend("
"); + $("#tbodyDataPort").prepend(""); }else{ if(n>0){ @@ -678,7 +707,7 @@ function systemList(){ rs.reverse(); var n=rs.length; if(rs!=null&&rs.length>0&&rs[0].error!=null){ - $("#tbodyData1").prepend(""); + $("#tbodyData1").prepend(""); }else{ if(n>0){ @@ -791,7 +820,7 @@ function browserList() { rs.reverse(); var n=rs.length; if(rs!=null&&rs.length>0&&rs[0].error!=null){ - $("#tbodyData1").prepend(""); + $("#tbodyData1").prepend(""); }else{ if(n>0){ $(rs).each(function(i, itemObj) { @@ -857,7 +886,7 @@ function websiteList() { $("#tbodyData2").html(""); var n=rs.length; if(rs!=null&&rs.length>0&&rs[0].error!=null){ - $("#tbodyData2").prepend(""); + $("#tbodyData2").prepend(""); }else{ if(n>0){ $(rs).each(function(i, itemObj) { diff --git a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp_new b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp_new deleted file mode 100644 index bc3ab2e8c..000000000 --- a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp_new +++ /dev/null @@ -1,935 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8"%> -<%@ include file="/WEB-INF/include/taglib.jsp"%> - - - - - - 数据概览 - - - - - - - - - - - -
-
${serviceDictInfo.showSequence}${serviceDictInfo.itemCode} diff --git a/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp b/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp index 847d43915..aa0667642 100644 --- a/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/sysDictList.jsp @@ -65,7 +65,7 @@ if(cked.prop("placeholder")!=1){ confirmx("", url+"&sysDictId="+cked.val()); }else{ - if(${fns:getUser().loginId=='admin'}){ + if(${fns:getUser().isAdmin()}){ confirmx("", url+"&sysDictId="+cked.val()); }else{ top.$.jBox.tip("", ""); diff --git a/src/main/webapp/WEB-INF/views/basics/taskInfoList.jsp b/src/main/webapp/WEB-INF/views/basics/taskInfoList.jsp index 1ccdf774d..7b75fb448 100644 --- a/src/main/webapp/WEB-INF/views/basics/taskInfoList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/taskInfoList.jsp @@ -68,10 +68,22 @@ - + <%-- --%> + +
+ + +
+
+ + + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleForm.jsp index 28c0f1f51..8d7ff244e 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleForm.jsp @@ -99,6 +99,11 @@ $(function(){ if(sfd==632||sfd==631){ var files = $(this)[0].files; if(files.length>0){ + //多文件上传个数限制防止get请求url过长 + if(files.length>50){ + top.$.jBox.tip(""+' '+50); + return false; + } for(var i = 0;i < files.length;i ++) { var file = files[i]; var faceName = file.name; diff --git a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp index fa79e79f5..3e601a586 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp @@ -94,6 +94,7 @@ + @@ -137,8 +138,19 @@ -<%-- - --%> + + +
+ + +
+
+ + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/basicprotocol/list.jsp b/src/main/webapp/WEB-INF/views/cfg/basicprotocol/list.jsp index dddab3933..4a8afa2ce 100644 --- a/src/main/webapp/WEB-INF/views/cfg/basicprotocol/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/basicprotocol/list.jsp @@ -158,6 +158,7 @@ + @@ -218,8 +219,20 @@ - +<%-- --%> + +
+ + +
+
-
+
@@ -85,7 +85,7 @@
-
@@ -106,10 +106,147 @@
- + + + +
-
+ + + + + + + + + + +
+
-
+
+ + + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp index 7edadf09a..c93109aa0 100644 --- a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp @@ -212,6 +212,26 @@ +
+
+ + + + + + + + + + + + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp index ec40dc215..e9ee7b755 100644 --- a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp @@ -154,6 +154,7 @@ + @@ -200,8 +201,20 @@ - +<%-- --%> + +
+ + +
+
+ + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/intercept/interceptForm.jsp b/src/main/webapp/WEB-INF/views/cfg/intercept/interceptForm.jsp index d10904252..4a424d0e5 100644 --- a/src/main/webapp/WEB-INF/views/cfg/intercept/interceptForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/intercept/interceptForm.jsp @@ -317,6 +317,7 @@ $(".replaceAction").addClass("hidden"); $(".whiteListAction").addClass("hidden"); $(".spoofingAction").addClass("hidden"); + $(".intensity").removeClass("hidden");//域名关联度 if(interceptRatelimitIp == 'intercept_ratelimit_ip'){ $("select[name='"+protocolNamePrefix+"protocol']").find("option").remove(); $("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh"); @@ -336,6 +337,7 @@ $(".replaceAction").addClass("hidden"); $(".whiteListAction").addClass("hidden"); $(".spoofingAction").addClass("hidden"); + $(".intensity").addClass("hidden");//域名关联度 if(interceptRatelimitIp == 'intercept_ratelimit_ip'){ $("select[name='"+protocolNamePrefix+"protocol']").find("option").remove(); $("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh"); @@ -356,6 +358,7 @@ $(".replaceAction").removeClass("hidden"); $(".whiteListAction").addClass("hidden"); $(".spoofingAction").addClass("hidden"); + $(".intensity").addClass("hidden");//域名关联度 if(interceptRatelimitIp == 'intercept_ratelimit_ip'){ $("select[name='"+protocolNamePrefix+"protocol']").find("option").remove(); $("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh"); @@ -373,6 +376,7 @@ $(".replaceAction").addClass("hidden"); $(".whiteListAction").removeClass("hidden"); $(".spoofingAction").addClass("hidden"); + $(".intensity").addClass("hidden");//域名关联度 if(interceptRatelimitIp == 'intercept_ratelimit_ip'){ $("select[name='"+protocolNamePrefix+"protocol']").find("option").remove(); $("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh"); @@ -392,6 +396,7 @@ $(".replaceAction").addClass("hidden"); $(".whiteListAction").addClass("hidden"); $(".spoofingAction").removeClass("hidden"); + $(".intensity").addClass("hidden");//域名关联度 if(interceptRatelimitIp == 'intercept_ratelimit_ip'){ $("select[name='"+protocolNamePrefix+"protocol']").find("option").remove(); $("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh"); @@ -410,10 +415,13 @@ - + - + + + + @@ -532,25 +540,6 @@ - - -
-
- -
- -
-
-
-
-
--%>
<%-- action 为128 白名单时 --%> - + @@ -213,8 +217,20 @@ - +<%-- --%> + +
+ + +
+
@@ -460,13 +477,22 @@ + + + + + + + + + <%-- + ${indexCfg.userRegion3 } - @@ -474,7 +500,7 @@ @@ -499,14 +525,15 @@ - + ${indexCfg.userRegion2 } + <%-- ${policyGroup.groupName } - + --%> @@ -516,7 +543,7 @@ diff --git a/src/main/webapp/WEB-INF/views/cfg/intercept/strateagy/list.jsp b/src/main/webapp/WEB-INF/views/cfg/intercept/strateagy/list.jsp index cf3b7d488..c08b5a5df 100644 --- a/src/main/webapp/WEB-INF/views/cfg/intercept/strateagy/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/intercept/strateagy/list.jsp @@ -81,7 +81,7 @@ - <%-- --%> + @@ -123,8 +123,20 @@ - +<%-- --%> + +
+ + +
+
@@ -202,8 +202,20 @@ - +<%-- --%> + +
+ + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp index 1a2c8533c..3deeeb8bc 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipForm.jsp @@ -535,6 +535,26 @@ var showHideIPSECProtocol=function(obj){
+
+
+ + + + + + + + + + + + +
+
+ + + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/mail/mailForm.jsp b/src/main/webapp/WEB-INF/views/cfg/mail/mailForm.jsp index b9dd496ef..66dbe66f0 100644 --- a/src/main/webapp/WEB-INF/views/cfg/mail/mailForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/mail/mailForm.jsp @@ -243,6 +243,26 @@ +
+
+ + + + + + + + + + + + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/mail/mailList.jsp b/src/main/webapp/WEB-INF/views/cfg/mail/mailList.jsp index 870f2027c..48c6a01b8 100644 --- a/src/main/webapp/WEB-INF/views/cfg/mail/mailList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/mail/mailList.jsp @@ -153,6 +153,7 @@ + @@ -201,8 +202,20 @@ - +<%-- --%> + +
+ + +
+
+ + + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/maintenance/dnsResStrategy/list.jsp b/src/main/webapp/WEB-INF/views/cfg/maintenance/dnsResStrategy/list.jsp index 12dfc00f7..39ba6fb7b 100644 --- a/src/main/webapp/WEB-INF/views/cfg/maintenance/dnsResStrategy/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/maintenance/dnsResStrategy/list.jsp @@ -101,7 +101,7 @@ - <%-- --%> + @@ -145,8 +145,20 @@ - +<%-- --%> + +
+ + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist.jsp b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist.jsp index a5af9f12c..a574dfb70 100644 --- a/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist.jsp @@ -102,7 +102,7 @@ - <%-- --%> + diff --git a/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp index fc1671cbe..10f034c5b 100644 --- a/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp @@ -198,7 +198,7 @@ - <%-- --%> + @@ -233,6 +233,18 @@ <%-- --%>
+ +
+ + +
+
+ + + + + +
@@ -495,7 +516,7 @@ - + <%@include file="/WEB-INF/include/excel/importModal.jsp" %> diff --git a/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp b/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp index c94599f72..ad753e432 100644 --- a/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp @@ -123,6 +123,7 @@ + diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/cache/list.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/cache/list.jsp index 6aa2380d3..a7b70a08a 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/cache/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/cache/list.jsp @@ -137,6 +137,7 @@ + @@ -180,8 +181,19 @@ - + +
+ + +
+
+ + + + + + + + + + + + + + + <%--
@@ -385,8 +403,20 @@ - +<%-- --%> + +
+ + +
+
+ + + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp b/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp index c0112674f..fb27b1522 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp @@ -281,6 +281,26 @@ +
+
+ + + + + + + + + + + + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp index 6262aa565..5496e3900 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp @@ -303,6 +303,7 @@ + @@ -356,8 +357,20 @@ - +<%-- --%> + +
+ + +
+
+ + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/website/sslForm.jsp b/src/main/webapp/WEB-INF/views/cfg/website/sslForm.jsp index a39eb30ec..dfd5a6712 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/sslForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/sslForm.jsp @@ -225,6 +225,26 @@ +
+
+ + + + + + + + + + + + +
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/website/sslList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/sslList.jsp index d073cb15b..80a66efa1 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/sslList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/sslList.jsp @@ -151,6 +151,7 @@ + @@ -197,8 +198,20 @@ - +<%-- --%> + +
+ + +
+
+ + + + + +
@@ -491,7 +512,7 @@ - + <%@include file="/WEB-INF/include/excel/importModal.jsp" %> diff --git a/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp b/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp index 4746eea48..ecb6dc728 100644 --- a/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp @@ -210,6 +210,26 @@ +
+
+ + + + + + + + + + + + +
+

diff --git a/src/main/webapp/WEB-INF/views/cfg/whitelist/domainList.jsp b/src/main/webapp/WEB-INF/views/cfg/whitelist/domainList.jsp index a74860c96..19d64b3a5 100644 --- a/src/main/webapp/WEB-INF/views/cfg/whitelist/domainList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/whitelist/domainList.jsp @@ -134,6 +134,7 @@ + @@ -178,8 +179,20 @@ - +<%-- --%> + +
+ + +
+

+ + + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp index a96cdd798..0a045c490 100644 --- a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp @@ -149,6 +149,7 @@ + @@ -198,8 +199,20 @@ - +<%-- --%> + +
+ + +
+
- - - - - - - - - -
-
- - - - - - - -
-
-
-
- - - - - - - -
-
-
-
- -
-
-
- - - - -
-
- - - - - - - - - - -
-
-
-
-
-
- <%--
- -
--%> -
-
-
-
-
-
- -
-
-
-
- - - - - - - -
-
-
-
- -
-
-
- - - - -
-
- - - - - - - - - - -
-
- -
-
-
-
-
-
-
- <%--
- -
--%> -
-
-
-
-
- -
- - - - - - - - - - - - - - -<%-- --%> - - - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/ntcTotalReportDetailList.jsp b/src/main/webapp/WEB-INF/views/dashboard/ntcTotalReportDetailList.jsp new file mode 100644 index 000000000..20aa1ebc7 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/ntcTotalReportDetailList.jsp @@ -0,0 +1,343 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="traffic_ip_active"></spring:message> + + + + + +
+ +

+ +

+ +
+ + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+ + +
+
+ +
+
+
+ + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp index 800217ec5..c56cee2b8 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficActionTransList.jsp @@ -17,6 +17,7 @@

+
@@ -27,7 +28,7 @@
+ value="" onclick="WdatePicker({onpicked:setTime,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/>
@@ -36,7 +37,7 @@
+ value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'beginDate\',{d:7})}'});"/> @@ -53,13 +54,17 @@ - + <%-- --%> + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp index 551936bd1..2e4a1b06e 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp @@ -16,7 +16,7 @@ cursor: pointer; } .Wdate { - width: 220px !important; + width: 200px !important; } @@ -43,7 +43,7 @@ + value="${beginDate}" onclick="WdatePicker({onpicked:setTime,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/>
@@ -52,7 +52,7 @@
+ value="${endDate}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'beginDate\',{d:7})}'});"/>
@@ -60,7 +60,7 @@
- @@ -80,8 +80,17 @@
-
- +
+ + +
+ +


@@ -89,18 +98,18 @@ - + - - + +
() () () ()
-
+
/ ,
  
@@ -108,8 +117,12 @@ + + + - +<%-- --%> + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp index a5efa5c86..900278a3a 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp @@ -3,7 +3,7 @@ - <spring:message code="traffic_ip_active"></spring:message> + <spring:message code="domain_name"></spring:message> @@ -24,6 +24,7 @@ + @@ -37,35 +38,54 @@ <%-- --%> + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp index d603b81dc..40e87c59e 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp @@ -33,7 +33,7 @@ + value="" onclick="WdatePicker({onpicked:setTime,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/>
@@ -42,7 +42,7 @@
+ value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'beginDate\',{d:7})}'});"/> @@ -57,8 +57,17 @@ -
- +
+ + +
+ +


@@ -71,13 +80,13 @@ () () - - () + + () -
+
/ ,
  
@@ -85,8 +94,10 @@ + diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp index 3ced6aa31..ada214487 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp @@ -17,6 +17,7 @@

+
@@ -29,7 +30,7 @@
+ value="" onclick="WdatePicker({onpicked:setTime,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});" />
@@ -38,7 +39,7 @@
+ value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'beginDate\',{d:7})}'});" /> @@ -46,12 +47,13 @@ + -
- +
+
@@ -60,13 +62,22 @@

-
- +
+ + +
+ +


- +
@@ -85,19 +96,28 @@
-<%--
${page}
--%> +
  
+ + + <%-- --%> + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp new file mode 100644 index 000000000..2b9c6f5cf --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp @@ -0,0 +1,418 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + <spring:message code="active_port"></spring:message> + + + +
+ +

+ +

+ +
+ + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+ + +
+
+ +
+
+
+
+ + + + + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp index b46da2d00..b9dfa4692 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp @@ -33,18 +33,31 @@ - - -
-
-
- + value="" onclick="WdatePicker({onpicked:setTime,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/> +
+
+
+
+
+ +
+ +
+
+
+
+
+
- -
-
+ +
+
@@ -57,8 +70,17 @@
-
- +
+ + +
+ +


@@ -71,13 +93,13 @@ () () - - () + + () -
+
/ ,
  
@@ -85,8 +107,12 @@ + + + - + <spring:message code="traffic_user_behavior"></spring:message> -
- +
+ + +
+ +
+
@@ -186,20 +145,15 @@ () - - () + + () -
-
-
-
-    - -
+
/ ,
+
  
@@ -210,8 +164,12 @@ + + + -
-
-
+
+
@@ -859,6 +869,7 @@ }, grid:{ left: 53, + top: '35%', }, xAxis: { type: 'time', @@ -875,7 +886,7 @@ color: '#fff', fontSize: 12, formatter: function(value) { - return echarts.format.formatTime('hh:mm:ss', new Date(value)); + return echarts.format.formatTime('hh:mm', new Date(value)); } }, splitLine: { @@ -885,6 +896,10 @@ }, yAxis: [{ type: 'value', + name: 'Bps', + nameTextStyle:{ + color:'#ffffff', + }, min: 0, axisLine: { lineStyle: { @@ -897,14 +912,20 @@ color: 'white', fontSize: 12, formatter: function (value, index) { - if (value > 1000 && value <= 1000000) { - return value/1000 + " K"; + if (value > 1024 && value <= 1048576) { + return Math.round(value/1024) + " K";//Bps } - if (value > 10000000 && value <= 1000000000) { - return value/1000000 + " M"; + if (value > 1048576 && value <= 1073741824) { + return Math.round(value/1048576) + " M";//Bps } - if (value > 100000000) { - return value/1000000000 + " B"; + if (value > 1073741824 && value <= 1099511627776) { + return Math.round(value/1073741824) + " G";//Bps + } + if (value > 1099511627776 && value <= 1125899906842624) { + return Math.round(value/1099511627776) + " T";//Bps + } + if (value > 1125899906842624) { + return Math.round(value/1125899906842624) + " P";//Bps } return value; } @@ -1044,16 +1065,19 @@ }, axisLabel: { formatter: function(value) { - if (value > 1000 && value <= 1000000) { - return value/1000 + " K"; - } - if (value > 10000000 && value <= 1000000000) { - return value/1000000 + " M"; - } - if (value > 100000000) { - return value/1000000000 + " B"; - } - return value; + if (value > 1000 && value <= 1000000) { + return Math.round(value/1000) + " K"; + } + if (value > 1000000 && value <= 1000000000) { + return Math.round(value/1000000) + " M"; + } + if (value > 1000000000 && value <= 1000000000000) { + return Math.round(value/1000000000) + " T"; + } + if (value > 1000000000000) { + return Math.round(value/1000000000000) + " P"; + } + return value; }, }, splitNumber: 4, @@ -1136,7 +1160,7 @@ $.ajax({ type:'get', dataType: 'json', - url:"${pageContext.request.contextPath}/nis/dynamicpage/indexTraffic?baseNum=" + top.baseNum, + url:"${pageContext.request.contextPath}/nis/dynamicpage/indexTraffic?hour=2&baseNum=" + top.baseNum, success:function(res){//处理返回结果 if(res) { data = res; @@ -1189,7 +1213,7 @@ $.ajax({ type:'get', dataType: 'json', - url:'${pageContext.request.contextPath}/nis/dynamicpage/indexLog?sid=' + top.indexLogServiceId + "&baseNum=" + top.baseNum, + url:'${pageContext.request.contextPath}/nis/dynamicpage/indexLog?hour=24&sid=' + top.indexLogServiceId + "&baseNum=" + top.serviceBaseNum, success:function(res){//处理返回结果 logData = res; _logData = logData.shift(); @@ -1219,10 +1243,39 @@ /* 数字特效 */ function animalNum(dropNum){ - //var value = rand(100,999);; + var unitStr = ""; + if (dropNum > 1000 && dropNum <= 1000000) { + dropNum = Math.round(dropNum/1000);//K取整 + //dropNum = (dropNum/1000).toFixed(1);alert(dropNum); + unitStr = "K"; + } + if (dropNum > 1000000 && dropNum <= 1000000000) { + dropNum = Math.round(dropNum/1000000);//M + //dropNum = (dropNum/1000000).toFixed(1); + unitStr = "M"; + } + if (dropNum > 1000000000 && dropNum <= 1000000000000) { + dropNum = Math.round(dropNum/1000000000);//G + //dropNum = (dropNum/1000000000).toFixed(1); + unitStr = "G"; + } + if (dropNum > 1000000000000 && dropNum <= 1000000000000000) { + dropNum = Math.round(dropNum/1000000000000);//T + //dropNum = (dropNum/1000000000000).toFixed(1); + unitStr = "T"; + } + if (dropNum > 1000000000000000) { + dropNum = Math.round(dropNum/1000000000000000);//P + //dropNum = (dropNum/1000000000000000).toFixed(1); + unitStr = "P"; + } + //dropNum = rand(100,999); + //dropNum= dropNum+"M"; + $("#dataNums").empty(); $("#dataNums").rollNum({ deVal:dropNum }); + $("#dataNumsStr").html(""+unitStr+"");//alert(unitStr); }; function rand(min,max) { @@ -1240,7 +1293,7 @@ $.ajax({ type:'get', dataType: 'json', - url:'${pageContext.request.contextPath}/nis/dynamicpage/indexDrop' + "?baseNum=" + top.baseNum, + url:'${pageContext.request.contextPath}/nis/dynamicpage/indexDrop?hour=24' + "&baseNum=" + top.dropBaseNum, success:function(res){//处理返回结果 if(res) { dropData = res; diff --git a/src/main/webapp/WEB-INF/views/dynamicpage/dynamicIndex.jsp.bak b/src/main/webapp/WEB-INF/views/dynamicpage/dynamicIndex.jsp.bak index 877b5e2ea..b892bffc8 100644 --- a/src/main/webapp/WEB-INF/views/dynamicpage/dynamicIndex.jsp.bak +++ b/src/main/webapp/WEB-INF/views/dynamicpage/dynamicIndex.jsp.bak @@ -10,7 +10,6 @@ -
-
-
+
+
@@ -859,6 +869,7 @@ }, grid:{ left: 53, + top: '35%', }, xAxis: { type: 'time', @@ -875,7 +886,7 @@ color: '#fff', fontSize: 12, formatter: function(value) { - return echarts.format.formatTime('hh:mm:ss', new Date(value)); + return echarts.format.formatTime('hh:mm', new Date(value)); } }, splitLine: { @@ -885,6 +896,10 @@ }, yAxis: [{ type: 'value', + name: 'Bps', + nameTextStyle:{ + color:'#ffffff', + }, min: 0, axisLine: { lineStyle: { @@ -897,14 +912,20 @@ color: 'white', fontSize: 12, formatter: function (value, index) { - if (value > 1000 && value <= 1000000) { - return value/1000 + " K"; + if (value > 1024 && value <= 1048576) { + return Math.round(value/1024) + " K";//Bps } - if (value > 10000000 && value <= 1000000000) { - return value/1000000 + " M"; + if (value > 1048576 && value <= 1073741824) { + return Math.round(value/1048576) + " M";//Bps } - if (value > 100000000) { - return value/1000000000 + " B"; + if (value > 1073741824 && value <= 1099511627776) { + return Math.round(value/1073741824) + " G";//Bps + } + if (value > 1099511627776 && value <= 1125899906842624) { + return Math.round(value/1099511627776) + " T";//Bps + } + if (value > 1125899906842624) { + return Math.round(value/1125899906842624) + " P";//Bps } return value; } @@ -1044,16 +1065,19 @@ }, axisLabel: { formatter: function(value) { - if (value > 1000 && value <= 1000000) { - return value/1000 + " K"; - } - if (value > 10000000 && value <= 1000000000) { - return value/1000000 + " M"; - } - if (value > 100000000) { - return value/1000000000 + " B"; - } - return value; + if (value > 1000 && value <= 1000000) { + return Math.round(value/1000) + " K"; + } + if (value > 1000000 && value <= 1000000000) { + return Math.round(value/1000000) + " M"; + } + if (value > 1000000000 && value <= 1000000000000) { + return Math.round(value/1000000000) + " T"; + } + if (value > 1000000000000) { + return Math.round(value/1000000000000) + " P"; + } + return value; }, }, splitNumber: 4, @@ -1136,7 +1160,7 @@ $.ajax({ type:'get', dataType: 'json', - url:"${pageContext.request.contextPath}/nis/dynamicpage/indexTraffic?baseNum=" + top.baseNum, + url:"${pageContext.request.contextPath}/nis/dynamicpage/indexTraffic?hour=2&baseNum=" + top.baseNum, success:function(res){//处理返回结果 if(res) { data = res; @@ -1189,7 +1213,7 @@ $.ajax({ type:'get', dataType: 'json', - url:'${pageContext.request.contextPath}/nis/dynamicpage/indexLog?sid=' + top.indexLogServiceId + "&baseNum=" + top.baseNum, + url:'${pageContext.request.contextPath}/nis/dynamicpage/indexLog?hour=24&sid=' + top.indexLogServiceId + "&baseNum=" + top.serviceBaseNum, success:function(res){//处理返回结果 logData = res; _logData = logData.shift(); @@ -1219,10 +1243,39 @@ /* 数字特效 */ function animalNum(dropNum){ - //var value = rand(100,999);; + var unitStr = ""; + if (dropNum > 1000 && dropNum <= 1000000) { + dropNum = Math.round(dropNum/1000);//K取整 + //dropNum = (dropNum/1000).toFixed(1);alert(dropNum); + unitStr = "K"; + } + if (dropNum > 1000000 && dropNum <= 1000000000) { + dropNum = Math.round(dropNum/1000000);//M + //dropNum = (dropNum/1000000).toFixed(1); + unitStr = "M"; + } + if (dropNum > 1000000000 && dropNum <= 1000000000000) { + dropNum = Math.round(dropNum/1000000000);//G + //dropNum = (dropNum/1000000000).toFixed(1); + unitStr = "G"; + } + if (dropNum > 1000000000000 && dropNum <= 1000000000000000) { + dropNum = Math.round(dropNum/1000000000000);//T + //dropNum = (dropNum/1000000000000).toFixed(1); + unitStr = "T"; + } + if (dropNum > 1000000000000000) { + dropNum = Math.round(dropNum/1000000000000000);//P + //dropNum = (dropNum/1000000000000000).toFixed(1); + unitStr = "P"; + } + //dropNum = rand(100,999); + //dropNum= dropNum+"M"; + $("#dataNums").empty(); $("#dataNums").rollNum({ deVal:dropNum }); + $("#dataNumsStr").html(""+unitStr+"");//alert(unitStr); }; function rand(min,max) { @@ -1240,7 +1293,7 @@ $.ajax({ type:'get', dataType: 'json', - url:'${pageContext.request.contextPath}/nis/dynamicpage/indexDrop' + "?baseNum=" + top.baseNum, + url:'${pageContext.request.contextPath}/nis/dynamicpage/indexDrop?hour=24' + "&baseNum=" + top.dropBaseNum, success:function(res){//处理返回结果 if(res) { dropData = res; diff --git a/src/main/webapp/WEB-INF/views/home.jsp b/src/main/webapp/WEB-INF/views/home.jsp index 8d0336c8b..66fc8440e 100644 --- a/src/main/webapp/WEB-INF/views/home.jsp +++ b/src/main/webapp/WEB-INF/views/home.jsp @@ -193,7 +193,7 @@ function changeFrameHeight() { var paddingHeight = 11; //update for dynamicHomePage E - iframe.contents().find(".page-content").addClass("page-content-body"); + //iframe.contents().find(".page-content").addClass("page-content-body"); iframe.prop("height",clientHeight-headerHeight-barHeight-footerHeight-paddingHeight); menuHeight(); } @@ -342,11 +342,11 @@ background:#3d3d3d;
- + - +
- +
@@ -79,7 +79,7 @@ $(document).ready(function(){
+ value="${log.searchFoundEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'searchFoundStartTime\')}',maxDate:'#F{$dp.$D(\'searchFoundStartTime\',{d:1})}'});"/> @@ -207,7 +207,7 @@ $(document).ready(function(){ - + <%-- --%> @@ -354,7 +354,7 @@ $(document).ready(function(){ ${log.dAsn} ${log.sSubscribeId} ${log.dSubscribeId} - ${log.userRegion} + <%-- ${log.userRegion} --%> ${log.sceneFile} diff --git a/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp index b421a5d48..451157281 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/bgpList.jsp @@ -108,8 +108,8 @@
- +
@@ -117,8 +117,8 @@
- +
@@ -250,7 +250,7 @@ - + <%-- --%> @@ -363,7 +363,7 @@ ${log.dAsn} ${log.sSubscribeId} ${log.dSubscribeId} - ${log.userRegion} + <%-- ${log.userRegion} --%> ${log.sceneFile} ${log.type } diff --git a/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp index ef3bb649b..f193d503e 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/collectVoipList.jsp @@ -58,7 +58,7 @@ $(document).ready(function(){
+ value="${log.searchFoundStartTime}" onclick="WdatePicker({onpicked:setTimee,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'searchFoundEndTime\')}'});"/>
@@ -67,7 +67,7 @@ $(document).ready(function(){
+ value="${log.searchFoundEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'searchFoundStartTime\')}',maxDate:'#F{$dp.$D(\'searchFoundStartTime\',{d:1})}'});"/> diff --git a/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp index 01450527e..e92b5532d 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/connRecordLogList.jsp @@ -120,8 +120,8 @@
- +
@@ -129,8 +129,8 @@
- +
@@ -272,7 +272,7 @@ - + <%-- --%> @@ -399,7 +399,7 @@ ${log.dAsn} ${log.sSubscribeId} ${log.dSubscribeId} - ${log.userRegion} + <%-- ${log.userRegion} --%> ${log.sceneFile} diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp index e074c2b4c..dd49a716a 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ddosList.jsp @@ -113,7 +113,7 @@ $(document).ready(function(){
+ value="${log.searchFoundStartTime}" onclick="WdatePicker({onpicked:setTimee,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'searchFoundEndTime\')}'});"/>
@@ -122,7 +122,7 @@ $(document).ready(function(){
+ value="${log.searchFoundEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'searchFoundStartTime\')}',maxDate:'#F{$dp.$D(\'searchFoundStartTime\',{d:1})}'});"/> @@ -263,7 +263,7 @@ $(document).ready(function(){ - + @@ -399,7 +399,7 @@ $(document).ready(function(){ ${log.dAsn} ${log.sSubscribeId} ${log.dSubscribeId} - ${log.userRegion} + <%-- ${log.userRegion} --%> ${log.sceneFile} diff --git a/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp index b80380308..7a163f1ce 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp @@ -109,8 +109,8 @@
- +
@@ -118,8 +118,8 @@
- +
@@ -269,7 +269,7 @@ - + <%-- --%> @@ -437,7 +437,7 @@ ${log.dAsn} ${log.sSubscribeId} ${log.dSubscribeId} - ${log.userRegion} + <%-- ${log.userRegion} --%> ${log.sceneFile} diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp index 8dd570d54..69450f0d9 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp @@ -111,7 +111,7 @@ $(document).ready(function(){
+ value="${log.searchFoundStartTime}" onclick="WdatePicker({onpicked:setTimee,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'searchFoundEndTime\')}'});"/>
@@ -120,7 +120,7 @@ $(document).ready(function(){
+ value="${log.searchFoundEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'searchFoundStartTime\')}',maxDate:'#F{$dp.$D(\'searchFoundStartTime\',{d:1})}'});"/> @@ -254,7 +254,7 @@ $(document).ready(function(){ - + <%-- --%> @@ -388,7 +388,7 @@ $(document).ready(function(){ ${log.dAsn} ${log.sSubscribeId} ${log.dSubscribeId} - ${log.userRegion} + <%-- ${log.userRegion} --%> ${log.sceneFile} diff --git a/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp index 8ce7ecc26..3348eaa34 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp @@ -98,7 +98,7 @@

- +

@@ -135,8 +135,8 @@
- +
@@ -144,8 +144,8 @@
- +
@@ -154,6 +154,9 @@
+ + +
@@ -128,8 +128,8 @@
- +
@@ -292,7 +292,7 @@ - + <%-- --%> @@ -474,7 +474,7 @@ ${log.dAsn} ${log.sSubscribeId} ${log.dSubscribeId} - ${log.userRegion} + <%-- ${log.userRegion} --%> ${log.sceneFile} diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp index 0392a8ab4..15c801739 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp @@ -6,6 +6,7 @@ IP + - - - - - - - - diff --git a/src/main/webapp/WEB-INF/views/login.jsp_new b/src/main/webapp/WEB-INF/views/login.jsp_new index 3511cbfd2..124a385bc 100644 --- a/src/main/webapp/WEB-INF/views/login.jsp_new +++ b/src/main/webapp/WEB-INF/views/login.jsp_new @@ -14,7 +14,7 @@ - + NTC @@ -59,6 +59,7 @@ padding: 0px; } body{ + font-family: inherit; max-height:1080px; max-width:1920px; height:864px; @@ -95,7 +96,7 @@ } .main_right{ - background-image: url("${pageContext.request.contextPath}/static/login/assets/images/login/login_06.png"); + background-image: url("${pageContext.request.contextPath}/static/login/assets/images/login/login_06-K.png"); background-repeat:no-repeat; background-size: 100% 100%; max-height: 501px; diff --git a/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp b/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp index 8e7c7e975..862b67008 100644 --- a/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp +++ b/src/main/webapp/WEB-INF/views/report/asnRecordList.jsp @@ -2,6 +2,7 @@ <%@ include file="/WEB-INF/include/taglib.jsp"%> + <spring:message code="asn_conn_report"/> @@ -44,6 +45,66 @@ }; $("div#"+content+"").printArea(options); } + + function setReportTime(){ + var chooseDate=new Date($('#searchFoundStartTime').val()); + chooseDate=chooseDate.setDate(chooseDate.getDate()+7); + var modifyTime=new Date(chooseDate); + $('#searchFoundEndTime').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); + } + //打印列表 + function doPrint() { + $.ajax({ + type:'post', + async:false, + cache:false, + url:'${ctx}/report/asnPrint',// + data:{ + "searchAsnType":$('[name="searchAsnType"]').val(), + "asn":$('[name="asn"]').val(), + "searchFoundStartTime":$('[name="searchFoundStartTime"]').val(), + "searchFoundEndTime":$('[name="searchFoundEndTime"]').val() + }, + dataType:"json", + success:function(data){ + if(data !=null){ + var userTableStr=''; + userTableStr +=''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + for(var j=0;j @@ -82,8 +143,11 @@
- + +<%-- value="${log.searchFoundStartTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> --%> + +
@@ -91,8 +155,10 @@
- + +<%-- value="${log.searchFoundEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> --%> +
@@ -101,9 +167,24 @@
-
- -
+ +<%-- --%> +<%-- --%> + + +
+ + +
+
+ +
href="javascript:;"> @@ -145,6 +226,7 @@
${page}
+
diff --git a/src/main/webapp/WEB-INF/views/report/eventBlockList.jsp b/src/main/webapp/WEB-INF/views/report/eventBlockList.jsp new file mode 100644 index 000000000..53fbf6767 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/report/eventBlockList.jsp @@ -0,0 +1,315 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + <spring:message code="ntc_event_block_report"/> + + + + + +
+ +

+ +

+ +
+
+
+ + +
+ + + + + <%-- --%> + <%-- + --%> + <%-- + + + --%> + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + <%-- --%> + + + + +
${log.taskIds }${log.taskName }${log.ipNum }${log.httpNum }${log.mailNum }${log.vedioNum }${log.agentNum }${log.taskTime }${log.reportTime }${log.reportTime}
+
${page}
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/report/eventKeyProtectionList.jsp b/src/main/webapp/WEB-INF/views/report/eventKeyProtectionList.jsp new file mode 100644 index 000000000..55e702363 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/report/eventKeyProtectionList.jsp @@ -0,0 +1,310 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + <spring:message code="ntc_event_key_protection_report"/> + + + + + +
+ +

+ +

+ +
+
+
+
+ + + + + + + + + +
+
+
+
+ +
+ +
+
+ +
+ + + +
+
+
+ + +
+
+ +
+ href="javascript:;"> + + +
+ +
+ + + +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+
+ +
+ + + + + <%-- --%> + <%-- + --%> + <%-- + + + --%> + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + <%-- --%> + + + + +
${log.taskIds }${log.taskName }${log.letterNum }${log.configNum }${log.monitorNum }${log.controlNum }${log.taskTime }${log.reportTime }${log.reportTime}
+
${page}
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/report/eventMonitorList.jsp b/src/main/webapp/WEB-INF/views/report/eventMonitorList.jsp new file mode 100644 index 000000000..aeb9133bb --- /dev/null +++ b/src/main/webapp/WEB-INF/views/report/eventMonitorList.jsp @@ -0,0 +1,324 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + <spring:message code="ntc_event_monitor_report"/> + + + + + +
+ +

+ +

+ +
+
+
+
+ + + + + + + + + +
+ +
+
+
+ +
+ +
+
+
+ + + +
+
+
+ + +
+
+ +
+ href="javascript:;"> + + +
+ +
+ + + +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + +
+
+ +
+ + + + + <%-- --%> + <%-- + --%> + <%-- + + + --%> + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + <%-- --%> + + + + +
${log.taskIds }${log.taskName }${log.ipNum }${log.httpNum }${log.mailNum }${log.vedioNum }${log.agentNum }${log.taskTime }${log.reportTime }${log.reportTime}
+
${page}
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/report/ipRangeReportList.jsp b/src/main/webapp/WEB-INF/views/report/ipRangeReportList.jsp index 839c40f55..ce1ca3429 100644 --- a/src/main/webapp/WEB-INF/views/report/ipRangeReportList.jsp +++ b/src/main/webapp/WEB-INF/views/report/ipRangeReportList.jsp @@ -2,6 +2,7 @@ <%@ include file="/WEB-INF/include/taglib.jsp"%> + <spring:message code="ip_range_report"/> @@ -34,7 +35,67 @@ // }); // ajaxConnPercent(); }); - + //打印列表 + function doPrint() { + $.ajax({ + type:'post', + async:false, + cache:false, + url:'${ctx}/report/ipRangePrint',// + data:{ + "seType":$('[name="searchAreaType1"]').val(), + "searchAreaType":$('[name="searchAreaType"]').val(), + "searchCountry":$('[name="searchCountry"]').val(), + "searchIp":$('[name="searchIp"]').val() + }, + dataType:"json", + success:function(data){ + if(data !=null){ + var userTableStr=''; + userTableStr +=''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + for(var j=0;j @@ -52,7 +113,7 @@ - +
@@ -91,9 +152,24 @@
-
- -
+ +<%-- --%> +<%-- --%> + + +
+ + +
+
+ +
href="javascript:;"> @@ -138,6 +214,7 @@
'; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += ''; + userTableStr += '
${page}
+ diff --git a/src/main/webapp/WEB-INF/views/report/list.jsp b/src/main/webapp/WEB-INF/views/report/list.jsp index 35d94be39..cac9f6098 100644 --- a/src/main/webapp/WEB-INF/views/report/list.jsp +++ b/src/main/webapp/WEB-INF/views/report/list.jsp @@ -5,6 +5,7 @@ + <spring:message code="${bean.cfgName}"></spring:message> <%@ include file="/WEB-INF/include/form/pageGroup.jsp"%> -
+
<%--
diff --git a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp index 8f29af99c..0f272c4e1 100644 --- a/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/specific/specificServiceCfgList.jsp @@ -213,6 +213,17 @@ +
+ + +
+
@@ -266,16 +277,11 @@
- - - - - - +
@@ -284,8 +290,8 @@ - - + + @@ -296,7 +302,7 @@ - + @@ -307,7 +313,7 @@ - + @@ -320,14 +326,14 @@ <%-- --%> <%-- --%> - - + + - + <%-- ${specificServiceCfg.showSequence} --%> diff --git a/src/main/webapp/WEB-INF/views/sys/cfgOperationLogList.jsp b/src/main/webapp/WEB-INF/views/sys/cfgOperationLogList.jsp index 38dbafaea..f460f31cc 100644 --- a/src/main/webapp/WEB-INF/views/sys/cfgOperationLogList.jsp +++ b/src/main/webapp/WEB-INF/views/sys/cfgOperationLogList.jsp @@ -66,14 +66,14 @@ readonly="readonly" maxlength="20" class="form-control Wdate" value="" - onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" /> + onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,maxDate:'#F{$dp.$D(\'endDate\')}'});" />
" - onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" /> + onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'%y-%M-%d'});" />
diff --git a/src/main/webapp/WEB-INF/views/sys/dictForm.jsp b/src/main/webapp/WEB-INF/views/sys/dictForm.jsp index 1bcbaac80..129f0635f 100644 --- a/src/main/webapp/WEB-INF/views/sys/dictForm.jsp +++ b/src/main/webapp/WEB-INF/views/sys/dictForm.jsp @@ -91,6 +91,7 @@ $(obj).find(".itemCode").attr("name","dictItemList["+index+"].itemCode"); $(obj).find(".itemValue").attr("name","dictItemList["+index+"].itemValue"); $(obj).find(".itemDesc").attr("name","dictItemList["+index+"].itemDesc"); + $(obj).find(".itemSort").attr("name","dictItemList["+index+"].itemSort"); $(obj).find(".itemStatus").attr("name","dictItemList["+index+"].status"); $(obj).find(".itemType").attr("name","dictItemList["+index+"].type"); @@ -180,6 +181,7 @@ + readonly="readonly"/> readonly="readonly"/> readonly="readonly"/> + readonly="readonly"/> " - onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" /> + onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'%y-%M-%d'});" />
diff --git a/src/main/webapp/static/global/css/page.css b/src/main/webapp/static/global/css/page.css index 625ac7645..ab961db4e 100644 --- a/src/main/webapp/static/global/css/page.css +++ b/src/main/webapp/static/global/css/page.css @@ -89,4 +89,9 @@ margin-top: 20px; word-break: break-all; word-wrap: break-word; white-space: normal; +} + +/* ʵʱģ,ӡťʾ */ +.css-print{ + display: none; } \ No newline at end of file diff --git a/src/main/webapp/static/global/plugins/highcharts/js/exporting-data.js b/src/main/webapp/static/global/plugins/highcharts/js/exporting-data.js new file mode 100644 index 000000000..02e0889fc --- /dev/null +++ b/src/main/webapp/static/global/plugins/highcharts/js/exporting-data.js @@ -0,0 +1,27 @@ +/* + Highcharts JS v7.0.0 (2018-12-11) + Exporting module + + (c) 2010-2018 Torstein Honsi + + License: www.highcharts.com/license +*/ +(function(m){"object"===typeof module&&module.exports?module.exports=m:"function"===typeof define&&define.amd?define(function(){return m}):m("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(m){(function(a){a.ajax=function(f){var b=a.merge(!0,{url:!1,type:"GET",dataType:"json",success:!1,error:!1,data:!1,headers:{}},f);f={json:"application/json",xml:"application/xml",text:"text/plain",octet:"application/octet-stream"};var c=new XMLHttpRequest;if(!b.url)return!1;c.open(b.type.toUpperCase(), +b.url,!0);c.setRequestHeader("Content-Type",f[b.dataType]||f.text);a.objectEach(b.headers,function(a,f){c.setRequestHeader(f,a)});c.onreadystatechange=function(){var a;if(4===c.readyState){if(200===c.status){a=c.responseText;if("json"===b.dataType)try{a=JSON.parse(a)}catch(v){b.error&&b.error(c,v);return}return b.success&&b.success(a)}b.error&&b.error(c,c.responseText)}};try{b.data=JSON.stringify(b.data)}catch(k){}c.send(b.data||!0)}})(m);(function(a){var f=a.win,b=f.navigator,c=f.document,k=f.URL|| +f.webkitURL||f,v=/Edge\/\d+/.test(b.userAgent);a.dataURLtoBlob=function(a){if((a=a.match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/))&&3/g,"\x26gt;").replace(/"/g,"\x26quot;").replace(/'/g,"\x26#x27;").replace(/\//g,"\x26#x2F;"):"Chart")+"\x3c/caption\x3e");for(var p=0,q=a.length;pe&&(e=a[p].length);b+=function(a,b,e){var h="\x3cthead\x3e",c=0;e=e||b&&b.length;var k,d,l=0;if(d=f&&a&&b){a:if(d=a.length,b.length===d){for(;d--;)if(a[d]!==b[d]){d=!1;break a}d=!0}else d=!1;d=!d}if(d){for(h+="\x3ctr\x3e";c< +e;++c)d=a[c],k=a[c+1],d===k?++l:l?(h+=m("th","highcharts-table-topheading",'scope\x3d"col" colspan\x3d"'+(l+1)+'"',d),l=0):(d===b[c]?g.exporting.useRowspanHeaders?(k=2,delete b[c]):(k=1,b[c]=""):k=1,h+=m("th","highcharts-table-topheading",'scope\x3d"col"'+(1(.*?$)/);e&&e[1]&&(e='\x3cforeignObject x\x3d"0" y\x3d"0" width\x3d"'+b.chart.width+'" height\x3d"'+b.chart.height+'"\x3e\x3cbody xmlns\x3d"http://www.w3.org/1999/xhtml"\x3e'+e[1]+"\x3c/body\x3e\x3c/foreignObject\x3e",a=a.replace("\x3c/svg\x3e",e+"\x3c/svg\x3e"))}a=a.replace(/zIndex="[^"]+"/g, -"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/.*?$/,"\x3c/svg\x3e").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,'$1\x3d"rgb($2)" $1-opacity\x3d"$3"').replace(/ /g, -"\u00a0").replace(/­/g,"\u00ad");this.ieSanitizeSVG&&(a=this.ieSanitizeSVG(a));return a},getChartHTML:function(){return this.container.innerHTML},getSVG:function(a){var b,e,c,v,m,g=p(this.options,a);e=q("div",null,{position:"absolute",top:"-9999em",width:this.chartWidth+"px",height:this.chartHeight+"px"},z.body);c=this.renderTo.style.width;m=this.renderTo.style.height;c=g.exporting.sourceWidth||g.chart.width||/px$/.test(c)&&parseInt(c,10)||600;m=g.exporting.sourceHeight||g.chart.height||/px$/.test(m)&& -parseInt(m,10)||400;t(g.chart,{animation:!1,renderTo:e,forExport:!0,renderer:"SVGRenderer",width:c,height:m});g.exporting.enabled=!1;delete g.data;g.series=[];k(this.series,function(a){v=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});v.isInternal||g.series.push(v)});k(this.axes,function(a){a.userOptions.internalKey||(a.userOptions.internalKey=f.uniqueKey())});b=new f.Chart(g,this.callback);a&&k(["xAxis","yAxis","series"],function(c){var d={};a[c]&&(d[c]=a[c], -b.update(d))});k(this.axes,function(a){var c=f.find(b.axes,function(b){return b.options.internalKey===a.userOptions.internalKey}),d=a.getExtremes(),e=d.userMin,d=d.userMax;!c||void 0===e&&void 0===d||c.setExtremes(e,d,!0,!1)});c=b.getChartHTML();c=this.sanitizeSVG(c,g);g=null;b.destroy();B(e);return c},getSVGForExport:function(a,b){var e=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}},e.chartOptions,b,{exporting:{sourceWidth:a&&a.sourceWidth||e.sourceWidth,sourceHeight:a&&a.sourceHeight|| -e.sourceHeight}}))},exportChart:function(a,b){b=this.getSVGForExport(a,b);a=p(this.options.exporting,a);f.post(a.url,{filename:a.filename||"chart",type:a.type,width:a.width||0,scale:a.scale,svg:b},a.formAttributes)},print:function(){var a=this,b=a.container,e=[],c=b.parentNode,f=z.body,m=f.childNodes,g=a.options.exporting.printMaxWidth,d,n;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);D(a,"beforePrint");if(n=g&&a.chartWidth>g)d=[a.options.chart.width,void 0,!1],a.setSize(g,void 0,!1); -k(m,function(a,b){1===a.nodeType&&(e[b]=a.style.display,a.style.display="none")});f.appendChild(b);C.focus();C.print();setTimeout(function(){c.appendChild(b);k(m,function(a,b){1===a.nodeType&&(a.style.display=e[b])});a.isPrinting=!1;n&&a.setSize.apply(a,d);D(a,"afterPrint")},1E3)}},contextMenu:function(a,b,e,c,v,m,g){var d=this,n=d.options.navigation,h=d.chartWidth,G=d.chartHeight,p="cache-"+a,l=d[p],x=Math.max(v,m),y,r;l||(d[p]=l=q("div",{className:a},{position:"absolute",zIndex:1E3,padding:x+"px"}, -d.container),y=q("div",{className:"highcharts-menu"},null,l),u(y,t({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},n.menuStyle)),r=function(){u(l,{display:"none"});g&&g.setState(0);d.openMenu=!1},d.exportEvents.push(w(l,"mouseleave",function(){l.hideTimer=setTimeout(r,500)}),w(l,"mouseenter",function(){f.clearTimeout(l.hideTimer)}),w(z,"mouseup",function(b){d.pointer.inClass(b.target,a)||r()})),k(b,function(a){"string"===typeof a&&(a=d.options.exporting.menuItemDefinitions[a]); -if(f.isObject(a,!0)){var b;a.separator?b=q("hr",null,null,y):(b=q("div",{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();r();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text||d.options.lang[a.textKey]},null,y),b.onmouseover=function(){u(this,n.menuItemHoverStyle)},b.onmouseout=function(){u(this,n.menuItemStyle)},u(b,t({cursor:"pointer"},n.menuItemStyle)));d.exportDivElements.push(b)}}),d.exportDivElements.push(y,l),d.exportMenuWidth=l.offsetWidth,d.exportMenuHeight= -l.offsetHeight);b={display:"block"};e+d.exportMenuWidth>h?b.right=h-e-v-x+"px":b.left=e-x+"px";c+m+d.exportMenuHeight>G&&"top"!==g.alignOptions.verticalAlign?b.bottom=G-c-x+"px":b.top=c+m-x+"px";u(l,b);d.openMenu=!0},addButton:function(a){var b=this,e=b.renderer,c=p(b.options.navigation.buttonOptions,a),f=c.onclick,m=c.menuItems,g,d,n=c.symbolSize||12;b.btnCount||(b.btnCount=0);b.exportDivElements||(b.exportDivElements=[],b.exportSVGElements=[]);if(!1!==c.enabled){var h=c.theme,k=h.states,q=k&&k.hover, -k=k&&k.select,l;delete h.states;f?l=function(a){a.stopPropagation();f.call(b,a)}:m&&(l=function(){b.contextMenu(d.menuClassName,m,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)});c.text&&c.symbol?h.paddingLeft=r(h.paddingLeft,25):c.text||t(h,{width:c.width,height:c.height,padding:0});d=e.button(c.text,0,0,l,h,q,k).addClass(a.className).attr({"stroke-linecap":"round",title:r(b.options.lang[c._titleKey],""),zIndex:3});d.menuClassName=a.menuClassName||"highcharts-menu-"+b.btnCount++;c.symbol&& -(g=e.symbol(c.symbol,c.symbolX-n/2,c.symbolY-n/2,n,n,{width:n,height:n}).addClass("highcharts-button-symbol").attr({zIndex:1}).add(d),g.attr({stroke:c.symbolStroke,fill:c.symbolFill,"stroke-width":c.symbolStrokeWidth||1}));d.add().align(t(c,{width:d.width,x:r(c.x,b.buttonOffset)}),!0,"spacingBox");b.buttonOffset+=(d.width+c.buttonSpacing)*("right"===c.align?-1:1);b.exportSVGElements.push(d,g)}},destroyExport:function(a){var b=a?a.target:this;a=b.exportSVGElements;var e=b.exportDivElements,c=b.exportEvents, -h;a&&(k(a,function(a,c){a&&(a.onclick=a.ontouchstart=null,h="cache-"+a.menuClassName,b[h]&&delete b[h],b.exportSVGElements[c]=a.destroy())}),a.length=0);e&&(k(e,function(a,c){f.clearTimeout(a.hideTimer);H(a,"mouseleave");b.exportDivElements[c]=a.onmouseout=a.onmouseover=a.ontouchstart=a.onclick=null;B(a)}),e.length=0);c&&(k(c,function(a){a()}),c.length=0)}});J.menu=function(a,b,e,c){return["M",a,b+2.5,"L",a+e,b+2.5,"M",a,b+c/2+.5,"L",a+e,b+c/2+.5,"M",a,b+c-1.5,"L",a+e,b+c-1.5]};A.prototype.renderExporting= -function(){var a=this,b=a.options.exporting,e=b.buttons,c=a.isDirtyExporting||!a.exportSVGElements;a.buttonOffset=0;a.isDirtyExporting&&a.destroyExport();c&&!1!==b.enabled&&(a.exportEvents=[],E(e,function(b){a.addButton(b)}),a.isDirtyExporting=!1);w(a,"destroy",a.destroyExport)};A.prototype.callbacks.push(function(a){a.renderExporting();w(a,"redraw",a.renderExporting);k(["exporting","navigation"],function(b){a[b]={update:function(e,c){a.isDirtyExporting=!0;p(!0,a.options[b],e);r(c,!0)&&a.redraw()}}})})})(h)}); +/* + Highcharts JS v7.0.0 (2018-12-11) + Exporting module + + (c) 2010-2018 Torstein Honsi + + License: www.highcharts.com/license +*/ +(function(l){"object"===typeof module&&module.exports?module.exports=l:"function"===typeof define&&define.amd?define(function(){return l}):l("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(l){(function(g){var y=g.defaultOptions,z=g.doc,l=g.Chart,q=g.addEvent,I=g.removeEvent,C=g.fireEvent,t=g.createElement,D=g.discardElement,r=g.css,p=g.merge,u=g.pick,E=g.objectEach,x=g.extend,J=g.isTouchDevice,A=g.win,G=A.navigator.userAgent,F=g.SVGRenderer,H=g.Renderer.prototype.symbols,K=/Edge\/|Trident\/|MSIE /.test(G), +L=/firefox/i.test(G);x(y.lang,{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"});y.navigation||(y.navigation={});p(!0,y.navigation,{buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,verticalAlign:"top",width:24}});p(!0,y.navigation,{menuStyle:{border:"1px solid #999999",background:"#ffffff", +padding:"5px 0"},menuItemStyle:{padding:"0.5em 1em",color:"#333333",background:"none",fontSize:J?"14px":"11px",transition:"background 250ms, color 250ms"},menuItemHoverStyle:{background:"#335cad",color:"#ffffff"},buttonOptions:{symbolFill:"#666666",symbolStroke:"#666666",symbolStrokeWidth:3,theme:{padding:5}}});y.exporting={type:"image/png",url:"https://export.highcharts.com/",printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu", +symbol:"menu",titleKey:"contextButtonTitle",menuItems:"printChart downloadJPEG".split(" ")}},menuItemDefinitions:{printChart:{textKey:"printChart",onclick:function(){this.print()}},separator:{separator:!0},downloadPNG:{textKey:"downloadPNG",onclick:function(){this.exportChart()}},downloadJPEG:{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},downloadPDF:{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}}, +downloadSVG:{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}}};g.post=function(b,a,d){var c=t("form",p({method:"post",action:b,enctype:"multipart/form-data"},d),{display:"none"},z.body);E(a,function(a,b){t("input",{type:"hidden",name:b,value:a},null,c)});c.submit();D(c)};x(l.prototype,{sanitizeSVG:function(b,a){if(a&&a.exporting&&a.exporting.allowHTML){var d=b.match(/<\/svg>(.*?$)/);d&&d[1]&&(d='\x3cforeignObject x\x3d"0" y\x3d"0" width\x3d"'+a.chart.width+'" height\x3d"'+ +a.chart.height+'"\x3e\x3cbody xmlns\x3d"http://www.w3.org/1999/xhtml"\x3e'+d[1]+"\x3c/body\x3e\x3c/foreignObject\x3e",b=b.replace("\x3c/svg\x3e",d+"\x3c/svg\x3e"))}b=b.replace(/zIndex="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/.*?$/, +"\x3c/svg\x3e").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,'$1\x3d"rgb($2)" $1-opacity\x3d"$3"').replace(/ /g,"\u00a0").replace(/­/g,"\u00ad");this.ieSanitizeSVG&&(b=this.ieSanitizeSVG(b));return b},getChartHTML:function(){this.styledMode&&this.inlineStyles();return this.container.innerHTML},getSVG:function(b){var a,d,c,w,m,h=p(this.options,b);d=t("div",null,{position:"absolute",top:"-9999em",width:this.chartWidth+"px",height:this.chartHeight+"px"},z.body);c= +this.renderTo.style.width;m=this.renderTo.style.height;c=h.exporting.sourceWidth||h.chart.width||/px$/.test(c)&&parseInt(c,10)||(h.isGantt?800:600);m=h.exporting.sourceHeight||h.chart.height||/px$/.test(m)&&parseInt(m,10)||400;x(h.chart,{animation:!1,renderTo:d,forExport:!0,renderer:"SVGRenderer",width:c,height:m});h.exporting.enabled=!1;delete h.data;h.series=[];this.series.forEach(function(a){w=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});w.isInternal|| +h.series.push(w)});this.axes.forEach(function(a){a.userOptions.internalKey||(a.userOptions.internalKey=g.uniqueKey())});a=new g.Chart(h,this.callback);b&&["xAxis","yAxis","series"].forEach(function(c){var d={};b[c]&&(d[c]=b[c],a.update(d))});this.axes.forEach(function(b){var c=g.find(a.axes,function(a){return a.options.internalKey===b.userOptions.internalKey}),d=b.getExtremes(),e=d.userMin,d=d.userMax;c&&(void 0!==e&&e!==c.min||void 0!==d&&d!==c.max)&&c.setExtremes(e,d,!0,!1)});c=a.getChartHTML(); +C(this,"getSVG",{chartCopy:a});c=this.sanitizeSVG(c,h);h=null;a.destroy();D(d);return c},getSVGForExport:function(b,a){var d=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}},d.chartOptions,a,{exporting:{sourceWidth:b&&b.sourceWidth||d.sourceWidth,sourceHeight:b&&b.sourceHeight||d.sourceHeight}}))},getFilename:function(){var b=this.userOptions.title&&this.userOptions.title.text,a=this.options.exporting.filename;if(a)return a;"string"===typeof b&&(a=b.toLowerCase().replace(/<\/?[^>]+(>|$)/g, +"").replace(/[\s_]+/g,"-").replace(/[^a-z0-9\-]/g,"").replace(/^[\-]+/g,"").replace(/[\-]+/g,"-").substr(0,24).replace(/[\-]+$/g,""));if(!a||5>a.length)a="chart";return a},exportChart:function(b,a){a=this.getSVGForExport(b,a);b=p(this.options.exporting,b);g.post(b.url,{filename:b.filename||this.getFilename(),type:b.type,width:b.width||0,scale:b.scale,svg:a},b.formAttributes)},print:function(){function b(b){(a.fixedDiv?[a.fixedDiv,a.scrollingContainer]:[a.container]).forEach(function(a){b.appendChild(a)})} +var a=this,d=[],c=z.body,g=c.childNodes,m=a.options.exporting.printMaxWidth,h,e;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);C(a,"beforePrint");if(e=m&&a.chartWidth>m)h=[a.options.chart.width,void 0,!1],a.setSize(m,void 0,!1);g.forEach(function(a,b){1===a.nodeType&&(d[b]=a.style.display,a.style.display="none")});b(c);setTimeout(function(){A.focus();A.print();setTimeout(function(){b(a.renderTo);g.forEach(function(a,b){1===a.nodeType&&(a.style.display=d[b])});a.isPrinting=!1;e&&a.setSize.apply(a, +h);C(a,"afterPrint")},1E3)},1)}},contextMenu:function(b,a,d,c,w,m,h){var e=this,n=e.options.navigation,k=e.chartWidth,v=e.chartHeight,l="cache-"+b,f=e[l],B=Math.max(w,m),p;f||(e.exportContextMenu=e[l]=f=t("div",{className:b},{position:"absolute",zIndex:1E3,padding:B+"px",pointerEvents:"auto"},e.fixedDiv||e.container),p=t("div",{className:"highcharts-menu"},null,f),e.styledMode||r(p,x({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},n.menuStyle)), +f.hideMenu=function(){r(f,{display:"none"});h&&h.setState(0);e.openMenu=!1;g.clearTimeout(f.hideTimer)},e.exportEvents.push(q(f,"mouseleave",function(){f.hideTimer=setTimeout(f.hideMenu,500)}),q(f,"mouseenter",function(){g.clearTimeout(f.hideTimer)}),q(z,"mouseup",function(a){e.pointer.inClass(a.target,b)||f.hideMenu()}),q(f,"click",function(){e.openMenu&&f.hideMenu()})),a.forEach(function(a){"string"===typeof a&&(a=e.options.exporting.menuItemDefinitions[a]);if(g.isObject(a,!0)){var b;a.separator? +b=t("hr",null,null,p):(b=t("div",{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();f.hideMenu();a.onclick&&a.onclick.apply(e,arguments)},innerHTML:a.text||e.options.lang[a.textKey]},null,p),e.styledMode||(b.onmouseover=function(){r(this,n.menuItemHoverStyle)},b.onmouseout=function(){r(this,n.menuItemStyle)},r(b,x({cursor:"pointer"},n.menuItemStyle))));e.exportDivElements.push(b)}}),e.exportDivElements.push(p,f),e.exportMenuWidth=f.offsetWidth,e.exportMenuHeight=f.offsetHeight); +a={display:"block"};d+e.exportMenuWidth>k?a.right=k-d-w-B+"px":a.left=d-B+"px";c+m+e.exportMenuHeight>v&&"top"!==h.alignOptions.verticalAlign?a.bottom=v-c-B+"px":a.top=c+m-B+"px";r(f,a);e.openMenu=!0},addButton:function(b){var a=this,d=a.renderer,c=p(a.options.navigation.buttonOptions,b),g=c.onclick,m=c.menuItems,h,e,n=c.symbolSize||12;a.btnCount||(a.btnCount=0);a.exportDivElements||(a.exportDivElements=[],a.exportSVGElements=[]);if(!1!==c.enabled){var k=c.theme,v=k.states,l=v&&v.hover,v=v&&v.select, +f;a.styledMode||(k.fill=u(k.fill,"#ffffff"),k.stroke=u(k.stroke,"none"));delete k.states;g?f=function(b){b&&b.stopPropagation();g.call(a,b)}:m&&(f=function(b){b&&b.stopPropagation();a.contextMenu(e.menuClassName,m,e.translateX,e.translateY,e.width,e.height,e);e.setState(2)});c.text&&c.symbol?k.paddingLeft=u(k.paddingLeft,25):c.text||x(k,{width:c.width,height:c.height,padding:0});a.styledMode||(k["stroke-linecap"]="round",k.fill=u(k.fill,"#ffffff"),k.stroke=u(k.stroke,"none"));e=d.button(c.text,0, +0,f,k,l,v).addClass(b.className).attr({title:u(a.options.lang[c._titleKey||c.titleKey],"")});e.menuClassName=b.menuClassName||"highcharts-menu-"+a.btnCount++;c.symbol&&(h=d.symbol(c.symbol,c.symbolX-n/2,c.symbolY-n/2,n,n,{width:n,height:n}).addClass("highcharts-button-symbol").attr({zIndex:1}).add(e),a.styledMode||h.attr({stroke:c.symbolStroke,fill:c.symbolFill,"stroke-width":c.symbolStrokeWidth||1}));e.add(a.exportingGroup).align(x(c,{width:e.width,x:u(c.x,a.buttonOffset)}),!0,"spacingBox");a.buttonOffset+= +(e.width+c.buttonSpacing)*("right"===c.align?-1:1);a.exportSVGElements.push(e,h)}},destroyExport:function(b){var a=b?b.target:this;b=a.exportSVGElements;var d=a.exportDivElements,c=a.exportEvents,l;b&&(b.forEach(function(b,c){b&&(b.onclick=b.ontouchstart=null,l="cache-"+b.menuClassName,a[l]&&delete a[l],a.exportSVGElements[c]=b.destroy())}),b.length=0);a.exportingGroup&&(a.exportingGroup.destroy(),delete a.exportingGroup);d&&(d.forEach(function(b,c){g.clearTimeout(b.hideTimer);I(b,"mouseleave");a.exportDivElements[c]= +b.onmouseout=b.onmouseover=b.ontouchstart=b.onclick=null;D(b)}),d.length=0);c&&(c.forEach(function(a){a()}),c.length=0)}});F.prototype.inlineToAttributes="fill stroke strokeLinecap strokeLinejoin strokeWidth textAnchor x y".split(" ");F.prototype.inlineBlacklist=[/-/,/^(clipPath|cssText|d|height|width)$/,/^font$/,/[lL]ogical(Width|Height)$/,/perspective/,/TapHighlightColor/,/^transition/,/^length$/];F.prototype.unstyledElements=["clipPath","defs","desc"];l.prototype.inlineStyles=function(){function b(a){return a.replace(/([A-Z])/g, +function(a,b){return"-"+b.toLowerCase()})}function a(d){function m(a,f){q=t=!1;if(l){for(r=l.length;r--&&!t;)t=l[r].test(f);q=!t}"transform"===f&&"none"===a&&(q=!0);for(r=g.length;r--&&!q;)q=g[r].test(f)||"function"===typeof a;q||v[f]===a&&"svg"!==d.nodeName||e[d.nodeName][f]===a||(-1!==c.indexOf(f)?d.setAttribute(b(f),a):u+=b(f)+":"+a+";")}var f,v,u="",w,q,t,r;if(1===d.nodeType&&-1===h.indexOf(d.nodeName)){f=A.getComputedStyle(d,null);v="svg"===d.nodeName?{}:A.getComputedStyle(d.parentNode,null); +e[d.nodeName]||(n=k.getElementsByTagName("svg")[0],w=k.createElementNS(d.namespaceURI,d.nodeName),n.appendChild(w),e[d.nodeName]=p(A.getComputedStyle(w,null)),"text"===d.nodeName&&delete e.text.fill,n.removeChild(w));if(L||K)for(var x in f)m(f[x],x);else E(f,m);u&&(f=d.getAttribute("style"),d.setAttribute("style",(f?f+";":"")+u));"svg"===d.nodeName&&d.setAttribute("stroke-width","1px");"text"!==d.nodeName&&[].forEach.call(d.children||d.childNodes,a)}}var d=this.renderer,c=d.inlineToAttributes,g=d.inlineBlacklist, +l=d.inlineWhitelist,h=d.unstyledElements,e={},n,k,d=z.createElement("iframe");r(d,{width:"1px",height:"1px",visibility:"hidden"});z.body.appendChild(d);k=d.contentWindow.document;k.open();k.write('\x3csvg xmlns\x3d"http://www.w3.org/2000/svg"\x3e\x3c/svg\x3e');k.close();a(this.container.querySelector("svg"));n.parentNode.removeChild(n)};H.menu=function(b,a,d,c){return["M",b,a+2.5,"L",b+d,a+2.5,"M",b,a+c/2+.5,"L",b+d,a+c/2+.5,"M",b,a+c-1.5,"L",b+d,a+c-1.5]};H.menuball=function(b,a,d,c){b=[];c=c/3- +2;return b=b.concat(this.circle(d-c,a,c,c),this.circle(d-c,a+c+4,c,c),this.circle(d-c,a+2*(c+4),c,c))};l.prototype.renderExporting=function(){var b=this,a=b.options.exporting,d=a.buttons,c=b.isDirtyExporting||!b.exportSVGElements;b.buttonOffset=0;b.isDirtyExporting&&b.destroyExport();c&&!1!==a.enabled&&(b.exportEvents=[],b.exportingGroup=b.exportingGroup||b.renderer.g("exporting-group").attr({zIndex:3}).add(),E(d,function(a){b.addButton(a)}),b.isDirtyExporting=!1);q(b,"destroy",b.destroyExport)}; +q(l,"init",function(){var b=this;["exporting","navigation"].forEach(function(a){b[a]={update:function(d,c){b.isDirtyExporting=!0;p(!0,b.options[a],d);u(c,!0)&&b.redraw()}}})});l.prototype.callbacks.push(function(b){b.renderExporting();q(b,"redraw",b.renderExporting)})})(l)}); +// # sourceMappingURL=exporting.js.map diff --git a/src/main/webapp/static/global/plugins/highcharts/js/exporting.js.old b/src/main/webapp/static/global/plugins/highcharts/js/exporting.js.old new file mode 100644 index 000000000..1cef1138e --- /dev/null +++ b/src/main/webapp/static/global/plugins/highcharts/js/exporting.js.old @@ -0,0 +1,26 @@ +/* + Highcharts JS v6.1.0 (2018-04-13) + Exporting module + + (c) 2010-2017 Torstein Honsi + + License: www.highcharts.com/license +*/ +(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(f){var h=f.defaultOptions,z=f.doc,A=f.Chart,w=f.addEvent,H=f.removeEvent,D=f.fireEvent,q=f.createElement,B=f.discardElement,u=f.css,p=f.merge,r=f.pick,k=f.each,E=f.objectEach,t=f.extend,I=f.isTouchDevice,C=f.win,F=C.navigator.userAgent,J=f.Renderer.prototype.symbols;/Edge\/|Trident\/|MSIE /.test(F);/firefox/i.test(F);t(h.lang,{/*printChart:"Print chart",*//*downloadPNG:"Download PNG image",*/downloadJPEG:"Download JPEG image", +/*downloadPDF:"Download PDF document",*//*downloadSVG:"Download SVG vector image",*/contextButtonTitle:"download"});h.navigation={buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,verticalAlign:"top",width:24}};p(!0,h.navigation,{menuStyle:{border:"1px solid #999999",background:"#ffffff",padding:"5px 0"},menuItemStyle:{padding:"0.5em 1em",background:"none",color:"#333333",fontSize:I?"14px":"11px",transition:"background 250ms, color 250ms"},menuItemHoverStyle:{background:"#335cad", +color:"#ffffff"},buttonOptions:{symbolFill:"#666666",symbolStroke:"#666666",symbolStrokeWidth:3,theme:{fill:"#ffffff",stroke:"none",padding:5}}});h.exporting={type:"image/jpeg",url:"${pageContext.request.contextPath}/",printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",menuItems:"downloadJPEG".split(" ")}},menuItemDefinitions:{/*printChart:{textKey:"printChart", +onclick:function(){this.print()}},*//*separator:{separator:!0},*//*downloadPNG:{textKey:"downloadPNG",onclick:function(){this.exportChart()}},*/downloadJPEG:{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},/*downloadPDF:{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},*//*downloadSVG:{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}*/}};f.post=function(a,b,e){var c=q("form",p({method:"post",action:a,enctype:"multipart/form-data"}, +e),{display:"none"},z.body);E(b,function(a,b){q("input",{type:"hidden",name:b,value:a},null,c)});c.submit();B(c)};t(A.prototype,{sanitizeSVG:function(a,b){if(b&&b.exporting&&b.exporting.allowHTML){var e=a.match(/<\/svg>(.*?$)/);e&&e[1]&&(e='\x3cforeignObject x\x3d"0" y\x3d"0" width\x3d"'+b.chart.width+'" height\x3d"'+b.chart.height+'"\x3e\x3cbody xmlns\x3d"http://www.w3.org/1999/xhtml"\x3e'+e[1]+"\x3c/body\x3e\x3c/foreignObject\x3e",a=a.replace("\x3c/svg\x3e",e+"\x3c/svg\x3e"))}a=a.replace(/zIndex="[^"]+"/g, +"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/.*?$/,"\x3c/svg\x3e").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,'$1\x3d"rgb($2)" $1-opacity\x3d"$3"').replace(/ /g, +"\u00a0").replace(/­/g,"\u00ad");this.ieSanitizeSVG&&(a=this.ieSanitizeSVG(a));return a},getChartHTML:function(){return this.container.innerHTML},getSVG:function(a){var b,e,c,v,m,g=p(this.options,a);e=q("div",null,{position:"absolute",top:"-9999em",width:this.chartWidth+"px",height:this.chartHeight+"px"},z.body);c=this.renderTo.style.width;m=this.renderTo.style.height;c=g.exporting.sourceWidth||g.chart.width||/px$/.test(c)&&parseInt(c,10)||600;m=g.exporting.sourceHeight||g.chart.height||/px$/.test(m)&& +parseInt(m,10)||400;t(g.chart,{animation:!1,renderTo:e,forExport:!0,renderer:"SVGRenderer",width:c,height:m});g.exporting.enabled=!1;delete g.data;g.series=[];k(this.series,function(a){v=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});v.isInternal||g.series.push(v)});k(this.axes,function(a){a.userOptions.internalKey||(a.userOptions.internalKey=f.uniqueKey())});b=new f.Chart(g,this.callback);a&&k(["xAxis","yAxis","series"],function(c){var d={};a[c]&&(d[c]=a[c], +b.update(d))});k(this.axes,function(a){var c=f.find(b.axes,function(b){return b.options.internalKey===a.userOptions.internalKey}),d=a.getExtremes(),e=d.userMin,d=d.userMax;!c||void 0===e&&void 0===d||c.setExtremes(e,d,!0,!1)});c=b.getChartHTML();c=this.sanitizeSVG(c,g);g=null;b.destroy();B(e);return c},getSVGForExport:function(a,b){var e=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}},e.chartOptions,b,{exporting:{sourceWidth:a&&a.sourceWidth||e.sourceWidth,sourceHeight:a&&a.sourceHeight|| +e.sourceHeight}}))},exportChart:function(a,b){b=this.getSVGForExport(a,b);a=p(this.options.exporting,a);f.post(a.url,{filename:a.filename||"chart",type:a.type,width:a.width||0,scale:a.scale,svg:b},a.formAttributes)},print:function(){var a=this,b=a.container,e=[],c=b.parentNode,f=z.body,m=f.childNodes,g=a.options.exporting.printMaxWidth,d,n;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);D(a,"beforePrint");if(n=g&&a.chartWidth>g)d=[a.options.chart.width,void 0,!1],a.setSize(g,void 0,!1); +k(m,function(a,b){1===a.nodeType&&(e[b]=a.style.display,a.style.display="none")});f.appendChild(b);C.focus();C.print();setTimeout(function(){c.appendChild(b);k(m,function(a,b){1===a.nodeType&&(a.style.display=e[b])});a.isPrinting=!1;n&&a.setSize.apply(a,d);D(a,"afterPrint")},1E3)}},contextMenu:function(a,b,e,c,v,m,g){var d=this,n=d.options.navigation,h=d.chartWidth,G=d.chartHeight,p="cache-"+a,l=d[p],x=Math.max(v,m),y,r;l||(d[p]=l=q("div",{className:a},{position:"absolute",zIndex:1E3,padding:x+"px"}, +d.container),y=q("div",{className:"highcharts-menu"},null,l),u(y,t({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},n.menuStyle)),r=function(){u(l,{display:"none"});g&&g.setState(0);d.openMenu=!1},d.exportEvents.push(w(l,"mouseleave",function(){l.hideTimer=setTimeout(r,500)}),w(l,"mouseenter",function(){f.clearTimeout(l.hideTimer)}),w(z,"mouseup",function(b){d.pointer.inClass(b.target,a)||r()})),k(b,function(a){"string"===typeof a&&(a=d.options.exporting.menuItemDefinitions[a]); +if(f.isObject(a,!0)){var b;a.separator?b=q("hr",null,null,y):(b=q("div",{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();r();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text||d.options.lang[a.textKey]},null,y),b.onmouseover=function(){u(this,n.menuItemHoverStyle)},b.onmouseout=function(){u(this,n.menuItemStyle)},u(b,t({cursor:"pointer"},n.menuItemStyle)));d.exportDivElements.push(b)}}),d.exportDivElements.push(y,l),d.exportMenuWidth=l.offsetWidth,d.exportMenuHeight= +l.offsetHeight);b={display:"block"};e+d.exportMenuWidth>h?b.right=h-e-v-x+"px":b.left=e-x+"px";c+m+d.exportMenuHeight>G&&"top"!==g.alignOptions.verticalAlign?b.bottom=G-c-x+"px":b.top=c+m-x+"px";u(l,b);d.openMenu=!0},addButton:function(a){var b=this,e=b.renderer,c=p(b.options.navigation.buttonOptions,a),f=c.onclick,m=c.menuItems,g,d,n=c.symbolSize||12;b.btnCount||(b.btnCount=0);b.exportDivElements||(b.exportDivElements=[],b.exportSVGElements=[]);if(!1!==c.enabled){var h=c.theme,k=h.states,q=k&&k.hover, +k=k&&k.select,l;delete h.states;f?l=function(a){a.stopPropagation();f.call(b,a)}:m&&(l=function(){b.contextMenu(d.menuClassName,m,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)});c.text&&c.symbol?h.paddingLeft=r(h.paddingLeft,25):c.text||t(h,{width:c.width,height:c.height,padding:0});d=e.button(c.text,0,0,l,h,q,k).addClass(a.className).attr({"stroke-linecap":"round",title:r(b.options.lang[c._titleKey],""),zIndex:3});d.menuClassName=a.menuClassName||"highcharts-menu-"+b.btnCount++;c.symbol&& +(g=e.symbol(c.symbol,c.symbolX-n/2,c.symbolY-n/2,n,n,{width:n,height:n}).addClass("highcharts-button-symbol").attr({zIndex:1}).add(d),g.attr({stroke:c.symbolStroke,fill:c.symbolFill,"stroke-width":c.symbolStrokeWidth||1}));d.add().align(t(c,{width:d.width,x:r(c.x,b.buttonOffset)}),!0,"spacingBox");b.buttonOffset+=(d.width+c.buttonSpacing)*("right"===c.align?-1:1);b.exportSVGElements.push(d,g)}},destroyExport:function(a){var b=a?a.target:this;a=b.exportSVGElements;var e=b.exportDivElements,c=b.exportEvents, +h;a&&(k(a,function(a,c){a&&(a.onclick=a.ontouchstart=null,h="cache-"+a.menuClassName,b[h]&&delete b[h],b.exportSVGElements[c]=a.destroy())}),a.length=0);e&&(k(e,function(a,c){f.clearTimeout(a.hideTimer);H(a,"mouseleave");b.exportDivElements[c]=a.onmouseout=a.onmouseover=a.ontouchstart=a.onclick=null;B(a)}),e.length=0);c&&(k(c,function(a){a()}),c.length=0)}});J.menu=function(a,b,e,c){return["M",a,b+2.5,"L",a+e,b+2.5,"M",a,b+c/2+.5,"L",a+e,b+c/2+.5,"M",a,b+c-1.5,"L",a+e,b+c-1.5]};A.prototype.renderExporting= +function(){var a=this,b=a.options.exporting,e=b.buttons,c=a.isDirtyExporting||!a.exportSVGElements;a.buttonOffset=0;a.isDirtyExporting&&a.destroyExport();c&&!1!==b.enabled&&(a.exportEvents=[],E(e,function(b){a.addButton(b)}),a.isDirtyExporting=!1);w(a,"destroy",a.destroyExport)};A.prototype.callbacks.push(function(a){a.renderExporting();w(a,"redraw",a.renderExporting);k(["exporting","navigation"],function(b){a[b]={update:function(e,c){a.isDirtyExporting=!0;p(!0,a.options[b],e);r(c,!0)&&a.redraw()}}})})})(h)}); diff --git a/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js b/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js index 38062c420..aee446312 100644 --- a/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js +++ b/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js @@ -1,19 +1,317 @@ /* - Highcharts JS v6.1.0 (2018-04-13) - Client side exporting module +Highcharts JS v6.1.0 (2018-04-13) +Client side exporting module - (c) 2015 Torstein Honsi / Oystein Moseng +(c) 2015 Torstein Honsi / Oystein Moseng - License: www.highcharts.com/license -*/ -(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(c){function n(a,f){var d=t.getElementsByTagName("head")[0],b=t.createElement("script");b.type="text/javascript";b.src=a;b.onload=f;b.onerror=function(){c.error("Error loading script "+a)};d.appendChild(b)}var C=c.merge,e=c.win,r=e.navigator,t=e.document,w=c.each,x=e.URL||e.webkitURL||e,B=/Edge\/|Trident\/|MSIE /.test(r.userAgent),D=/Edge\/\d+/.test(r.userAgent),E=B?150:0;c.CanVGRenderer={}; -c.dataURLtoBlob=function(a){if(e.atob&&e.ArrayBuffer&&e.Uint8Array&&e.Blob&&x.createObjectURL){a=a.match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/);for(var c=e.atob(a[3]),d=new e.ArrayBuffer(c.length),d=new e.Uint8Array(d),b=0;br.userAgent.indexOf("Chrome");try{if(!c&&0>r.userAgent.toLowerCase().indexOf("firefox"))return x.createObjectURL(new e.Blob([a],{type:"image/svg+xml;charset-utf-16"}))}catch(d){}return"data:image/svg+xml;charset\x3dUTF-8,"+ -encodeURIComponent(a)};c.imageToDataUrl=function(a,c,d,b,u,l,k,m,p){var g=new e.Image,h,f=function(){setTimeout(function(){var e=t.createElement("canvas"),f=e.getContext&&e.getContext("2d"),y;try{if(f){e.height=g.height*b;e.width=g.width*b;f.drawImage(g,0,0,e.width,e.height);try{y=e.toDataURL(c),u(y,c,d,b)}catch(F){h(a,c,d,b)}}else k(a,c,d,b)}finally{p&&p(a,c,d,b)}},E)},q=function(){m(a,c,d,b);p&&p(a,c,d,b)};h=function(){g=new e.Image;h=l;g.crossOrigin="Anonymous";g.onload=f;g.onerror=q;g.src=a}; -g.onload=f;g.onerror=q;g.src=a};c.downloadSVGLocal=function(a,f,d,b){function u(b,a){a=new e.jsPDF("l","pt",[b.width.baseVal.value+2*a,b.height.baseVal.value+2*a]);w(b.querySelectorAll('*[visibility\x3d"hidden"]'),function(b){b.parentNode.removeChild(b)});e.svg2pdf(b,a,{removeInvalid:!0});return a.output("datauristring")}function l(){z.innerHTML=a;var e=z.getElementsByTagName("text"),f;w(e,function(b){w(["font-family","font-size"],function(a){for(var c=b;c&&c!==z;){if(c.style[a]){b.style[a]=c.style[a]; -break}c=c.parentNode}});b.style["font-family"]=b.style["font-family"]&&b.style["font-family"].split(" ").splice(-1);f=b.getElementsByTagName("title");w(f,function(a){b.removeChild(a)})});e=u(z.firstChild,0);try{c.downloadURL(e,v),b&&b()}catch(G){d()}}var k,m,p=!0,g,h=f.libURL||c.getOptions().exporting.libURL,z=t.createElement("div"),q=f.type||"image/png",v=(f.filename||"chart")+"."+("image/svg+xml"===q?"svg":q.split("/")[1]),A=f.scale||1,h="/"!==h.slice(-1)?h+"/":h;if("image/svg+xml"===q)try{r.msSaveOrOpenBlob? -(m=new MSBlobBuilder,m.append(a),k=m.getBlob("image/svg+xml")):k=c.svgToDataUrl(a),c.downloadURL(k,v),b&&b()}catch(y){d()}else"application/pdf"===q?e.jsPDF&&e.svg2pdf?l():(p=!0,n(h+"jspdf.js",function(){n(h+"svg2pdf.js",function(){l()})})):(k=c.svgToDataUrl(a),g=function(){try{x.revokeObjectURL(k)}catch(y){}},c.imageToDataUrl(k,q,{},A,function(a){try{c.downloadURL(a,v),b&&b()}catch(F){d()}},function(){var f=t.createElement("canvas"),u=f.getContext("2d"),l=a.match(/^]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1]* -A,k=a.match(/^]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*A,m=function(){u.drawSvg(a,0,0,l,k);try{c.downloadURL(r.msSaveOrOpenBlob?f.msToBlob():f.toDataURL(q),v),b&&b()}catch(H){d()}finally{g()}};f.width=l;f.height=k;e.canvg?m():(p=!0,n(h+"rgbcolor.js",function(){n(h+"canvg.js",function(){m()})}))},d,d,function(){p&&g()}))};c.Chart.prototype.getSVGForLocalExport=function(a,e,d,b){var f=this,l,k=0,m,p,g,h,n,q=function(a,c,d){++k;d.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","href", -a);k===l.length&&b(f.sanitizeSVG(m.innerHTML,p))};c.wrap(c.Chart.prototype,"getChartHTML",function(b){var a=b.apply(this,Array.prototype.slice.call(arguments,1));p=this.options;m=this.container.cloneNode(!0);return a});f.getSVGForExport(a,e);l=m.getElementsByTagName("image");try{if(l.length)for(h=0,n=l.length;h r.userAgent.indexOf("Chrome"); + try { + if (!c && 0 > r.userAgent.toLowerCase().indexOf("firefox")) + return x.createObjectURL(new e.Blob([a], { + type: "image/svg+xml;charset-utf-16" + })) + } catch (d) {} + return "data:image/svg+xml;charset\x3dUTF-8," + + encodeURIComponent(a) + }; + c.imageToDataUrl = function (a, c, d, b, u, l, k, m, p) { + var g = new e.Image, + h, + f = function () { + setTimeout(function () { + var e = t.createElement("canvas"), + f = e.getContext && e.getContext("2d"), + y; + try { + if (f) { + e.height = g.height * b; + e.width = g.width * b; + f.drawImage(g, 0, 0, e.width, e.height); + try { + y = e.toDataURL(c), + u(y, c, d, b) + } catch (F) { + h(a, c, d, b) + } + } else + k(a, c, d, b) + } + finally { + p && p(a, c, d, b) + } + }, E) + }, + q = function () { + m(a, c, d, b); + p && p(a, c, d, b) + }; + h = function () { + g = new e.Image; + h = l; + g.crossOrigin = "Anonymous"; + g.onload = f; + g.onerror = q; + g.src = a + }; + g.onload = f; + g.onerror = q; + g.src = a + }; + c.downloadSVGLocal = function (a, f, d, b) { + function u(b, a) { + a = new e.jsPDF("l", "pt", [b.width.baseVal.value + 2 * a, b.height.baseVal.value + 2 * a]); + w(b.querySelectorAll('*[visibility\x3d"hidden"]'), function (b) { + b.parentNode.removeChild(b) + }); + e.svg2pdf(b, a, { + removeInvalid: !0 + }); + return a.output("datauristring") + } + function l() { + z.innerHTML = a; + var e = z.getElementsByTagName("text"), + f; + w(e, function (b) { + w(["font-family", "font-size"], function (a) { + for (var c = b; c && c !== z; ) { + if (c.style[a]) { + b.style[a] = c.style[a]; + break + } + c = c.parentNode + } + }); + b.style["font-family"] = b.style["font-family"] && b.style["font-family"].split(" ").splice(-1); + f = b.getElementsByTagName("title"); + w(f, function (a) { + b.removeChild(a) + }) + }); + e = u(z.firstChild, 0); + try { + c.downloadURL(e, v), + b && b() + } catch (G) { + d() + } + } + var k, + m, + p = !0, + g, + h = f.libURL || c.getOptions().exporting.libURL, + z = t.createElement("div"), + q = f.type || "image/png", + v = (f.filename || "chart") + "." + ("image/svg+xml" === q ? "svg" : q.split("/")[1]), + A = f.scale || 1, + h = "/" !== h.slice(-1) ? h + "/" : h; + if ("image/svg+xml" === q) + try { + r.msSaveOrOpenBlob ? + (m = new MSBlobBuilder, m.append(a), k = m.getBlob("image/svg+xml")) : k = c.svgToDataUrl(a), + c.downloadURL(k, v), + b && b() + } catch (y) { + d() + } + else + "application/pdf" === q ? e.jsPDF && e.svg2pdf ? l() : (p = !0, n(h + "jspdf.js", function () { + n(h + "svg2pdf.js", function () { + l() + }) + })) : (k = c.svgToDataUrl(a), g = function () { + try { + x.revokeObjectURL(k) + } catch (y) {} + }, c.imageToDataUrl(k, q, {}, A, function (a) { + try { + c.downloadURL(a, v), + b && b() + } catch (F) { + d() + } + }, function () { + var f = t.createElement("canvas"), + u = f.getContext("2d"), + l = a.match(/^]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * + A, + k = a.match(/^]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * A, + m = function () { + u.drawSvg(a, 0, 0, l, k); + try { + c.downloadURL(r.msSaveOrOpenBlob ? f.msToBlob() : f.toDataURL(q), v), + b && b() + } catch (H) { + d() + } + finally { + g() + } + }; + f.width = l; + f.height = k; + e.canvg ? m() : (p = !0, n(h + "rgbcolor.js", function () { + n(h + "canvg.js", function () { + m() + }) + })) + }, d, d, function () { + p && g() + })) + }; + c.Chart.prototype.getSVGForLocalExport = function (a, e, d, b) { + var f = this, + l, + k = 0, + m, + p, + g, + h, + n, + q = function (a, c, d) { + ++k; + d.imageElement.setAttributeNS("http://www.w3.org/1999/xlink", "href", + a); + k === l.length && b(f.sanitizeSVG(m.innerHTML, p)) + }; + c.wrap(c.Chart.prototype, "getChartHTML", function (b) { + var a = b.apply(this, Array.prototype.slice.call(arguments, 1)); + p = this.options; + m = this.container.cloneNode(!0); + return a + }); + f.getSVGForExport(a, e); + l = m.getElementsByTagName("image"); + try { + if (l.length) + for (h = 0, n = l.length; h < n; ++h) + g = l[h], c.imageToDataUrl(g.getAttributeNS("http://www.w3.org/1999/xlink", "href"), "image/png", { + imageElement: g + }, a.scale, q, d, d, d); + else + b(f.sanitizeSVG(m.innerHTML, p)) + } catch (v) { + d() + } + }; + c.Chart.prototype.exportChartLocal = + function (a, e) { + var d = this, + b = c.merge(d.options.exporting, a), + f = function () { + if (!1 === b.fallbackToExportServer) + if (b.error) + b.error(b); + else + throw "Fallback to export server disabled"; + else + d.exportChart(b) + }; + B && ("application/pdf" === b.type || d.container.getElementsByTagName("image").length && "image/svg+xml" !== b.type) || "application/pdf" === b.type && d.container.getElementsByTagName("image").length ? f() : d.getSVGForLocalExport(b, e, f, function (a) { + -1 < a.indexOf("\x3cforeignObject") && "image/svg+xml" !== b.type ? f() : c.downloadSVGLocal(a, + b, f) + }) + }; + C(!0, c.getOptions().exporting, { + libURL: "https://code.highcharts.com/6.1.0/lib/", + menuItemDefinitions: { + downloadPNG: { + textKey: "downloadPNG", + onclick: function () { + console.log(this) + this.legend.itemStyle.color='#000000' + this.exportChartLocal() + this.legend.itemStyle.color='#ffffff' + console.log('ok') + console.log(this) + } + }, + downloadJPEG: { + textKey: "downloadJPEG", + onclick: function () { + this.exportChartLocal({ + type: "image/jpeg" + }) + } + }, + downloadSVG: { + textKey: "downloadSVG", + onclick: function () { + this.exportChartLocal({ + type: "image/svg+xml" + }) + } + }, + downloadPDF: { + textKey: "downloadPDF", + onclick: function () { + this.legend.itemStyle.color='#000000' + this.exportChartLocal({ + type: "application/pdf" + }) + this.legend.itemStyle.color='#ffffff' + } + } + } + }) + })(n) +}); diff --git a/src/main/webapp/static/global/plugins/highcharts/js/series-label.js b/src/main/webapp/static/global/plugins/highcharts/js/series-label.js index 31208a9f4..fde37285d 100644 --- a/src/main/webapp/static/global/plugins/highcharts/js/series-label.js +++ b/src/main/webapp/static/global/plugins/highcharts/js/series-label.js @@ -1,20 +1,22 @@ -/* - Highcharts JS v6.1.0 (2018-04-13) - - (c) 2009-2017 Torstein Honsi - - License: www.highcharts.com/license -*/ -(function(r){"object"===typeof module&&module.exports?module.exports=r:r(Highcharts)})(function(r){(function(n){function r(c,b,a,k,d,e){c=(e-b)*(a-c)-(k-b)*(d-c);return 0c?!1:!0}function w(c,b,a,k,d,e,f,m){return r(c,b,d,e,f,m)!==r(a,k,d,e,f,m)&&r(c,b,a,k,d,e)!==r(c,b,a,k,f,m)}function A(c,b,a,k,d,e,f,m){return w(c,b,c+a,b,d,e,f,m)||w(c+a,b,c+a,b+k,d,e,f,m)||w(c,b+k,c+a,b+k,d,e,f,m)||w(c,b,c,b+k,d,e,f,m)}var D=n.addEvent,u=n.each,B=n.extend,y=n.isNumber,x=n.pick,z=n.Series,E=n.SVGRenderer, -C=n.Chart;n.setOptions({plotOptions:{series:{label:{enabled:!0,connectorAllowed:!1,connectorNeighbourDistance:24,minFontSize:null,maxFontSize:null,onArea:null,style:{fontWeight:"bold"},boxesToAvoid:[]}}}});E.prototype.symbols.connector=function(c,b,a,k,d){var e=d&&d.anchorX;d=d&&d.anchorY;var f,m,h=a/2;y(e)&&y(d)&&(f=["M",e,d],m=b-d,0>m&&(m=-k-m),mb+k?f.push("L",c+h,b+k):dc+a&&f.push("L",c+a,b+k/2));return f||[]};z.prototype.getPointsOnGraph= -function(){if(this.xAxis||this.yAxis){var c=this.points,b,a,k=[],d,e,f,m;e=this.graph||this.area;f=e.element;var h=this.chart.inverted,q=this.xAxis;b=this.yAxis;var v=h?b.pos:q.pos,h=h?q.pos:b.pos,q=x(this.options.label.onArea,!!this.area),p=b.getThreshold(this.options.threshold);if(this.getPointSpline&&f.getPointAtLength&&!q){e.toD&&(a=e.attr("d"),e.attr({d:e.toD}));m=f.getTotalLength();for(d=0;dl.right||gl.bottom|| -n=c-16&&l[g-1].chartX<=c+a.width+16){if(A(c,b,a.width,a.height,l[g-1].chartX,l[g-1].chartY,l[g].chartX,l[g].chartY))return!1;this===p&&!f&&k&&(f=A(c-16,b-16,a.width+32,a.height+32,l[g-1].chartX,l[g-1].chartY,l[g].chartX,l[g].chartY))}!h&&!f||this===p&&!q||(n=c+a.width/2-l[g].chartX,r=b+a.height/2-l[g].chartY,d=Math.min(d,n*n+r*r))}if(!q&&h&&this===p&&(k&&!f|| -dl&&a<=l+w-c.width&&b>=r&&b<=r+t-c.height}if(a.xAxis||a.yAxis){var d,e,f,m=[],h,q,n=a.options.label,p=c.inverted,l=p?a.yAxis.pos:a.xAxis.pos,r=p?a.xAxis.pos:a.yAxis.pos,w=c.inverted?a.yAxis.len:a.xAxis.len,t=c.inverted?a.xAxis.len:a.yAxis.len,g=a.interpolatedPoints, -u=x(n.onArea,!!a.area),p=a.labelBySeries;d=n.minFontSize;e=n.maxFontSize;if(a.visible&&!a.isSeriesBoosting&&g){p||(a.labelBySeries=p=c.renderer.label(a.name,0,-9999,"connector").css(B({color:u?c.renderer.getContrast(a.color):a.color},a.options.label.style)),d&&e&&p.css({fontSize:a.labelFontSize(d,e)}),p.attr({padding:0,opacity:c.renderer.forExport?1:0,stroke:a.color,"stroke-width":1,zIndex:3}).add().animate({opacity:1},{duration:200}));d=p.getBBox();d.width=Math.round(d.width);for(q=g.length-1;0< -q;--q)u?(e=g[q].chartX-d.width/2,f=g[q].chartCenterY-d.height/2):(e=g[q].chartX+3,f=g[q].chartY-d.height-3,b(e,f,d)&&(h=a.checkClearPoint(e,f,d)),h&&m.push(h),e=g[q].chartX+3,f=g[q].chartY+3,b(e,f,d)&&(h=a.checkClearPoint(e,f,d)),h&&m.push(h),e=g[q].chartX-d.width-3,f=g[q].chartY+3,b(e,f,d)&&(h=a.checkClearPoint(e,f,d)),h&&m.push(h),e=g[q].chartX-d.width-3,f=g[q].chartY-d.height-3),b(e,f,d)&&(h=a.checkClearPoint(e,f,d)),h&&m.push(h);if(n.connectorAllowed&&!m.length&&!u)for(e=l+w-d.width;e>=l;e-=16)for(f= -r;f=m&&(g={x:n.x,y:n.y},n={}),a.labelBySeries.attr(B(n,{anchorX:h.connectorPoint&&h.connectorPoint.plotX+l,anchorY:h.connectorPoint&&h.connectorPoint.plotY+ -r})).animate(g),a.options.kdNow=!0,a.buildKDTree(),a=a.searchPoint({chartX:h.x,chartY:h.y},!0),p.closest=[a,h.x-a.plotX,h.y-a.plotY]}else p&&(a.labelBySeries=p.destroy())}}})};D(C,"render",function(){var c=this,b=Math.max(n.animObject(c.renderer.globalAnimation).duration,250),a=!c.hasRendered;c.labelSeries=[];c.labelSeriesMaxSum=0;n.clearTimeout(c.seriesLabelTimer);u(c.series,function(k){var d=k.options.label,e=k.labelBySeries,f=e&&e.closest;d.enabled&&k.visible&&(k.graph||k.area)&&!k.isSeriesBoosting&& -(c.labelSeries.push(k),d.minFontSize&&d.maxFontSize&&(k.sum=n.reduce(k.yData,function(a,b){return(a||0)+(b||0)},0),c.labelSeriesMaxSum=Math.max(c.labelSeriesMaxSum,k.sum)),a&&(b=Math.max(b,n.animObject(k.options.animation).duration)),f&&(void 0!==f[0].plotX?e.animate({x:f[0].plotX+f[1],y:f[0].plotY+f[2]}):e.attr({opacity:0})))});c.seriesLabelTimer=n.syncTimeout(function(){c.series&&c.labelSeries&&c.drawSeriesLabels()},c.renderer.forExport?0:b)})})(r)}); +/* + Highcharts JS v7.0.1 (2018-12-19) + + (c) 2009-2018 Torstein Honsi + + License: www.highcharts.com/license +*/ +(function(r){"object"===typeof module&&module.exports?module.exports=r:"function"===typeof define&&define.amd?define(function(){return r}):r("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(r){(function(n){function r(c,b,a,k,d,e){c=(e-b)*(a-c)-(k-b)*(d-c);return 0c?!1:!0}function v(c,b,a,k,d,e,f,m){return r(c,b,d,e,f,m)!==r(a,k,d,e,f,m)&&r(c,b,a,k,d,e)!==r(c,b,a,k,f,m)}function z(c,b,a,k,d,e,f,m){return v(c,b,c+a,b,d,e,f,m)||v(c+a,b,c+a,b+k,d,e,f,m)||v(c,b+k,c+a,b+k,d,e,f,m)|| +v(c,b,c,b+k,d,e,f,m)}var C=n.addEvent,A=n.extend,w=n.isNumber,x=n.pick,y=n.Series,D=n.SVGRenderer,B=n.Chart;n.setOptions({plotOptions:{series:{label:{enabled:!0,connectorAllowed:!1,connectorNeighbourDistance:24,minFontSize:null,maxFontSize:null,onArea:null,style:{fontWeight:"bold"},boxesToAvoid:[]}}}});D.prototype.symbols.connector=function(c,b,a,k,d){var e=d&&d.anchorX;d=d&&d.anchorY;var f,m,h=a/2;w(e)&&w(d)&&(f=["M",e,d],m=b-d,0>m&&(m=-k-m),mb+k?f.push("L",c+h,b+k):dc+a&&f.push("L",c+a,b+k/2));return f||[]};y.prototype.getPointsOnGraph=function(){if(this.xAxis||this.yAxis){var c=this.points,b,a,k=[],d,e,f,m;e=this.graph||this.area;f=e.element;var h=this.chart.inverted,q=this.xAxis;b=this.yAxis;var u=h?b.pos:q.pos,h=h?q.pos:b.pos,q=x(this.options.label.onArea,!!this.area),p=b.getThreshold(this.options.threshold);if(this.getPointSpline&&f.getPointAtLength&&!q){e.toD&&(a=e.attr("d"),e.attr({d:e.toD}));m=f.getTotalLength();for(d= +0;dl.right||gl.bottom||n=c-16&&l[g-1].chartX<=c+a.width+16){if(z(c,b,a.width,a.height,l[g-1].chartX,l[g-1].chartY,l[g].chartX,l[g].chartY))return!1;this===p&&!f&&k&&(f=z(c-16,b-16,a.width+32,a.height+32,l[g-1].chartX,l[g-1].chartY,l[g].chartX,l[g].chartY))}!h&&!f||this===p&&!q||(n=c+a.width/2- +l[g].chartX,r=b+a.height/2-l[g].chartY,d=Math.min(d,n*n+r*r))}if(!q&&h&&this===p&&(k&&!f||dl&&a<=l+v-c.width&&b>=r&&b<=r+t-c.height}if(a.xAxis||a.yAxis){var d,e,f,m=[],h,q,n=a.options.label,p=c.inverted,l=p?a.yAxis.pos: +a.xAxis.pos,r=p?a.xAxis.pos:a.yAxis.pos,v=c.inverted?a.yAxis.len:a.xAxis.len,t=c.inverted?a.xAxis.len:a.yAxis.len,g=a.interpolatedPoints,w=x(n.onArea,!!a.area),p=a.labelBySeries;d=n.minFontSize;e=n.maxFontSize;if(a.visible&&!a.isSeriesBoosting&&g){p||(a.labelBySeries=p=c.renderer.label(a.name,0,-9999,"connector").css(A({color:w?c.renderer.getContrast(a.color):a.color},a.options.label.style)),d&&e&&p.css({fontSize:a.labelFontSize(d,e)}),p.attr({padding:0,opacity:c.renderer.forExport?1:0,stroke:a.color, +"stroke-width":1,zIndex:3}).add().animate({opacity:1},{duration:200}));d=p.getBBox();d.width=Math.round(d.width);for(q=g.length-1;0=l;e-=16)for(f=r;f=m&&(g={x:n.x, +y:n.y},n={}),a.labelBySeries.attr(A(n,{anchorX:h.connectorPoint&&h.connectorPoint.plotX+l,anchorY:h.connectorPoint&&h.connectorPoint.plotY+r})).animate(g),a.options.kdNow=!0,a.buildKDTree(),a=a.searchPoint({chartX:h.x,chartY:h.y},!0),p.closest=[a,h.x-a.plotX,h.y-a.plotY]}else p&&(a.labelBySeries=p.destroy())}else p&&(a.labelBySeries=p.destroy())}})};C(B,"render",function(){var c=this,b=Math.max(n.animObject(c.renderer.globalAnimation).duration,250),a=!c.hasRendered;c.labelSeries=[];c.labelSeriesMaxSum= +0;n.clearTimeout(c.seriesLabelTimer);c.series.forEach(function(k){var d=k.options.label,e=k.labelBySeries,f=e&&e.closest;d.enabled&&k.visible&&(k.graph||k.area)&&!k.isSeriesBoosting&&(c.labelSeries.push(k),d.minFontSize&&d.maxFontSize&&(k.sum=k.yData.reduce(function(a,b){return(a||0)+(b||0)},0),c.labelSeriesMaxSum=Math.max(c.labelSeriesMaxSum,k.sum)),a&&(b=Math.max(b,n.animObject(k.options.animation).duration)),f&&(void 0!==f[0].plotX?e.animate({x:f[0].plotX+f[1],y:f[0].plotY+f[2]}):e.attr({opacity:0})))}); +c.seriesLabelTimer=n.syncTimeout(function(){c.series&&c.labelSeries&&c.drawSeriesLabels()},c.renderer.forExport?0:b)})})(r)}); +//# sourceMappingURL=series-label.js.map diff --git a/src/main/webapp/static/global/plugins/highcharts/js/standalone.js b/src/main/webapp/static/global/plugins/highcharts/js/standalone.js new file mode 100644 index 000000000..f31cf3f53 --- /dev/null +++ b/src/main/webapp/static/global/plugins/highcharts/js/standalone.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e,t){return e(t={exports:{}},t.exports),t.exports}var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function s(){o=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}function u(e){var t;o||s();for(var r=e.length,i=r%3,a="",u=[],f=0,l=r-i;fl?l:f+16383));return 1===i?(t=e[r-1],a+=n[t>>2],a+=n[t<<4&63],a+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],a+=n[t>>10],a+=n[t>>4&63],a+=n[t<<2&63],a+="="),u.push(a),u.join("")}function f(e,t,r,n,i){var a,o,s=8*i-n-1,h=(1<>1,f=-7,l=r?i-1:0,c=r?-1:1,d=e[t+l];for(l+=c,a=d&(1<<-f)-1,d>>=-f,f+=s;f>0;a=256*a+e[t+l],l+=c,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=c,f-=8);if(0===a)a=1-u;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)}function l(e,t,r,n,i,a){var o,s,h,u=8*a-i-1,f=(1<>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-o))<1&&(o--,h*=2),(t+=o+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(o++,h/=2),o+l>=f?(s=0,o=f):o+l>=1?(s=(t*h-1)*Math.pow(2,i),o+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;e[r+d]=255&o,d+=p,o/=256,u-=8);e[r+d-p]|=128*m}var c={}.toString,d=Array.isArray||function(e){return"[object Array]"==c.call(e)};v.TYPED_ARRAY_SUPPORT=void 0===e.TYPED_ARRAY_SUPPORT||e.TYPED_ARRAY_SUPPORT;var p=m();function m(){return v.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(e,t){if(m()=m())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+m().toString(16)+" bytes");return 0|e}function x(e){return!(null==e||!e._isBuffer)}function S(e,t){if(x(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(n)return $(e).length;t=(""+t).toLowerCase(),n=!0}}function E(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function A(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=v.from(t,n)),x(t))return 0===t.length?-1:C(e,t,r,n,i);if("number"==typeof t)return t&=255,v.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,i){var a,o=1,s=e.length,h=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,h/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(a=r;as&&(r=s-h),a=r;a>=0;a--){for(var l=!0,c=0;ci&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function L(e,t,r){return 0===t&&r===e.length?u(e):u(e.slice(t,r))}function P(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(a=e[i+1]))&&(h=(31&u)<<6|63&a)>127&&(f=h);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(h=(15&u)<<12|(63&a)<<6|63&o)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(h=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&h<1114112&&(f=h)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=U)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return F(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return D(this,t,r);case"latin1":case"binary":return M(this,t,r);case"base64":return L(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},v.prototype.equals=function(e){if(!x(e))throw new TypeError("Argument must be a Buffer");return this===e||0===v.compare(this,e)},v.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},v.prototype.compare=function(e,t,r,n,i){if(!x(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),h=this.slice(n,i),u=e.slice(t,r),f=0;fi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return R(this,e,t,r);case"utf8":case"utf-8":return z(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return O(this,e,t,r);case"base64":return B(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var U=4096;function D(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function Z(e,t,r,n,i,a){if(!x(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function W(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function Y(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function q(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function H(e,t,r,n,i){return i||q(e,0,r,4),l(e,t,r,n,23,4),r+4}function K(e,t,r,n,i){return i||q(e,0,r,8),l(e,t,r,n,52,8),r+8}v.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},v.prototype.readUInt8=function(e,t){return t||N(e,1,this.length),this[e]},v.prototype.readUInt16LE=function(e,t){return t||N(e,2,this.length),this[e]|this[e+1]<<8},v.prototype.readUInt16BE=function(e,t){return t||N(e,2,this.length),this[e]<<8|this[e+1]},v.prototype.readUInt32LE=function(e,t){return t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},v.prototype.readUInt32BE=function(e,t){return t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},v.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var n=this[e],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*t)),n},v.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},v.prototype.readInt8=function(e,t){return t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},v.prototype.readInt16LE=function(e,t){t||N(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt16BE=function(e,t){t||N(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},v.prototype.readInt32LE=function(e,t){return t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},v.prototype.readInt32BE=function(e,t){return t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},v.prototype.readFloatLE=function(e,t){return t||N(e,4,this.length),f(this,e,!0,23,4)},v.prototype.readFloatBE=function(e,t){return t||N(e,4,this.length),f(this,e,!1,23,4)},v.prototype.readDoubleLE=function(e,t){return t||N(e,8,this.length),f(this,e,!0,52,8)},v.prototype.readDoubleBE=function(e,t){return t||N(e,8,this.length),f(this,e,!1,52,8)},v.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Z(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+i]=e/a&255;return t+r},v.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,1,255,0),v.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},v.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):W(this,e,t,!0),t+2},v.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,65535,0),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):W(this,e,t,!1),t+2},v.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Y(this,e,t,!0),t+4},v.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,4294967295,0),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Y(this,e,t,!1),t+4},v.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Z(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+r},v.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Z(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},v.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,1,127,-128),v.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},v.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):W(this,e,t,!0),t+2},v.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,32767,-32768),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):W(this,e,t,!1),t+2},v.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,2147483647,-2147483648),v.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Y(this,e,t,!0),t+4},v.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),v.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Y(this,e,t,!1),t+4},v.prototype.writeFloatLE=function(e,t,r){return H(this,e,t,!0,r)},v.prototype.writeFloatBE=function(e,t,r){return H(this,e,t,!1,r)},v.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},v.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},v.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(a<1e3||!v.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function G(e){return function(e){var t,r,n,h,u,f;o||s();var l=e.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===e[l-2]?2:"="===e[l-1]?1:0,f=new a(3*l/4-u),n=u>0?l-4:l;var c=0;for(t=0,r=0;t>16&255,f[c++]=h>>8&255,f[c++]=255&h;return 2===u?(h=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4,f[c++]=255&h):1===u&&(h=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2,f[c++]=h>>8&255,f[c++]=255&h),f}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Q(e){return null!=e&&(!!e._isBuffer||ee(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ee(e.slice(0,0))}(e))}function ee(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var te=Object.freeze({INSPECT_MAX_BYTES:50,kMaxLength:p,Buffer:v,SlowBuffer:function(e){return+e!=e&&(e=0),v.alloc(+e)},isBuffer:Q});function re(){}function ne(){ne.init.call(this)}function ie(e){return void 0===e._maxListeners?ne.defaultMaxListeners:e._maxListeners}function ae(e,t,r,n){var i,a,o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]):(a=e._events=new re,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(i=ie(e))&&i>0&&o.length>i){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=o.length,s=h,"function"==typeof console.warn?console.warn(s):console.log(s)}}else o=a[t]=r,++e._eventsCount;return e}function oe(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function se(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function he(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}function ue(){throw new Error("setTimeout has not been defined")}function fe(){throw new Error("clearTimeout has not been defined")}re.prototype=Object.create(null),ne.EventEmitter=ne,ne.usingDomains=!1,ne.prototype.domain=void 0,ne.prototype._events=void 0,ne.prototype._maxListeners=void 0,ne.defaultMaxListeners=10,ne.init=function(){this.domain=null,ne.usingDomains&&(!(void 0).active||this instanceof(void 0).Domain||(this.domain=(void 0).active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new re,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ne.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ne.prototype.getMaxListeners=function(){return ie(this)},ne.prototype.emit=function(e){var t,r,n,i,a,o,s,h="error"===e;if(o=this._events)h=h&&null==o.error;else if(!h)return!1;if(s=this.domain,h){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=o[e]))return!1;var f="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=he(e,n),a=0;a0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new re,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var le=ue,ce=fe;function de(e){if(le===setTimeout)return setTimeout(e,0);if((le===ue||!le)&&setTimeout)return le=setTimeout,setTimeout(e,0);try{return le(e,0)}catch(t){try{return le.call(null,e,0)}catch(t){return le.call(this,e,0)}}}"function"==typeof e.setTimeout&&(le=setTimeout),"function"==typeof e.clearTimeout&&(ce=clearTimeout);var pe,me=[],ge=!1,ve=-1;function ye(){ge&&pe&&(ge=!1,pe.length?me=pe.concat(me):ve=-1,me.length&&_e())}function _e(){if(!ge){var e=de(ye);ge=!0;for(var t=me.length;t;){for(pe=me,me=[];++ve1)for(var r=1;r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Ye(t)?r.showHidden=t:t&&function(e,t){if(!t||!Ve(t))return e;var r=Object.keys(t),n=r.length;for(;n--;)e[r[n]]=t[r[n]]}(r,t),Ke(r.showHidden)&&(r.showHidden=!1),Ke(r.depth)&&(r.depth=2),Ke(r.colors)&&(r.colors=!1),Ke(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Fe),Ne(r,e,r.depth)}function Fe(e,t){var r=Me.styles[t];return r?"["+Me.colors[r][0]+"m"+e+"["+Me.colors[r][1]+"m":e}function je(e,t){return e}function Ne(e,t,r){if(e.customInspect&&t&&Je(t.inspect)&&t.inspect!==Me&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return He(n)||(n=Ne(e,n,r)),n}var i=function(e,t){if(Ke(t))return e.stylize("undefined","undefined");if(He(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(n=t,"number"==typeof n)return e.stylize(""+t,"number");var n;if(Ye(t))return e.stylize(""+t,"boolean");if(qe(t))return e.stylize("null","null")}(e,t);if(i)return i;var a=Object.keys(t),o=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),Ge(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return Ze(t);if(0===a.length){if(Je(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Xe(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if($e(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ge(t))return Ze(t)}var h,u,f="",l=!1,c=["{","}"];(h=t,Array.isArray(h)&&(l=!0,c=["[","]"]),Je(t))&&(f=" [Function"+(t.name?": "+t.name:"")+"]");return Xe(t)&&(f=" "+RegExp.prototype.toString.call(t)),$e(t)&&(f=" "+Date.prototype.toUTCString.call(t)),Ge(t)&&(f=" "+Ze(t)),0!==a.length||l&&0!=t.length?r<0?Xe(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=l?function(e,t,r,n,i){for(var a=[],o=0,s=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,f,c)):c[0]+f+c[1]}function Ze(e){return"["+Error.prototype.toString.call(e)+"]"}function We(e,t,r,n,i,a){var o,s,h;if((h=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=h.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):h.set&&(s=e.stylize("[Setter]","special")),et(n,i)||(o="["+i+"]"),s||(e.seen.indexOf(h.value)<0?(s=qe(r)?Ne(e,h.value,null):Ne(e,h.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),Ke(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function Ye(e){return"boolean"==typeof e}function qe(e){return null===e}function He(e){return"string"==typeof e}function Ke(e){return void 0===e}function Xe(e){return Ve(e)&&"[object RegExp]"===Qe(e)}function Ve(e){return"object"==typeof e&&null!==e}function $e(e){return Ve(e)&&"[object Date]"===Qe(e)}function Ge(e){return Ve(e)&&("[object Error]"===Qe(e)||e instanceof Error)}function Je(e){return"function"==typeof e}function Qe(e){return Object.prototype.toString.call(e)}function et(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tt(){this.head=null,this.tail=null,this.length=0}Me.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Me.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},tt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},tt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},tt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},tt.prototype.clear=function(){this.head=this.tail=null,this.length=0},tt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},tt.prototype.concat=function(e){if(0===this.length)return v.alloc(0);if(1===this.length)return this.head.data;for(var t=v.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var rt=r(function(e,t){var r=te.Buffer,n=r.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};var i=t.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!n(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=a)}this.charBuffer=new r(6),this.charReceived=0,this.charLength=0};function a(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function s(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}i.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var i;n=(t+=e.toString(this.encoding,0,n)).length-1;if((i=t.charCodeAt(n))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,n)}return t},i.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},i.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t}}).StringDecoder;at.ReadableState=it;var nt=function(e){Ke(Ue)&&(Ue=Ie.env.NODE_DEBUG||""),e=e.toUpperCase(),De[e]||(new RegExp("\\b"+e+"\\b","i").test(Ue)?De[e]=function(){var t=function(e){if(!He(e)){for(var t=[],r=0;r=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),o=n[r];r0)if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var h;!t.decoder||i||n||(r=t.decoder.write(r),h=!t.objectMode&&0===r.length),i||(t.reading=!1),h||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&ut(e))),function(e,t){t.readingMore||(t.readingMore=!0,we(lt,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=st?e=st:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function ut(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(nt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?we(ft,e):ft(e))}function ft(e){nt("emit readable"),e.emit("readable"),pt(e)}function lt(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;ea.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=v.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,o),0===(e-=o)){o===a.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function gt(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,we(vt,t,e))}function vt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function yt(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return nt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?gt(this):ut(this),null;if(0===(e=ht(e,t))&&t.ended)return 0===t.length&>(this),null;var n,i=t.needReadable;return nt("need readable",i),(0===t.length||t.length-e0?mt(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&>(this)),null!==n&&this.emit("data",n),n},at.prototype._read=function(e){this.emit("error",new Error("not implemented"))},at.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,nt("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?o:u;function a(e){nt("onunpipe"),e===r&&u()}function o(){nt("onend"),e.end()}n.endEmitted?we(i):r.once("end",i),e.on("unpipe",a);var s=function(e){return function(){var t=e._readableState;nt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,pt(e))}}(r);e.on("drain",s);var h=!1;function u(){nt("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",c),e.removeListener("unpipe",a),r.removeListener("end",o),r.removeListener("end",u),r.removeListener("data",l),h=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var f=!1;function l(t){nt("ondata"),f=!1,!1!==e.write(t)||f||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==yt(n.pipes,e))&&!h&&(nt("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,f=!0),r.pause())}function c(t){var r;nt("onerror",t),m(),e.removeListener("error",c),0===(r="error",e.listeners(r).length)&&e.emit("error",t)}function d(){e.removeListener("finish",p),m()}function p(){nt("onfinish"),e.removeListener("close",d),m()}function m(){nt("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",c),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(nt("pipe resume"),r.resume()),e},at.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},bt.prototype._write=function(e,t,r){r(new Error("not implemented"))},bt.prototype._writev=null,bt.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,Ct(e,t),r&&(t.finished?we(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Le(Bt,at);for(var zt=Object.keys(bt.prototype),Tt=0;Tt>2,a=(3&t)<<4|r>>4,o=l>1?(15&r)<<2|n>>6:64,s=l>2?63&n:64,h.push(Wt.charAt(i)+Wt.charAt(a)+Wt.charAt(o)+Wt.charAt(s));return h.join("")},decode:function(e){var t,r,n,i,a,o,s=0,h=0;if("data:"===e.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var u,f=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===Wt.charAt(64)&&f--,e.charAt(e.length-2)===Wt.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(u=Zt.uint8array?new Uint8Array(0|f):new Array(0|f);s>4,r=(15&i)<<4|(a=Wt.indexOf(e.charAt(s++)))>>2,n=(3&a)<<6|(o=Wt.indexOf(e.charAt(s++))),u[h++]=t,64!==a&&(u[h++]=r),64!==o&&(u[h++]=n);return u}},qt=!0,Ht=function(e,t){return new v(e,t)},Kt=function(e){return v.alloc?v.alloc(e):new v(e)},Xt=function(e){return Q(e)},Vt=function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume},$t=r(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),Gt=r(function(e){var t=e.exports={version:"2.3.0"};"number"==typeof __e&&(__e=t)}),Jt=(Gt.version,function(e,t,r){if(function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!")}(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}),Qt=function(e){return"object"==typeof e?null!==e:"function"==typeof e},er=function(e){if(!Qt(e))throw TypeError(e+" is not an object!");return e},tr=function(e){try{return!!e()}catch(e){return!0}},rr=!tr(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),nr=$t.document,ir=Qt(nr)&&Qt(nr.createElement),ar=function(e){return ir?nr.createElement(e):{}},or=!rr&&!tr(function(){return 7!=Object.defineProperty(ar("div"),"a",{get:function(){return 7}}).a}),sr=Object.defineProperty,hr={f:rr?Object.defineProperty:function(e,t,r){if(er(e),t=function(e,t){if(!Qt(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!Qt(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!Qt(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!Qt(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")}(t,!0),er(r),or)try{return sr(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},ur=rr?function(e,t,r){return hr.f(e,t,function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}(1,r))}:function(e,t,r){return e[t]=r,e},fr=function(e,t,r){var n,i,a,o=e&fr.F,s=e&fr.G,h=e&fr.S,u=e&fr.P,f=e&fr.B,l=e&fr.W,c=s?Gt:Gt[t]||(Gt[t]={}),d=c.prototype,p=s?$t:h?$t[t]:($t[t]||{}).prototype;for(n in s&&(r=t),r)(i=!o&&p&&void 0!==p[n])&&n in c||(a=i?p[n]:r[n],c[n]=s&&"function"!=typeof p[n]?r[n]:f&&i?Jt(a,$t):l&&p[n]==a?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(a):u&&"function"==typeof a?Jt(Function.call,a):a,u&&((c.virtual||(c.virtual={}))[n]=a,e&fr.R&&d&&!d[n]&&ur(d,n,a)))};fr.F=1,fr.G=2,fr.S=4,fr.P=8,fr.B=16,fr.W=32,fr.U=64,fr.R=128;var lr,cr,dr,pr,mr=fr,gr=$t.document&&document.documentElement,vr={}.toString,yr=$t.process,_r=$t.setImmediate,wr=$t.clearImmediate,br=$t.MessageChannel,kr=0,xr={},Sr=function(){var e=+this;if(xr.hasOwnProperty(e)){var t=xr[e];delete xr[e],t()}},Er=function(e){Sr.call(e.data)};_r&&wr||(_r=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return xr[++kr]=function(){!function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}e.apply(r,t)}("function"==typeof e?e:Function(e),t)},lr(kr),kr},wr=function(e){delete xr[e]},"process"==(pr=yr,vr.call(pr).slice(8,-1))?lr=function(e){yr.nextTick(Jt(Sr,e,1))}:br?(dr=(cr=new br).port2,cr.port1.onmessage=Er,lr=Jt(dr.postMessage,dr,1)):$t.addEventListener&&"function"==typeof postMessage&&!$t.importScripts?(lr=function(e){$t.postMessage(e+"","*")},$t.addEventListener("message",Er,!1)):lr="onreadystatechange"in ar("script")?function(e){gr.appendChild(ar("script")).onreadystatechange=function(){gr.removeChild(this),Sr.call(e)}}:function(e){setTimeout(Jt(Sr,e,1),0)});var Ar={set:_r,clear:wr};mr(mr.G+mr.B,{setImmediate:Ar.set,clearImmediate:Ar.clear});var Cr,Rr,zr=Gt.setImmediate,Tr=t.MutationObserver||t.WebKitMutationObserver;if(Tr){var Or=0,Br=new Tr(Ur),Ir=t.document.createTextNode("");Br.observe(Ir,{characterData:!0}),Cr=function(){Ir.data=Or=++Or%2}}else if(t.setImmediate||void 0===t.MessageChannel)Cr="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){Ur(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(Ur,0)};else{var Lr=new t.MessageChannel;Lr.port1.onmessage=Ur,Cr=function(){Lr.port2.postMessage(0)}}var Pr=[];function Ur(){var e,t;Rr=!0;for(var r=Pr.length;r;){for(t=Pr,Pr=[],e=-1;++e1;)try{return i.stringifyByChunk(e,n,r)}catch(e){r=Math.floor(r/2)}return i.stringifyByChar(e)}function o(e,t){for(var r=0;r "+e:e}};var Qr=Jr,en=r(function(e,t){for(var r=new Array(256),n=0;n<256;n++)r[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;r[254]=r[254]=1;function i(){Qr.call(this,"utf-8 decode"),this.leftOver=null}function a(){Qr.call(this,"utf-8 encode")}t.utf8encode=function(e){return Zt.nodebuffer?Ht(e,"utf-8"):function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i>>6,t[a++]=128|63&r):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|63&r):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|63&r);return t}(e)},t.utf8decode=function(e){return Zt.nodebuffer?Gr.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,a,o=e.length,s=new Array(2*o);for(n=0,t=0;t4)s[n++]=65533,t+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&t1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return s.length!==n&&(s.subarray?s=s.subarray(0,n):s.length=n),Gr.applyFromCharCode(s)}(e=Gr.transformTo(Zt.uint8array?"uint8array":"array",e))},Gr.inherits(i,Qr),i.prototype.processChunk=function(e){var n=Gr.transformTo(Zt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(Zt.uint8array){var i=n;(n=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),n.set(i,this.leftOver.length)}else n=this.leftOver.concat(n);this.leftOver=null}var a=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0?t:0===n?t:n+r[e[n]]>t?n:t}(n),o=n;a!==n.length&&(Zt.uint8array?(o=n.subarray(0,a),this.leftOver=n.subarray(a,n.length)):(o=n.slice(0,a),this.leftOver=n.slice(a,n.length))),this.push({data:t.utf8decode(o),meta:e.meta})},i.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=i,Gr.inherits(a,Qr),a.prototype.processChunk=function(e){this.push({data:t.utf8encode(e.data),meta:e.meta})},t.Utf8EncodeWorker=a});en.utf8encode,en.utf8decode,en.Utf8DecodeWorker,en.Utf8EncodeWorker;function tn(e){Qr.call(this,"ConvertWorker to "+e),this.destType=e}Gr.inherits(tn,Qr),tn.prototype.processChunk=function(e){this.push({data:Gr.transformTo(this.destType,e.data),meta:e.meta})};var rn=tn,nn=Nt.Readable;function an(e,t,r){nn.call(this,t),this._helper=e;var n=this;e.on("data",function(e,t){n.push(e)||n._helper.pause(),r&&r(t)}).on("error",function(e){n.emit("error",e)}).on("end",function(){n.push(null)})}Gr.inherits(an,nn),an.prototype._read=function(){this._helper.resume()};var on=an,sn=null;if(Zt.nodestream)try{sn=on}catch(e){}function hn(e,t){return new $r.Promise(function(r,n){var i=[],a=e._internalType,o=e._outputType,s=e._mimeType;e.on("data",function(e,r){i.push(e),t&&t(r)}).on("error",function(e){i=[],n(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return Gr.newBlob(Gr.transformTo("arraybuffer",t),r);case"base64":return Yt.encode(t);default:return Gr.transformTo(e,t)}}(o,function(e,t){var r,n=0,i=null,a=0;for(r=0;r=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})};var dn=cn;function pn(e){Qr.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Gr.inherits(pn,Qr),pn.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Qr.prototype.processChunk.call(this,e)};var mn=pn;var gn=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var vn=function(e,t){return void 0!==e&&e.length?"string"!==Gr.getTypeOf(e)?function(e,t,r,n){var i=gn,a=n+r;e^=-1;for(var o=n;o>>8^i[255&(e^t[o])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=gn,a=n+r;e^=-1;for(var o=n;o>>8^i[255&(e^t.charCodeAt(o))];return-1^e}(0|t,e,e.length,0):0};function yn(){Qr.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Gr.inherits(yn,Qr),yn.prototype.processChunk=function(e){this.streamInfo.crc32=vn(e.data,this.streamInfo.crc32||0),this.push(e)};var _n=yn;function wn(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}wn.prototype={getContentWorker:function(){var e=new dn($r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new mn("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new dn($r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},wn.createWorkerFrom=function(e,t,r){return e.pipe(new _n).pipe(new mn("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new mn("compressedSize")).withStreamInfo("compression",t)};var bn=wn,kn=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};kn.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var n="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!n&&(t=t.pipe(new en.Utf8EncodeWorker)),!i&&n&&(t=t.pipe(new en.Utf8DecodeWorker))}catch(e){(t=new Qr("error")).error(e)}return new fn(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof bn&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new en.Utf8EncodeWorker)),bn.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof bn?this._data.getContentWorker():this._data instanceof Qr?this._data:new dn(this._data)}};for(var xn=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],Sn=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},En=0;En=0;)e[t]=0}var In=0,Ln=1,Pn=2,Un=29,Dn=256,Mn=Dn+1+Un,Fn=30,jn=19,Nn=2*Mn+1,Zn=15,Wn=16,Yn=7,qn=256,Hn=16,Kn=17,Xn=18,Vn=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],$n=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Gn=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Jn=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Qn=new Array(2*(Mn+2));Bn(Qn);var ei=new Array(2*Fn);Bn(ei);var ti=new Array(512);Bn(ti);var ri=new Array(256);Bn(ri);var ni=new Array(Un);Bn(ni);var ii,ai,oi,si=new Array(Fn);function hi(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function ui(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function fi(e){return e<256?ti[e]:ti[256+(e>>>7)]}function li(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function ci(e,t,r){e.bi_valid>Wn-r?(e.bi_buf|=t<>Wn-e.bi_valid,e.bi_valid+=r-Wn):(e.bi_buf|=t<>>=1,r<<=1}while(--t>0);return r>>>1}function mi(e,t,r){var n,i,a=new Array(Zn+1),o=0;for(n=1;n<=Zn;n++)a[n]=o=o+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=pi(a[s]++,s))}}function gi(e){var t;for(t=0;t8?li(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function yi(e,t,r,n){var i=2*t,a=2*r;return e[i]>1;r>=1;r--)_i(e,a,r);i=h;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],_i(e,a,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,a[2*i]=a[2*r]+a[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,a[2*r+1]=a[2*n+1]=i,e.heap[1]=i++,_i(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,a,o,s,h=t.dyn_tree,u=t.max_code,f=t.stat_desc.static_tree,l=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(a=0;a<=Zn;a++)e.bl_count[a]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;rp&&(a=p,m++),h[2*n+1]=a,n>u||(e.bl_count[a]++,o=0,n>=d&&(o=c[n-d]),s=h[2*n],e.opt_len+=s*(a+o),l&&(e.static_len+=s*(f[2*n+1]+o)));if(0!==m){do{for(a=p-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(n=e.bl_count[a];0!==n;)(i=e.heap[--r])>u||(h[2*i+1]!==a&&(e.opt_len+=(a-h[2*i+1])*h[2*i],h[2*i+1]=a),n--)}}(e,t),mi(a,u,e.bl_count)}function ki(e,t,r){var n,i,a=-1,o=t[1],s=0,h=7,u=4;for(0===o&&(h=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=o,o=t[2*(n+1)+1],++s>=7;n0?(e.strm.data_type===On&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return zn;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return Tn;for(t=32;t=3&&0===e.bl_tree[2*Jn[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=i&&(i=a)):i=a=r+5,r+4<=i&&-1!==t?Ei(e,t,r,n):e.strategy===Rn||a===i?(ci(e,(Ln<<1)+(n?1:0),3),wi(e,Qn,ei)):(ci(e,(Pn<<1)+(n?1:0),3),function(e,t,r,n){var i;for(ci(e,t-257,5),ci(e,r-1,5),ci(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(ri[r]+Dn+1)]++,e.dyn_dtree[2*fi(t)]++),e.last_lit===e.lit_bufsize-1},_tr_align:function(e){ci(e,Ln<<1,3),di(e,qn,Qn),function(e){16===e.bi_valid?(li(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}};var Ci=function(e,t,r,n){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(i=i+t[n++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0};var Ri=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var zi,Ti=function(e,t,r,n){var i=Ri,a=n+r;e^=-1;for(var o=n;o>>8^i[255&(e^t[o])];return-1^e},Oi={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Bi=0,Ii=1,Li=3,Pi=4,Ui=5,Di=0,Mi=1,Fi=-2,ji=-3,Ni=-5,Zi=-1,Wi=1,Yi=2,qi=3,Hi=4,Ki=0,Xi=2,Vi=8,$i=9,Gi=15,Ji=8,Qi=286,ea=30,ta=19,ra=2*Qi+1,na=15,ia=3,aa=258,oa=aa+ia+1,sa=32,ha=42,ua=69,fa=73,la=91,ca=103,da=113,pa=666,ma=1,ga=2,va=3,ya=4,_a=3;function wa(e,t){return e.msg=Oi[t],t}function ba(e){return(e<<1)-(e>4?9:0)}function ka(e){for(var t=e.length;--t>=0;)e[t]=0}function xa(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(Cn.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function Sa(e,t){Ai._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xa(e.strm)}function Ea(e,t){e.pending_buf[e.pending++]=t}function Aa(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Ca(e,t){var r,n,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,h=e.strstart>e.w_size-oa?e.strstart-(e.w_size-oa):0,u=e.window,f=e.w_mask,l=e.prev,c=e.strstart+aa,d=u[a+o-1],p=u[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+o]===p&&u[r+o-1]===d&&u[r]===u[a]&&u[++r]===u[a+1]){a+=2,r++;do{}while(u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&ao){if(e.match_start=t,o=n,n>=s)break;d=u[a+o-1],p=u[a+o]}}}while((t=l[t&f])>h&&0!=--i);return o<=e.lookahead?o:e.lookahead}function Ra(e){var t,r,n,i,a,o,s,h,u,f,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-oa)){Cn.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,h=e.strstart+e.lookahead,u=i,f=void 0,(f=o.avail_in)>u&&(f=u),r=0===f?0:(o.avail_in-=f,Cn.arraySet(s,o.input,o.next_in,f,h),1===o.state.wrap?o.adler=Ci(o.adler,s,f,h):2===o.state.wrap&&(o.adler=Ti(o.adler,s,f,h)),o.next_in+=f,o.total_in+=f,f),e.lookahead+=r,e.lookahead+e.insert>=ia)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<=ia&&(e.ins_h=(e.ins_h<=ia)if(n=Ai._tr_tally(e,e.strstart-e.match_start,e.match_length-ia),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ia){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=ia&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=ia-1)),e.prev_length>=ia&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ia,n=Ai._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-ia),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<15&&(o=2,n-=16),i<1||i>$i||r!==Vi||n<8||n>15||t<0||t>9||a<0||a>Hi)return wa(e,Fi);8===n&&(n=9);var s=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Vi,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Cn.Buf16(2*ra),this.dyn_dtree=new Cn.Buf16(2*(2*ea+1)),this.bl_tree=new Cn.Buf16(2*(2*ta+1)),ka(this.dyn_ltree),ka(this.dyn_dtree),ka(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Cn.Buf16(na+1),this.heap=new Cn.Buf16(2*Qi+1),ka(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Cn.Buf16(2*Qi+1),ka(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Ra(e),0===e.lookahead&&t===Bi)return ma;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Sa(e,!1),0===e.strm.avail_out))return ma;if(e.strstart-e.block_start>=e.w_size-oa&&(Sa(e,!1),0===e.strm.avail_out))return ma}return e.insert=0,t===Pi?(Sa(e,!0),0===e.strm.avail_out?va:ya):(e.strstart>e.block_start&&(Sa(e,!1),e.strm.avail_out),ma)}),new Oa(4,4,8,4,za),new Oa(4,5,16,8,za),new Oa(4,6,32,32,za),new Oa(4,4,16,16,Ta),new Oa(8,16,32,32,Ta),new Oa(8,16,128,128,Ta),new Oa(8,32,128,256,Ta),new Oa(32,128,258,1024,Ta),new Oa(32,258,258,4096,Ta)];var Pa={deflateInit:function(e,t){return La(e,t,Vi,Gi,Ji,Ki)},deflateInit2:La,deflateReset:Ia,deflateResetKeep:Ba,deflateSetHeader:function(e,t){return e&&e.state?2!==e.state.wrap?Fi:(e.state.gzhead=t,Di):Fi},deflate:function(e,t){var r,n,i,a;if(!e||!e.state||t>Ui||t<0)return e?wa(e,Fi):Fi;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===pa&&t!==Pi)return wa(e,0===e.avail_out?Ni:Fi);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===ha)if(2===n.wrap)e.adler=0,Ea(n,31),Ea(n,139),Ea(n,8),n.gzhead?(Ea(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Ea(n,255&n.gzhead.time),Ea(n,n.gzhead.time>>8&255),Ea(n,n.gzhead.time>>16&255),Ea(n,n.gzhead.time>>24&255),Ea(n,9===n.level?2:n.strategy>=Yi||n.level<2?4:0),Ea(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ea(n,255&n.gzhead.extra.length),Ea(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Ti(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ua):(Ea(n,0),Ea(n,0),Ea(n,0),Ea(n,0),Ea(n,0),Ea(n,9===n.level?2:n.strategy>=Yi||n.level<2?4:0),Ea(n,_a),n.status=da);else{var o=Vi+(n.w_bits-8<<4)<<8;o|=(n.strategy>=Yi||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(o|=sa),o+=31-o%31,n.status=da,Aa(n,o),0!==n.strstart&&(Aa(n,e.adler>>>16),Aa(n,65535&e.adler)),e.adler=1}if(n.status===ua)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ti(e.adler,n.pending_buf,n.pending-i,i)),xa(e),i=n.pending,n.pending!==n.pending_buf_size));)Ea(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Ti(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=fa)}else n.status=fa;if(n.status===fa)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ti(e.adler,n.pending_buf,n.pending-i,i)),xa(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}a=n.gzindexi&&(e.adler=Ti(e.adler,n.pending_buf,n.pending-i,i)),0===a&&(n.gzindex=0,n.status=la)}else n.status=la;if(n.status===la)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ti(e.adler,n.pending_buf,n.pending-i,i)),xa(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}a=n.gzindexi&&(e.adler=Ti(e.adler,n.pending_buf,n.pending-i,i)),0===a&&(n.status=ca)}else n.status=ca;if(n.status===ca&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&xa(e),n.pending+2<=n.pending_buf_size&&(Ea(n,255&e.adler),Ea(n,e.adler>>8&255),e.adler=0,n.status=da)):n.status=da),0!==n.pending){if(xa(e),0===e.avail_out)return n.last_flush=-1,Di}else if(0===e.avail_in&&ba(t)<=ba(r)&&t!==Pi)return wa(e,Ni);if(n.status===pa&&0!==e.avail_in)return wa(e,Ni);if(0!==e.avail_in||0!==n.lookahead||t!==Bi&&n.status!==pa){var s=n.strategy===Yi?function(e,t){for(var r;;){if(0===e.lookahead&&(Ra(e),0===e.lookahead)){if(t===Bi)return ma;break}if(e.match_length=0,r=Ai._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Sa(e,!1),0===e.strm.avail_out))return ma}return e.insert=0,t===Pi?(Sa(e,!0),0===e.strm.avail_out?va:ya):e.last_lit&&(Sa(e,!1),0===e.strm.avail_out)?ma:ga}(n,t):n.strategy===qi?function(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=aa){if(Ra(e),e.lookahead<=aa&&t===Bi)return ma;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=ia&&e.strstart>0&&(n=o[i=e.strstart-1])===o[++i]&&n===o[++i]&&n===o[++i]){a=e.strstart+aa;do{}while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ia?(r=Ai._tr_tally(e,1,e.match_length-ia),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Ai._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Sa(e,!1),0===e.strm.avail_out))return ma}return e.insert=0,t===Pi?(Sa(e,!0),0===e.strm.avail_out?va:ya):e.last_lit&&(Sa(e,!1),0===e.strm.avail_out)?ma:ga}(n,t):zi[n.level].func(n,t);if(s!==va&&s!==ya||(n.status=pa),s===ma||s===va)return 0===e.avail_out&&(n.last_flush=-1),Di;if(s===ga&&(t===Ii?Ai._tr_align(n):t!==Ui&&(Ai._tr_stored_block(n,0,0,!1),t===Li&&(ka(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),xa(e),0===e.avail_out))return n.last_flush=-1,Di}return t!==Pi?Di:n.wrap<=0?Mi:(2===n.wrap?(Ea(n,255&e.adler),Ea(n,e.adler>>8&255),Ea(n,e.adler>>16&255),Ea(n,e.adler>>24&255),Ea(n,255&e.total_in),Ea(n,e.total_in>>8&255),Ea(n,e.total_in>>16&255),Ea(n,e.total_in>>24&255)):(Aa(n,e.adler>>>16),Aa(n,65535&e.adler)),xa(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?Di:Mi)},deflateEnd:function(e){var t;return e&&e.state?(t=e.state.status)!==ha&&t!==ua&&t!==fa&&t!==la&&t!==ca&&t!==da&&t!==pa?wa(e,Fi):(e.state=null,t===da?wa(e,ji):Di):Fi},deflateSetDictionary:function(e,t){var r,n,i,a,o,s,h,u,f=t.length;if(!e||!e.state)return Fi;if(2===(a=(r=e.state).wrap)||1===a&&r.status!==ha||r.lookahead)return Fi;for(1===a&&(e.adler=Ci(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===a&&(ka(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new Cn.Buf8(r.w_size),Cn.arraySet(u,t,f-r.w_size,r.w_size,0),t=u,f=r.w_size),o=e.avail_in,s=e.next_in,h=e.input,e.avail_in=f,e.next_in=0,e.input=t,Ra(r);r.lookahead>=ia;){n=r.strstart,i=r.lookahead-(ia-1);do{r.ins_h=(r.ins_h<=252?6:Fa>=248?5:Fa>=240?4:Fa>=224?3:Fa>=192?2:1;Ma[254]=Ma[254]=1;function ja(e,t){if(t<65537&&(e.subarray&&Da||!e.subarray&&Ua))return String.fromCharCode.apply(null,Cn.shrinkBuf(e,t));for(var r="",n=0;n>>6,t[a++]=128|63&r):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|63&r):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|63&r);return t},buf2binstring:function(e){return ja(e,e.length)},binstring2buf:function(e){for(var t=new Cn.Buf8(e.length),r=0,n=t.length;r4)s[n++]=65533,r+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&r1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return ja(s,n)},utf8border:function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+Ma[e[r]]>t?r:t}};var Za=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},Wa=Object.prototype.toString,Ya=0,qa=-1,Ha=0,Ka=8;function Xa(e){if(!(this instanceof Xa))return new Xa(e);this.options=Cn.assign({level:qa,method:Ka,chunkSize:16384,windowBits:15,memLevel:8,strategy:Ha,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Za,this.strm.avail_out=0;var r=Pa.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Ya)throw new Error(Oi[r]);if(t.header&&Pa.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?Na.string2buf(t.dictionary):"[object ArrayBuffer]"===Wa.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=Pa.deflateSetDictionary(this.strm,n))!==Ya)throw new Error(Oi[r]);this._dict_set=!0}}function Va(e,t){var r=new Xa(t);if(r.push(e,!0),r.err)throw r.msg||Oi[r.err];return r.result}Xa.prototype.push=function(e,t){var r,n,i=this.strm,a=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=Na.string2buf(e):"[object ArrayBuffer]"===Wa.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new Cn.Buf8(a),i.next_out=0,i.avail_out=a),1!==(r=Pa.deflate(i,n))&&r!==Ya)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(Na.buf2binstring(Cn.shrinkBuf(i.output,i.next_out))):this.onData(Cn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=Pa.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Ya):2!==n||(this.onEnd(Ya),i.avail_out=0,!0)},Xa.prototype.onData=function(e){this.chunks.push(e)},Xa.prototype.onEnd=function(e){e===Ya&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Cn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var $a={Deflate:Xa,deflate:Va,deflateRaw:function(e,t){return(t=t||{}).raw=!0,Va(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,Va(e,t)}},Ga=function(e,t){var r,n,i,a,o,s,h,u,f,l,c,d,p,m,g,v,y,_,w,b,k,x,S,E,A;r=e.state,n=e.next_in,E=e.input,i=n+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),h=r.dmax,u=r.wsize,f=r.whave,l=r.wnext,c=r.window,d=r.hold,p=r.bits,m=r.lencode,g=r.distcode,v=(1<>>=w=_>>>24,p-=w,0===(w=_>>>16&255))A[a++]=65535&_;else{if(!(16&w)){if(0==(64&w)){_=m[(65535&_)+(d&(1<>>=w,p-=w),p<15&&(d+=E[n++]<>>=w=_>>>24,p-=w,!(16&(w=_>>>16&255))){if(0==(64&w)){_=g[(65535&_)+(d&(1<h){e.msg="invalid distance too far back",r.mode=30;break e}if(d>>>=w,p-=w,k>(w=a-o)){if((w=k-w)>f&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(x=0,S=c,0===l){if(x+=u-w,w2;)A[a++]=S[x++],A[a++]=S[x++],A[a++]=S[x++],b-=3;b&&(A[a++]=S[x++],b>1&&(A[a++]=S[x++]))}else{x=a-k;do{A[a++]=A[x++],A[a++]=A[x++],A[a++]=A[x++],b-=3}while(b>2);b&&(A[a++]=A[x++],b>1&&(A[a++]=A[x++]))}break}}break}}while(n>3,d&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=a,e.avail_in=n=1&&0===T[b];b--);if(k>b&&(k=b),0===b)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(w=1;w0&&(0===e||1!==b))return-1;for(O[1]=0,y=1;y<15;y++)O[y+1]=O[y]+T[y];for(_=0;_852||2===e&&A>592)return 1;for(;;){p=y-S,o[_]d?(m=B[I+o[_]],g=R[z+o[_]]):(m=96,g=0),h=1<>S)+(u-=h)]=p<<24|m<<16|g|0}while(0!==u);for(h=1<>=1;if(0!==h?(C&=h-1,C+=h):C=0,_++,0==--T[y]){if(y===b)break;y=t[r+o[_]]}if(y>k&&(C&l)!==f){for(0===S&&(S=k),c+=w,E=1<<(x=y-S);x+S852||2===e&&A>592)return 1;i[f=C&l]=k<<24|x<<16|c-a|0}}return 0!==C&&(i[c+C]=y-S<<24|64<<16|0),s.bits=k,0},no=0,io=1,ao=2,oo=4,so=5,ho=6,uo=0,fo=1,lo=2,co=-2,po=-3,mo=-4,go=-5,vo=8,yo=1,_o=2,wo=3,bo=4,ko=5,xo=6,So=7,Eo=8,Ao=9,Co=10,Ro=11,zo=12,To=13,Oo=14,Bo=15,Io=16,Lo=17,Po=18,Uo=19,Do=20,Mo=21,Fo=22,jo=23,No=24,Zo=25,Wo=26,Yo=27,qo=28,Ho=29,Ko=30,Xo=31,Vo=32,$o=852,Go=592,Jo=15;function Qo(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function es(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=yo,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Cn.Buf32($o),t.distcode=t.distdyn=new Cn.Buf32(Go),t.sane=1,t.back=-1,uo):co}function ts(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,es(e)):co}function rs(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?co:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,ts(e))):co}function ns(e,t){var r,n;return e?(n=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Cn.Buf16(320),this.work=new Cn.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},e.state=n,n.window=null,(r=rs(e,t))!==uo&&(e.state=null),r):co}var is,as,os=!0;function ss(e){if(os){var t;for(is=new Cn.Buf32(512),as=new Cn.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ro(io,e.lens,0,288,is,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ro(ao,e.lens,0,32,as,0,e.work,{bits:5}),os=!1}e.lencode=is,e.lenbits=9,e.distcode=as,e.distbits=5}function hs(e,t,r,n){var i,a=e.state;return null===a.window&&(a.wsize=1<=a.wsize?(Cn.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((i=a.wsize-a.wnext)>n&&(i=n),Cn.arraySet(a.window,t,r-n,i,a.wnext),(n-=i)?(Cn.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,r.check=Ti(r.check,C,2,0),u=0,f=0,r.mode=_o;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=Ko;break}if((15&u)!==vo){e.msg="unknown compression method",r.mode=Ko;break}if(f-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=Ko;break}r.dmax=1<>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=Ti(r.check,C,2,0)),u=0,f=0,r.mode=wo;case wo:for(;f<32;){if(0===s)break e;s--,u+=n[a++]<>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=Ti(r.check,C,4,0)),u=0,f=0,r.mode=bo;case bo:for(;f<16;){if(0===s)break e;s--,u+=n[a++]<>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=Ti(r.check,C,2,0)),u=0,f=0,r.mode=ko;case ko:if(1024&r.flags){for(;f<16;){if(0===s)break e;s--,u+=n[a++]<>>8&255,r.check=Ti(r.check,C,2,0)),u=0,f=0}else r.head&&(r.head.extra=null);r.mode=xo;case xo:if(1024&r.flags&&((d=r.length)>s&&(d=s),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Cn.arraySet(r.head.extra,n,a,d,k)),512&r.flags&&(r.check=Ti(r.check,n,d,a)),s-=d,a+=d,r.length-=d),r.length))break e;r.length=0,r.mode=So;case So:if(2048&r.flags){if(0===s)break e;d=0;do{k=n[a+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k))}while(k&&d>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=zo;break;case Co:for(;f<32;){if(0===s)break e;s--,u+=n[a++]<>>=7&f,f-=7&f,r.mode=Yo;break}for(;f<3;){if(0===s)break e;s--,u+=n[a++]<>>=1)){case 0:r.mode=Oo;break;case 1:if(ss(r),r.mode=Do,t===ho){u>>>=2,f-=2;break e}break;case 2:r.mode=Lo;break;case 3:e.msg="invalid block type",r.mode=Ko}u>>>=2,f-=2;break;case Oo:for(u>>>=7&f,f-=7&f;f<32;){if(0===s)break e;s--,u+=n[a++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=Ko;break}if(r.length=65535&u,u=0,f=0,r.mode=Bo,t===ho)break e;case Bo:r.mode=Io;case Io:if(d=r.length){if(d>s&&(d=s),d>h&&(d=h),0===d)break e;Cn.arraySet(i,n,a,d,o),s-=d,a+=d,h-=d,o+=d,r.length-=d;break}r.mode=zo;break;case Lo:for(;f<14;){if(0===s)break e;s--,u+=n[a++]<>>=5,f-=5,r.ndist=1+(31&u),u>>>=5,f-=5,r.ncode=4+(15&u),u>>>=4,f-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Ko;break}r.have=0,r.mode=Po;case Po:for(;r.have>>=3,f-=3}for(;r.have<19;)r.lens[R[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=ro(no,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid code lengths set",r.mode=Ko;break}r.have=0,r.mode=Uo;case Uo:for(;r.have>>16&255,y=65535&A,!((g=A>>>24)<=f);){if(0===s)break e;s--,u+=n[a++]<>>=g,f-=g,r.lens[r.have++]=y;else{if(16===y){for(E=g+2;f>>=g,f-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=Ko;break}k=r.lens[r.have-1],d=3+(3&u),u>>>=2,f-=2}else if(17===y){for(E=g+3;f>>=g)),u>>>=3,f-=3}else{for(E=g+7;f>>=g)),u>>>=7,f-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Ko;break}for(;d--;)r.lens[r.have++]=k}}if(r.mode===Ko)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Ko;break}if(r.lenbits=9,S={bits:r.lenbits},x=ro(io,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid literal/lengths set",r.mode=Ko;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=ro(ao,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg="invalid distances set",r.mode=Ko;break}if(r.mode=Do,t===ho)break e;case Do:r.mode=Mo;case Mo:if(s>=6&&h>=258){e.next_out=o,e.avail_out=h,e.next_in=a,e.avail_in=s,r.hold=u,r.bits=f,Ga(e,c),o=e.next_out,i=e.output,h=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,u=r.hold,f=r.bits,r.mode===zo&&(r.back=-1);break}for(r.back=0;v=(A=r.lencode[u&(1<>>16&255,y=65535&A,!((g=A>>>24)<=f);){if(0===s)break e;s--,u+=n[a++]<>_)])>>>16&255,y=65535&A,!(_+(g=A>>>24)<=f);){if(0===s)break e;s--,u+=n[a++]<>>=_,f-=_,r.back+=_}if(u>>>=g,f-=g,r.back+=g,r.length=y,0===v){r.mode=Wo;break}if(32&v){r.back=-1,r.mode=zo;break}if(64&v){e.msg="invalid literal/length code",r.mode=Ko;break}r.extra=15&v,r.mode=Fo;case Fo:if(r.extra){for(E=r.extra;f>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=jo;case jo:for(;v=(A=r.distcode[u&(1<>>16&255,y=65535&A,!((g=A>>>24)<=f);){if(0===s)break e;s--,u+=n[a++]<>_)])>>>16&255,y=65535&A,!(_+(g=A>>>24)<=f);){if(0===s)break e;s--,u+=n[a++]<>>=_,f-=_,r.back+=_}if(u>>>=g,f-=g,r.back+=g,64&v){e.msg="invalid distance code",r.mode=Ko;break}r.offset=y,r.extra=15&v,r.mode=No;case No:if(r.extra){for(E=r.extra;f>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Ko;break}r.mode=Zo;case Zo:if(0===h)break e;if(d=c-h,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Ko;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=o-r.offset,d=r.length;d>h&&(d=h),h-=d,r.length-=d;do{i[o++]=m[p++]}while(--d);0===r.length&&(r.mode=Mo);break;case Wo:if(0===h)break e;i[o++]=r.length,h--,r.mode=Mo;break;case Yo:if(r.wrap){for(;f<32;){if(0===s)break e;s--,u|=n[a++]<=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Za,this.strm.avail_out=0;var r=us.inflateInit2(this.strm,t.windowBits);if(r!==fs.Z_OK)throw new Error(Oi[r]);this.header=new ls,us.inflateGetHeader(this.strm,this.header)}function ps(e,t){var r=new ds(t);if(r.push(e,!0),r.err)throw r.msg||Oi[r.err];return r.result}ds.prototype.push=function(e,t){var r,n,i,a,o,s,h=this.strm,u=this.options.chunkSize,f=this.options.dictionary,l=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?fs.Z_FINISH:fs.Z_NO_FLUSH,"string"==typeof e?h.input=Na.binstring2buf(e):"[object ArrayBuffer]"===cs.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new Cn.Buf8(u),h.next_out=0,h.avail_out=u),(r=us.inflate(h,fs.Z_NO_FLUSH))===fs.Z_NEED_DICT&&f&&(s="string"==typeof f?Na.string2buf(f):"[object ArrayBuffer]"===cs.call(f)?new Uint8Array(f):f,r=us.inflateSetDictionary(this.strm,s)),r===fs.Z_BUF_ERROR&&!0===l&&(r=fs.Z_OK,l=!1),r!==fs.Z_STREAM_END&&r!==fs.Z_OK)return this.onEnd(r),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&r!==fs.Z_STREAM_END&&(0!==h.avail_in||n!==fs.Z_FINISH&&n!==fs.Z_SYNC_FLUSH)||("string"===this.options.to?(i=Na.utf8border(h.output,h.next_out),a=h.next_out-i,o=Na.buf2string(h.output,i),h.next_out=a,h.avail_out=u-a,a&&Cn.arraySet(h.output,h.output,i,a,0),this.onData(o)):this.onData(Cn.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(l=!0)}while((h.avail_in>0||0===h.avail_out)&&r!==fs.Z_STREAM_END);return r===fs.Z_STREAM_END&&(n=fs.Z_FINISH),n===fs.Z_FINISH?(r=us.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===fs.Z_OK):n!==fs.Z_SYNC_FLUSH||(this.onEnd(fs.Z_OK),h.avail_out=0,!0)},ds.prototype.onData=function(e){this.chunks.push(e)},ds.prototype.onEnd=function(e){e===fs.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Cn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ms={Inflate:ds,inflate:ps,inflateRaw:function(e,t){return(t=t||{}).raw=!0,ps(e,t)},ungzip:ps},gs={};(0,Cn.assign)(gs,$a,ms,fs);var vs=gs,ys="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array?"uint8array":"array";function _s(e,t){Qr.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Gr.inherits(_s,Qr),_s.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(Gr.transformTo(ys,e.data),!1)},_s.prototype.flush=function(){Qr.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},_s.prototype.cleanUp=function(){Qr.prototype.cleanUp.call(this),this._pako=null},_s.prototype._createPako=function(){this._pako=new vs[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};var ws={STORE:{magic:"\0\0",compressWorker:function(e){return new Qr("STORE compression")},uncompressWorker:function(){return new Qr("STORE decompression")}},DEFLATE:{magic:"\b\0",compressWorker:function(e){return new _s("Deflate",e)},uncompressWorker:function(){return new _s("Inflate",{})}}},bs="PK",ks="PK",xs="PK",Ss="PK",Es="PK",As="PK\b",Cs=function(e,t){var r,n="";for(r=0;r>>=8;return n},Rs=function(e,t,r,n,i,a){var o,s,h=e.file,u=e.compression,f=a!==en.utf8encode,l=Gr.transformTo("string",a(h.name)),c=Gr.transformTo("string",en.utf8encode(h.name)),d=h.comment,p=Gr.transformTo("string",a(d)),m=Gr.transformTo("string",en.utf8encode(d)),g=c.length!==h.name.length,v=m.length!==d.length,y="",_="",w="",b=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),f||!g&&!v||(S|=2048);var E,A,C=0,R=0;b&&(C|=16),"UNIX"===i?(R=798,C|=(E=h.unixPermissions,A=E,E||(A=b?16893:33204),(65535&A)<<16)):(R=20,C|=63&(h.dosPermissions||0)),o=k.getUTCHours(),o<<=6,o|=k.getUTCMinutes(),o<<=5,o|=k.getUTCSeconds()/2,s=k.getUTCFullYear()-1980,s<<=4,s|=k.getUTCMonth()+1,s<<=5,s|=k.getUTCDate(),g&&(_=Cs(1,1)+Cs(vn(l),4)+c,y+="up"+Cs(_.length,2)+_),v&&(w=Cs(1,1)+Cs(vn(p),4)+m,y+="uc"+Cs(w.length,2)+w);var z="";return z+="\n\0",z+=Cs(S,2),z+=u.magic,z+=Cs(o,2),z+=Cs(s,2),z+=Cs(x.crc32,4),z+=Cs(x.compressedSize,4),z+=Cs(x.uncompressedSize,4),z+=Cs(l.length,2),z+=Cs(y.length,2),{fileRecord:bs+z+l+y,dirRecord:ks+Cs(R,2)+z+Cs(p.length,2)+"\0\0\0\0"+Cs(C,4)+Cs(n,4)+l+y+p}};function zs(e,t,r,n){Qr.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}Gr.inherits(zs,Qr),zs.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,Qr.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},zs.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=Rs(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},zs.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=Rs(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return As+Cs(e.crc32,4)+Cs(e.compressedSize,4)+Cs(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},zs.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t0?e.substring(0,t):""},Us=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},Ds=function(e,t){return t=void 0!==t?t:ln.createFolders,e=Us(e),this.files[e]||Ls.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function Ms(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var Fs={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)this.files.hasOwnProperty(t)&&(n=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,n))},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(1===arguments.length){if(Ms(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var i=this.files[this.root+e];return i&&!i.dir?i:null}return e=this.root+e,Ls.call(this,e,t,r),this},folder:function(e){if(!e)return this;if(Ms(e))return this.filter(function(t,r){return r.dir&&e.test(t)});var t=this.root+e,r=Ds.call(this,t),n=this.clone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(t,r){return r.name.slice(0,e.length)===e}),n=0;n=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return Gr.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}};var Ns=js;function Zs(e){Ns.call(this,e);for(var t=0;t=0;--a)if(this.data[a]===t&&this.data[a+1]===r&&this.data[a+2]===n&&this.data[a+3]===i)return a-this.zero;return-1},Zs.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&r===a[1]&&n===a[2]&&i===a[3]},Zs.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var Ws=Zs;function Ys(e){Ns.call(this,e)}Gr.inherits(Ys,Ns),Ys.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},Ys.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},Ys.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},Ys.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var qs=Ys;function Hs(e){Ws.call(this,e)}Gr.inherits(Hs,Ws),Hs.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var Ks=Hs;function Xs(e){Ks.call(this,e)}Gr.inherits(Xs,Ks),Xs.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};var Vs=Xs,$s=function(e){var t=Gr.getTypeOf(e);return Gr.checkSupport(t),"string"!==t||Zt.uint8array?"nodebuffer"===t?new Vs(e):Zt.uint8array?new Ks(Gr.transformTo("uint8array",e)):new Ws(Gr.transformTo("array",e)):new qs(e)};function Gs(e,t){this.options=e,this.loadOptions=t}Gs.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in ws)if(ws.hasOwnProperty(t)&&ws[t].magic===e)return ws[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+Gr.pretty(this.compressionMethod)+" unknown (inner file : "+Gr.transformTo("string",this.fileName)+")");this.decompressed=new bn(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===e&&(this.dosPermissions=63&this.externalFileAttributes),3===e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=$s(this.extraFields[1].value);this.uncompressedSize===Gr.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===Gr.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===Gr.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===Gr.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e0)this.isSignature(t,ks)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=$s(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};var eh=Qs;function th(e){return new $r.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new _n);n.on("error",function(e){r(e)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}function rh(){if(!(this instanceof rh))return new rh;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var e=new rh;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}rh.prototype=Fs,rh.prototype.loadAsync=function(e,t){var r=this;return t=Gr.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:en.utf8decode}),qt&&Vt(e)?$r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):Gr.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var r=new eh(t);return r.load(e),r}).then(function(e){var r=[$r.Promise.resolve(e)],n=e.files;if(t.checkCRC32)for(var i=0;ie.filename?"string"!=typeof e.filename?(console.error("Zipclex filename can only be of type string"),!1):Array.isArray(e.sheet.data)?!!(e=>e.every(e=>Array.isArray(e)))(e.sheet.data)||(console.error("Zipclex sheet data childs is not of type array"),!1):(console.error("Zipcelx sheet data is not of type array"),!1):(console.error("Zipclex config missing property filename"),!1),sh=1/0,hh="[object Symbol]",uh=/[&<>"'`]/g,fh=RegExp(uh.source),lh="object"==typeof t&&t&&t.Object===Object&&t,ch="object"==typeof self&&self&&self.Object===Object&&self,dh=lh||ch||Function("return this")();var ph=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"}),mh=Object.prototype.toString,gh=dh.Symbol,vh=gh?gh.prototype:void 0,yh=vh?vh.toString:void 0;function _h(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&mh.call(e)==hh}(e))return yh?yh.call(e):"";var t=e+"";return"0"==t&&1/e==-sh?"-0":t}var wh=function(e){var t;return(e=null==(t=e)?"":_h(t))&&fh.test(e)?e.replace(uh,ph):e};const bh=e=>{if("number"!=typeof e)return"";const t=Math.floor(e/26),r=String.fromCharCode(97+e%26).toUpperCase();return 0===t?r:bh(t-1)+r};var kh=(e,t)=>`${bh(e)}${t}`,xh=(e,t,r)=>(-1===ah.indexOf(e.type)&&(console.warn('Invalid type supplied in cell config, falling back to "string"'),e.type="string"),"string"===e.type?((e,t,r)=>`${wh(t)}`)(t,e.value,r):((e,t,r)=>`${t}`)(t,e.value,r)),Sh=e=>e.map((e,t)=>((e,t)=>{const r=t+1,n=e.map((e,t)=>xh(e,t,r)).join("");return`${n}`})(e,t)).join(""),Eh='\n{placeholder}';e.zipcelx=(e=>{if(!oh(e))throw new Error("Validation failed.");const t=new nh,r=t.folder("xl");r.file("workbook.xml",'\n'),r.file("_rels/workbook.xml.rels",'\n\n\n'),t.file("_rels/.rels",'\n'),t.file("[Content_Types].xml",'\n\n\n\n\n\n');const n=(e=>{const t=Sh(e);return Eh.replace("{placeholder}",t)})(e.sheet.data);return r.file("worksheets/sheet1.xml",n),t.generateAsync({type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}).then(t=>{ih.saveAs(t,`${e.filename}.xlsx`)})})}); diff --git a/src/main/webapp/static/global/plugins/tableExport-3.3.13/tableexport.js b/src/main/webapp/static/global/plugins/tableExport-3.3.13/tableexport.js index 13365f04e..b972d1f85 100644 --- a/src/main/webapp/static/global/plugins/tableExport-3.3.13/tableexport.js +++ b/src/main/webapp/static/global/plugins/tableExport-3.3.13/tableexport.js @@ -102,7 +102,7 @@ } } // 当文字过长有省略时取title导出 - var titleText=$(val).text(); + var titleText=$(val).text().trim(); if($(val).attr("title")!=null&&$(val).attr("title")!=""){ titleText=$(val).attr("title"); } @@ -236,13 +236,19 @@ } var $cols = $(val).find('th, td'); return $cols.map(function (i, val) { + // 当文字过长有省略时取title导出 + var titleText=$(val).text().trim(); + if($(val).attr("title")!=null&&$(val).attr("title")!=""){ + titleText=$(val).attr("title"); + } if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { return; } if ($(val).is(emptyCSS)) { return " " } - return '"' + TableExport.prototype.formatValue(isTrimWhitespace, $(val).text().replace(/"/g, '""')) + '"'; + titleText=$cols.is("th")?"\t"+titleText:titleText; + return '"' + TableExport.prototype.formatValue(isTrimWhitespace, titleText.replace(/"/g, '""')) + '"'; }).get().join(colD); }).get().join(rdel), dataObject = TableExport.prototype.escapeHtml( @@ -309,7 +315,7 @@ * @param myClass {String} */ function createObjButton(dataObject, myContent, myClass) { - var exportButton = ""; + var exportButton = ""; checkCaption(exportButton); } }); diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index 8c14a80c3..8e6f52956 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -884,12 +884,14 @@ var switchAction=function(action){ $(this).removeAttr("disabled"); $(this).removeClass("hidden"); $(this).removeClass("disabled"); - }) + }); + $(".doBalckList").removeClass("hidden"); }else{ $(".policy").find("input,select,div,button").each(function(){ $(this).attr("disabled","disabled"); $(this).addClass("hidden"); - }) + }); + $(".doBalckList").addClass("hidden"); } /*************************action切换时,隐藏白名单和drop的是否记录日志*****************************/ diff --git a/src/main/webapp/static/global/scripts/jeesite.js b/src/main/webapp/static/global/scripts/jeesite.js index 40dbd0118..1ae873ff2 100644 --- a/src/main/webapp/static/global/scripts/jeesite.js +++ b/src/main/webapp/static/global/scripts/jeesite.js @@ -397,8 +397,8 @@ function customColumnClick(){ html+="
"; }) html +="
"; - - top.$.jBox(html,{title:" Custom Columns",showIcon:false,opacity:0.3,submit:submit}); + var cus=$("#tb_custom",parent.document).val(); + top.$.jBox(html,{title:""+cus ,showIcon:false,opacity:0.3,submit:submit}); } diff --git a/src/main/webapp/static/global/scripts/pzLog.js b/src/main/webapp/static/global/scripts/pzLog.js index 33dcc0f2d..4ad93aea6 100644 --- a/src/main/webapp/static/global/scripts/pzLog.js +++ b/src/main/webapp/static/global/scripts/pzLog.js @@ -5,6 +5,22 @@ $(function(){ //获取配置日志总数 getTotalLog(); }); + +function setTime(){ + var chooseDate=new Date($('#beginDate').val()); + chooseDate=chooseDate.setDate(chooseDate.getDate()+7); + var modifyTime=new Date(chooseDate); + $('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); +} + +function setTimee(){ + var chooseDate=new Date($('#searchFoundStartTime').val()); + chooseDate=chooseDate.setDate(chooseDate.getDate()+1); + var modifyTime=new Date(chooseDate); + $('#searchFoundEndTime').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); +} + + var getTotalLog=function(){ /* td需要配置属性有,audit,functionId,compileId,action @@ -20,7 +36,7 @@ var getTotalLog=function(){ var serviceId=$(this).attr("serviceId"); var functionId=$(this).attr("functionId"); if(audit&&compileId&&functionId&&serviceId){ - if(audit == 1){ + if(audit != 0){ var has=false; for(var i=0;idiv.info_1 p:nth-child(2){ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info .info_2 .fr_fc .numberRun2{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info .info_2 .fr_fc .numberRun3{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info .info_2 .fr_fc .numberRun5{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info .info_2 .fr_fc .numberRun6{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info .info_2 .fr_fc .numberRun7{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info .info_2 .fr_fc .numberRun8{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info .info_2 .fr_fc .numberRun{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 2.1em; + margin-top: 2.5em; margin-left: 0px; } .data_content .data_info>div.info_1 .fl_fc .numberRun4{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 1px; + margin-top: 3px; margin-left: 0px; } .data_content .data_info>div.info_1 .fl_fc .numberRun1{ width:100%; font-weight: 600; - font-size: 16px; + font-size: 14px; /*color:#288dce;*/ color:#ffffff; - margin-top: 33px; + margin-top: 35px; margin-left: 0px; } .data_content .data_info>div.info_1 .fl_fc .numberRun4-unit{ @@ -254,9 +255,10 @@ p{ font-size: 11px; /*color:#337ab7 !important;*/ color:#ffffff !important; - margin-top: -6px; + margin-top: -3px; text-align: center; - margin-left: 1.3px; + margin-left: 6.3px; + width: 100% } /* .data_info{ float: right; diff --git a/src/main/webapp/static/pages/css/pagination.css b/src/main/webapp/static/pages/css/pagination.css index bb078001f..b5b899f17 100644 --- a/src/main/webapp/static/pages/css/pagination.css +++ b/src/main/webapp/static/pages/css/pagination.css @@ -5,6 +5,9 @@ width:960px; height:100%; } +.M-box{ + margin-bottom: 10px; +} .M-box,.M-box1,.M-box2,.M-box3{ position: relative; text-align: center; @@ -20,49 +23,79 @@ } .M-box span,.M-box1 span,.M-box2 span,.M-box3 span{ float: left; - margin:0 5px; - width: 38px; - height: 38px; - line-height: 38px; - color: #bdbdbd; - font-size: 14px; + line-height: 33px; + text-decoration: none; + background-color: #ffffff; + border: 1px solid #999999; + border-left-width: 0; } .M-box .active,.M-box1 .active,.M-box2 .active,.M-box3 .active{ float: left; - margin:0 5px; - width: 38px; - height: 38px; - line-height: 38px; - background: #3598dc; - color: #fff; + width: 30px; + height: 33px; + line-height: 33px; + background: #f5f5f5; + color: #999999; font-size: 14px; - border: 1px solid #3598dc; + border: 1px solid #DDDDDD; } .M-box a,.M-box1 a,.M-box2 a,.M-box3 a{ float: left; - margin:0 5px; - width: 38px; - height: 38px; - line-height: 38px; + width: 30px; + height: 33px; + line-height: 33px; background: #fff; border: 1px solid #ebebeb; - color: #08c; + color: #3598DC; font-size: 14px; + text-decoration:none } .M-box a:hover,.M-box1 a:hover,.M-box2 a:hover,.M-box3 a:hover{ - color:#fff; - background: #3598dc; + color:#23527c; + background: #f5f5f5; } .M-box .next,.M-box .prev,.M-box1 .next,.M-box1 .prev{ - font-family: "Simsun"; + font-family: "Open Sans", sans-serif; font-size: 16px; font-weight: bold; + line-height: 30px; } .now,.count{ padding:0 5px; color:#f00; } - +.dian-dian{ + float: left; + width: 30px; + height: 33px; + font-size: 14px; + line-height: 33px; + color: #999999; + text-decoration: none; + background-color: #ffffff; + border: 1px solid #DDDDDD !important; + border-left-width: 0 !important;; + border-right-width: 0 !important;; +} +.pageView{ + display: inline-flex; + height: 33px; +} +.pageMessage{ + color:#999999; + display: inline-block; + margin: 7px; +} +.pageMessage input{ + border: 1px solid #ddd; + color:#999999; + width:10%; + height: 22px; + font-size: 14px; + line-height: 33px; + margin-left:5px; + text-align:center; +} /* input{ float: left; diff --git a/src/main/webapp/static/pages/scripts/echart.js b/src/main/webapp/static/pages/scripts/echart.js index 7734171a4..9cd32e2f4 100644 --- a/src/main/webapp/static/pages/scripts/echart.js +++ b/src/main/webapp/static/pages/scripts/echart.js @@ -1,6 +1,19 @@ //蓝色系 colors:['#0026af', '#0032bc', '#004bbc', '#015bb1', '#2f74b5', '#4186c1', '#5597cd', '#67a7de', '#77b5dc', '#98cde7', '#b9e7f4', '#d9ffff'], //彩色系colors:[ '#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5','#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4'], - + Highcharts.setOptions({ // Apply to all charts + chart: { + events: { + beforePrint: function () { + $('.highcharts-legend text').css('color','#000000'); + $('.highcharts-legend text').css('fill','#000000'); + }, + afterPrint: function () { + $('.highcharts-legend text').css('color','#ffffff'); + $('.highcharts-legend text').css('fill','#ffffff'); + } + } + } + }); //协议统计分析 function echart_1(rs) { var data=new Array(); @@ -10,15 +23,15 @@ var inoctetsNum=d.count; unit=changeUnit(inoctetsNum); inoctetsNum=changeNum(inoctetsNum); - var pktNum=new Array(); - var byteLen=new Array(); +// var pktNum=new Array(); +// var byteLen=new Array(); //协议图-操作系统 data.push({ name: d.protoType, y: parseFloat(inoctetsNum), // drilldown: d.protoType, }); - +/* pktNum[0]="pktNum"; pktNum[1]=parseInt(d.pktNum); byteLen[0]="byteLen"; @@ -30,7 +43,7 @@ type:'pie', innerSize: '70%', data: [pktNum,byteLen], - }); + });*/ }); var chart = Highcharts.chart('chart_1', { @@ -52,7 +65,7 @@ }, exporting: { allowHTML:true, - filename:'Protocol-Type', + filename:'Protocol-Type'+addDateName(), chartOptions: { plotOptions: { series: { @@ -246,7 +259,7 @@ //}, exporting: { allowHTML:true, - filename:'Active-IP', + filename:'Active-IP'+addDateName(), chartOptions: { plotOptions: { series: { @@ -471,7 +484,7 @@ },*/ exporting: { allowHTML:true, - filename:'App', + filename:'App'+addDateName(), buttons: exportingButton('#415262') }, noData:{ @@ -623,7 +636,7 @@ function echart_2(rs){ }, exporting: { allowHTML:true, - filename:'BS', + filename:'BS'+addDateName(), chartOptions: { plotOptions: { series: { @@ -776,7 +789,7 @@ function echart_5(rs){ },*/ exporting: { allowHTML:true, - filename:'BS', + filename:'BS'+addDateName(), chartOptions: { plotOptions: { series: { @@ -888,31 +901,31 @@ function echart_4(rs){ var data=new Array(); // var drillData=new Array(); var unit="bytes"; - $(rs).each(function(i, d) { - var inoctetsNum=d.count; - unit=changeUnit(inoctetsNum); - inoctetsNum=changeNum(inoctetsNum); -// var pktNum=new Array(); -// var byteLen=new Array(); - data.push({ - name: d.websiteService, - y: parseFloat(inoctetsNum), -// drilldown: d.websiteService, + $(rs).each(function(i, d) { + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); + // var pktNum=new Array(); + // var byteLen=new Array(); + data.push({ + name: d.websiteService, + y: parseFloat(inoctetsNum), + // drilldown: d.websiteService, + }); + + /* pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen); + + drillData.push({ + name: d.websiteService, + id: d.websiteService, + type:'pie', + data: [pktNum,byteLen], + });*/ + }); - -/* pktNum[0]="pktNum"; - pktNum[1]=parseInt(d.pktNum); - byteLen[0]="byteLen"; - byteLen[1]=parseInt(d.byteLen); - - drillData.push({ - name: d.websiteService, - id: d.websiteService, - type:'pie', - data: [pktNum,byteLen], - });*/ - - }); // 创建图例 var chart = Highcharts.chart('chart_4',{ chart: { @@ -924,7 +937,7 @@ function echart_4(rs){ }, exporting: { allowHTML:true, - filename:'Website', + filename:'Website'+addDateName(), chartOptions: { plotOptions: { series: { @@ -1071,7 +1084,7 @@ function echart_6(rs){ },*/ exporting: { allowHTML:true, - filename:'Website', + filename:'Website'+addDateName(), chartOptions: { plotOptions: { series: { @@ -1170,41 +1183,46 @@ function echart_topic_domain(rs){ var data=[{ 'id': '0.0', // 'parent': '', - 'name': 'TOPIC' + 'name': 'Service' }]; var unit="bytes"; $(rs).each(function(i,d){ var inoctetsNum=d.count; - unit=changeUnit(inoctetsNum); - inoctetsNum=changeNum(inoctetsNum); + var inoctetsNumK=inoctetsNum/1024; + var inoctetsNumM=inoctetsNumK/1024; + var inoctetsNumG=inoctetsNumM/1024; + inoctetsNum=inoctetsNumG; + inoctetsNum=Math.round(inoctetsNum*100)/100; + + unit="GB"; + if(inoctetsNum>0){ + /****主题中的子域名*******/ + var topicData=0; + $(d.domainData).each(function(j,t){ + var domainNum=t.byteCount; + var domainNumK=domainNum/1024; + var domainNumM=domainNumK/1024; + var domainNumG=domainNumM/1024; + domainNum=domainNumG; + domainNum=Math.round(domainNum*100)/100; + topicData=topicData+domainNum; + data.push({ + 'id': '2.'+t.webId, + 'parent': '1.'+d.topicId, + 'name': t.domain, + 'value':parseFloat(domainNum) + }); + }) data.push({ 'id': '1.'+d.topicId, 'parent': '0.0', 'name': d.topic, - 'value':parseFloat(inoctetsNum) + 'value':parseFloat(topicData) }); - /****主题中的子域名*******/ - $(d.domainData).each(function(j,t){ - var domainNum=t.byteCount; - unit=changeUnit(domainNum); - domainNum=changeNum(domainNum); - data.push({ - 'id': '2.'+t.webId, - 'parent': '1.'+d.topicId, - 'name': t.domain, - 'value':parseFloat(domainNum) - }); - }) - + } }); - - - // Splice in transparent for the center circle Highcharts.getOptions().colors.splice(0, 0, 'transparent'); - - var chart = Highcharts.chart('chart_topic', { - chart: { backgroundColor: 'rgba(255, 255, 255, 0)', plotBackgroundColor:null, @@ -1221,7 +1239,7 @@ function echart_topic_domain(rs){ },*/ exporting: { allowHTML:true, - filename:'Topic', + filename:'Service'+addDateName(), chartOptions: { plotOptions: { series: { @@ -1235,7 +1253,11 @@ function echart_topic_domain(rs){ buttons: exportingButton('#6e6379') }, //colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6','#0099cc','#cc0033','#ff6633','#99cccc','#d9f9d0'], - colors:['#003078','#004bbc', '#015bb1', '#2f74b5', '#4186c1', '#0058e1','#066aff', '#5597cd', '#5c9dff', '#67a7de', '#77b5dc', '#98cde7','#89b9ff','#78adff'], +// colors:['#003078','#004bbc', '#015bb1', '#2f74b5', '#4186c1', '#0058e1','#066aff', '#5597cd', '#5c9dff', '#67a7de', '#77b5dc', '#98cde7','#89b9ff','#78adff'], +// colors:['#008ef9','#0594ff', '#002540', '#004679', '#025ba1', '#026fc0','#0279d5'], +// colors:['#002540','#004679','#025ba1', '#026fc0', '#0279d5', '#0086e9', '#008ef9','#0594ff', '#25a2ff', '#63bbff', '#88cbff'], + colors:[ '#1C4573','#275A9C', '#306EB9', '#3579CE', '#3C85E1', '#3E8EF1','#4294F7', '#4294F7', '#98CBFA'], +// colors:colors, noData:{ style: {//设置字体颜色 color: '#fff', @@ -1282,13 +1304,13 @@ function echart_topic_domain(rs){ colorByPoint: true, dataLabels: { rotationMode: 'parallel' - } + }, }, { level: 3, colorVariation: { key: 'brightness', - to: -0.5 + to: 0.5 } }, { level: 4, @@ -1345,8 +1367,32 @@ function exportingButton(color) { fill: color } } - } + }, + menuItems: [ + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[0],// 打印 + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[1],// jpeg + 'downloadPNG','downloadPDF', + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[4],// excel + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[3],// cvs + ] } }; return button; } +// 加时间后缀名 +function addDateName(){ + var nowDate=new Date(); + var myDate = new Date(); + //获取当前年 + var year=myDate.getFullYear(); + //获取当前月 + var month=myDate.getMonth()+1; + //获取当前日 + var date=myDate.getDate(); + var h=myDate.getHours(); //获取当前小时数(0-23) + var m=myDate.getMinutes(); //获取当前分钟数(0-59) + var s=myDate.getSeconds(); + + var now=year+""+month+""+date+""+h+""+m+""+s; + return now; +} diff --git a/src/main/webapp/static/pages/scripts/echart.js.blue b/src/main/webapp/static/pages/scripts/echart.js.blue new file mode 100644 index 000000000..63c7cfcd4 --- /dev/null +++ b/src/main/webapp/static/pages/scripts/echart.js.blue @@ -0,0 +1,1376 @@ +//蓝色系 colors:['#0026af', '#0032bc', '#004bbc', '#015bb1', '#2f74b5', '#4186c1', '#5597cd', '#67a7de', '#77b5dc', '#98cde7', '#b9e7f4', '#d9ffff'], +//彩色系 colors:['#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5','#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4'], +//彩改蓝 colors:['#012765','#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff'], + + Highcharts.setOptions({ // Apply to all charts + chart: { + events: { + beforePrint: function () { + $(".highcharts-background").attr("fill","rgba(48,48,48,1)") + }, + afterPrint: function () { + $(".highcharts-background").attr("fill","rgba(255, 255, 255, 0)") + } + } + } + }); + //协议统计分析 + function echart_1(rs) { + var data=new Array(); + var drillData=new Array(); + var unit="bytes"; + $(rs).each(function(i, d) { + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); + var pktNum=new Array(); + var byteLen=new Array(); + //协议图-操作系统 + data.push({ + name: d.protoType, + y: parseFloat(inoctetsNum), +// drilldown: d.protoType, + }); + + pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen); + + drillData.push({ + name: d.protoType, + id: d.protoType, + type:'pie', + innerSize: '70%', + data: [pktNum,byteLen], + }); + + }); + var chart = Highcharts.chart('chart_1', { + chart: { + type: 'pie', + spacing : [40, 40 , 40, 40], + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, +// margin:10, + + }, + navigation: { + buttonOptions: { + x:31, + y:-30 + } + }, + exporting: { + allowHTML:true, + filename:'Protocol-Type', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + }, + buttons: exportingButton('#3b355b') + }, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + }, + //colors:['#f36f8a', '#44A9A8', '#ffff43','#25f3e6' ,'#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'], + //colors:[ '#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4','#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5'], + //colors:['#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5','#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4'], + //colors:[ '#012765','#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff'], + colors:['#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff','#012765'], + title: { + text: null + }, + /*tool: { + enabled: true, +// headerFormat: '{point.key}- {point.percentage:.1f}%'+unit, + pointFormat: '{series.name} {point.y}'+unit, + },*/ + tooltip: { + headerFormat: '{series.name}
', + pointFormat: '{point.name}
{point.y}
'+unit + }, + credits:{//是否有highcharts水印 + enabled:false + }, + legend:{ + width:480, + x:50, + itemWidth:100, + itemDistance:2, + itemHoverStyle:{ + color:'#61D2F7', + }, + itemStyle:{ + color: '#fff', + fontFamily:'Microsoft YaHei', + }, +// navigation: {//图例分页 +// activeColor: 'red', +// animation: true, +// arrowSize: 15, +// inactiveColor: '#CCC', +// style: { +// fontWeight: 'bold', +// color: '#333', +// fontSize: '12px' +// } +// } + }, + + plotOptions: { + pie: { + borderColor: "", + allowPointSelect: true, + cursor: 'pointer', + showInLegend: true, + dataLabels: { + enabled: false, + format: '{point.name}:
{point.percentage:.1f}%', + style: { + color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' + } + }, + size: 200, //饼图的大小 + states: { + hover: { + enabled: false + } + }, + point: { + events: { + mouseOver: function(e) { // 鼠标滑过时动态更新标题 + // 标题更新函数,API 地址:https://api.hcharts.cn/highcharts#Chart.setTitle + chart.setTitle({ + text:e.target.name.length>10? this.percentage.toFixed(2)+"%
"+e.target.name.substring(0,10)+"...":this.percentage.toFixed(2)+"%
"+(e.target.name+"").substring(0,10)+"", + floating:true, + y:120, + style: {//设置字体颜色 + color: '#fff', + fontFamily:'Microsoft YaHei' + }, + }); + this.slice(); + }, + // 鼠标移出时,收回突出显示 + mouseOut: function() { + this.slice(); + }, + // 默认是点击突出,这里屏蔽掉 + click: function() { + return false; + } + }, + }, + }, + }, + series: [{ + type: 'pie', + innerSize: '70%',//圆环的大小 + name: ' ', + data: data + }], +// drilldown:{ +// series:drillData, +// drillUpButton: { +// relativeTo: 'spacingBox', +// } +// } + + }, function(c) { // 图表初始化完毕后的会掉函数 + // 环形图圆心 + var centerY = c.series[0].center[1], + titleHeight = parseInt(c.title.styles.fontSize); + // 动态设置标题位置 + c.setTitle({ + y:centerY + titleHeight/2 + }); + }); + + } + + + // echart_main中心图 活跃IP统计 + function echart_main(rs) { +// if(rs==null||rs.length<=0){ +// rs=[{"ipAddr":"103.6.1.12","linkNum":532,"pktNum": 5,"byteLen": 6}, +// {"ipAddr":"163.5.6.43","linkNum":532,"pktNum": 5,"byteLen": 7}, +// {"ipAddr":"170.1.0.1","linkNum":532,"pktNum": 5,"byteLen": 8}, +// {"ipAddr":"10.32.33.61","linkNum":532,"pktNum": 5,"byteLen": 9}, +// {"ipAddr":"145.16.1.2","linkNum":532,"pktNum": 5,"byteLen": 10}, +// {"ipAddr":"153.5.0.36","linkNum":532,"pktNum": 5,"byteLen": 11}] +// } + var data=new Array(); + var xData=new Array(); + var drillData=new Array(); + var unit="bytes"; + $(rs).each(function(i, d) { + var inoctetsNum=d.linkNum; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); + /*var pktNum=new Array(); + var byteLen=new Array();*/ + xData.push(d.ipAddr); + //活跃IP图 + data.push({ + name: d.ipAddr, + y: parseFloat(inoctetsNum), +// drilldown: d.ipAddr, + }); + /*pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen);*/ + /*drillData.push({ + name: d.ipAddr, + id: d.ipAddr, + type:'pie', + tooltip: { + enabled: true, + pointFormat: '{series.name}: {point.y} ({point.percentage:.1f}%)' + }, + data: [pktNum,byteLen], + });*/ + }); + var chart = Highcharts.chart('chart_main', { + chart: { + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, + type: 'bar', +// marginLeft:80, + marginTop:50, + inverted: true, + }, + //navigation: { + //buttonOptions: { + //y:13, + //x:-7 + //} + //}, + exporting: { + allowHTML:true, + filename:'Active-IP', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + }, + buttons: { + contextButton: { + symbolSize: 12, + symbolX: 11, + symbolY: 10, + symbolStroke: '#e6e6e6', + symbolFill: '#e6e6e6', + width: 21, + height: 20, + theme: { + 'stroke-width': 1, + stroke: '#e6e6e6', + r: 0, + fill: '#51586f', + states: { + hover: { + fill: '#51586f' + }, + select: { + fill: '#51586f' + } + } + } + } + } + }, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + },// + //colors:['#f36f8a', '#44A9A8', '#ffff43','#25f3e6','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'], + colors:['#004bbc', '#015bb1', '#2f74b5', '#4186c1', '#5597cd', '#67a7de', '#77b5dc', '#98cde7', '#b9e7f4', '#d9ffff'], + title: { + text: null + }, + labels:{ + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + }, + xAxis: { + type:'category', + categories: xData, + title: { + text: null + }, + labels:{ + formatter:function(){ + if(this.value.length>15){ + return ''+this.value.substring(0,15)+"..."+'' + }else{ + return this.value + } + }, + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + } + + }, + yAxis: { + min: 0, + title: { + text: unit, + align:'high', + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + }, + labels: { + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + }, + lineWidth: 1 + }, + tooltip: { + headerFormat: '{series.name}
', + pointFormat: '{point.name}
{point.y}
'+unit + }, + plotOptions: { + bar: { + borderColor: "", + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei', + textOutline:'none', + fontWeight:'normal' + } + }, + showInLegend: false + } + }, + credits:{//是否有highcharts水印 + enabled:false + }, + series: [{ + name: ' ', + colorByPoint: true, + data: data + }], +// drilldown:{ +// activeAxisLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei', +// +// }, +// activeDataLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei' +// }, +// drillUpButton:{ +// relativeTo: 'spacingBox', +// }, +// series:drillData +// } + }); + } + function changeNum(inoctetsNum){ + // 变化单位 + var inoctetsNumK=inoctetsNum/1024; + var inoctetsNumM=inoctetsNumK/1024; + var inoctetsNumG=inoctetsNumM/1024; +// if(inoctetsNumK>1){ +// inoctetsNum=inoctetsNumK; +// }; +// if(inoctetsNumM>1){ +// inoctetsNum=inoctetsNumM; +// }; +// if(inoctetsNumG>1){ +// inoctetsNum=inoctetsNumG; +// }; + inoctetsNum=inoctetsNumG; + inoctetsNum=inoctetsNum.toFixed(2) + return inoctetsNum; + } + function changeUnit(inoctetsNum){ + // 变化单位 + var unit="GB"; +// var inoctetsNumK=inoctetsNum/1024; +// var inoctetsNumM=inoctetsNumK/1024; +// var inoctetsNumG=inoctetsNumM/1024; +// if(inoctetsNumK>1){ +// unit="KB"; +// }; +// if(inoctetsNumM>1){ +// unit="MB"; +// }; +// if(inoctetsNumG>1){ +// unit="GB"; +// }; + return unit + } + //app应用类型统计 echart_3 + function echart_3(rs) { + var data=new Array(); + var xData=new Array(); + var drillData=new Array(); + var unit="bytes"; + $(rs).each(function(i, d) { + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); + var pktNum=new Array(); + var byteLen=new Array(); + xData.push(d.appType); + data.push({ + name: d.appType, + y: parseFloat(inoctetsNum), +// drilldown: d.appType, + }); +/* pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen); + drillData.push({ + name: d.appType, + id: d.appType, + data: [pktNum,byteLen], + });*/ + }); + var chart = Highcharts.chart('chart_3',{ + chart: { + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, + type: 'column', + marginTop:50, + marginBottom:60, + + }, + /*navigation: { + buttonOptions: { + y: 13, + } + },*/ + exporting: { + allowHTML:true, + filename:'App', + buttons: exportingButton('#415262') + }, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + }, + labels:{ + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + }, + //colors:['#f36f8a', '#44A9A8', '#ffff43','#25f3e6','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'], + colors:['#0026af', '#0032bc', '#004bbc', '#015bb1', '#2f74b5', '#4186c1', '#5597cd', '#67a7de', '#77b5dc', '#98cde7', '#b9e7f4', '#d9ffff'], + title: { + text: null + }, + credits:{//是否有highcharts水印 + enabled:false + }, + xAxis: { + categories: xData, + labels:{ + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + }, + title: { + text: 'App', + align:'high', + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + }, + }, + yAxis: { + min: 0, + title: { + text: unit, + align:'high', + style: {//设置字体颜色 + color: '#fff', + fontFamily:'Microsoft YaHei' + }, + }, + labels:{ + enabled:true, + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei' + }, + }, + + }, + tooltip: { + enabled: true, + headerFormat: '{point.key}
', + pointFormat: '{point.y:.1f} '+unit, + shared: true, + useHTML: true + }, + plotOptions: { + column: { + dataLabels: {// 柱形图上的数字显示 + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + style: {//设置字体颜色 + color: '#fff', + fontSize:'10px', + fontFamily:'Microsoft YaHei', + textOutline:'none', + fontWeight:'normal' + } + }, + borderColor: "",//去边框 + showInLegend:false + }, + }, + + series: [{ + name: '', + colorByPoint: true, + data: data + }], + /*drilldown:{ + activeAxisLabelStyle:{ + textDecoration:'none', + color: '#fff', + fontStyle:'Microsoft YaHei', + + }, + activeDataLabelStyle:{ + textDecoration:'none', + color: '#fff', + fontStyle:'Microsoft YaHei' + }, + drillUpButton: { + relativeTo: 'spacingBox', + }, + series:drillData + }*/ + }); + } + //终端用户 分操作系统 +function echart_2(rs){ + var data=new Array(); + var drillData=new Array(); + var unit="bytes"; + $(rs).each(function(i, d) { + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); +// var pktNum=new Array(); +// var byteLen=new Array(); + data.push({ + name: d.osType, + y: parseFloat(inoctetsNum), +// drilldown: d.osType, + }); + +/* pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen); + + drillData.push({ + name: d.osType, + id: d.osType, + type:'pie', + data: [pktNum,byteLen], + });*/ + + }); + // 创建图例 + var chart = Highcharts.chart('chart_2',{ + chart: { + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, + type: 'pie', + }, + exporting: { + allowHTML:true, + filename:'BS', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + }, + buttons: exportingButton('#372f57') + }, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + }, + legend:{ + width:480, + x:40, + itemWidth:100, + itemDistance:2, + itemHoverStyle:{ + color:'#61D2F7', + }, + itemStyle:{ + color: '#fff', + fontFamily:'Microsoft YaHei', + } + }, + //colors:['#f36f8a', '#44A9A8', '#ffff43','#25f3e6','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'], + //colors:[ '#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4','#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5'], + //colors:['#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5','#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4'], + //colors:[ '#012765','#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff'], + colors:['#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff','#012765'], + title: { + text: null, + style: {//设置字体颜色 + color: '#fff', + fontSize:'18px', + fontFamily:'Microsoft YaHei' + }, + + }, + plotOptions: { + series: { + dataLabels: { + enabled: false, + format: '{point.name}' + }, + }, + pie:{ + borderColor: "", + showInLegend: true, + size: '80%', + point: { + events: { + mouseOver: function(e) { + this.slice(); + }, + // 鼠标移出时,收回突出显示 + mouseOut: function() { + this.slice(); + }, + // 默认是点击突出,这里屏蔽掉 + click: function() { + return false; + } + }, + }, + } + }, + credits:{//是否有highcharts水印 + enabled:false + }, + tooltip: { + enabled: true, + headerFormat: '{point.key}: {point.percentage:.1f}%
', + pointFormat: '{point.y} '+unit, + shared: true, + useHTML: true + }, + series: [{ + name: ' ', + size: '80%', + colorByPoint: true, + data: data + }], +// drilldown:{ +// activeAxisLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei', +// +// }, +// activeDataLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei' +// }, +// series:drillData, +// drillUpButton: { +// relativeTo: 'spacingBox', +// } +// } + }); +} +//当点击操作系统列表时-显示浏览器 +function echart_5(rs){ + var data=new Array(); + var drillData=new Array(); + var unit="bytes"; + $(rs).each(function(i, d) { + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); +// var pktNum=new Array(); +// var byteLen=new Array(); + //协议图-操作系统 + data.push({ + name: d.bsType, + y: parseFloat(inoctetsNum), +// drilldown: d.bsType, + }); + +/* pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen); + + drillData.push({ + name: d.bsType, + id: d.bsType, + type:'pie', + data: [pktNum,byteLen], + });*/ + + }); + // 创建图例 + var chart = Highcharts.chart('chart_2',{ + chart: { + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, + type: 'pie' + }, + /*navigation: { + buttonOptions: { + y: -8, + } + },*/ + exporting: { + allowHTML:true, + filename:'BS', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + }, + buttons: exportingButton('#372f57') + }, + legend:{ + width:480, + x:40, + itemWidth:100, + itemDistance:2, + itemHoverStyle:{ + color:'#61D2F7', + }, + itemStyle:{ + color: '#fff', + fontFamily:'Microsoft YaHei', + } + }, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + }, + //colors:['#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5','#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4'], + //colors:[ '#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4','#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5'], + /*colors:['#f36f8a', '#44A9A8', '#ffff43','#25f3e6','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'],*/ + //colors:[ '#012765','#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff'], + colors:['#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff','#012765'], + title: { + text: null, + style: {//设置字体颜色 + color: '#fff', + fontSize:'18px', + fontFamily:'Microsoft YaHei' + }, + + }, + plotOptions: { + series: { + dataLabels: { + enabled: false, + format: '{point.name}' + }, + + }, + pie:{ + borderColor: "", + point: { + events: { + mouseOver: function(e) { // 鼠标滑过时动态更新标题 + this.slice(); + }, + // 鼠标移出时,收回突出显示 + mouseOut: function() { + this.slice(); + }, + // 默认是点击突出,这里屏蔽掉 + click: function() { + return false; + } + }, + }, + showInLegend: true, + size: '80%', + } + }, + credits:{//是否有highcharts水印 + enabled:false + }, + tooltip: { + enabled: true, + headerFormat: '{point.key}: {point.percentage:.1f}%
', + pointFormat: '{point.y} '+unit, + shared: true, + useHTML: true + }, + series: [{ + name: ' ', + size: '80%', + colorByPoint: true, + data: data + }], +// drilldown:{ +// activeAxisLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei', +// +// }, +// activeDataLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei' +// }, +// series:drillData, +// drillUpButton: { +// relativeTo: 'spacingBox', +// } +// } + }); +} + +//网站流量分析 +function echart_4(rs){ + var data=new Array(); +// var drillData=new Array(); + var unit="bytes"; + $(rs).each(function(i, d) { + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); +// var pktNum=new Array(); +// var byteLen=new Array(); + data.push({ + name: d.websiteService, + y: parseFloat(inoctetsNum), +// drilldown: d.websiteService, + }); + +/* pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen); + + drillData.push({ + name: d.websiteService, + id: d.websiteService, + type:'pie', + data: [pktNum,byteLen], + });*/ + + }); + // 创建图例 + var chart = Highcharts.chart('chart_4',{ + chart: { + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, + type: 'pie' + }, + exporting: { + allowHTML:true, + filename:'Website', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + } + }, + } + }, + buttons: exportingButton('#3c2347') + }, + //colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'], + //colors:[ '#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4','#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5'], + //colors:['#fe392e','#fe7d2e','#febb1d', '#feff1d','#51d569','#51d5d5','#0032bc','#1d7cf9' ,'#77b5dc','#b9e7f4'], + //colors:[ '#012765','#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff'], + colors:['#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff','#012765'], + title: { + text: null, + }, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + }, + plotOptions: { + series: { + dataLabels: { + enabled: false, + format: '{point.name}' + }, + }, + pie:{ + borderColor: "", + size: "80%", + showInLegend: true, + point: { + events: { + mouseOver: function(e) { + this.slice(); + }, + // 鼠标移出时,收回突出显示 + mouseOut: function() { + this.slice(); + }, + // 默认是点击突出,这里屏蔽掉 + click: function() { + return false; + } + }, + }, + } + }, + credits:{//是否有highcharts水印 + enabled:false + }, + legend:{ + width:480, + x:50, + itemWidth:100, + itemDistance:2, + itemHoverStyle:{ + color:'#61D2F7', + }, + itemStyle:{ + color: '#fff', + fontFamily:'Microsoft YaHei', + } + }, + tooltip: { + enabled: true, + headerFormat: '{point.key}: {point.percentage:.1f}%
', + pointFormat: '{point.y} '+unit, + shared: true, + useHTML: true + }, + series: [{ + name: ' ', + colorByPoint: true, + data: data, + }], +// drilldown:{ +// activeAxisLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei', +// +// }, +// activeDataLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei' +// }, +// series:drillData, +// drillUpButton: { +// relativeTo: 'spacingBox', +// } +// } + }); +} +//网站流量分析-点击列表显示网站分类 +function echart_6(rs){ + var data=new Array(); +// var drillData=new Array(); + var unit="bytes"; + $(rs).each(function(i, d) { + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); +// var pktNum=new Array(); +// var byteLen=new Array(); + //协议图-操作系统 + data.push({ + name: d.domain, + y: parseFloat(inoctetsNum), +// drilldown: d.domain, + }); + +/* pktNum[0]="pktNum"; + pktNum[1]=parseInt(d.pktNum); + byteLen[0]="byteLen"; + byteLen[1]=parseInt(d.byteLen); + + drillData.push({ + name: d.domain, + id: d.domain, + type:'pie', + data: [pktNum,byteLen], + });*/ + + }); + // 创建图例 + var chart = Highcharts.chart('chart_4',{ + chart: { + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, + type: 'pie' + }, + /*navigation: { + buttonOptions: { + x:-5, + y: -10, + } + },*/ + exporting: { + allowHTML:true, + filename:'Website', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + } + }, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + }, + colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6'], + title: { + text: null, + }, + plotOptions: { + series: { + dataLabels: { + enabled: false, + format: '{point.name}' + }, + }, + pie:{ + borderColor: "", + showInLegend: true, + point: { + events: { + mouseOver: function(e) { // 鼠标滑过时动态更新标题 + this.slice(); + }, + // 鼠标移出时,收回突出显示 + mouseOut: function() { + this.slice(); + }, + // 默认是点击突出,这里屏蔽掉 + click: function() { + return false; + } + }, + }, + } + }, + credits:{//是否有highcharts水印 + enabled:false + }, + legend:{ + width:480, + x:50, + itemWidth:100, + itemDistance:2, + itemHoverStyle:{ + color:'#61D2F7', + }, + itemStyle:{ + color: '#fff', + fontFamily:'Microsoft YaHei', + } + }, + tooltip: { + enabled: true, + headerFormat: '{point.key}: {point.percentage:.1f}%
', + pointFormat: '{point.y} '+unit, + shared: true, + useHTML: true + }, + series: [{ + name: ' ', + colorByPoint: true, + data: data, + }], +// drilldown:{ +// activeAxisLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei', +// +// }, +// activeDataLabelStyle:{ +// textDecoration:'none', +// color: '#fff', +// fontStyle:'Microsoft YaHei' +// }, +// series:drillData, +// drillUpButton: { +// relativeTo: 'spacingBox', +// } +// } + }); +} +function echart_topic_domain(rs){ + var data=[{ + 'id': '0.0', +// 'parent': '', + 'name': 'TOPIC' + }]; + var unit="bytes"; + $(rs).each(function(i,d){ + var inoctetsNum=d.count; + unit=changeUnit(inoctetsNum); + inoctetsNum=changeNum(inoctetsNum); + data.push({ + 'id': '1.'+d.topicId, + 'parent': '0.0', + 'name': d.topic, + 'value':parseFloat(inoctetsNum) + }); + /****主题中的子域名*******/ + $(d.domainData).each(function(j,t){ + var domainNum=t.byteCount; + unit=changeUnit(domainNum); + domainNum=changeNum(domainNum); + if(domainNum>0){ + data.push({ + 'id': '2.'+t.webId, + 'parent': '1.'+d.topicId, + 'name': t.domain, + 'value':parseFloat(domainNum) + }); + } + }) + + }); + Highcharts.getOptions().colors.splice(0, 0, 'transparent'); + var chart = Highcharts.chart('chart_topic', { + chart: { + backgroundColor: 'rgba(255, 255, 255, 0)', + plotBackgroundColor:null, + plotBorderWidth:null, + plotShadow:false, + marginTop:50, + marginBottom:10, + }, + /* navigation: { + buttonOptions: { + x:-5, + y:15, + } + },*/ + exporting: { + allowHTML:true, + filename:'Topic', + chartOptions: { + plotOptions: { + series: { + dataLabels: { + enabled: true, + allowOverlap: true, // 允许数据标签重叠 + }, + }, + } + }, + buttons: exportingButton('#6e6379') + }, + //colors:[ '#44A9A8', '#f36f8a','#25f3e6','#ffff43','#964CEC','#32B0ED','#2b6ed7','#7278DD','#2DA9D8','#C66FE6','#0099cc','#cc0033','#ff6633','#99cccc','#d9f9d0'], +// colors:['#003078','#004bbc', '#015bb1', '#2f74b5', '#4186c1', '#0058e1','#066aff', '#5597cd', '#5c9dff', '#67a7de', '#77b5dc', '#98cde7','#89b9ff','#78adff'], +// colors:['#008ef9','#0594ff', '#002540', '#004679', '#025ba1', '#026fc0','#0279d5'], +// colors:['#002540','#004679','#025ba1', '#026fc0', '#0279d5', '#0086e9', '#008ef9','#0594ff', '#25a2ff', '#63bbff', '#88cbff'], + //colors:[ '#1C4573','#275A9C', '#306EB9', '#3579CE', '#3C85E1', '#3E8EF1','#4294F7', '#4294F7', '#98CBFA'], +// colors:['#012765','#01378e' ,'#014abd','#0156df','#0b68fe','#3481fe', '#5d9bfe','#85b4fe','#aecdff','#d6e6ff'], + colors:['#01378e','#013fa2','#014abd','#014ecb','#0156df','#015ef4','#0b68fe','#2075fe','#3481fe','#488efe','#5d9bfe','#71a7fe','#85b4fe','#9ac0fe','#aecdff','#d6e6ff','#012765','#012f7a'], +// colors:colors, + noData:{ + style: {//设置字体颜色 + color: '#fff', + }, + }, + title: { + text: null + }, + credits:{//是否有highcharts水印 + enabled:false + }, + series: [{ + type: "sunburst", + data: data, + allowDrillToNode: true, + cursor: 'pointer', + colorByPoint: true, + dataLabels: { + //format: '{point.name}', + /*formatter: function(){ + this.point.value = this.point.value.toFixed(2); + this.series.name = this.point.name; + console.info(this); + },*/ + filter: { + property: 'innerArcLength', + operator: '>', + value: 16 + } + }, + levels: [{ + level: 1, + levelIsConstant: false, + dataLabels: { + rotationMode: 'parallel', + filter: { + property: 'outerArcLength', + operator: '>', + value: 64 + } + } + }, { + level: 2, + colorByPoint: true, + dataLabels: { + rotationMode: 'parallel' + }, + }, + { + level: 3, + colorVariation: { + key: 'brightness', + to: 0.5 + } + }, { + level: 4, + colorVariation: { + key: 'brightness', + to: 0.5 + } + }] + + }], + plotOptions: { + sunburst: { + borderColor: "", + dataLabels: { + enabled: true, + style: {//设置字体颜色 + color: '#fff', + fontSize:'11px', + fontFamily:'Microsoft YaHei', + textOutline:'none', + fontWeight:'normal' + }, + format: '{point.name}', + } + } + }, + tooltip: { + headerFormat: "", + pointFormat: '{point.name} : {point.value:.2f} ' +unit + } + }); +} + +function exportingButton(color) { + var button = { + contextButton: { + symbolSize: 12, + symbolX: 11, + symbolY: 10, + symbolStroke: '#e6e6e6', + symbolFill: '#e6e6e6', + width: 21, + height: 20, + theme: { + 'stroke-width': 1, + stroke: '#e6e6e6', + r: 0, + fill: color, + states: { + hover: { + fill: color + }, + select: { + fill: color + } + } + } + } + }; + return button; +} diff --git a/src/main/webapp/static/pages/scripts/importExcel.js b/src/main/webapp/static/pages/scripts/importExcel.js index 98520db02..1a0cab3cb 100644 --- a/src/main/webapp/static/pages/scripts/importExcel.js +++ b/src/main/webapp/static/pages/scripts/importExcel.js @@ -20,7 +20,7 @@ $(function(){ if($(".requestIdSel").hasClass("hidden")){ $(".attributeSel").addClass("hidden"); $(".classifySel").addClass("hidden"); - + $("select[name='requestId']").empty(); if($(".appSelDiv").length == 0){ // 新增文件div上移 var fileDiv = $(".fileSelDiv").clone(); @@ -133,9 +133,10 @@ var importCfg=function(){ } var appFlag=true; if(($("#functionId").val() == 63)||($("#functionId").val() == 408)||($("#functionId").val() == 407)|| - ($("#functionId").val() == 402)||($("#functionId").val() == 403)||($("#functionId").val() == 405)){ + ($("#functionId").val() == 402)||($("#functionId").val() == 403)||($("#functionId").val() == 405) + ||($("#functionId").val() == 563)||($("#functionId").val() == 565)||($("#functionId").val() == 564)||($("#functionId").val() == 566)){ var appIdValue=$("#appIdName").val(); - if(appIdValue == null || appIdValue ==''){ + if(appIdValue == null || appIdValue =='' || typeof(appIdValue) == "undefined"){ appFlag=false; } } diff --git a/src/main/webapp/static/pages/scripts/jQuery.print.js b/src/main/webapp/static/pages/scripts/jQuery.print.js new file mode 100644 index 000000000..de758f7c4 --- /dev/null +++ b/src/main/webapp/static/pages/scripts/jQuery.print.js @@ -0,0 +1,279 @@ +/* @license + * jQuery.print, version 1.6.0 + * (c) Sathvik Ponangi, Doers' Guild + * Licence: CC-By (http://creativecommons.org/licenses/by/3.0/) + *--------------------------------------------------------------------------*/ +(function ($) { + "use strict"; + // A nice closure for our definitions + + function jQueryCloneWithSelectAndTextAreaValues(elmToClone, withDataAndEvents, deepWithDataAndEvents) { + // Replacement jQuery clone that also clones the values in selects and textareas as jQuery doesn't for performance reasons - https://stackoverflow.com/questions/742810/clone-isnt-cloning-select-values + // Based on https://github.com/spencertipping/jquery.fix.clone + var $elmToClone = $(elmToClone), + $result = $elmToClone.clone(withDataAndEvents, deepWithDataAndEvents), + $myTextareas = $elmToClone.find('textarea').add($elmToClone.filter('textarea')), + $resultTextareas = $result.find('textarea').add($result.filter('textarea')), + $mySelects = $elmToClone.find('select').add($elmToClone.filter('select')), + $resultSelects = $result.find('select').add($result.filter('select')), + i, l, j, m; + + for (i = 0, l = $myTextareas.length; i < l; ++i) { + $($resultTextareas[i]).val($($myTextareas[i]).val()); + } + for (i = 0, l = $mySelects.length; i < l; ++i) { + for (j = 0, m = $mySelects[i].options.length; j < m; ++j) { + if ($mySelects[i].options[j].selected === true) { + $resultSelects[i].options[j].selected = true; + } + } + } + return $result; + } + + function getjQueryObject(string) { + // Make string a vaild jQuery thing + var jqObj = $(""); + try { + jqObj = jQueryCloneWithSelectAndTextAreaValues(string); + } catch (e) { + jqObj = $("") + .html(string); + } + return jqObj; + } + + function printFrame(frameWindow, content, options) { + // Print the selected window/iframe + var def = $.Deferred(); + try { + frameWindow = frameWindow.contentWindow || frameWindow.contentDocument || frameWindow; + var wdoc = frameWindow.document || frameWindow.contentDocument || frameWindow; + if(options.doctype) { + wdoc.write(options.doctype); + } + wdoc.write(content); + wdoc.close(); + var printed = false, + callPrint = function () { + if(printed) { + return; + } + // Fix for IE : Allow it to render the iframe + frameWindow.focus(); + try { + // Fix for IE11 - printng the whole page instead of the iframe content + if (!frameWindow.document.execCommand('print', false, null)) { + // document.execCommand returns false if it failed -http://stackoverflow.com/a/21336448/937891 + frameWindow.print(); + } + // focus body as it is losing focus in iPad and content not getting printed + $('body').focus(); + } catch (e) { + frameWindow.print(); + } + frameWindow.close(); + printed = true; + def.resolve(); + }; + // Print once the frame window loads - seems to work for the new-window option but unreliable for the iframe + $(frameWindow).on("load", callPrint); + // Fallback to printing directly if the frame doesn't fire the load event for whatever reason + setTimeout(callPrint, options.timeout); + } catch (err) { + def.reject(err); + } + return def; + } + + function printContentInIFrame(content, options) { + var $iframe = $(options.iframe + ""); + var iframeCount = $iframe.length; + if (iframeCount === 0) { + // Create a new iFrame if none is given + $iframe = $('