字符串类导入模板定义

This commit is contained in:
duandongmei
2018-10-18 10:13:34 +08:00
parent f17fe56c9d
commit 85d127c000
7 changed files with 403 additions and 23 deletions

View File

@@ -46,10 +46,12 @@ import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.util.DictUtils;
import com.nis.util.Encodes;
import com.nis.util.Reflections;
import com.nis.util.StringUtil;
import com.nis.web.service.configuration.DnsResStrategyService;
import com.sun.xml.internal.rngom.ast.builder.CommentList;
import sun.util.logging.resources.logging;
@@ -239,7 +241,7 @@ public class ExportExcel {
if("protocol".equals(headerStr)){
if(service.getFunctionId().equals(5) ){
commentStr="";
//block tcp
//ip block tcp
if(service.getAction().equals(16) ){
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
@@ -292,7 +294,7 @@ public class ExportExcel {
}
}
//导入的Direction
//Direction
if("direction".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigDirection())){
headerStr="";
@@ -302,7 +304,8 @@ public class ExportExcel {
List<SysDataDictionaryItem> direction=DictUtils.getDictList("DIRECTION");
if(direction !=null && direction.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : direction) {
if(((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1) && StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
if(((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1)
&& StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else if((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
@@ -316,7 +319,7 @@ public class ExportExcel {
}
}
//导入的限速
//ratelimit
if("ratelimit".equals(headerStr)){
commentStr="";
List<SysDataDictionaryItem> ratelimit=DictUtils.getDictList("RATE_LIMIT");
@@ -330,6 +333,149 @@ public class ExportExcel {
}
}
}
//字符串或摘要字符串
}else if(region.getRegionType().equals(2) || region.getRegionType().equals(3)){
if(region.getRegionType().equals(3)){
if("district".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigDistrict())){
headerStr="";
commentStr="";
}else{
commentStr=region.getConfigDistrict();
}
}
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)){
if(StringUtil.isEmpty(region.getConfigExprType())){
headerStr="";
commentStr="";
}else{
commentStr="";
List<SysDataDictionaryItem> exprType=DictUtils.getDictList("EXPRESSION_TYPE");
if(exprType !=null && exprType.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : exprType) {
if(((","+region.getConfigExprType()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1)
&& StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else if((","+region.getConfigExprType()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
}
}
//match method
if("match_method".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigMatchMethod())){
headerStr="";
commentStr="";
}else{
commentStr="";
List<SysDataDictionaryItem> matchMethod=DictUtils.getDictList("MATCH_METHOD");
if(matchMethod !=null && matchMethod.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : matchMethod) {
if(((","+region.getConfigMatchMethod()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1)
&& StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else if((","+region.getConfigMatchMethod()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
}
}
//ishex
if("is_hex".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigHex())){
headerStr="";
commentStr="";
}else{
commentStr="";
List<SysDataDictionaryItem> isHex=DictUtils.getDictList("IS_HEX");
if(isHex !=null && isHex.size()>0){
if(((","+region.getConfigHex()+",").indexOf("1") >-1)){
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
if(sysDataDictionaryItem.getItemCode().equals(1)){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
}
}
if(!((","+region.getConfigHex()+",").indexOf("1") >-1)){
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
if(sysDataDictionaryItem.getItemCode().equals(0)){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
}
}
if("is_case_insenstive".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigHex())){
headerStr="";
commentStr="";
}else{
commentStr="";
List<SysDataDictionaryItem> isCaseSenstive=DictUtils.getDictList("CASE_INSENSTIVE");
if(isCaseSenstive !=null && isCaseSenstive.size()>0){
if(((","+region.getConfigHex()+",").indexOf("2") >-1)){
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
if(sysDataDictionaryItem.getItemCode().equals(1)){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
}
}
if(!((","+region.getConfigHex()+",").indexOf("2") >-1)){
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
if(sysDataDictionaryItem.getItemCode().equals(1)){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
}
}
}
titleInfo[0]=headerStr;
titleInfo[1]=commentStr;