diff --git a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java index 1e8c1a51f..87f8945c0 100644 --- a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java @@ -31,11 +31,14 @@ public class AppComplexFeatureCfg extends BaseCfg { */ private static final String tableName="app_complex_feature_cfg"; @Expose + @ExcelField(title="cfg_id",sort=0) private Integer compileId; private Integer appCode;//specific_service_cfg表一级节点的spec_service_code private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code private Integer specServiceId; + @ExcelField(title="district",sort=1) private String district; + @ExcelField(title="key_word",sort=201) private String cfgKeywords; private String appName; private List ipPortList = new ArrayList(); @@ -48,20 +51,54 @@ public class AppComplexFeatureCfg extends BaseCfg { this.cfgRegionCode1 = cfgRegionCode1; } + /** + * 表达式类型 + */ @Expose - @ExcelField(title="expression_type") + @ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=202) @SerializedName("exprType") protected Integer exprType ; - + /** + * 匹配方式 + */ @Expose - @ExcelField(title="match_method") + @ExcelField(title="match_method",dictType="MATCH_METHOD",sort=203) @SerializedName("matchMethod") protected Integer matchMethod ; - + /** + * 是否hex + */ + @ExcelField(title="is_hex",sort=204) + protected Integer isHex; + /** + * 是否hex + */ + @ExcelField(title="is_case_insenstive",sort=205) + protected Integer isCaseInsenstive; + /** + * 是否hex二进制 + */ @Expose - @ExcelField(title="whether_hexbinary") @SerializedName("isHexbin") protected Integer isHexbin; + + + + public Integer getIsHex() { + return isHex; + } + + public void setIsHex(Integer isHex) { + this.isHex = isHex; + } + + public Integer getIsCaseInsenstive() { + return isCaseInsenstive; + } + + public void setIsCaseInsenstive(Integer isCaseInsenstive) { + this.isCaseInsenstive = isCaseInsenstive; + } public Integer getExprType() { return exprType; diff --git a/src/main/java/com/nis/domain/configuration/AppDomainCfg.java b/src/main/java/com/nis/domain/configuration/AppDomainCfg.java index f0db9a873..074880f1c 100644 --- a/src/main/java/com/nis/domain/configuration/AppDomainCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppDomainCfg.java @@ -26,29 +26,66 @@ public class AppDomainCfg extends BaseCfg { private static final long serialVersionUID = -4685445179478960429L; private static final String tableName="app_domain_cfg"; @Expose + @ExcelField(title="cfg_id",sort=0) private Integer compileId; @Expose private String ratelimit; private Integer appCode;//specific_service_cfg表一级节点的spec_service_code private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code private Integer specServiceId; + @ExcelField(title="domain",sort=3) private String domain; private String cfgKeywords; + @ExcelField(title="social_app",sort=2) private String appName; + /** + * 表达式类型 + */ @Expose - @ExcelField(title="expression_type") + @ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=7) @SerializedName("exprType") protected Integer exprType ; - + /** + * 匹配方式 + */ @Expose - @ExcelField(title="match_method") + @ExcelField(title="match_method",dictType="MATCH_METHOD",sort=8) @SerializedName("matchMethod") protected Integer matchMethod ; @Expose - @ExcelField(title="whether_hexbinary") @SerializedName("isHexbin") protected Integer isHexbin; + + + /** + * 是否hex + */ + @ExcelField(title="is_hex",sort=5) + protected Integer isHex; + /** + * 是否hex + */ + @ExcelField(title="is_case_insenstive",sort=6) + protected Integer isCaseInsenstive; + + + + public Integer getIsHex() { + return isHex; + } + + public void setIsHex(Integer isHex) { + this.isHex = isHex; + } + + public Integer getIsCaseInsenstive() { + return isCaseInsenstive; + } + + public void setIsCaseInsenstive(Integer isCaseInsenstive) { + this.isCaseInsenstive = isCaseInsenstive; + } public Integer getExprType() { return exprType; diff --git a/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java b/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java index cfdb51fe3..634b736c5 100644 --- a/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java +++ b/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import java.util.List; import com.nis.domain.basics.AsnIpCfg; +import com.nis.util.excel.ExcelField; /** @@ -28,6 +29,7 @@ public class AppFeatureIndex extends BaseCfg { private static final long serialVersionUID = -8069201965300255275L; private static final String tableName="app_feature_index"; private Integer appCode;//specific_service_cfg表一级节点的spec_service_code + @ExcelField(title="social_app",sort=2) private String appName; private Integer specServiceId; private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code diff --git a/src/main/java/com/nis/domain/configuration/AppHttpCfg.java b/src/main/java/com/nis/domain/configuration/AppHttpCfg.java index 61b60d52b..32c093c3b 100644 --- a/src/main/java/com/nis/domain/configuration/AppHttpCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppHttpCfg.java @@ -26,30 +26,68 @@ public class AppHttpCfg extends BaseCfg { private static final long serialVersionUID = 7528723915857911560L; private static final String tableName="app_http_cfg"; @Expose + @ExcelField(title="cfg_id",sort=0) private Integer compileId; @Expose private String ratelimit; private Integer appCode;//specific_service_cfg表一级节点的spec_service_code private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code private Integer specServiceId; + @ExcelField(title="district",sort=3) private String district; + @ExcelField(title="key_word",sort=4) private String cfgKeywords; + @ExcelField(title="social_app",sort=2) private String appName; + + /** + * 表达式类型 + */ @Expose - @ExcelField(title="expression_type") + @ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=7) @SerializedName("exprType") protected Integer exprType ; - + /** + * 匹配方式 + */ @Expose - @ExcelField(title="match_method") + @ExcelField(title="match_method",dictType="MATCH_METHOD",sort=8) @SerializedName("matchMethod") protected Integer matchMethod ; @Expose - @ExcelField(title="whether_hexbinary") @SerializedName("isHexbin") protected Integer isHexbin; + + + /** + * 是否hex + */ + @ExcelField(title="is_hex",sort=5) + protected Integer isHex; + /** + * 是否hex + */ + @ExcelField(title="is_case_insenstive",sort=6) + protected Integer isCaseInsenstive; + + + public Integer getIsHex() { + return isHex; + } + + public void setIsHex(Integer isHex) { + this.isHex = isHex; + } + + public Integer getIsCaseInsenstive() { + return isCaseInsenstive; + } + + public void setIsCaseInsenstive(Integer isCaseInsenstive) { + this.isCaseInsenstive = isCaseInsenstive; + } public Integer getExprType() { return exprType; diff --git a/src/main/java/com/nis/domain/configuration/AppIpCfg.java b/src/main/java/com/nis/domain/configuration/AppIpCfg.java index 22e93fefe..713bf6f03 100644 --- a/src/main/java/com/nis/domain/configuration/AppIpCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppIpCfg.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.excel.ExcelField; /** * @Description: APP策略配置 @@ -18,21 +19,26 @@ public class AppIpCfg extends BaseCfg { private static final long serialVersionUID = 4758285716968228089L; private static final String tableName="app_ip_cfg"; @Expose + @ExcelField(title="cfg_id",sort=0) private Integer compileId; @Expose private String ratelimit; private Integer appCode;//specific_service_cfg表一级节点的spec_service_code private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code private Integer specServiceId; + @ExcelField(title="social_app",sort=2) private String appName; @Expose + @ExcelField(title="ip_type",dictType="IP_TYPE",sort=3) @SerializedName("ipType") protected Integer ipType; protected Integer ipPattern; protected String srcIpAddress; + @ExcelField(title="server_ip",sort=4) protected String destIpAddress; protected Integer portPattern; protected String srcPort; + @ExcelField(title="server_port",sort=5) protected String destPort; /** @@ -45,6 +51,7 @@ public class AppIpCfg extends BaseCfg { * 方向 */ @Expose + @ExcelField(title="protocol",dictType="PROTOCOL",sort=6) @SerializedName("protocol") protected Integer protocol ; /** diff --git a/src/main/java/com/nis/domain/configuration/AppSslCertCfg.java b/src/main/java/com/nis/domain/configuration/AppSslCertCfg.java index ecc4d1510..7287b7491 100644 --- a/src/main/java/com/nis/domain/configuration/AppSslCertCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppSslCertCfg.java @@ -25,30 +25,68 @@ public class AppSslCertCfg extends BaseCfg { private static final long serialVersionUID = -4366457794248757698L; private static final String tableName="app_ssl_cert_cfg"; @Expose + @ExcelField(title="cfg_id",sort=0) private Integer compileId; @Expose private String ratelimit; private Integer appCode;//specific_service_cfg表一级节点的spec_service_code private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code private Integer specServiceId; + @ExcelField(title="district",sort=3) private String district; + @ExcelField(title="key_word",sort=4) private String cfgKeywords; + @ExcelField(title="social_app",sort=2) private String appName; + + /** + * 表达式类型 + */ @Expose - @ExcelField(title="expression_type") + @ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=7) @SerializedName("exprType") protected Integer exprType ; - + /** + * 匹配方式 + */ @Expose - @ExcelField(title="match_method") + @ExcelField(title="match_method",dictType="MATCH_METHOD",sort=8) @SerializedName("matchMethod") protected Integer matchMethod ; @Expose - @ExcelField(title="whether_hexbinary") @SerializedName("isHexbin") protected Integer isHexbin; + + + /** + * 是否hex + */ + @ExcelField(title="is_hex",sort=5) + protected Integer isHex; + /** + * 是否hex + */ + @ExcelField(title="is_case_insenstive",sort=6) + protected Integer isCaseInsenstive; + + + public Integer getIsHex() { + return isHex; + } + + public void setIsHex(Integer isHex) { + this.isHex = isHex; + } + + public Integer getIsCaseInsenstive() { + return isCaseInsenstive; + } + + public void setIsCaseInsenstive(Integer isCaseInsenstive) { + this.isCaseInsenstive = isCaseInsenstive; + } public Integer getExprType() { return exprType; diff --git a/src/main/java/com/nis/domain/configuration/AppTopicDomainCfg.java b/src/main/java/com/nis/domain/configuration/AppTopicDomainCfg.java index 8084d7946..ebd519770 100644 --- a/src/main/java/com/nis/domain/configuration/AppTopicDomainCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppTopicDomainCfg.java @@ -28,30 +28,63 @@ public class AppTopicDomainCfg extends BaseCfg { @Expose private String ratelimit; // private Integer appCode;//specific_service_cfg表一级节点的spec_service_code + @ExcelField(title="website_server",dictType="WEBSITE_SERVER",sort=3) private Long websiteServiceId;//specific_service_cfg表二级节点的spec_service_code private Integer specServiceId; + @ExcelField(title="domain",sort=4) private String domain; private String cfgKeywords; private String appName; + @ExcelField(title="topic",dictType="TOPIC",sort=2) private Long topicId; + /** + * 表达式类型 + */ @Expose - @ExcelField(title="expression_type") + @ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=7) @SerializedName("exprType") protected Integer exprType ; - + /** + * 匹配方式 + */ @Expose - @ExcelField(title="match_method") + @ExcelField(title="match_method",dictType="MATCH_METHOD",sort=8) @SerializedName("matchMethod") protected Integer matchMethod ; @Expose - @ExcelField(title="whether_hexbinary") @SerializedName("isHexbin") protected Integer isHexbin; + + /** + * 是否hex + */ + @ExcelField(title="is_hex",sort=5) + protected Integer isHex; + /** + * 是否hex + */ + @ExcelField(title="is_case_insenstive",sort=6) + protected Integer isCaseInsenstive; + public Integer getIsHex() { + return isHex; + } + + public void setIsHex(Integer isHex) { + this.isHex = isHex; + } + + public Integer getIsCaseInsenstive() { + return isCaseInsenstive; + } + + public void setIsCaseInsenstive(Integer isCaseInsenstive) { + this.isCaseInsenstive = isCaseInsenstive; + } public Long getTopicId() { return topicId; diff --git a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java index 2528652fb..ddc0a52ef 100644 --- a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java @@ -200,5 +200,14 @@ public class BaseStringCfg extends BaseCfg { } return list; } + + public static List baseHexList(List list){ + for (int i = 0; i < list.size(); i++) { + BaseStringCfg base=(BaseStringCfg)list.get(i); + base.setIsHex(base.getIsHexbin()); + base.setIsCaseInsenstive(base.getIsHexbin()); + } + return list; + } } diff --git a/src/main/java/com/nis/domain/configuration/DnsIpCfg.java b/src/main/java/com/nis/domain/configuration/DnsIpCfg.java index 061bd05a3..e83061beb 100644 --- a/src/main/java/com/nis/domain/configuration/DnsIpCfg.java +++ b/src/main/java/com/nis/domain/configuration/DnsIpCfg.java @@ -13,6 +13,7 @@ import java.util.Date; import com.google.gson.annotations.Expose; import com.nis.domain.BaseEntity; import com.nis.domain.SysUser; +import com.nis.util.excel.ExcelField; /** * @ClassName: DnsIpConfig.java @@ -27,6 +28,7 @@ public class DnsIpCfg extends BaseIpCfg { */ private static final long serialVersionUID = 8149437730819674317L; private String indexTable="dns_ip_cfg"; + @ExcelField(title="group",sort=3) private String dnsStrategyName; private Integer dnsStrategyId; diff --git a/src/main/java/com/nis/domain/configuration/DnsResStrategy.java b/src/main/java/com/nis/domain/configuration/DnsResStrategy.java index c2a07db69..b74add6d3 100644 --- a/src/main/java/com/nis/domain/configuration/DnsResStrategy.java +++ b/src/main/java/com/nis/domain/configuration/DnsResStrategy.java @@ -2,6 +2,8 @@ package com.nis.domain.configuration; import javax.net.ssl.KeyManager; +import com.nis.util.excel.ExcelField; + /** * dns响应策略配置 * @author dell @@ -14,6 +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) private Integer resGroup1Num; private Integer resGroup2Id; private Integer resGroup2Num; @@ -25,7 +28,11 @@ public class DnsResStrategy extends BaseCfg { private Integer resGroup5Num; private Integer minTtl; private Integer maxTtl; + @ExcelField(title="group",sort=2) private String group1Name; + @ExcelField(title="min_ttl",sort=4) + private String miTtlmax; + @Override public void initDefaultValue() { this.resGroup2Id=0; @@ -37,6 +44,18 @@ public class DnsResStrategy extends BaseCfg { this.resGroup5Id=0; this.resGroup5Num=0; } + + + public String getMiTtlmax() { + return miTtlmax; + } + + + public void setMiTtlmax(String miTtlmax) { + this.miTtlmax = miTtlmax; + } + + public Integer getResGroup1Id() { return resGroup1Id; } diff --git a/src/main/java/com/nis/domain/configuration/PxyObjKeyring.java b/src/main/java/com/nis/domain/configuration/PxyObjKeyring.java index cc43962f9..987bfc41d 100644 --- a/src/main/java/com/nis/domain/configuration/PxyObjKeyring.java +++ b/src/main/java/com/nis/domain/configuration/PxyObjKeyring.java @@ -2,6 +2,8 @@ package com.nis.domain.configuration; import java.util.Date; +import com.nis.util.excel.ExcelField; + /** * 拦截证书策略 * @author dell @@ -14,16 +16,34 @@ public class PxyObjKeyring extends BaseCfg { */ private static final long serialVersionUID = -2720862431960415564L; private String indexTable="pxy_obj_keyring"; + @ExcelField(title="keyring_type",dictType="INTERCEPT_CERTIFICATE_TYPE",sort=2) private String keyringType; + @ExcelField(title="private_key_file",sort=3) private String privateKeyFile; + @ExcelField(title="public_key_file",sort=4) private String publicKeyFile; + @ExcelField(title="expire_after",sort=5) private Integer expireAfter; private String publicKeyAlgo; private String crl; + @ExcelField(title="issuer",sort=6) private String issuer; + @ExcelField(title="not_before_time",sort=8) private Date notBeforeTime; + @ExcelField(title="not_after_time",sort=9) private Date notAfterTime; + @ExcelField(title="certificate_subject",sort=7) private String subject; + @ExcelField(title="keyring_name",sort=1) + private String keyringName; + + + public String getKeyringName() { + return keyringName; + } + public void setKeyringName(String keyringName) { + this.keyringName = keyringName; + } public String getKeyringType() { return keyringType; } 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 c4628008f..ef2c5770c 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.taglibs.standard.functions.Functions; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; @@ -36,6 +37,9 @@ import com.nis.domain.configuration.AppPolicyCfg; import com.nis.domain.configuration.AppSslCertCfg; import com.nis.domain.configuration.AppTcpCfg; import com.nis.domain.configuration.AppTopicDomainCfg; +import com.nis.domain.configuration.AvFileSampleCfg; +import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.DdosIpCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.configuration.WebsiteDomainTopic; @@ -1481,12 +1485,13 @@ public class AppCfgController extends BaseController { noExportMap.put("NTC_IP", ipPortInfoNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); for (AppPolicyCfg cfg : page.getList()) { AppPolicyCfg cfgIndexInfo=appCfgService.exportIpInfo(cfg); ipList.addAll(cfgIndexInfo.getIpPortList()); subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList()); } + subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); dataMap.put(entity.getMenuNameCode(), page.getList()); dataMap.put("NTC_IP", ipList); dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); @@ -1500,6 +1505,252 @@ public class AppCfgController extends BaseController { //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(); + /*//导出选中记录 + * 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"); + 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 = appCfgService.findAppTopicDomainList(pageInfo, entity); + for (int i = 0; i < page.getList().size(); i++) { + AppTopicDomainCfg appTop=page.getList().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,action,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("top export failed",e); + addMessage(redirectAttributes, "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(); + + + /*//导出选中记录 + * 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"); + 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 = appCfgService.findAppIpList(pageInfo, entity); + for(AppIpCfg appIp:page.getList()){ + 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,action,client_port,ir_type,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("appIp export failed",e); + addMessage(redirectAttributes, "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(); + + + /*//导出选中记录 + * 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"); + 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 = appCfgService.findAppHttpList(pageInfo, entity); + for(AppHttpCfg http:page.getList()){ + 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,action,client_port,ir_type,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("http export failed",e); + addMessage(redirectAttributes, "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(); + + + /*//导出选中记录 + * 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"); + 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 = appCfgService.findAppDomainList(pageInfo, entity); + for(AppDomainCfg domain:page.getList()){ + 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,action,client_port,ir_type,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("http export failed",e); + addMessage(redirectAttributes, "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(); + + + /*//导出选中记录 + * 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"); + 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 = appCfgService.findAppSslList(pageInfo, entity); + for(AppSslCertCfg ssl:page.getList()){ + 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,action,client_port,ir_type,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("App ssl export failed",e); + addMessage(redirectAttributes, "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 6e8234f66..f500c6606 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.taglibs.standard.functions.Functions; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; @@ -24,6 +25,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.nis.domain.FunctionRegionDict; import com.nis.domain.Page; import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.configuration.AppBuiltInFeatureFile; @@ -39,6 +41,8 @@ import com.nis.domain.configuration.AppSslCertCfg; import com.nis.domain.configuration.AppStringFeatureCfg; import com.nis.domain.configuration.AppTcpCfg; import com.nis.domain.configuration.AppTopicDomainCfg; +import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.configuration.WebsiteDomainTopic; @@ -236,7 +240,8 @@ public class AppFeatureCfgController extends BaseController { for(AppComplexFeatureCfg cfg:complexList){ if(!cfg.getCfgType().equals(cfgType)){ tabList.add(new String[]{"3",cfg.getCfgType()}); - cfgType = cfg.getCfgType(); + cfgType = cfg.getCfgType();0. + } } }*/ @@ -244,4 +249,113 @@ public class AppFeatureCfgController extends BaseController { model.addAttribute("tabList", tabList); return "/cfg/app/appSubFeatureList"; } + + //appfeature配置导出 + @RequestMapping(value = "exportFeature") + public void exportAppSsl(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(); + + + /*//导出选中记录 + * 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"); + 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 = appMultiFeatureCfgService.findAppFeatureIndexList(pageInfo, entity); + for(AppFeatureIndex feature:page.getList()){ + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(feature.getSpecServiceId()); + feature.setAppName(app.getSpecServiceName()); + } + String cfgIndexInfoNoExport=",letter,whether_area_block,classification,attribute,label,do_log,action,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; + String appComplexNoExport=",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 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,"; + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), AppFeatureIndex.class); + noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); + List ipList=new ArrayList(); + List keywordList=new ArrayList(); + for (AppFeatureIndex cfg : page.getList()) { + Map maps=appMultiFeatureCfgService.exportFeature(cfg); + keywordList.addAll(maps.get("APP_KEYWORDS")); + ipList.addAll(maps.get("APP_IP_RANGE")); + } + keywordList=replaceKeyList(keywordList); + dataMap.put(entity.getMenuNameCode(), page.getList()); + if(entity.getFunctionId()!=564 && entity.getFunctionId()!=567 ){ + 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){ + 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){ + appComplexNoExport=appComplexNoExport+"district,"; + titleList.add("APP_DK_GL"); + classMap.put("APP_DK_GL", AppComplexFeatureCfg.class); + noExportMap.put("APP_DK_GL",appComplexNoExport); + dataMap.put("APP_DK_GL", keywordList); + } + } + + /*}*/ + this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); + } catch (Exception e) { + logger.error("Appfeature export failed",e); + addMessage(redirectAttributes, "export_failed"); + } + //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } + + public static List replaceKeyList(List list){ + for (int i = 0; i < list.size(); i++) { + AppComplexFeatureCfg base=(AppComplexFeatureCfg)list.get(i); + base.setIsHex(base.getIsHexbin()); + base.setIsCaseInsenstive(base.getIsHexbin()); + 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 43a54c807..b471eefa2 100644 --- a/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java +++ b/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java @@ -19,6 +19,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.nis.domain.Page; import com.nis.domain.configuration.AppPolicyCfg; +import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; @@ -268,12 +269,13 @@ public class BasicProtocolController extends BaseController { noExportMap.put("NTC_IP", ipPortInfoNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); for (AppPolicyCfg cfg : page.getList()) { AppPolicyCfg cfgIndexInfo=appCfgService.exportIpInfo(cfg); ipList.addAll(cfgIndexInfo.getIpPortList()); subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList()); } + subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); dataMap.put(entity.getMenuNameCode(), page.getList()); dataMap.put("NTC_IP", ipList); dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); 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 79bba6407..bd74540a9 100644 --- a/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java +++ b/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java @@ -20,6 +20,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.nis.domain.Page; import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.configuration.AppPolicyCfg; +import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.specific.SpecificServiceCfg; @@ -306,12 +307,13 @@ public class EncryptedTunnelBehaviorController extends BaseController { noExportMap.put("NTC_IP", ipPortInfoNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); for (AppPolicyCfg cfg : page.getList()) { AppPolicyCfg cfgIndexInfo=appCfgService.exportIpInfo(cfg); ipList.addAll(cfgIndexInfo.getIpPortList()); subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList()); } + subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); dataMap.put(entity.getMenuNameCode(), page.getList()); dataMap.put("NTC_IP", ipList); dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList); 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 331d08418..5ececa34d 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 @@ -1,7 +1,11 @@ package com.nis.web.controller.configuration.maintenance; +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; @@ -20,9 +24,11 @@ import com.nis.domain.basics.ServiceDictInfo; import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.DnsIpCfg; import com.nis.domain.configuration.DnsResStrategy; +import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.DnsIpCfg; import com.nis.domain.configuration.RequestInfo; import com.nis.exceptions.MaatConvertException; +import com.nis.util.Constants; import com.nis.util.StringUtil; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; @@ -110,4 +116,55 @@ public class DnsIpCfgController extends BaseController { return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId; } + + //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(); + + + /*//导出选中记录 + * 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"); + 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 = dnsIpCfgService.findPage(pageInfo, entity); + for (int i = 0; i < page.getList().size(); i++) { + if(StringUtil.isEmpty(page.getList().get(i).getDnsStrategyName())){ + Properties msgProp = getMsgProp(); + page.getList().get(i).setDnsStrategyName(msgProp.getProperty("default_group")); + } + } + model.addAttribute("page", page); + 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(), page.getList()); + /*}*/ + this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); + } catch (Exception e) { + logger.error("DnsIp export failed",e); + addMessage(redirectAttributes, "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 73bc636eb..9f45c9bb4 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 @@ -1,12 +1,16 @@ package com.nis.web.controller.configuration.maintenance; +import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.taglibs.standard.functions.Functions; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; @@ -16,8 +20,12 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.nis.domain.Page; import com.nis.domain.basics.PolicyGroupInfo; +import com.nis.domain.configuration.AppSslCertCfg; import com.nis.domain.configuration.DnsResStrategy; +import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.specific.SpecificServiceCfg; import com.nis.exceptions.MaatConvertException; +import com.nis.util.Constants; import com.nis.util.StringUtil; import com.nis.web.controller.BaseController; @@ -135,4 +143,52 @@ public class DnsResStrategyController extends BaseController { return true; } } + + //dns配置导出 + @RequestMapping(value = "exportDns") + 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(); + + + /*//导出选中记录 + * 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"); + 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 = dnsResStrategyService.findPage(pageInfo, entity); + for (int i = 0; i < page.getList().size(); i++) { + page.getList().get(i).setMiTtlmax(String.valueOf(page.getList().get(i).getMinTtl())+"-"+String.valueOf(page.getList().get(i).getMaxTtl())); + } + model.addAttribute("page", page); + titleList.add(entity.getMenuNameCode()); + classMap.put(entity.getMenuNameCode(), DnsResStrategy.class); + String cfgIndexInfoNoExport=",valid_identifier,do_log,client_port,ir_type,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("Dns export failed",e); + addMessage(redirectAttributes, "export_failed"); + } + //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } } 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 69a4a9668..15e41c1df 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 @@ -940,7 +940,7 @@ public class AvContentController extends BaseController { noExportMap.put("NTC_STREAMING_MEDIA_URL", regionCfgNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); List streamurlList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { Map maps=avContentCfgService.exportstream(cfg); @@ -948,6 +948,7 @@ public class AvContentController extends BaseController { 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(), page.getList()); dataMap.put("NTC_UNIVERSAL_IP", ipList); @@ -1029,7 +1030,7 @@ public class AvContentController extends BaseController { noExportMap.put("NTC_VOIP_ACCOUNT", regionCfgNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); List countlList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { Map maps=avContentCfgService.exportvoip(cfg); @@ -1038,6 +1039,7 @@ public class AvContentController extends BaseController { subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID")); } countlList=BaseStringCfg.replaceBaseKeyList(countlList); + subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); dataMap.put(entity.getMenuNameCode(), page.getList()); dataMap.put("NTC_UNIVERSAL_IP", ipList); dataMap.put("NTC_VOIP_ACCOUNT", countlList); 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 a34fccd5c..fed7c5bdc 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 @@ -207,7 +207,7 @@ public class BgpCfgController extends BaseController{ noExportMap.put("NTC_BGP_AS", regionCfgNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); List asInfoList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { CfgIndexInfo cfgIndexInfo=bgpCfgService.exportbgp(cfg); @@ -216,6 +216,7 @@ public class BgpCfgController extends BaseController{ asInfoList.addAll(cfgIndexInfo.getNtcBgpAsCfgList()); } asInfoList=BaseStringCfg.replaceBaseKeyList(asInfoList); + subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); dataMap.put(entity.getMenuNameCode(), page.getList()); dataMap.put("NTC_IP", ipList); dataMap.put("NTC_BGP_AS", asInfoList); 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 75bfb7dde..54a56377a 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 @@ -520,7 +520,7 @@ public class FileTransferCfgController extends BaseController{ noExportMap.put("NTC_FTP_CONTENT", regionCfgNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); List ftpkeyList=new ArrayList(); List ftpurlList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { @@ -530,6 +530,7 @@ public class FileTransferCfgController extends BaseController{ 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(), page.getList()); @@ -612,7 +613,7 @@ public class FileTransferCfgController extends BaseController{ noExportMap.put("NTC_P2P_HASH_BIN", hashCfgNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); List hashList=new ArrayList(); List keywordList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { @@ -622,6 +623,7 @@ public class FileTransferCfgController extends BaseController{ 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(), page.getList()); 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 d6a17689b..e96778e8e 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 @@ -24,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.nis.domain.Page; +import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.FileDigestCfg; @@ -242,7 +243,7 @@ public class MailCfgController extends BaseController{ noExportMap.put("NTC_MAIL_HDR", regionCfgNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); List mailBodyList=new ArrayList(); List mailReqHdrList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { @@ -252,6 +253,9 @@ public class MailCfgController extends BaseController{ 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); 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 806ea7f85..f164316e1 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 @@ -522,130 +522,131 @@ public class WebsiteController 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 = websiteCfgService.getWebsiteList(pageInfo, entity); - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_HTTP_URL"); - titleList.add("NTC_HTTP_REQ_HDR"); - titleList.add("NTC_HTTP_RES_HDR"); - titleList.add("NTC_HTTP_REQ_BODY"); - titleList.add("NTC_HTTP_RES_BODY"); - titleList.add("NTC_UNIVERSAL_IP"); - titleList.add("NTC_SUBSCRIBE_ID"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_HTTP_URL", HttpUrlCfg.class); - classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class); - classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class); - classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class); - classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class); - classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); - classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class); - 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,"; - noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); - noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport); - noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport); - noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport); - noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport); - noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport); - noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport); - noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); - - 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=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")); + //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 = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity); + titleList.add(entity.getMenuNameCode()); + titleList.add("NTC_HTTP_URL"); + titleList.add("NTC_HTTP_REQ_HDR"); + titleList.add("NTC_HTTP_RES_HDR"); + titleList.add("NTC_HTTP_REQ_BODY"); + titleList.add("NTC_HTTP_RES_BODY"); + titleList.add("NTC_UNIVERSAL_IP"); + titleList.add("NTC_SUBSCRIBE_ID"); + classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); + classMap.put("NTC_HTTP_URL", HttpUrlCfg.class); + classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class); + classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class); + classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class); + classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class); + classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class); + classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class); + 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,"; + noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); + noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport); + noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport); + noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport); + noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport); + noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport); + noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport); + noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); + + 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=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); + dataMap.put(entity.getMenuNameCode(), page.getList()); + dataMap.put("NTC_HTTP_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_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"); } - httpUrlList=BaseStringCfg.replaceBaseKeyList(httpUrlList); - httpReqHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpReqHdrList); - httpResHdrList=ComplexkeywordCfg.replaceComplexKeyList(httpResHdrList); - httpReqBodyList=BaseStringCfg.replaceBaseKeyList(httpReqBodyList); - httpResBodyList=BaseStringCfg.replaceBaseKeyList(httpResBodyList); - dataMap.put(entity.getMenuNameCode(), page.getList()); - dataMap.put("NTC_HTTP_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_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"); - } - return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId(); - } + return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId(); + } //dns配置导出 @RequestMapping(value = "exportdns") @@ -681,12 +682,16 @@ public class WebsiteController extends BaseController{ Properties msgProp = getMsgProp(); if(page.getList().get(i).getDnsStrategyId()!=null && page.getList().get(i).getDnsStrategyId()!=0){ List resStrategys=dnsResStrategyService.findDnsResStrategys(page.getList().get(i).getDnsStrategyId(), 1,1); - String msg= msgProp.getProperty(resStrategys.get(0).getCfgDesc()); + if(resStrategys!=null && resStrategys.size()>0){ + String msg= msgProp.getProperty(resStrategys.get(0).getCfgDesc()); if(!StringUtil.isEmpty(msg)){ page.getList().get(i).setDnsStrategyName(msg); }else{ page.getList().get(i).setDnsStrategyName(resStrategys.get(0).getCfgDesc()); } + }else{ + page.getList().get(i).setDnsStrategyName(msgProp.getProperty("no_strategy")); + } }else{ page.getList().get(i).setDnsStrategyName(msgProp.getProperty("no_strategy")); } @@ -717,7 +722,7 @@ public class WebsiteController extends BaseController{ noExportMap.put("NTC_DNS_REGION", regionCfgNoExport); noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport); List ipList=new ArrayList(); - List subscribeInfoList=new ArrayList(); + List subscribeInfoList=new ArrayList(); List regionInfoList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { CfgIndexInfo cfgIndexInfo=websiteCfgService.exportdns(cfg); @@ -725,6 +730,8 @@ public class WebsiteController extends BaseController{ subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList()); regionInfoList.addAll(cfgIndexInfo.getDomainList()); } + subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList); + regionInfoList=ComplexkeywordCfg.replaceComplexKeyList(regionInfoList); dataMap.put(entity.getMenuNameCode(), page.getList()); dataMap.put("NTC_IP", ipList); dataMap.put("NTC_DNS_REGION", regionInfoList); @@ -805,7 +812,7 @@ public class WebsiteController extends BaseController{ List sslSnaList = new ArrayList<>(); List sslCnList = new ArrayList<>(); List ipPortList = new ArrayList<>(); - List subscribeIdList = new ArrayList<>(); + List subscribeIdList = new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { Map maps=websiteCfgService.exportssl(cfg); sslSniList.addAll(maps.get("NTC_SSL_SNI")); @@ -817,6 +824,7 @@ public class WebsiteController extends BaseController{ sslSniList=BaseStringCfg.replaceBaseKeyList(sslSniList); sslSnaList=BaseStringCfg.replaceBaseKeyList(sslSnaList); sslCnList=BaseStringCfg.replaceBaseKeyList(sslCnList); + subscribeIdList=BaseStringCfg.baseHexList(subscribeIdList); dataMap.put(entity.getMenuNameCode(), page.getList()); dataMap.put("NTC_UNIVERSAL_IP", ipPortList); dataMap.put("NTC_SSL_SNI", sslSniList); 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 4106d90d8..3bb87362b 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 @@ -254,117 +254,117 @@ public class WhiteListController extends CommonController{ } //ip配置导出 - @RequestMapping(value = "exportIpAddr") - public void exportIp(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(); - - - /*//导出选中记录 - * 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"); - 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 = ipCfgService.getIpCfgList(pageInfo, entity); - titleList.add(entity.getMenuNameCode()); - titleList.add("NTC_IP"); - classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("NTC_IP", IpPortCfg.class); - String cfgIndexInfoNoExport=",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 : page.getList()) { - CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg); - ipList.addAll(cfgIndexInfo.getIpPortList()); - } - dataMap.put(entity.getMenuNameCode(), page.getList()); - 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, "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(); - - - /*//导出选中记录 - * 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"); - 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 = domainService.getDomainList(pageInfo, entity); - 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 : page.getList()) { - CfgIndexInfo cfgIndexInfo=domainService.exportDomainInfo(cfg); - httpurlList.addAll(cfgIndexInfo.getHttpUrlList()); - } - httpurlList=BaseStringCfg.replaceBaseKeyList(httpurlList); - dataMap.put(entity.getMenuNameCode(), page.getList()); - 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, "export_failed"); - } - //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + @RequestMapping(value = "exportIpAddr") + public void exportIp(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(); + + + /*//导出选中记录 + * 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"); + 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 = ipCfgService.getIpCfgList(pageInfo, entity); + 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 : page.getList()) { + CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg); + ipList.addAll(cfgIndexInfo.getIpPortList()); + } + dataMap.put(entity.getMenuNameCode(), page.getList()); + 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, "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(); + + + /*//导出选中记录 + * 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"); + 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 = domainService.getDomainList(pageInfo, entity); + 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 : page.getList()) { + CfgIndexInfo cfgIndexInfo=domainService.exportDomainInfo(cfg); + httpurlList.addAll(cfgIndexInfo.getHttpUrlList()); + } + httpurlList=BaseStringCfg.replaceBaseKeyList(httpurlList); + dataMap.put(entity.getMenuNameCode(), page.getList()); + 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, "export_failed"); + } + //return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId(); + } } 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 39ac83275..93c87c666 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 @@ -2,7 +2,9 @@ package com.nis.web.controller.configuration.proxy; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -16,9 +18,12 @@ 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.FunctionRegionDict; import com.nis.domain.Page; import com.nis.domain.callback.ProxyFileStrategyCfg; +import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; +import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.HttpBodyCfg; import com.nis.domain.configuration.HttpReqHeadCfg; import com.nis.domain.configuration.HttpResHeadCfg; @@ -27,6 +32,7 @@ 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; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; @@ -230,4 +236,132 @@ public class HttpRedirectPolicyController extends BaseController{ } return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+functionId; } + + + //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 = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity); + 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,"; + 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=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(), 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"); + } + 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 8afb41a11..8fe99e141 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 @@ -23,6 +23,7 @@ import com.nis.domain.Page; import com.nis.domain.SysUser; import com.nis.domain.configuration.BaseStringCfg; 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.PxyObjKeyring; @@ -218,12 +219,8 @@ public class InterceptController extends CommonController{ } Page page = ipCfgService.getIpCfgList(pageInfo, entity); titleList.add(entity.getMenuNameCode()); - titleList.add("PXY_INTERCEPT_IP"); - titleList.add("PXY_INTERCEPT_PKT_BIN"); classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); - classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class); - classMap.put("PXY_INTERCEPT_PKT_BIN", InterceptPktBin.class); - String cfgIndexInfoNoExport=",group_name,userregion4,userregion5,"; + String cfgIndexInfoNoExport=",policy_name,group_name,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" @@ -232,25 +229,43 @@ public class InterceptController extends CommonController{ + ",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,"; noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport); - noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport); - noExportMap.put("PXY_INTERCEPT_PKT_BIN", interceptNoExport); List ipList=new ArrayList(); - List interInfoList=new ArrayList(); + List httpUrlList=new ArrayList(); + List pktBinList=new ArrayList(); for (CfgIndexInfo cfg : page.getList()) { - CfgIndexInfo cfgIndexInfo=interceptCfgService.exportIpInfo(cfg); - if(cfgIndexInfo.getIpPortList()!=null){ - ipList.addAll(cfgIndexInfo.getIpPortList()); - } - if(cfgIndexInfo.getInterceptPktBinList()!=null){ - interInfoList.addAll(cfgIndexInfo.getInterceptPktBinList()); - } + 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")); } - interInfoList=BaseStringCfg.replaceBaseKeyList(interInfoList); + pktBinList=BaseStringCfg.replaceBaseKeyList(pktBinList); + httpUrlList=BaseStringCfg.baseHexList(httpUrlList); dataMap.put(entity.getMenuNameCode(), page.getList()); - dataMap.put("PXY_INTERCEPT_IP", ipList); - dataMap.put("PXY_INTERCEPT_PKT_BIN", interInfoList); - + if(entity.getFunctionId()==212){ //IP Payload + 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拦截 + 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){//域名拦截 + titleList.add("NTC_HTTP_URL"); + classMap.put("NTC_HTTP_URL", HttpUrlCfg.class); + noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport); + dataMap.put("NTC_HTTP_URL", httpUrlList); + } /*}*/ this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap); } catch (Exception e) { 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 b45511248..4d7ee386f 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 @@ -6,7 +6,9 @@ import java.security.KeyStore; import java.security.Principal; import java.security.SecureRandom; import java.security.cert.X509Certificate; +import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; @@ -30,6 +32,8 @@ 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.DnsResStrategy; +import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.PxyObjKeyring; import com.nis.domain.maat.ToMaatResult; import com.nis.domain.maat.ToMaatResult.ResponseData; @@ -288,4 +292,53 @@ public class PxyObjKeyringController extends BaseController { return true; } } + + + //pxyObjKeyring配置导出 + @RequestMapping(value = "exportPxy") + public void exportDns(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(); + + + /*//导出选中记录 + * 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"); + 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 = pxyObjKeyringService.findPage(pageInfo, entity); + for (int i = 0; i exportftp(CfgIndexInfo entity){ Map dataMap=new HashMap(); List ipPortList = fileTransferCfgDao.getIpPortList(entity); @@ -694,6 +696,11 @@ public class FileTransferCfgService extends CrudService hashList = fileTransferCfgDao.getP2pHashList(entity); + for (int i = 0; i < hashList.size(); i++) { + BaseStringCfg base =hashList.get(i); + if(!StringUtil.isEmpty(base.getUserRegion1())) + base.setUserRegion1(DictUtils.getDictLabel("P2P_HASH_TYPE",base.getUserRegion1())); + } List keywordList = fileTransferCfgDao.getP2pKeywordList(entity); List subscribeIdList = fileTransferCfgDao.getP2pSubscribeidList(entity); dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList); diff --git a/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java b/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java index 9724cf007..f82d4cd5a 100644 --- a/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java @@ -2,6 +2,7 @@ package com.nis.web.service.configuration; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -73,6 +74,27 @@ public class HttpRedirectCfgService extends CrudService exportHttpCfg(CfgIndexInfo entity){ + Map dataMap=new HashMap(); + List httpUrlList = websiteCfgDao.getHttpUrlList(entity); + List httpReqHdrList = websiteCfgDao.getHttpReqHdrList(entity); + List httpResHdrList = websiteCfgDao.getHttpResHdrList(entity); + List ipPortCfgList = websiteCfgDao.getIpPortList(entity); + entity.setCfgType(Constants.HTTP_REDIRECT_REQ_BODY_REGION); + List httpReqBodyList = websiteCfgDao.getHttpReqBodyList(entity); + entity.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION); + List httpResBodyList = websiteCfgDao.getHttpResBodyList(entity); + List subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); + dataMap.put("NTC_UNIVERSAL_IP", ipPortCfgList); + dataMap.put("NTC_HTTP_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); + return dataMap; + } + public Page getHttpRedirectList(Page page, CfgIndexInfo 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/InterceptCfgService.java b/src/main/java/com/nis/web/service/configuration/InterceptCfgService.java index 3d5df15c1..b93367306 100644 --- a/src/main/java/com/nis/web/service/configuration/InterceptCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/InterceptCfgService.java @@ -2,6 +2,7 @@ package com.nis.web.service.configuration; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -70,22 +71,19 @@ public class InterceptCfgService extends CrudService return page; } /** - * 保存dns配置 + * 保存ip拦截 * @param entity */ - public CfgIndexInfo exportIpInfo(CfgIndexInfo entity){ + public Map exportIpInfo(CfgIndexInfo entity){ + Map dataMap=new HashMap(); List ipPortList = websiteCfgDao.getIpPortList(entity); - if(ipPortList!=null){ - entity.setIpPortList(ipPortList); - } - if(entity.getFunctionId()!=null) { - List info=interceptCfgDao.getInterceptPktBin(entity); - if(info!=null){ - entity.setInterceptPktBinList(info); - } - } - return entity; + List info = interceptCfgDao.getInterceptPktBin(entity); + List httpUrlList = websiteCfgDao.getHttpUrlList(entity); + dataMap.put("PXY_INTERCEPT_IP", ipPortList); + dataMap.put("NTC_HTTP_URL", httpUrlList); + dataMap.put("PXY_INTERCEPT_PKT_BIN", info); + return dataMap; } public void saveInterceptCfg(List> interceptPktBins){ @@ -157,7 +155,6 @@ public class InterceptCfgService extends CrudService }else{ - entity.setEditTime(new Date()); entity.setEditorId(entity.getCurrentUser().getId()); 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 576250e34..0d38d7ad7 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgList.jsp @@ -126,6 +126,7 @@ +
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 3ff188f03..994c238da 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgList.jsp @@ -126,6 +126,7 @@ +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp index 029a3b07d..38b2c911e 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgList.jsp @@ -130,6 +130,7 @@ +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgList.jsp index 5bd7512ff..fe3f2a0ee 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgList.jsp @@ -176,6 +176,7 @@ +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgList.jsp index 3d9a746b0..b18afb2f9 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgList.jsp @@ -126,6 +126,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 aff972f42..86b07b4c3 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appTopicDomainCfgList.jsp @@ -123,6 +123,7 @@ +
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 d684904d7..21972f85c 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/fileSampleList.jsp @@ -129,8 +129,8 @@ - - +<%-- + --%>