字符串类处理和限速信息处理

This commit is contained in:
duandongmei
2018-10-18 13:53:38 +08:00
parent 85d127c000
commit b695f209c3

View File

@@ -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<SysDataDictionaryItem> 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<DnsResStrategy> 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<SysDataDictionaryItem> 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<DnsResStrategy> 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;
}