diff --git a/src/main/java/com/nis/util/excel/ExportExcel.java b/src/main/java/com/nis/util/excel/ExportExcel.java index f37273b7a..d891c014d 100644 --- a/src/main/java/com/nis/util/excel/ExportExcel.java +++ b/src/main/java/com/nis/util/excel/ExportExcel.java @@ -496,7 +496,7 @@ public class ExportExcel { commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n"; index++; } - if(("domain_name".equals(headerStr)) && (region.getFunctionId().equals(560))){ + if("domain_name".equals(headerStr)){ commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n"; index++; //1、非空 @@ -1113,9 +1113,9 @@ public class ExportExcel { commentStr=""; } if(StringUtil.isEmpty(defaultValue)){ - defaultValue="0"; + defaultValue = region.getConfigDirection().split(",")[0]; } - defaultValue = region.getFunctionId().equals(301)?"1":defaultValue; + } /*}*/ /*if(StringUtil.isEmpty(commentStr)){ diff --git a/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java index 2d6a4917b..6a97ef509 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java @@ -45,6 +45,7 @@ public class CheckAppFeatureComplexStringFormatThread implements Callable dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); StringBuffer msg=new StringBuffer(); + boolean error = false; while(!srcQueue.isEmpty()) { int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE); if(regionDict.getRegionType().intValue()==3) { @@ -57,10 +58,15 @@ public class CheckAppFeatureComplexStringFormatThread implements Callable checkAppComplexFeatureCfg(StringBuffer msg, diff --git a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java index e01a35d7c..a2b0bd291 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java @@ -45,6 +45,7 @@ public class CheckComplexStringFormatThread implements Callable{ public String call() throws Exception { List dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); StringBuffer msg=new StringBuffer(); + boolean error = false; while(!srcQueue.isEmpty()) { int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE); if(regionDict.getRegionType().intValue()==3) { @@ -57,10 +58,15 @@ public class CheckComplexStringFormatThread implements Callable{ //msg=e.getMessage(); //msg.append(e.getMessage()); //break; + error = true; } } dataList.clear(); } + if(error) { + msg.append("validate_error"); + } + return msg.toString(); } public List checkComplexStringCfg(StringBuffer msg, diff --git a/src/main/java/com/nis/util/excel/thread/CheckDnsResStrategyFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckDnsResStrategyFormatThread.java index 107ae5be1..ec8813803 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckDnsResStrategyFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckDnsResStrategyFormatThread.java @@ -42,6 +42,7 @@ public class CheckDnsResStrategyFormatThread implements Callable{ public String call() throws Exception { List dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); StringBuffer msg=new StringBuffer(); + boolean error = false; while(!srcQueue.isEmpty()) { int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE); if(regionDict.getRegionType().intValue()==6) { @@ -53,10 +54,15 @@ public class CheckDnsResStrategyFormatThread implements Callable{ // TODO: handle exception //msg=e.getMessage(); //break; + error = true; } } dataList.clear(); } + if(error) { + msg.append("validate_error"); + } + return msg.toString(); } public List checkDnsResStrategyCfg(StringBuffer msg,List list) diff --git a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java index fb8bc3f73..d32e8d80f 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java @@ -51,6 +51,7 @@ public class CheckIpFormatThread implements Callable{ public String call() throws Exception { List dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); StringBuffer msg=new StringBuffer(); + boolean error = false; while(!srcQueue.isEmpty()) { int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE); if(regionDict.getRegionType().intValue()==1) { @@ -63,10 +64,15 @@ public class CheckIpFormatThread implements Callable{ // TODO: handle exception //msg.append(e.getMessage()); //break; + error = true; } } dataList.clear(); } + if(error) { + msg.append("validate_error"); + } + return msg.toString(); } public List checkIpCfg(StringBuffer msg,List> asnNos, List list) diff --git a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java index ff770be4d..846f8dfb7 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java @@ -44,6 +44,7 @@ public class CheckStringFormatThread implements Callable{ public String call() throws Exception { List dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); StringBuffer msg=new StringBuffer(); + boolean error = false; while(!srcQueue.isEmpty()) { int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE); if(regionDict.getRegionType().intValue()==2) { @@ -55,10 +56,15 @@ public class CheckStringFormatThread implements Callable{ // TODO: handle exception //msg=e.getMessage(); //break; + error = true; } } dataList.clear(); } + if(error) { + msg.append("validate_error"); + } + return msg.toString(); } @@ -84,7 +90,7 @@ public class CheckStringFormatThread implements Callable{ } StringBuffer errTip = new StringBuffer(); Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f"); - Pattern domainPattern = Pattern.compile(Constants.DOMAIN_REGEXP); + Pattern domainPattern = Pattern.compile("^[a-zA-Z0-9.-]*$"); for (int i = 0; i < list.size(); i++) { StringBuffer errInfo = new StringBuffer(); BaseStringCfg baseStringCfg = new BaseStringCfg(); diff --git a/src/main/java/com/nis/util/excel/thread/CheckTopicWebsiteFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckTopicWebsiteFormatThread.java index 34b8165a6..dd59f0194 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckTopicWebsiteFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckTopicWebsiteFormatThread.java @@ -47,6 +47,7 @@ public class CheckTopicWebsiteFormatThread implements Callable{ public String call() throws Exception { List dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); StringBuffer msg=new StringBuffer(); + boolean error = false; while(!srcQueue.isEmpty()) { int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE); if(regionDict.getRegionType().intValue()==2) { @@ -58,10 +59,15 @@ public class CheckTopicWebsiteFormatThread implements Callable{ // TODO: handle exception //msg=e.getMessage(); //break; + error = true; } } dataList.clear(); } + if(error) { + msg.append("validate_error"); + } + return msg.toString(); } @@ -87,7 +93,7 @@ public class CheckTopicWebsiteFormatThread implements Callable{ } StringBuffer errTip = new StringBuffer(); Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f"); - Pattern domainPattern = Pattern.compile(Constants.DOMAIN_REGEXP); + Pattern domainPattern = Pattern.compile("^[a-zA-Z0-9.-]*$"); for (int i = 0; i < list.size(); i++) { StringBuffer errInfo = new StringBuffer(); AppTopicDomainCfg baseStringCfg = new AppTopicDomainCfg(); diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index f0ab92c1c..6bc1acbe2 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -963,8 +963,10 @@ public class BaseController { BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); List> futures=new ArrayList<>(); + + Properties props=this.getMsgProp(); for(int i=0;i future:futures) { String msg = future.get(); if(StringUtils.isNotBlank(msg)) { + if(msg.equals("validate_error")) { + valideteError=true; + }else if(msg.endsWith("validate_error")) { + _msg.append(msg.substring(0, msg.length()-1-"validate_error".length())); + valideteError=true; + }else { + _msg.append(msg); + } //throw new ServiceException(msg); - _msg.append(msg); + } } + if(valideteError) { + _msg.append(props.getProperty("validate_error", "Unexpected error occurred while validating")); + } + long end=System.currentTimeMillis(); logger.warn("checkIpCfgMulity finish,cost:"+(end-start)+",size:"+queue.size()); return queue; @@ -1005,8 +1020,10 @@ public class BaseController { BlockingQueue> queue=new ArrayBlockingQueue<>(list.size()); ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); List> futures=new ArrayList<>(); + + Properties props=this.getMsgProp(); for(int i=0;i future:futures) { String msg = future.get(); if(StringUtils.isNotBlank(msg)) { + if(msg.equals("validate_error")) { + valideteError=true; + }else if(msg.endsWith("validate_error")) { + _msg.append(msg.substring(0, msg.length()-1-"validate_error".length())); + valideteError=true; + }else { + _msg.append(msg); + } //throw new ServiceException(msg); - _msg.append(msg); + } } + if(valideteError) { + _msg.append(props.getProperty("validate_error", "Unexpected error occurred while validating")); + } + long end=System.currentTimeMillis(); logger.warn("checkStringCfgMulity finish,cost:"+(end-start)+",size:"+queue.size()); return queue; @@ -1045,8 +1075,10 @@ public class BaseController { BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); List> futures=new ArrayList<>(); + + Properties props=this.getMsgProp(); for(int i=0;i future:futures) { String msg = future.get(); if(StringUtils.isNotBlank(msg)) { + if(msg.equals("validate_error")) { + valideteError=true; + }else if(msg.endsWith("validate_error")) { + _msg.append(msg.substring(0, msg.length()-1-"validate_error".length())); + valideteError=true; + }else { + _msg.append(msg); + } //throw new ServiceException(msg); - _msg.append(msg); + } } + if(valideteError) { + _msg.append(props.getProperty("validate_error", "Unexpected error occurred while validating")); + } + long end=System.currentTimeMillis(); logger.warn("checkComplexStringCfgMulity finish,cost:"+(end-start)+",size:"+queue.size()); return queue; @@ -1085,8 +1130,10 @@ public class BaseController { BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); List> futures=new ArrayList<>(); + + Properties props=this.getMsgProp(); for(int i=0;i future:futures) { String msg = future.get(); if(StringUtils.isNotBlank(msg)) { - _msg.append(msg); + if(msg.equals("validate_error")) { + valideteError=true; + }else if(msg.endsWith("validate_error")) { + _msg.append(msg.substring(0, msg.length()-1-"validate_error".length())); + valideteError=true; + }else { + _msg.append(msg); + } //throw new ServiceException(msg); + } } + if(valideteError) { + _msg.append(props.getProperty("validate_error", "Unexpected error occurred while validating")); + } + long end=System.currentTimeMillis(); logger.warn("checkDnsResStrategyCfgMulity finish,cost:"+(end-start)+",size:"+queue.size()); return queue; @@ -1127,8 +1187,10 @@ public class BaseController { BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); List> futures=new ArrayList<>(); + + Properties props=this.getMsgProp(); for(int i=0;i future:futures) { String msg = future.get(); if(StringUtils.isNotBlank(msg)) { - _msg.append(msg); + if(msg.equals("validate_error")) { + valideteError=true; + }else if(msg.endsWith("validate_error")) { + _msg.append(msg.substring(0, msg.length()-1-"validate_error".length())); + valideteError=true; + }else { + _msg.append(msg); + } //throw new ServiceException(msg); + } } + if(valideteError) { + _msg.append(props.getProperty("validate_error", "Unexpected error occurred while validating")); + } + long end=System.currentTimeMillis(); logger.warn("checkAppComplexFeatureStringCfgMulity finish,cost:"+(end-start)+",size:"+queue.size()); return queue; @@ -1168,10 +1243,11 @@ public class BaseController { BlockingQueue queue=new ArrayBlockingQueue<>(list.size()); ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE); List> futures=new ArrayList<>(); + + Properties props=this.getMsgProp(); for(int i=0;i future:futures) { String msg = future.get(); if(StringUtils.isNotBlank(msg)) { + if(msg.equals("validate_error")) { + valideteError=true; + }else if(msg.endsWith("validate_error")) { + _msg.append(msg.substring(0, msg.length()-1-"validate_error".length())); + valideteError=true; + }else { + _msg.append(msg); + } //throw new ServiceException(msg); - _msg.append(msg); + } } + if(valideteError) { + _msg.append(props.getProperty("validate_error", "Unexpected error occurred while validating")); + } + long end=System.currentTimeMillis(); logger.warn("checkTopicWebsiteCfgMulity finish,cost:"+(end-start)+",size:"+queue.size()); return queue; diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index b309c80e5..a6b07fe9a 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1490,4 +1490,5 @@ endTime=End Time single=Single everyDay=Every Day everyWeek=Every Week -everyMonth=Every Month \ No newline at end of file +everyMonth=Every Month +validate_error=Unexpected error occurred while validating \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 18b4969ed..6c57a5a43 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1494,4 +1494,5 @@ endTime=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C single=\u041E\u0434\u043D\u043E\u043A\u0440\u0430\u0442\u043D\u043E everyDay=\u0415\u0436\u0435\u0434\u043D\u0435\u0432\u043D\u043E everyWeek=\u0415\u0436\u0435\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u043E -everyMonth=\u0415\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u043E \ No newline at end of file +everyMonth=\u0415\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u043E +validate_error=Unexpected error occurred while validating \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index a10363d75..4bf89325b 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1490,4 +1490,5 @@ endTime=\u7ED3\u675F\u65F6\u95F4 single=\u5355\u6B21 everyDay=\u6BCF\u5929 everyWeek=\u6BCF\u5468 -everyMonth=\u6BCF\u6708 \ No newline at end of file +everyMonth=\u6BCF\u6708 +validate_error=\u9A8C\u8BC1\u65F6\u53D1\u751F\u610F\u5916\u9519\u8BEF \ No newline at end of file