diff --git a/src/main/java/com/nis/util/excel/ExportExcel.java b/src/main/java/com/nis/util/excel/ExportExcel.java index bd2f77c92..c22ba90bf 100644 --- a/src/main/java/com/nis/util/excel/ExportExcel.java +++ b/src/main/java/com/nis/util/excel/ExportExcel.java @@ -135,6 +135,43 @@ public class ExportExcel { } public String[] validRegionFieldAndSetComment(String headerStr,String commentStr,FunctionRegionDict region,FunctionServiceDict service,Properties msgProp){ String[] titleInfo=new String[2]; + //ratelimit + if("ratelimit".equals(headerStr)){ + commentStr=""; + List ratelimit=DictUtils.getDictList("RATE_LIMIT"); + if(ratelimit !=null && ratelimit.size()>0){ + for (SysDataDictionaryItem sysDataDictionaryItem : ratelimit) { + if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + }else{ + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + } + } + } + } + + if("policy_name".equals(headerStr)){ + DnsResStrategyService dnsResStrategyService=new DnsResStrategyService(); + List resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1); + if(StringUtil.isEmpty(resStrategys)){ + headerStr=""; + commentStr=""; + }else{ + if(service.getAction().equals(1)){ + headerStr=""; + commentStr=""; + }else{ + for (DnsResStrategy dnsResStrategy : resStrategys) { + commentStr=commentStr+dnsResStrategy.getCfgId()+":"+dnsResStrategy.getCfgDesc()+"\n"; + } + } + } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + } + } + if(region.getRegionType().equals(1)){//IP配置 //ip配置需要导入的信息:srcIp srcPort destIp destPort Protocol Direction //确定需要导入的srcIp srcPort destIp destPort信息 @@ -319,20 +356,6 @@ public class ExportExcel { } } - //ratelimit - if("ratelimit".equals(headerStr)){ - commentStr=""; - List ratelimit=DictUtils.getDictList("RATE_LIMIT"); - if(ratelimit !=null && ratelimit.size()>0){ - for (SysDataDictionaryItem sysDataDictionaryItem : ratelimit) { - if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; - }else{ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; - } - } - } - } //字符串或摘要字符串 }else if(region.getRegionType().equals(2) || region.getRegionType().equals(3)){ if(region.getRegionType().equals(3)){ @@ -345,27 +368,6 @@ public class ExportExcel { } } - if("policy_name".equals(headerStr)){ - DnsResStrategyService dnsResStrategyService=new DnsResStrategyService(); - List resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1); - if(StringUtil.isEmpty(resStrategys)){ - headerStr=""; - commentStr=""; - }else{ - if(service.getAction().equals(1)){ - headerStr=""; - commentStr=""; - }else{ - for (DnsResStrategy dnsResStrategy : resStrategys) { - commentStr=commentStr+dnsResStrategy.getCfgId()+":"+dnsResStrategy.getCfgDesc()+"\n"; - } - } - } - if(StringUtil.isEmpty(commentStr)){ - headerStr=""; - commentStr=""; - } - } } //expr type if("expression_type".equals(headerStr)){ @@ -1541,7 +1543,7 @@ public class ExportExcel { public ExportExcel write(HttpServletResponse response, String fileName) throws IOException{ response.reset(); response.setContentType("application/octet-stream; charset=utf-8"); - response.setHeader("Content-Disposition", "attachment; filename="+Encodes.urlEncode(fileName)); + response.setHeader("Content-Disposition", "attachment; filename=\""+fileName+"\""); write(response.getOutputStream()); return this; }