diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 1b4e4b9fe..80a7550bc 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -37,6 +37,7 @@ import com.beust.jcommander.internal.Lists; import com.nis.domain.FunctionRegionDict; import com.nis.domain.FunctionServiceDict; import com.nis.domain.SysDataDictionaryItem; +import com.nis.domain.basics.AsnIpCfg; import com.nis.domain.basics.PolicyGroupInfo; import com.nis.domain.basics.ServiceDictInfo; import com.nis.domain.basics.SysDictInfo; @@ -230,7 +231,7 @@ public class BaseController { @Autowired protected AppMultiFeatureCfgService appMultiFeatureCfgService; @Autowired - protected GroupAreaService groupAreaService;// 分组区域管理 service + protected GroupAreaService groupAreaService;// 分组区域管理 service /** * 管理基础路径 */ @@ -383,25 +384,28 @@ public class BaseController { model.addAttribute("requestInfos", requestInfos); List fls = serviceDictInfoService.findAllFlDict(); String pNames = ""; - /*for (ServiceDictInfo serviceDictInfo : fls) { - pNames = ""; - pNames = serviceDictInfo.getPNames(fls, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : fls) { pNames = ""; pNames = + * serviceDictInfo.getPNames(fls, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("fls", fls); List xzs = serviceDictInfoService.findAllXzDict(); - /*for (ServiceDictInfo serviceDictInfo : xzs) { - pNames = ""; - pNames = serviceDictInfo.getPNames(xzs, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : xzs) { pNames = ""; pNames = + * serviceDictInfo.getPNames(xzs, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("xzs", xzs); List lables = serviceDictInfoService.findAllLableDict(); - /*for (ServiceDictInfo serviceDictInfo : lables) { - pNames = ""; - pNames = serviceDictInfo.getPNames(lables, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : lables) { pNames = ""; pNames = + * serviceDictInfo.getPNames(lables, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("lables", lables); List regionList = DictUtils.getFunctionRegionDictList(cfg.getFunctionId()); model.addAttribute("regionList", regionList); @@ -425,25 +429,28 @@ public class BaseController { model.addAttribute("requestInfos", requestInfos); List fls = serviceDictInfoService.findFlDict(); String pNames = ""; - /*for (ServiceDictInfo serviceDictInfo : fls) { - pNames = ""; - pNames = serviceDictInfo.getPNames(fls, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : fls) { pNames = ""; pNames = + * serviceDictInfo.getPNames(fls, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("fls", fls); List xzs = serviceDictInfoService.findXzDict(); - /*for (ServiceDictInfo serviceDictInfo : xzs) { - pNames = ""; - pNames = serviceDictInfo.getPNames(xzs, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : xzs) { pNames = ""; pNames = + * serviceDictInfo.getPNames(xzs, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("xzs", xzs); List lables = serviceDictInfoService.findLableDict(); - /* for (ServiceDictInfo serviceDictInfo : lables) { - pNames = ""; - pNames = serviceDictInfo.getPNames(lables, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : lables) { pNames = ""; pNames = + * serviceDictInfo.getPNames(lables, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("lables", lables); List itTypeList = new ArrayList(); itTypeList.add(Constants.ITEM_TYPE_AREA); @@ -464,25 +471,28 @@ public class BaseController { model.addAttribute("requestInfos", requestInfos); List fls = serviceDictInfoService.findFlDict(); String pNames = ""; - /*for (ServiceDictInfo serviceDictInfo : fls) { - pNames = ""; - pNames = serviceDictInfo.getPNames(fls, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : fls) { pNames = ""; pNames = + * serviceDictInfo.getPNames(fls, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("fls", fls); List xzs = serviceDictInfoService.findXzDict(); - /*for (ServiceDictInfo serviceDictInfo : xzs) { - pNames = ""; - pNames = serviceDictInfo.getPNames(xzs, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : xzs) { pNames = ""; pNames = + * serviceDictInfo.getPNames(xzs, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("xzs", xzs); List lables = serviceDictInfoService.findLableDict(); - /*for (ServiceDictInfo serviceDictInfo : lables) { - pNames = ""; - pNames = serviceDictInfo.getPNames(lables, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : lables) { pNames = ""; pNames = + * serviceDictInfo.getPNames(lables, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("lables", lables); List itTypeList = new ArrayList(); itTypeList.add(Constants.ITEM_TYPE_AREA); @@ -546,25 +556,28 @@ public class BaseController { model.addAttribute("requestInfos", requestInfos); List fls = serviceDictInfoService.findFlDict();// 只查询有效分类字典 String pNames = ""; - /*for (ServiceDictInfo serviceDictInfo : fls) { - pNames = ""; - pNames = serviceDictInfo.getPNames(fls, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : fls) { pNames = ""; pNames = + * serviceDictInfo.getPNames(fls, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("fls", fls); List xzs = serviceDictInfoService.findXzDict();// 只查询有效性质字典 - /*for (ServiceDictInfo serviceDictInfo : xzs) { - pNames = ""; - pNames = serviceDictInfo.getPNames(xzs, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : xzs) { pNames = ""; pNames = + * serviceDictInfo.getPNames(xzs, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("xzs", xzs); List lables = serviceDictInfoService.findLableDict();// 只查询有效标签字典 - /*for (ServiceDictInfo serviceDictInfo : lables) { - pNames = ""; - pNames = serviceDictInfo.getPNames(lables, serviceDictInfo.getParent().getServiceDictId(), pNames); - serviceDictInfo.setpNames(pNames); - }*/ + /* + * for (ServiceDictInfo serviceDictInfo : lables) { pNames = ""; pNames = + * serviceDictInfo.getPNames(lables, + * serviceDictInfo.getParent().getServiceDictId(), pNames); + * serviceDictInfo.setpNames(pNames); } + */ model.addAttribute("lables", lables); List regionList = DictUtils.getFunctionRegionDictList(cfg.getFunctionId()); model.addAttribute("regionList", regionList); @@ -812,191 +825,214 @@ public class BaseController { params.put("searchCfgId", entry.getCfgId()); } } - public List> checkStringCfg(FunctionServiceDict serviceDict, FunctionRegionDict regionDict, List list) - throws ServiceException { + + public List> checkStringCfg(FunctionServiceDict serviceDict, FunctionRegionDict regionDict, + List list) throws ServiceException { List> stringList = new ArrayList>(); Properties prop = this.getMsgProp(); - String exprTypeP=regionDict.getConfigExprType(); + String exprTypeP = regionDict.getConfigExprType(); if (StringUtil.isEmpty(exprTypeP)) { throw new RuntimeException("Found String region,but exprType is Empty"); } - String matchMethodP=regionDict.getConfigMatchMethod(); + String matchMethodP = regionDict.getConfigMatchMethod(); if (StringUtil.isEmpty(matchMethodP)) { throw new RuntimeException("Found String region,but matchMethod is Empty"); } - String hexP=regionDict.getConfigHex(); + String hexP = regionDict.getConfigHex(); if (StringUtil.isEmpty(hexP)) { throw new RuntimeException("Found String region,but hex is Empty"); } - String mulityKeywordsP=regionDict.getConfigMultiKeywords(); + String mulityKeywordsP = regionDict.getConfigMultiKeywords(); if (StringUtil.isEmpty(mulityKeywordsP)) { throw new RuntimeException("Found String region,but mulityKeywords is Empty"); } StringBuffer errTip = new StringBuffer(); - Pattern pattern=Pattern.compile("\t|\r|\n|\b|\f"); + Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f"); for (int i = 0; i < list.size(); i++) { StringBuffer errInfo = new StringBuffer(); BaseStringCfg baseStringCfg = new BaseStringCfg(); BeanUtils.copyProperties(list.get(i), baseStringCfg); if (regionDict.getRegionType().equals(2)) { - if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())){ - String userRegion1=baseStringCfg.getUserRegion1(); - if(StringUtils.isNotBlank(userRegion1)) { - List hashs=DictUtils.getDictList("P2P_HASH_TYPE"); - boolean has=false; - for(SysDataDictionaryItem hash:hashs) { - if(hash.getItemCode().equals(userRegion1)) { - has=true; + if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) { + String userRegion1 = baseStringCfg.getUserRegion1(); + if (StringUtils.isNotBlank(userRegion1)) { + List hashs = DictUtils.getDictList("P2P_HASH_TYPE"); + boolean has = false; + for (SysDataDictionaryItem hash : hashs) { + if (hash.getItemCode().equals(userRegion1)) { + has = true; break; } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("p2p_hash_type")+" ")+";"); + if (!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), + prop.getProperty("p2p_hash_type") + " ") + ";"); } } } - String keyword=baseStringCfg.getCfgKeywords(); - if(StringUtils.isBlank(keyword)) { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word")+" ")+";"); + String keyword = baseStringCfg.getCfgKeywords(); + if (StringUtils.isBlank(keyword)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";"); } - if(mulityKeywordsP.equals("0")) { - if(keyword.indexOf("\n")>-1) { - errInfo.append(String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word"))+";"); + if (mulityKeywordsP.equals("0")) { + if (keyword.indexOf("\n") > -1) { + errInfo.append( + String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";"); } - Matcher m=pattern.matcher(keyword); - if(m.find()) { - errInfo.append(String.format(prop.getProperty("has_invisible_char"), prop.getProperty("key_word")+" '"+keyword+"'")+";"); + Matcher m = pattern.matcher(keyword); + if (m.find()) { + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + keyword + "'") + ";"); } - }else { - boolean has=false; - for(String key:keyword.split("\n")) { - Matcher m=pattern.matcher(key); - if(m.find()) { - has=true; - errInfo.append(String.format(prop.getProperty("has_invisible_char"), prop.getProperty("key_word")+" '"+key+"'")+";"); + } else { + boolean has = false; + for (String key : keyword.split("\n")) { + Matcher m = pattern.matcher(key); + if (m.find()) { + has = true; + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + key + "'") + ";"); break; } } - if(!has) { - String reWord=keyword.replaceAll("\n", Constants.KEYWORD_EXPR); + if (!has) { + String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR); baseStringCfg.setCfgKeywords(reWord); } } - Integer exprType=baseStringCfg.getExprType(); - boolean has=false; - if(exprType==null) { - if(exprTypeP.indexOf(",")==-1) { - if(mulityKeywordsP.equals("0")&&exprTypeP.equals("1")) { - throw new RuntimeException("region dict config error,dict id is "+regionDict.getDictId()); + Integer exprType = baseStringCfg.getExprType(); + boolean has = false; + if (exprType == null) { + if (exprTypeP.indexOf(",") == -1) { + if (mulityKeywordsP.equals("0") && exprTypeP.equals("1")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); } baseStringCfg.setExprType(Integer.parseInt(exprTypeP)); - }else if(exprTypeP.indexOf("0")>-1&&mulityKeywordsP.equals("0")){ + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("0")) { baseStringCfg.setExprType(0); - }else if(exprTypeP.indexOf("1")>-1&&mulityKeywordsP.equals("1")&&keyword.indexOf("\n")>-1){ + } else if (exprTypeP.indexOf("1") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") > -1) { baseStringCfg.setExprType(1); - }else if(exprTypeP.indexOf("0")>-1&&mulityKeywordsP.equals("1")&&keyword.indexOf("\n")==-1){ + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") == -1) { baseStringCfg.setExprType(0); - }else { + } else { baseStringCfg.setExprType(Integer.parseInt(exprTypeP.split(",")[0])); } - //errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("expression_type"))+";"); - }else { - for(String exp:exprTypeP.split(",")) { - if(exp.equals(exprType.toString())) { - has=true; + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("expression_type"))+";"); + } else { + for (String exp : exprTypeP.split(",")) { + if (exp.equals(exprType.toString())) { + has = true; break; } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";"); + if (!has) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type")) + + ";"); } - has=false; + has = false; } - exprType=baseStringCfg.getExprType(); - Integer matchMethod=baseStringCfg.getMatchMethod(); - if(matchMethod==null) { - if(matchMethodP.indexOf(",")==-1) { - if(exprTypeP.equals("1")&&!matchMethodP.equals("0")) { - throw new RuntimeException("region dict config error,dict id is "+regionDict.getDictId()); + exprType = baseStringCfg.getExprType(); + Integer matchMethod = baseStringCfg.getMatchMethod(); + if (matchMethod == null) { + if (matchMethodP.indexOf(",") == -1) { + if (exprTypeP.equals("1") && !matchMethodP.equals("0")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); } baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP)); - }else if(exprType!=null&&exprType.intValue()==1){ - if(matchMethodP.indexOf("0")>-1) { + } else if (exprType != null && exprType.intValue() == 1) { + if (matchMethodP.indexOf("0") > -1) { baseStringCfg.setMatchMethod(0); - }else { - throw new RuntimeException("region dict config error,dict id is "+regionDict.getDictId()); + } else { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); } - - }else { + + } else { baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP.split(",")[0])); } - //errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("match_method"))+";"); - }else { - for(String exp:matchMethodP.split(",")) { - if(exp.equals(matchMethod.toString())) { - has=true; + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("match_method"))+";"); + } else { + for (String exp : matchMethodP.split(",")) { + if (exp.equals(matchMethod.toString())) { + has = true; break; } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";"); + if (!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method")) + + ";"); } } - - - Integer isHex=baseStringCfg.getIsHex(); - Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); - if(isHex==null||isCaseInsenstive==null) { - if(isHex==null) { - if(hexP.equals("0")||hexP.equals("2")) { + + Integer isHex = baseStringCfg.getIsHex(); + Integer isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + if (isHex == null || isCaseInsenstive == null) { + if (isHex == null) { + if (hexP.equals("0") || hexP.equals("2")) { baseStringCfg.setIsHex(0); - }else if(hexP.equals("1")) { + } else if (hexP.equals("1")) { baseStringCfg.setIsHex(1); - }else { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex"))+";"); + } else { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex")) + ";"); } } - if(isCaseInsenstive==null) { - if(hexP.equals("0")||hexP.equals("1")) { + if (isCaseInsenstive == null) { + if (hexP.equals("0") || hexP.equals("1")) { baseStringCfg.setIsCaseInsenstive(0); - }else if(hexP.equals("2")){ + } else if (hexP.equals("2")) { baseStringCfg.setIsCaseInsenstive(1); - }else { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_case_insenstive"))+";"); + } else { + errInfo.append(String.format(prop.getProperty("can_not_null"), + prop.getProperty("is_case_insenstive")) + ";"); } } - }else { - if(isHex.intValue()!=0&&isHex.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } else { + if (isHex.intValue() != 0 && isHex.intValue() != 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); } - if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); } - if(hexP.indexOf("1")==-1&&isHex.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); } - if(hexP.equals("1")&&isHex.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + if (hexP.equals("1") && isHex.intValue() == 0) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); } - if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); } - if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); } } - isHex=baseStringCfg.getIsHex(); - isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); - if(isHex!=null&&isCaseInsenstive!=null) { - if(isHex.intValue()==0&&isCaseInsenstive.intValue()==0) { + isHex = baseStringCfg.getIsHex(); + isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + if (isHex != null && isCaseInsenstive != null) { + if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { baseStringCfg.setIsHexbin(0); - }else if(isHex.intValue()==1&&isCaseInsenstive.intValue()==0) { + } else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 0) { baseStringCfg.setIsHexbin(1); - }else if(isHex.intValue()==1&&isCaseInsenstive.intValue()==1) { + } else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) { baseStringCfg.setIsHexbin(2); } } - + } if (errInfo.toString().length() > 0) {// errTip.append(String.format(prop.getProperty("line"), i + 2) + ","); @@ -1010,192 +1046,221 @@ public class BaseController { } return stringList; } - public List checkComplexStringCfg(FunctionServiceDict serviceDict, FunctionRegionDict regionDict, List list) - throws ServiceException { + + public List checkComplexStringCfg(FunctionServiceDict serviceDict, FunctionRegionDict regionDict, + List list) throws ServiceException { List stringList = new ArrayList(); Properties prop = this.getMsgProp(); - String exprTypeP=regionDict.getConfigExprType(); + String exprTypeP = regionDict.getConfigExprType(); if (StringUtil.isEmpty(exprTypeP)) { throw new RuntimeException("Found String region,but exprType is Empty"); } - String matchMethodP=regionDict.getConfigMatchMethod(); + String matchMethodP = regionDict.getConfigMatchMethod(); if (StringUtil.isEmpty(matchMethodP)) { throw new RuntimeException("Found String region,but matchMethod is Empty"); } - String hexP=regionDict.getConfigHex(); + String hexP = regionDict.getConfigHex(); if (StringUtil.isEmpty(hexP)) { throw new RuntimeException("Found String region,but hex is Empty"); } - String mulityKeywordsP=regionDict.getConfigMultiKeywords(); + String mulityKeywordsP = regionDict.getConfigMultiKeywords(); if (StringUtil.isEmpty(mulityKeywordsP)) { throw new RuntimeException("Found String region,but mulityKeywords is Empty"); } - String dirtrictP=regionDict.getConfigDistrict(); + String dirtrictP = regionDict.getConfigDistrict(); StringBuffer errTip = new StringBuffer(); - Pattern pattern=Pattern.compile("\t|\r|\n|\b|\f"); + Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f"); for (int i = 0; i < list.size(); i++) { StringBuffer errInfo = new StringBuffer(); ComplexkeywordCfg baseStringCfg = new ComplexkeywordCfg(); BeanUtils.copyProperties(list.get(i), baseStringCfg); if (regionDict.getRegionType().equals(3)) { - if(regionDict.getFunctionId().equals(7)) { - Long dnsStrategyId=baseStringCfg.getDnsStrategyId(); - if(dnsStrategyId!=null) { - List dnsStrategys=dnsResStrategyService.findDnsResStrategys(dnsStrategyId, Constants.VALID_YES, Constants.AUDIT_YES); - if(dnsStrategys==null||dnsStrategys.size()==0) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("dns_res_strategy"))+";"); + if (regionDict.getFunctionId().equals(7)) { + Long dnsStrategyId = baseStringCfg.getDnsStrategyId(); + if (dnsStrategyId != null) { + List dnsStrategys = dnsResStrategyService.findDnsResStrategys(dnsStrategyId, + Constants.VALID_YES, Constants.AUDIT_YES); + if (dnsStrategys == null || dnsStrategys.size() == 0) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), + prop.getProperty("dns_res_strategy")) + ";"); } } } - String keyword=baseStringCfg.getCfgKeywords(); - String district=baseStringCfg.getDistrict(); - if(StringUtils.isBlank(keyword)) { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word")+" ")+";"); + String keyword = baseStringCfg.getCfgKeywords(); + String district = baseStringCfg.getDistrict(); + if (StringUtils.isBlank(keyword)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";"); } - if(StringUtils.isNotBlank(dirtrictP)) { - if(StringUtils.isBlank(district)) { - if(dirtrictP.indexOf(",")==-1) { + if (StringUtils.isNotBlank(dirtrictP)) { + if (StringUtils.isBlank(district)) { + if (dirtrictP.indexOf(",") == -1) { baseStringCfg.setDistrict(dirtrictP); - }else { - //baseStringCfg.setDistrict(dirtrictP.split(",")[0]); - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("district")+" ")+";"); + } else { + // baseStringCfg.setDistrict(dirtrictP.split(",")[0]); + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("district") + " ") + + ";"); } - }else if(dirtrictP.indexOf(district)==-1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("district")+" ")+";"); + } else if (dirtrictP.indexOf(district) == -1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("district") + " ") + + ";"); } } - if(mulityKeywordsP.equals("0")) { - if(keyword.indexOf("\n")>-1) { - errInfo.append(String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word"))+";"); + if (mulityKeywordsP.equals("0")) { + if (keyword.indexOf("\n") > -1) { + errInfo.append( + String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";"); } - Matcher m=pattern.matcher(keyword); - if(m.find()) { - errInfo.append(String.format(prop.getProperty("has_invisible_char"), prop.getProperty("key_word")+" '"+keyword+"'")+";"); + Matcher m = pattern.matcher(keyword); + if (m.find()) { + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + keyword + "'") + ";"); } - }else { - boolean has=false; - for(String key:keyword.split("\n")) { - Matcher m=pattern.matcher(key); - if(m.find()) { - has=true; - errInfo.append(String.format(prop.getProperty("has_invisible_char"), prop.getProperty("key_word")+" '"+key+"'")+";"); + } else { + boolean has = false; + for (String key : keyword.split("\n")) { + Matcher m = pattern.matcher(key); + if (m.find()) { + has = true; + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + key + "'") + ";"); break; } } - if(!has) { - String reWord=keyword.replaceAll("\n", Constants.KEYWORD_EXPR); + if (!has) { + String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR); baseStringCfg.setCfgKeywords(reWord); } } - Integer exprType=baseStringCfg.getExprType(); - boolean has=false; - if(exprType==null) { - if(exprTypeP.indexOf(",")==-1) { - if(mulityKeywordsP.equals("0")&&exprTypeP.equals("1")) { - throw new RuntimeException("region dict config error,dict id is "+regionDict.getDictId()); + Integer exprType = baseStringCfg.getExprType(); + boolean has = false; + if (exprType == null) { + if (exprTypeP.indexOf(",") == -1) { + if (mulityKeywordsP.equals("0") && exprTypeP.equals("1")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); } baseStringCfg.setExprType(Integer.parseInt(exprTypeP)); - }else if(exprTypeP.indexOf("0")>-1&&mulityKeywordsP.equals("0")){ + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("0")) { baseStringCfg.setExprType(0); - }else if(exprTypeP.indexOf("1")>-1&&mulityKeywordsP.equals("1")&&keyword.indexOf("\n")>-1){ + } else if (exprTypeP.indexOf("1") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") > -1) { baseStringCfg.setExprType(1); - }else if(exprTypeP.indexOf("0")>-1&&mulityKeywordsP.equals("1")&&keyword.indexOf("\n")==-1){ + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") == -1) { baseStringCfg.setExprType(0); - }else { + } else { baseStringCfg.setExprType(Integer.parseInt(exprTypeP.split(",")[0])); } - //errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("expression_type"))+";"); - }else { - for(String exp:exprTypeP.split(",")) { - if(exp.equals(exprType.toString())) { - has=true; + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("expression_type"))+";"); + } else { + for (String exp : exprTypeP.split(",")) { + if (exp.equals(exprType.toString())) { + has = true; break; } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";"); + if (!has) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type")) + + ";"); } - has=false; + has = false; } - exprType=baseStringCfg.getExprType(); - Integer matchMethod=baseStringCfg.getMatchMethod(); - if(matchMethod==null) { - if(matchMethodP.indexOf(",")==-1) { - if(exprTypeP.equals("1")&&!matchMethodP.equals("0")) { - throw new RuntimeException("region dict config error,dict id is "+regionDict.getDictId()); + exprType = baseStringCfg.getExprType(); + Integer matchMethod = baseStringCfg.getMatchMethod(); + if (matchMethod == null) { + if (matchMethodP.indexOf(",") == -1) { + if (exprTypeP.equals("1") && !matchMethodP.equals("0")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); } baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP)); - }else if(exprType!=null&&exprType.intValue()==1){ - if(matchMethodP.indexOf("0")>-1) { + } else if (exprType != null && exprType.intValue() == 1) { + if (matchMethodP.indexOf("0") > -1) { baseStringCfg.setMatchMethod(0); - }else { - throw new RuntimeException("region dict config error,dict id is "+regionDict.getDictId()); + } else { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); } - - }else { + + } else { baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP.split(",")[0])); } - //errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("match_method"))+";"); - }else { - for(String exp:matchMethodP.split(",")) { - if(exp.equals(matchMethod.toString())) { - has=true; + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("match_method"))+";"); + } else { + for (String exp : matchMethodP.split(",")) { + if (exp.equals(matchMethod.toString())) { + has = true; break; } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";"); + if (!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method")) + + ";"); } } - Integer isHex=baseStringCfg.getIsHex(); - Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); - if(isHex==null||isCaseInsenstive==null) { - if(isHex==null) { - if(hexP.equals("0")||hexP.equals("2")) { + Integer isHex = baseStringCfg.getIsHex(); + Integer isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + if (isHex == null || isCaseInsenstive == null) { + if (isHex == null) { + if (hexP.equals("0") || hexP.equals("2")) { baseStringCfg.setIsHex(0); - }else if(hexP.equals("1")) { + } else if (hexP.equals("1")) { baseStringCfg.setIsHex(1); - }else { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex"))+";"); + } else { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex")) + ";"); } } - if(isCaseInsenstive==null) { - if(hexP.equals("0")||hexP.equals("1")) { + if (isCaseInsenstive == null) { + if (hexP.equals("0") || hexP.equals("1")) { baseStringCfg.setIsCaseInsenstive(0); - }else if(hexP.equals("2")){ + } else if (hexP.equals("2")) { baseStringCfg.setIsCaseInsenstive(1); - }else { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_case_insenstive"))+";"); + } else { + errInfo.append(String.format(prop.getProperty("can_not_null"), + prop.getProperty("is_case_insenstive")) + ";"); } } - }else { - if(isHex.intValue()!=0&&isHex.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } else { + if (isHex.intValue() != 0 && isHex.intValue() != 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); } - if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + if (isCaseInsenstive.intValue() != 0 && isCaseInsenstive.intValue() != 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); } - if(hexP.indexOf("1")==-1&&isHex.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + if (hexP.indexOf("1") == -1 && isHex.intValue() == 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); } - if(hexP.equals("1")&&isHex.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + if (hexP.equals("1") && isHex.intValue() == 0) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); } - if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + if (hexP.indexOf("2") == -1 && isCaseInsenstive.intValue() == 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); } - if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + if (hexP.equals("2") && isCaseInsenstive.intValue() == 0) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) + + ";"); } } - isHex=baseStringCfg.getIsHex(); - isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); - if(isHex!=null&&isCaseInsenstive!=null) { - if(isHex.intValue()==0&&isCaseInsenstive.intValue()==0) { + isHex = baseStringCfg.getIsHex(); + isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + if (isHex != null && isCaseInsenstive != null) { + if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { baseStringCfg.setIsHexbin(0); - }else if(isHex.intValue()==1&&isCaseInsenstive.intValue()==0) { + } else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 0) { baseStringCfg.setIsHexbin(1); - }else if(isHex.intValue()==1&&isCaseInsenstive.intValue()==1) { + } else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) { baseStringCfg.setIsHexbin(2); } } @@ -1242,101 +1307,105 @@ public class BaseController { StringBuffer errInfo = new StringBuffer(); IpPortCfg baseIpCfg = new IpPortCfg(); BeanUtils.copyProperties(list.get(i), baseIpCfg); - //特殊字段验证 - //packet ip ratelimit - if(serviceDict.getFunctionId().intValue()==5&&serviceDict.getAction().intValue()==64) { - String userRegion1=baseIpCfg.getUserRegion1(); + // 特殊字段验证 + // packet ip ratelimit + if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) { + String userRegion1 = baseIpCfg.getUserRegion1(); try { -// Double ratelimt= Double.parseDouble(userRegion1); - List ratelimtList=DictUtils.getDictList("RATE_LIMIT"); - boolean has=false; - for(SysDataDictionaryItem ratelimit:ratelimtList) { - if(ratelimit.getItemCode().equals(userRegion1)) { - has=true; + // Double ratelimt= Double.parseDouble(userRegion1); + List ratelimtList = DictUtils.getDictList("RATE_LIMIT"); + boolean has = false; + for (SysDataDictionaryItem ratelimit : ratelimtList) { + if (ratelimit.getItemCode().equals(userRegion1)) { + has = true; break; } } - if(!has) { - errInfo.append(prop.getProperty("ratelimit")+"."+String.format(prop.getProperty("must_between"),0.001,0.009)+";"); + if (!has) { + errInfo.append(prop.getProperty("ratelimit") + "." + + String.format(prop.getProperty("must_between"), 0.001, 0.009) + ";"); } } catch (Exception e) { // TODO: handle exception - errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit"))+";"); + errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit")) + ";"); } } - //payload ip - if(regionDict.getFunctionId().equals(212)) { - //replace_zone - String userRegion1=baseIpCfg.getUserRegion1(); - if(StringUtils.isNotBlank(userRegion1)) { + // payload ip + if (regionDict.getFunctionId().equals(212)) { + // replace_zone + String userRegion1 = baseIpCfg.getUserRegion1(); + if (StringUtils.isNotBlank(userRegion1)) { Object val = DictUtils.getDictLabel("INTERCEPT_REPLACE_ZONE", userRegion1); - if(StringUtils.isBlank(val.toString())) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("replace_zone"))+";"); + if (StringUtils.isBlank(val.toString())) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("replace_zone")) + + ";"); } - }else { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_zone"))+";"); + } else { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_zone")) + ";"); } - - //replaced_content - String userRegion2=baseIpCfg.getUserRegion2(); - if(StringUtils.isBlank(userRegion2)) { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content"))+";"); + + // replaced_content + String userRegion2 = baseIpCfg.getUserRegion2(); + if (StringUtils.isBlank(userRegion2)) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content")) + + ";"); } - //replace_content - String userRegion3=baseIpCfg.getUserRegion3(); - if(StringUtils.isBlank(userRegion3)) { - errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content"))+";"); + // replace_content + String userRegion3 = baseIpCfg.getUserRegion3(); + if (StringUtils.isBlank(userRegion3)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content")) + ";"); } } - //dns ip - if(regionDict.getFunctionId().equals(7)) { - Integer dnsStrategyId=baseIpCfg.getDnsStrategyId(); - if(dnsStrategyId!=null) { - List dnsStrategys=dnsResStrategyService.findDnsResStrategys(Long.valueOf(dnsStrategyId), Constants.VALID_YES, Constants.AUDIT_YES); - if(dnsStrategys==null||dnsStrategys.size()==0) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("dns_res_strategy"))+";"); + // dns ip + if (regionDict.getFunctionId().equals(7)) { + Integer dnsStrategyId = baseIpCfg.getDnsStrategyId(); + if (dnsStrategyId != null) { + List dnsStrategys = dnsResStrategyService + .findDnsResStrategys(Long.valueOf(dnsStrategyId), Constants.VALID_YES, Constants.AUDIT_YES); + if (dnsStrategys == null || dnsStrategys.size() == 0) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("dns_res_strategy")) + + ";"); } } } - if(regionDict.getFunctionId().equals(510) && "p2p_ip".equals(regionDict.getConfigServiceType())){ //P2p IP - String userRegion1=baseIpCfg.getUserRegion1(); - List ipTypes=DictUtils.getDictList("P2P_IP_TYPE"); - boolean has=false; - for(SysDataDictionaryItem type:ipTypes) { - if(type.getItemCode().equals(userRegion1)) { - has=true; + if (regionDict.getFunctionId().equals(510) && "p2p_ip".equals(regionDict.getConfigServiceType())) { // P2p + // IP + String userRegion1 = baseIpCfg.getUserRegion1(); + List ipTypes = DictUtils.getDictList("P2P_IP_TYPE"); + boolean has = false; + for (SysDataDictionaryItem type : ipTypes) { + if (type.getItemCode().equals(userRegion1)) { + has = true; break; } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("p2p_ip_config_type"))+";"); + if (!has) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("p2p_ip_config_type")) + + ";"); } } if (regionDict.getRegionType().equals(1)) { // 校验必填的IP,端口 - /*for (String code : configIpPortShow.split(",")) { - if ("1".equals(code)) {// 源IP - if (StringUtil.isEmpty(baseIpCfg.getSrcIpAddress())) { - errInfo.append(String.format(prop.getProperty("can_not_null"), - prop.getProperty("client_ip", "Client IP")) + ";"); - } - } else if ("2".equals(code)) {// 源端口 - if (StringUtil.isEmpty(baseIpCfg.getSrcPort())) { - errInfo.append(String.format(prop.getProperty("can_not_null"), - prop.getProperty("client_port", "Client Port")) + ";"); - } - } else if ("3".equals(code)) {// 目的IP - if (StringUtil.isEmpty(baseIpCfg.getDestIpAddress())) { - errInfo.append(String.format(prop.getProperty("can_not_null"), - prop.getProperty("server_ip", "Server IP")) + ";"); - } - } else if ("4".equals(code)) {// 目的端口 - if (StringUtil.isEmpty(baseIpCfg.getDestPort())) { - errInfo.append(String.format(prop.getProperty("can_not_null"), - prop.getProperty("server_port", "Server Port")) + ";"); - } - } - }*/ + /* + * for (String code : configIpPortShow.split(",")) { if ("1".equals(code)) {// + * 源IP if (StringUtil.isEmpty(baseIpCfg.getSrcIpAddress())) { + * errInfo.append(String.format(prop.getProperty("can_not_null"), + * prop.getProperty("client_ip", "Client IP")) + ";"); } } else if + * ("2".equals(code)) {// 源端口 if (StringUtil.isEmpty(baseIpCfg.getSrcPort())) { + * errInfo.append(String.format(prop.getProperty("can_not_null"), + * prop.getProperty("client_port", "Client Port")) + ";"); } } else if + * ("3".equals(code)) {// 目的IP if + * (StringUtil.isEmpty(baseIpCfg.getDestIpAddress())) { + * errInfo.append(String.format(prop.getProperty("can_not_null"), + * prop.getProperty("server_ip", "Server IP")) + ";"); } } else if + * ("4".equals(code)) {// 目的端口 if (StringUtil.isEmpty(baseIpCfg.getDestPort())) + * { errInfo.append(String.format(prop.getProperty("can_not_null"), + * prop.getProperty("server_port", "Server Port")) + ";"); } } } + */ boolean srcIpEmpty = false; boolean destIpEmpty = false; boolean srcPortEmpty = false; @@ -1353,41 +1422,48 @@ public class BaseController { if (StringUtil.isEmpty(baseIpCfg.getDestPort())) { destPortEmpty = true; } - if(srcIpEmpty&&destIpEmpty) { - if(configIpPortShow.indexOf("1")>-1&&configIpPortShow.indexOf("3")>-1) { + if (srcIpEmpty && destIpEmpty) { + if (configIpPortShow.indexOf("1") > -1 && configIpPortShow.indexOf("3") > -1) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("client_ip", "Client IP")) + ";"); - }else if(configIpPortShow.indexOf("1")>-1) { + } else if (configIpPortShow.indexOf("1") > -1) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("client_ip", "Client IP")) + ";"); - }else if(configIpPortShow.indexOf("3")>-1) { + } else if (configIpPortShow.indexOf("3") > -1) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("server_ip", "Server IP")) + ";"); } - }else if (destIpEmpty) {// 目的IP为空 - if(configIpPortShow.indexOf("3")>-1&&configIpPortShow.indexOf("1")==-1) {//目的IP必填 + } else if (destIpEmpty) {// 目的IP为空 + if (configIpPortShow.indexOf("3") > -1 && configIpPortShow.indexOf("1") == -1) {// 目的IP必填 errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("server_ip", "Server IP")) + ";"); - }else if(configIpPortShow.indexOf("1")>-1){ - /*if(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getSrcIpAddress())) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"'")+";"); - }else if(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getSrcIpAddress())) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"'")+";"); - }else if(Constants.IPV6_DEFAULT_IP_VALUE.equals(baseIpCfg.getSrcIpAddress())) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV6_DEFAULT_IP_VALUE+"'")+";"); - }else if(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getSrcIpAddress())) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"'")+";"); - }else if(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getSrcIpAddress())) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"'")+";"); - }else if(Constants.IPV4_DEFAULT_IP_VALUE.equals(baseIpCfg.getSrcIpAddress())) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV4_DEFAULT_IP_VALUE+"'")+";"); - }*/ + } else if (configIpPortShow.indexOf("1") > -1) { + /* + * if(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getSrcIpAddress())) + * { errInfo.append(prop.getProperty("client_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"'")+";"); }else + * if(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getSrcIpAddress()) + * ) { errInfo.append(prop.getProperty("client_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"'")+";"); }else + * if(Constants.IPV6_DEFAULT_IP_VALUE.equals(baseIpCfg.getSrcIpAddress())) { + * errInfo.append(prop.getProperty("client_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV6_DEFAULT_IP_VALUE+"'")+";"); }else + * if(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getSrcIpAddress())) + * { errInfo.append(prop.getProperty("client_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"'")+";"); }else + * if(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getSrcIpAddress()) + * ) { errInfo.append(prop.getProperty("client_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"'")+";"); }else + * if(Constants.IPV4_DEFAULT_IP_VALUE.equals(baseIpCfg.getSrcIpAddress())) { + * errInfo.append(prop.getProperty("client_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV4_DEFAULT_IP_VALUE+"'")+";"); } + */ String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType, ipPattern); if (matchType.startsWith("IPV6")) { @@ -1397,8 +1473,10 @@ public class BaseController { baseIpCfg.setIpPattern(2); if (baseIpCfg.getSrcIpAddress() .startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";"); + errInfo.append(prop.getProperty("client_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0]) + + ";"); } } else if (matchType.endsWith("SUBNET")) { // baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress()); @@ -1406,16 +1484,19 @@ public class BaseController { baseIpCfg.setIpPattern(1); if (baseIpCfg.getSrcIpAddress() .startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";"); + errInfo.append( + prop.getProperty("client_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0]) + + ";"); } } else { // baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress()); baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE); baseIpCfg.setIpPattern(3); if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) { - errInfo.append(prop.getProperty("client_ip") - + String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)+";"); + errInfo.append(prop.getProperty("client_ip") + String.format( + prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";"); } } baseIpCfg.setIpType(6); @@ -1427,8 +1508,10 @@ public class BaseController { baseIpCfg.setIpPattern(2); if (baseIpCfg.getSrcIpAddress() .startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";"); + errInfo.append(prop.getProperty("client_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0]) + + ";"); } } else if (matchType.endsWith("SUBNET")) { // baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress()); @@ -1436,46 +1519,56 @@ public class BaseController { baseIpCfg.setIpPattern(1); if (baseIpCfg.getSrcIpAddress() .startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) { - errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";"); + errInfo.append( + prop.getProperty("client_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0]) + + ";"); } } else { baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress()); baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE); baseIpCfg.setIpPattern(3); if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) { - errInfo.append(prop.getProperty("client_ip") - + String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)+";"); + errInfo.append(prop.getProperty("client_ip") + String.format( + prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";"); } } baseIpCfg.setIpType(4); } } - + } else if (srcIpEmpty) {// 源IP为空 - if(configIpPortShow.indexOf("1")>-1&&configIpPortShow.indexOf("3")==-1) {//源IP必填 + if (configIpPortShow.indexOf("1") > -1 && configIpPortShow.indexOf("3") == -1) {// 源IP必填 errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("client_ip", "Client IP")) + ";"); - }else if(configIpPortShow.indexOf("3")>-1){ - /*if(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getDestIpAddress())) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"'")+";"); - }else if(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getDestIpAddress())) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"'")+";"); - }else if(Constants.IPV6_DEFAULT_IP_VALUE.equals(baseIpCfg.getDestIpAddress())) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV6_DEFAULT_IP_VALUE+"'")+";"); - }else if(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getDestIpAddress())) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"'")+";"); - }else if(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getDestIpAddress())) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"'")+";"); - }else if(Constants.IPV4_DEFAULT_IP_VALUE.equals(baseIpCfg.getDestIpAddress())) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - "'"+Constants.IPV4_DEFAULT_IP_VALUE+"'")+";"); - }*/ + } else if (configIpPortShow.indexOf("3") > -1) { + /* + * if(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getDestIpAddress()) + * ) { errInfo.append(prop.getProperty("server_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"'")+";"); }else + * if(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getDestIpAddress() + * )) { errInfo.append(prop.getProperty("server_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"'")+";"); }else + * if(Constants.IPV6_DEFAULT_IP_VALUE.equals(baseIpCfg.getDestIpAddress())) { + * errInfo.append(prop.getProperty("server_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV6_DEFAULT_IP_VALUE+"'")+";"); }else + * if(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getDestIpAddress()) + * ) { errInfo.append(prop.getProperty("server_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"'")+";"); }else + * if(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getDestIpAddress() + * )) { errInfo.append(prop.getProperty("server_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"'")+";"); }else + * if(Constants.IPV4_DEFAULT_IP_VALUE.equals(baseIpCfg.getDestIpAddress())) { + * errInfo.append(prop.getProperty("server_ip") + + * String.format(prop.getProperty("can_not_be"), + * "'"+Constants.IPV4_DEFAULT_IP_VALUE+"'")+";"); } + */ String matchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType, ipPattern); if (matchType.startsWith("IPV6")) { @@ -1485,8 +1578,10 @@ public class BaseController { baseIpCfg.setIpPattern(2); if (baseIpCfg.getDestIpAddress() .startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";"); + errInfo.append(prop.getProperty("server_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0]) + + ";"); } } else if (matchType.endsWith("SUBNET")) { // baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress()); @@ -1494,16 +1589,19 @@ public class BaseController { baseIpCfg.setIpPattern(1); if (baseIpCfg.getDestIpAddress() .startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";"); + errInfo.append( + prop.getProperty("server_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0]) + + ";"); } } else { // baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress()); baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_VALUE); baseIpCfg.setIpPattern(3); if (baseIpCfg.getDestIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) { - errInfo.append(prop.getProperty("server_ip") - + String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)+";"); + errInfo.append(prop.getProperty("server_ip") + String.format( + prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";"); } } baseIpCfg.setIpType(6); @@ -1517,8 +1615,10 @@ public class BaseController { baseIpCfg.setIpPattern(2); if (baseIpCfg.getDestIpAddress() .startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";"); + errInfo.append(prop.getProperty("server_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0]) + + ";"); } } else if (matchType.endsWith("SUBNET")) { // baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress()); @@ -1526,28 +1626,31 @@ public class BaseController { baseIpCfg.setIpPattern(1); if (baseIpCfg.getDestIpAddress() .startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) { - errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"), - Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";"); + errInfo.append( + prop.getProperty("server_ip") + + String.format(prop.getProperty("can_not_be"), + Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0]) + + ";"); } } else { // baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress()); baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_VALUE); baseIpCfg.setIpPattern(3); if (baseIpCfg.getDestIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) { - errInfo.append(prop.getProperty("server_ip") - + String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)+";"); + errInfo.append(prop.getProperty("server_ip") + String.format( + prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";"); } } baseIpCfg.setIpType(4); } } - } else {//全不为空 - String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), - ipType, ipPattern); - String matchType1 = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), - ipType, ipPattern); - if (StringUtils.isNotBlank(matchType)&&StringUtils.isNotBlank(matchType1)&& - !matchType.equals(matchType1)) { + } else {// 全不为空 + String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType, + ipPattern); + String matchType1 = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType, + ipPattern); + if (StringUtils.isNotBlank(matchType) && StringUtils.isNotBlank(matchType1) + && !matchType.equals(matchType1)) { errInfo.append(prop.get("the_same_ip_type_pattern") + ";"); } // baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress()); @@ -1635,10 +1738,10 @@ public class BaseController { } else { baseIpCfg.setProtocol(Integer.parseInt(regionDict.getConfigProtocol().split(",")[0])); } - baseIpCfg.setProtocolId(serviceDict.getProtocolId()); + baseIpCfg.setProtocolId(serviceDict==null?0:serviceDict.getProtocolId()); } else { baseIpCfg.setProtocol(baseIpCfg.getProtocol()); - baseIpCfg.setProtocolId(serviceDict.getProtocolId()); + baseIpCfg.setProtocolId(serviceDict==null?0:serviceDict.getProtocolId()); } // TODO 判断Protocol的值 boolean validProtocol = this.validProtocol(errInfo, baseIpCfg.getProtocol(), protocol); @@ -1672,6 +1775,7 @@ public class BaseController { } return ipList; } + /** * 协议与端口验证规则 * @@ -1726,8 +1830,10 @@ public class BaseController { } return has; } + /** * 验证协议 + * * @param errInfo * @param protocol * @param protocolPattern @@ -1902,18 +2008,15 @@ public class BaseController { } if (!m.matches() && !m2.matches()) { errInfo.append( - String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) - + ";"); + String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) + ";"); valid = false; } if (!m1.matches() && !m3.matches()) { errInfo.append( - String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) - + ";"); + String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) + ";"); valid = false; } - } return valid; } @@ -2907,260 +3010,320 @@ public class BaseController { * @param regionDictIds * @param requestId */ - public void _import(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes, MultipartFile[] files, Integer serviceDictId, - String regionDictIds, Integer requestId) { + public void _import(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes, + MultipartFile[] files, Integer serviceDictId, String regionDictIds, Integer requestId) { try { FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId); - String regionCode=serviceDict.getRegionCode(); - List ipPortCfgs = new ArrayList(); - List> stringCfgs = new ArrayList>(); - List complexkeywordCfgs = new ArrayList(); - List cfgIndexInfos = new ArrayList(); - List appPolicyCfgs = new ArrayList(); - FunctionRegionDict appRegion=null; - for(String code:regionCode.split(",")) { - if(StringUtils.isNotBlank(code)) { - FunctionRegionDict d=DictUtils.getFunctionRegionDictByRegionCode(serviceDict.getFunctionId(),Integer.parseInt(code)); - if(d!=null&&d.getConfigServiceType()!=null&&d.getConfigServiceType().equals("app_policy")) { - appRegion=d; - break; + List ipPortCfgs = new ArrayList(); + List> stringCfgs = new ArrayList>(); + List complexkeywordCfgs = new ArrayList(); + List cfgIndexInfos = new ArrayList(); + List appPolicyCfgs = new ArrayList(); + FunctionRegionDict appRegion = null; + if(serviceDict!=null) { + String regionCode = serviceDict.getRegionCode(); + for (String code : regionCode.split(",")) { + if (StringUtils.isNotBlank(code)) { + FunctionRegionDict d = DictUtils.getFunctionRegionDictByRegionCode(serviceDict.getFunctionId(), + Integer.parseInt(code)); + if (d != null && d.getConfigServiceType() != null + && d.getConfigServiceType().equals("app_policy")) { + appRegion = d; + break; + } + } + } } - - } - - for (int i = 0; i < files.length; i++) { - MultipartFile file = files[i]; - ImportExcel ei = new ImportExcel(file, 0, 0); + for (int i = 0; i < files.length; i++) { + MultipartFile file = files[i]; + ImportExcel ei = new ImportExcel(file, 0, 0); - FunctionRegionDict regionDict = DictUtils - .getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i])); - if (regionDict.getRegionType().equals(1)) {//IP - if (regionDict.getFunctionId().equals(5)) { - if (serviceDict.getAction().equals(64)) { - List list = ei.getDataList(IpRateLimitTemplate.class,this.getMsgProp()); + FunctionRegionDict regionDict = DictUtils + .getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i])); + if (regionDict.getRegionType().equals(1)) {// IP + if (regionDict.getFunctionId().equals(5)) { + if (serviceDict!=null&&serviceDict.getAction().equals(64)) { + List list = ei.getDataList(IpRateLimitTemplate.class, + this.getMsgProp()); + ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); + } else { + List list = ei.getDataList(IpAllTemplate.class, this.getMsgProp()); + ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); + } + } else if (regionDict.getFunctionId().equals(212)) { + List list = ei.getDataList(IpPayloadTemplate.class, this.getMsgProp()); ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); - }else { - List list = ei.getDataList(IpAllTemplate.class,this.getMsgProp()); + } else if (regionDict.getFunctionId().equals(510) + && "p2p_ip".equals(regionDict.getConfigServiceType())) { // P2p IP + List list = ei.getDataList(P2pIpTemplate.class, this.getMsgProp()); + ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); + } else if (regionDict.getFunctionId().equals(600)) { + List list = ei.getDataList(AsnIpTemplate.class, this.getMsgProp()); + ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); + } else { + List list = ei.getDataList(IpAllTemplate.class, this.getMsgProp()); ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); } - }else if(regionDict.getFunctionId().equals(212)) { - List list = ei.getDataList(IpPayloadTemplate.class,this.getMsgProp()); - ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); - }else if(regionDict.getFunctionId().equals(510) && "p2p_ip".equals(regionDict.getConfigServiceType())){ //P2p IP - List list = ei.getDataList(P2pIpTemplate.class,this.getMsgProp()); - ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); - }else if(regionDict.getFunctionId().equals(600)) { - List list = ei.getDataList(AsnIpTemplate.class,this.getMsgProp()); - ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); - }else { - List list = ei.getDataList(IpAllTemplate.class,this.getMsgProp()); - ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); - } - }else if(regionDict.getRegionType().equals(2)) {//字符串类 - if(regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())){ //P2p hash - List list = ei.getDataList(P2pHashStringTemplate.class,this.getMsgProp()); - stringCfgs=this.checkStringCfg(serviceDict, regionDict, list); - }else{ - List list = ei.getDataList(StringAllTemplate.class,this.getMsgProp()); - stringCfgs=this.checkStringCfg(serviceDict, regionDict, list); - } + } else if (regionDict.getRegionType().equals(2)) {// 字符串类 + if (regionDict.getFunctionId().equals(510) + && "p2p_hash".equals(regionDict.getConfigServiceType())) { // P2p hash + List list = ei.getDataList(P2pHashStringTemplate.class, + this.getMsgProp()); + stringCfgs = this.checkStringCfg(serviceDict, regionDict, list); + } else { + List list = ei.getDataList(StringAllTemplate.class, this.getMsgProp()); + stringCfgs = this.checkStringCfg(serviceDict, regionDict, list); + } + + } else if (regionDict.getRegionType().equals(3)) {// 增强字符串类 + if (regionDict.getFunctionId().equals(7)) { + List list = ei.getDataList(DnsComplexStringTemplate.class, + this.getMsgProp()); + complexkeywordCfgs = this.checkComplexStringCfg(serviceDict, regionDict, list); + } else { + List list = ei.getDataList(ComplexStringAllTemplate.class, + this.getMsgProp()); + complexkeywordCfgs = this.checkComplexStringCfg(serviceDict, regionDict, list); + } - }else if(regionDict.getRegionType().equals(3)) {//增强字符串类 - if(regionDict.getFunctionId().equals(7)) { - List list = ei.getDataList(DnsComplexStringTemplate.class,this.getMsgProp()); - complexkeywordCfgs=this.checkComplexStringCfg(serviceDict, regionDict, list); - }else { - List list = ei.getDataList(ComplexStringAllTemplate.class,this.getMsgProp()); - complexkeywordCfgs=this.checkComplexStringCfg(serviceDict, regionDict, list); } - - } - Date date = new Date(); - String specServiceId=request.getParameter("appId"); - String behaviorId=request.getParameter("behaviorId"); - SpecificServiceCfg specificServiceCfg=null; - if(serviceDict.getServiceId().intValue()==33||serviceDict.getServiceId().intValue()==145|| - serviceDict.getServiceId().intValue()==35||serviceDict.getServiceId().intValue()==147|| - serviceDict.getServiceId().intValue()==36||serviceDict.getServiceId().intValue()==148) { - if(StringUtils.isNotBlank(specServiceId)) { - specificServiceCfg=specificServiceCfgService.getBySpecServiceId(Integer.parseInt(specServiceId)); + Date date = new Date(); + String specServiceId = request.getParameter("appId"); + String behaviorId = request.getParameter("behaviorId"); + String asnIpGroup = request.getParameter("asnGroupId"); + SpecificServiceCfg specificServiceCfg = null; + if (serviceDict!=null&&(serviceDict.getServiceId().intValue() == 33 || serviceDict.getServiceId().intValue() == 145 + || serviceDict.getServiceId().intValue() == 35 + || serviceDict.getServiceId().intValue() == 147 + || serviceDict.getServiceId().intValue() == 36 + || serviceDict.getServiceId().intValue() == 148)) { + if (StringUtils.isNotBlank(specServiceId)) { + specificServiceCfg = specificServiceCfgService + .getBySpecServiceId(Integer.parseInt(specServiceId)); + } } - } - if (regionDict.getRegionType().equals(1)) {//IP - for (BaseIpCfg cfg : ipPortCfgs) { - cfg.setAction(serviceDict.getAction()); - cfg.setAuditorId(UserUtils.getUser().getId()); - cfg.setAuditTime(date); - cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); - cfg.setCfgType(regionDict.getConfigRegionValue()); - cfg.setCreateTime(date); - cfg.setCreatorId(UserUtils.getUser().getId()); - cfg.setDoLog(1); - cfg.setFunctionId(regionDict.getFunctionId()); - cfg.setIsAudit(0); - cfg.setIsValid(0); - cfg.setIsAreaEffective(0); - cfg.setAttribute("0"); - cfg.setClassify("0"); - cfg.setLable("0"); - cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); - cfg.setServiceId(serviceDict.getServiceId()); - cfg.setTableName("ip_port_cfg"); - cfg.setCompileId(ipCfgService.getCompileId()); - if(serviceDict.getServiceId().intValue()==33||serviceDict.getServiceId().intValue()==145|| - serviceDict.getServiceId().intValue()==35||serviceDict.getServiceId().intValue()==147|| - serviceDict.getServiceId().intValue()==36||serviceDict.getServiceId().intValue()==148) { - if(specificServiceCfg!=null&&appRegion!=null) { - AppPolicyCfg appPolicyCfg=new AppPolicyCfg(); - BeanUtils.copyProperties(cfg, appPolicyCfg); - appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); - appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); - appPolicyCfg.setMatchMethod(0); - appPolicyCfg.setIsHexbin(0); - appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); - appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); - if(StringUtils.isNotBlank(behaviorId)) { - appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); - appPolicyCfg.setExprType(1); - }else { - appPolicyCfg.setExprType(0); - } - appPolicyCfgs.add(appPolicyCfg); + if (regionDict.getRegionType().equals(1)) {// IP + if(regionDict.getFunctionId().intValue()==600) { + CfgIndexInfo info=new CfgIndexInfo(); + List asnIpCfgs=Lists.newArrayList(); + info.setAsnIpGroup(Integer.parseInt(asnIpGroup)); + info.setAction(0); + info.setCfgRegionCode(regionDict.getConfigRegionCode()); + info.setCfgRegionCode(regionDict.getConfigRegionCode()); + info.setCfgType(regionDict.getConfigRegionValue()); + info.setCreateTime(date); + info.setCreatorId(UserUtils.getUser().getId()); + info.setDoLog(1); + info.setFunctionId(regionDict.getFunctionId()); + info.setIsAudit(0); + info.setIsValid(0); + info.setIsAreaEffective(0); + info.setAttribute("0"); + info.setClassify("0"); + info.setLable("0"); + info.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); + info.setServiceId(0); + for (BaseIpCfg cfg : ipPortCfgs) { + AsnIpCfg _cfg=new AsnIpCfg(); + BeanUtils.copyProperties(cfg, _cfg); + _cfg.setTableName(AsnIpCfg.getTablename()); + asnIpCfgs.add(_cfg); } + ipPortCfgs.clear(); + info.setAsnIpCfgs(asnIpCfgs); + asnIpCfgService.saveAsnIpCfg(info); }else { - CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); - BeanUtils.copyProperties(cfg, cfgIndexInfo); - cfgIndexInfos.add(cfgIndexInfo); + for (BaseIpCfg cfg : ipPortCfgs) { + cfg.setAction(serviceDict==null?null:serviceDict.getAction()); + cfg.setAuditorId(UserUtils.getUser().getId()); + cfg.setAuditTime(date); + cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); + cfg.setCfgType(regionDict.getConfigRegionValue()); + cfg.setCreateTime(date); + cfg.setCreatorId(UserUtils.getUser().getId()); + cfg.setDoLog(1); + cfg.setFunctionId(regionDict.getFunctionId()); + cfg.setIsAudit(0); + cfg.setIsValid(0); + cfg.setIsAreaEffective(0); + cfg.setAttribute("0"); + cfg.setClassify("0"); + cfg.setLable("0"); + cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); + cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId()); + cfg.setTableName("ip_port_cfg"); + cfg.setCompileId(ipCfgService.getCompileId()); + if (serviceDict!=null&&(serviceDict.getServiceId().intValue() == 33 + || serviceDict.getServiceId().intValue() == 145 + || serviceDict.getServiceId().intValue() == 35 + || serviceDict.getServiceId().intValue() == 147 + || serviceDict.getServiceId().intValue() == 36 + || serviceDict.getServiceId().intValue() == 148)) { + if (specificServiceCfg != null && appRegion != null) { + AppPolicyCfg appPolicyCfg = new AppPolicyCfg(); + BeanUtils.copyProperties(cfg, appPolicyCfg); + appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); + appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); + appPolicyCfg.setMatchMethod(0); + appPolicyCfg.setIsHexbin(0); + appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); + appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); + if (StringUtils.isNotBlank(behaviorId)) { + appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); + appPolicyCfg.setExprType(1); + } else { + appPolicyCfg.setExprType(0); + } + appPolicyCfgs.add(appPolicyCfg); + } + } else { + if(regionDict.getFunctionId().intValue()!=600) { + CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); + BeanUtils.copyProperties(cfg, cfgIndexInfo); + cfgIndexInfos.add(cfgIndexInfo); + } + } + + } + + if(ipPortCfgs!=null&&ipPortCfgs.size()>0) { + ipCfgService.saveBatch(ipPortCfgs, IpCfgDao.class); + } } - } - ipCfgService.saveBatch(ipPortCfgs, IpCfgDao.class); - }else if (regionDict.getRegionType().equals(2)) { - for(BaseStringCfg cfg:stringCfgs) { - cfg.setAction(serviceDict.getAction()); - cfg.setAuditorId(UserUtils.getUser().getId()); - cfg.setAuditTime(date); - cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); - cfg.setCfgType(regionDict.getConfigRegionValue()); - cfg.setCreateTime(date); - cfg.setCreatorId(UserUtils.getUser().getId()); - cfg.setDoLog(1); - cfg.setFunctionId(regionDict.getFunctionId()); - cfg.setIsAudit(0); - cfg.setIsValid(0); - cfg.setIsAreaEffective(0); - cfg.setAttribute("0"); - cfg.setClassify("0"); - cfg.setLable("0"); - cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); - cfg.setServiceId(serviceDict.getServiceId()); - cfg.setCompileId(ipCfgService.getCompileId()); - if(serviceDict.getServiceId().intValue()==33||serviceDict.getServiceId().intValue()==145|| - serviceDict.getServiceId().intValue()==35||serviceDict.getServiceId().intValue()==147|| - serviceDict.getServiceId().intValue()==36||serviceDict.getServiceId().intValue()==148) { - if(specificServiceCfg!=null&&appRegion!=null) { - AppPolicyCfg appPolicyCfg=new AppPolicyCfg(); - BeanUtils.copyProperties(cfg, appPolicyCfg); - appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); - appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); - appPolicyCfg.setMatchMethod(0); - appPolicyCfg.setIsHexbin(0); - appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); - appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); - if(StringUtils.isNotBlank(behaviorId)) { - appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); - appPolicyCfg.setExprType(1); - }else { - appPolicyCfg.setExprType(0); + } else if (regionDict.getRegionType().equals(2)) { + for (BaseStringCfg cfg : stringCfgs) { + cfg.setAction(serviceDict.getAction()); + cfg.setAuditorId(UserUtils.getUser().getId()); + cfg.setAuditTime(date); + cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); + cfg.setCfgType(regionDict.getConfigRegionValue()); + cfg.setCreateTime(date); + cfg.setCreatorId(UserUtils.getUser().getId()); + cfg.setDoLog(1); + cfg.setFunctionId(regionDict.getFunctionId()); + cfg.setIsAudit(0); + cfg.setIsValid(0); + cfg.setIsAreaEffective(0); + cfg.setAttribute("0"); + cfg.setClassify("0"); + cfg.setLable("0"); + cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); + cfg.setServiceId(serviceDict.getServiceId()); + cfg.setCompileId(ipCfgService.getCompileId()); + if (serviceDict.getServiceId().intValue() == 33 + || serviceDict.getServiceId().intValue() == 145 + || serviceDict.getServiceId().intValue() == 35 + || serviceDict.getServiceId().intValue() == 147 + || serviceDict.getServiceId().intValue() == 36 + || serviceDict.getServiceId().intValue() == 148) { + if (specificServiceCfg != null && appRegion != null) { + AppPolicyCfg appPolicyCfg = new AppPolicyCfg(); + BeanUtils.copyProperties(cfg, appPolicyCfg); + appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); + appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); + appPolicyCfg.setMatchMethod(0); + appPolicyCfg.setIsHexbin(0); + appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); + appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); + if (StringUtils.isNotBlank(behaviorId)) { + appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); + appPolicyCfg.setExprType(1); + } else { + appPolicyCfg.setExprType(0); + } + appPolicyCfgs.add(appPolicyCfg); } - appPolicyCfgs.add(appPolicyCfg); + } else { + CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); + BeanUtils.copyProperties(cfg, cfgIndexInfo); + cfgIndexInfos.add(cfgIndexInfo); } - }else { - CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); - BeanUtils.copyProperties(cfg, cfgIndexInfo); - cfgIndexInfos.add(cfgIndexInfo); } - } - //调用对应配置的service - if(regionDict.getDictId().intValue()==167) { - interceptCfgService.saveInterceptCfg(stringCfgs); - } - if(regionDict.getDictId().intValue()==15||regionDict.getDictId().intValue()==596) { - websiteCfgService.saveHttpUrlCfg(stringCfgs); - } - if(regionDict.getDictId().intValue()==36) { - fileTransferCfgService.saveFtpCfg(stringCfgs); - } - if(regionDict.getFunctionId().equals(510)){ //P2p hash - /*if("p2p_hash".equals(regionDict.getConfigServiceType())) { - fileTransferCfgService.saveP2pHashCfg(stringCfgs); - }else {*/ + // 调用对应配置的service + if (regionDict.getDictId().intValue() == 167) { + interceptCfgService.saveInterceptCfg(stringCfgs); + } + if (regionDict.getDictId().intValue() == 15 || regionDict.getDictId().intValue() == 596) { + websiteCfgService.saveHttpUrlCfg(stringCfgs); + } + if (regionDict.getDictId().intValue() == 36) { + fileTransferCfgService.saveFtpCfg(stringCfgs); + } + if (regionDict.getFunctionId().equals(510)) { // P2p hash + /* + * if("p2p_hash".equals(regionDict.getConfigServiceType())) { + * fileTransferCfgService.saveP2pHashCfg(stringCfgs); }else { + */ fileTransferCfgService.saveP2pCfg(stringCfgs); - /*}*/ - - } - }else if (regionDict.getRegionType().equals(3)) { - for(ComplexkeywordCfg cfg:complexkeywordCfgs) { - cfg.setAction(serviceDict.getAction()); - cfg.setAuditorId(UserUtils.getUser().getId()); - cfg.setAuditTime(date); - cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); - cfg.setCfgType(regionDict.getConfigRegionValue()); - cfg.setCreateTime(date); - cfg.setCreatorId(UserUtils.getUser().getId()); - cfg.setDoLog(1); - cfg.setFunctionId(regionDict.getFunctionId()); - cfg.setIsAudit(0); - cfg.setIsValid(0); - cfg.setIsAreaEffective(0); - cfg.setAttribute("0"); - cfg.setClassify("0"); - cfg.setLable("0"); - cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); - cfg.setServiceId(serviceDict.getServiceId()); - cfg.setCompileId(ipCfgService.getCompileId()); - if(serviceDict.getServiceId().intValue()==33||serviceDict.getServiceId().intValue()==145|| - serviceDict.getServiceId().intValue()==35||serviceDict.getServiceId().intValue()==147|| - serviceDict.getServiceId().intValue()==36||serviceDict.getServiceId().intValue()==148) { - if(specificServiceCfg!=null&&appRegion!=null) { - AppPolicyCfg appPolicyCfg=new AppPolicyCfg(); - BeanUtils.copyProperties(cfg, appPolicyCfg); - appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); - appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); - appPolicyCfg.setMatchMethod(0); - appPolicyCfg.setIsHexbin(0); - appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); - appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); - if(StringUtils.isNotBlank(behaviorId)) { - appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); - appPolicyCfg.setExprType(1); - }else { - appPolicyCfg.setExprType(0); + /* } */ + + } + } else if (regionDict.getRegionType().equals(3)) { + for (ComplexkeywordCfg cfg : complexkeywordCfgs) { + cfg.setAction(serviceDict.getAction()); + cfg.setAuditorId(UserUtils.getUser().getId()); + cfg.setAuditTime(date); + cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); + cfg.setCfgType(regionDict.getConfigRegionValue()); + cfg.setCreateTime(date); + cfg.setCreatorId(UserUtils.getUser().getId()); + cfg.setDoLog(1); + cfg.setFunctionId(regionDict.getFunctionId()); + cfg.setIsAudit(0); + cfg.setIsValid(0); + cfg.setIsAreaEffective(0); + cfg.setAttribute("0"); + cfg.setClassify("0"); + cfg.setLable("0"); + cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId); + cfg.setServiceId(serviceDict.getServiceId()); + cfg.setCompileId(ipCfgService.getCompileId()); + if (serviceDict.getServiceId().intValue() == 33 + || serviceDict.getServiceId().intValue() == 145 + || serviceDict.getServiceId().intValue() == 35 + || serviceDict.getServiceId().intValue() == 147 + || serviceDict.getServiceId().intValue() == 36 + || serviceDict.getServiceId().intValue() == 148) { + if (specificServiceCfg != null && appRegion != null) { + AppPolicyCfg appPolicyCfg = new AppPolicyCfg(); + BeanUtils.copyProperties(cfg, appPolicyCfg); + appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId()); + appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode()); + appPolicyCfg.setMatchMethod(0); + appPolicyCfg.setIsHexbin(0); + appPolicyCfg.setCfgType(appRegion.getConfigRegionValue()); + appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode()); + if (StringUtils.isNotBlank(behaviorId)) { + appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId)); + appPolicyCfg.setExprType(1); + } else { + appPolicyCfg.setExprType(0); + } + appPolicyCfgs.add(appPolicyCfg); } - appPolicyCfgs.add(appPolicyCfg); + } else { + CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); + BeanUtils.copyProperties(cfg, cfgIndexInfo); + cfgIndexInfos.add(cfgIndexInfo); } - }else { - CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); - BeanUtils.copyProperties(cfg, cfgIndexInfo); - cfgIndexInfos.add(cfgIndexInfo); + } + if (regionDict.getDictId().intValue() == 28) { + websiteCfgService.saveDnsCfg(complexkeywordCfgs); + } + if (regionDict.getDictId().intValue() == 30 || regionDict.getDictId().intValue() == 31) { + mailCfgService.saveMailCfg(complexkeywordCfgs); } } - if(regionDict.getDictId().intValue()==28) { - websiteCfgService.saveDnsCfg(complexkeywordCfgs); + if (cfgIndexInfos != null && cfgIndexInfos.size() > 0) { + ipCfgService.saveCfgIndexOf(cfgIndexInfos); } - if(regionDict.getDictId().intValue()==30||regionDict.getDictId().intValue()==31) { - mailCfgService.saveMailCfg(complexkeywordCfgs); + if (appPolicyCfgs != null && appPolicyCfgs.size() > 0) { + appCfgService.savePolicyList(appPolicyCfgs); } + } - if(cfgIndexInfos!=null&&cfgIndexInfos.size()>0) { - ipCfgService.saveCfgIndexOf(cfgIndexInfos); - } - if(appPolicyCfgs!=null&&appPolicyCfgs.size()>0) { - appCfgService.savePolicyList(appPolicyCfgs); - } - - } } catch (Exception e) { addMessage(redirectAttributes, e.getMessage()); e.printStackTrace(); @@ -3195,8 +3358,8 @@ public class BaseController { String fileName = msgProp.getProperty(functionName, functionName) + "_" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx"; - - fileName=fileName.replaceAll(" ", "_"); + + fileName = fileName.replaceAll(" ", "_"); if (request.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0) { fileName = URLEncoder.encode(fileName, "UTF-8"); } else { diff --git a/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java b/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java index 5689593e8..9cdffab9e 100644 --- a/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java +++ b/src/main/java/com/nis/web/service/basics/AsnIpCfgService.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -82,7 +83,12 @@ public class AsnIpCfgService extends CrudService, AsnIpCfg> { if(groupInfo.getIsIssued()==1) {//如果已经下发,则需要下到综合服务中 if(entity.getAsnIpCfgs()!=null) { for(AsnIpCfg cfg:entity.getAsnIpCfgs()) { - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + if(StringUtils.isNotBlank(entity.getCfgDesc())) { + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + }else { + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId","cfgDesc"}); + } + cfg.setCreateTime(crateTime); cfg.setCreatorId(entity.getCurrentUser().getId()); cfg.setAsnIpGroup(entity.getAsnIpGroup());