From 253adc13961bb01e2c344fd72d8c750b488d4081 Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Fri, 22 Mar 2019 18:21:25 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=94=99=E8=AF=AFIsHex=E5=80=BC=E4=B8=8D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8CBUG=20=E5=A4=8D=E7=8E=B0=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=EF=BC=9A=E5=A1=AB=E5=86=99=E9=94=99=E8=AF=AFIsHex=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=A1=AB=E5=86=99Is=20Case-sensitive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CheckComplexStringFormatThread.java | 73 ++++++++--------- .../excel/thread/CheckStringFormatThread.java | 81 ++++++++++--------- .../thread/CheckTopicWebsiteFormatThread.java | 73 ++++++++--------- 3 files changed, 115 insertions(+), 112 deletions(-) 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 a2b0bd291..1f8bb407a 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java @@ -381,45 +381,46 @@ public class CheckComplexStringFormatThread implements Callable{ 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")) + ";"); - } - 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.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.equals("2") && isCaseInsenstive.intValue() == 0) { - errInfo.append( - String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) - + ";"); - } - // 关键字十六进制校验 - if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) { - boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches(); - if(!bl) { - errInfo.append( - prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); - } - } } + isHex = baseStringCfg.getIsHex(); isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + 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 (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.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.indexOf("1") != -1 && isHex.intValue() == 1) { + boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches(); + if(!bl) { + errInfo.append( + prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + } + } + if (isHex != null && isCaseInsenstive != null) { if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { baseStringCfg.setIsHexbin(0); 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 be14df6f4..2be4d90a0 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java @@ -437,49 +437,50 @@ public class CheckStringFormatThread implements Callable{ 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")) + ";"); - } - 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.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.equals("2") && isCaseInsenstive.intValue() == 0) { - errInfo.append( - String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) - + ";"); - } - // 十六进制 关键字校验 - if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) { - boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches(); - if(!bl) { - String message = prop.getProperty("key_word"); - if(regionDict.getFunctionId().equals(403) || regionDict.getFunctionId().equals(200)) { - message = prop.getProperty("domain_name"); - } - errInfo.append( - message + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); - } - } } + isHex = baseStringCfg.getIsHex(); isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + 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 (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.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.indexOf("1") != -1 && isHex.intValue() == 1) { + boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches(); + if(!bl) { + String message = prop.getProperty("key_word"); + if(regionDict.getFunctionId().equals(403) || regionDict.getFunctionId().equals(200)) { + message = prop.getProperty("domain_name"); + } + errInfo.append( + message + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + } + } + if (isHex != null && isCaseInsenstive != null) { if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { baseStringCfg.setIsHexbin(0); 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 2be1b7641..e7f2e5c4a 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckTopicWebsiteFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckTopicWebsiteFormatThread.java @@ -254,45 +254,46 @@ public class CheckTopicWebsiteFormatThread implements Callable{ 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")) + ";"); - } - 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.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.equals("2") && isCaseInsenstive.intValue() == 0) { - errInfo.append( - String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive")) - + ";"); - } - // 十六进制 关键字校验 - if (hexP.indexOf("1") != -1 && isHex.intValue() == 1) { - boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches(); - if(!bl) { - errInfo.append( - prop.getProperty("domain_name") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); - } - } } + isHex = baseStringCfg.getIsHex(); isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + 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 (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.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.indexOf("1") != -1 && isHex.intValue() == 1) { + boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches(); + if(!bl) { + errInfo.append( + prop.getProperty("domain_name") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";"); + } + } + if (isHex != null && isCaseInsenstive != null) { if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { baseStringCfg.setIsHexbin(0); From a1ad6942604c8ca3fc0c39d7ef737a04ec6da02c Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Mon, 25 Mar 2019 10:00:31 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=AF=BC=E5=85=A5Excel=E6=96=87=E4=BB=B6=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=A9=BA=E8=A1=8C=E6=97=B6=EF=BC=8C=E9=94=99=E8=AF=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=A1=8C=E5=8F=B7=E4=B8=8E=E6=96=87=E4=BB=B6=E8=A1=8C?= =?UTF-8?q?=E5=8F=B7=E5=AF=B9=E4=B8=8D=E4=B8=8Abug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/util/excel/ImportBigExcel.java | 8 ++++--- .../nis/util/excel/XLSXCovertCSVReader.java | 22 ++++++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nis/util/excel/ImportBigExcel.java b/src/main/java/com/nis/util/excel/ImportBigExcel.java index fa4f8b70c..ecbde94c3 100644 --- a/src/main/java/com/nis/util/excel/ImportBigExcel.java +++ b/src/main/java/com/nis/util/excel/ImportBigExcel.java @@ -432,12 +432,14 @@ public class ImportBigExcel extends XLSXCovertCSVReader{ Map> dictMap = new HashMap>(); Object val1 = null; for (int i = 0, len = dataList.size(); i < len; i++) { - E e = (E)cls.newInstance(); - if(i<=headerNum) { + List row=dataList.get(i); + //boolean flag = row.stream().allMatch(obj -> "".equals(obj)); + if(i <= headerNum || row.size() == 0) {// 跳过第一行和空行 continue; } + + E e = (E)cls.newInstance(); int column = 0; - List row=dataList.get(i); StringBuilder sb = new StringBuilder(); for (Object[] os : annotationList){ Object val=row.get(column); diff --git a/src/main/java/com/nis/util/excel/XLSXCovertCSVReader.java b/src/main/java/com/nis/util/excel/XLSXCovertCSVReader.java index f16e5770a..a0ba0c86b 100644 --- a/src/main/java/com/nis/util/excel/XLSXCovertCSVReader.java +++ b/src/main/java/com/nis/util/excel/XLSXCovertCSVReader.java @@ -112,7 +112,8 @@ public abstract class XLSXCovertCSVReader { // private String[] record; // private List rows = new ArrayList(); private boolean isCellNull = false; - + + private int upRowId; // 记录上一行行号 /** * Accepts objects needed while parsing. * @@ -203,8 +204,23 @@ public abstract class XLSXCovertCSVReader { if (this.formatString == null) this.formatString = BuiltinFormats .getBuiltinFormat(this.formatIndex); - } - } + } + + }else if("row".equals(name)) { + // 获取行号 + String r = attributes.getValue("r"); + int index = Integer.parseInt(r); + + int gap = index - upRowId; + if(gap > 1) { // 存在空行 + while(gap > 1) { + optRows(sheetIndex,lastColumnNumber,rowlist); + gap--; + } + + } + upRowId = index; + } lastContents = ""; } From b7a64234f80f2c8196b39a7d3b5ecde58dbf266d Mon Sep 17 00:00:00 2001 From: shangguanyanfei Date: Wed, 27 Mar 2019 09:31:42 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E5=85=AC=E5=85=B1=E7=9A=84Scheduler?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=BC=80=E5=A7=8B=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=92=8C=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E7=9A=84=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/include/form/scheduleNew.jsp | 50 ++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp b/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp index 0d98f8dc5..fb2909188 100644 --- a/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp +++ b/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp @@ -14,6 +14,44 @@ + + + +
+ +

+ +

+ +
+
+
+
+
+ + + +
+
+
+ + + +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ <%-- --%> + +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp b/src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp new file mode 100644 index 000000000..e582b2b99 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp @@ -0,0 +1,260 @@ +<%@ + page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +

+ +

+ +
+
+
+
+ + + + <%-- --%> + + + + + +
+
+
+
+ + + + +
+ +
+ + + + + + +
+
+
+
+ + + +
+
+ + + + + <%-- --%> + + <%--
导出 + + +
--%> + + href="javascript:;"> + + +
+
+ + + +
+
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ${fns:abbr(cfg.keyword,20)} + + + + + + ${fns:abbr(cfg.description,20)}${cfg.creatorName }${cfg.editorName }
+
${page}
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp index 221d2c4a5..8244ea28b 100644 --- a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp @@ -85,7 +85,11 @@
- domainCheck urlCheck " type="text" id="tags_${tabName}${status.index}" + domainCheck + urlCheck + keywordSign " + type="text" id="tags_${tabName}${status.index}" name="${cfgName}.cfgKeywords" value="${cfg.cfgKeywords}">
@@ -97,6 +101,7 @@ domainCheck
urlCheck + keywordSign " type="text" name="${cfgName}.cfgKeywords" diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index dd4812ab4..74ebd6c64 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -1,11 +1,5 @@ $(function(){ - var protectedList = [".com"]; - $(".domainCheck").each(function(){ - $(this).on("blur",function(){ - protectedListWarn(this,$(this).val(),protectedList); - }); - protectedListWarn(this,$(this).val(),protectedList); - }); + // var leff =$("span[class~='le-ca-fo']").attr("data-original-title") // getConfigSyncStatus(); $("#contentTable").not(".logTb").find("tbody tr").each(function(i){ @@ -33,8 +27,33 @@ $(function(){ } }) - - + /** 获取配置保护名单 **/ + var protectionData; + var pathName = window.document.location.pathname.substring(0,window.document.location.pathname.lastIndexOf("/nis")+4); + $.ajax({ + type:'get', + url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo', + dataType:"json", + async:false, + success:function(data){ + if(data != null){ + protectionData = data; + for(var key in data){ + var list = data[key]; + $("."+key).each(function(){ + if(!$(this).hasClass("tags")){ + this.setAttribute("onblur","protectedListWarn(this,'"+list+"')"); + } + protectedListWarn(this,list); + }); + + } + + } + + } + }); + //增加描述新增时的文字长度限制 $("form input[name='cfgDesc']").attr("maxlength","128"); $("form input[name='cfgDesc']").addClass("required"); @@ -436,8 +455,12 @@ $(function(){ }); $(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/ exprTypeChecked(objNamePrefix,size,options); - if($(this).hasClass("urlCheck")){ - protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList); + + var tagObj = $(this); + for(var key in protectionData){ + if(tagObj.hasClass(key)){ + protectedListWarn(tagObj,protectionData[key]); + } } }, onRemoveTag:function(tag,size){ @@ -449,8 +472,12 @@ $(function(){ }); $(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/ exprTypeChecked(objNamePrefix,size,options); - if($(this).hasClass("urlCheck")){ - protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList); + + var tagObj = $(this); + for(var key in protectionData){ + if(tagObj.hasClass(key)){ + protectedListWarn(tagObj,protectionData[key]); + } } } }); @@ -1719,9 +1746,11 @@ function addPrintTableCss(rowValue,cellValue,tableIdValue,cssName){ } } /**保护名单提醒**/ -function protectedListWarn(obj,value,protectedList){ +function protectedListWarn(obj,protectedList){ $(obj).next(".fa-warning").remove(); - if(value !=null){ + var value = $(obj).val(); + if(value != ""){ + protectedList = typeof(protectedList) == 'string' ? protectedList.split(",") : protectedList; if(protectedList.indexOf(value) >= 0){ //$(obj).after(""+$.validator.messages.protect_warn+""); $.jBox.info($.validator.messages.protect_warn,$.validator.messages.info); From bf00ccd875c6e2764b2fb9f99b7c0233d19a3370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E5=86=AC=E6=A2=85?= Date: Tue, 9 Apr 2019 09:10:40 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=A1=A8=E5=A2=9E=E5=8A=A0type=EF=BC=9A1-?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E4=BB=BB=E5=8A=A1=EF=BC=9B2-=E5=85=A8?= =?UTF-8?q?=E9=87=8F=E5=90=8C=E6=AD=A5=E6=89=A7=E8=A1=8C=E6=97=B6=E6=9C=AA?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=9A=84=E4=BB=BB=E5=8A=A1=E3=80=82=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=A8=E9=87=8F=E5=90=8C=E6=AD=A5=E6=97=B6?= =?UTF-8?q?=E6=9C=AA=E6=89=A7=E8=A1=8C=E4=BB=BB=E5=8A=A1=E7=9A=84=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=20=E5=85=A8=E9=87=8F=E5=90=8C=E6=AD=A5=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=9A=E5=8A=A1=E6=97=A0=E6=95=B0=E6=8D=AE=E4=B9=9F?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E4=B8=8B=E5=8F=91{}=E8=87=B3=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ScheduleUpdateInterceptor.java | 1 + .../java/com/nis/quartz/ScheduleCfgJob.java | 2 +- .../com/nis/quartz/ScheduleStatusJob.java | 57 +- .../com/nis/quartz/ScheduleSyncCfgJob.java | 548 ++++++++++++++++++ .../java/com/nis/util/ConfigServiceUtil.java | 2 + .../ConfigSynchronizationController.java | 7 + .../java/com/nis/web/dao/SchedulerDao.java | 2 +- .../java/com/nis/web/dao/SchedulerDao.xml | 22 +- .../com/nis/web/service/ScheduleService.java | 103 ++-- .../ConfigSynchronizationService.java | 22 +- .../resources/applicationContext-quartz.xml | 23 +- .../20190328/alert_proc_statistics_config.sql | 133 +++++ .../sql/20190328/alert_scheduler_cfg.sql | 1 + 13 files changed, 846 insertions(+), 77 deletions(-) create mode 100644 src/main/java/com/nis/quartz/ScheduleSyncCfgJob.java create mode 100644 src/main/resources/sql/20190328/alert_proc_statistics_config.sql create mode 100644 src/main/resources/sql/20190328/alert_scheduler_cfg.sql diff --git a/src/main/java/com/nis/persistence/interceptor/ScheduleUpdateInterceptor.java b/src/main/java/com/nis/persistence/interceptor/ScheduleUpdateInterceptor.java index 85a793778..f38ed2839 100644 --- a/src/main/java/com/nis/persistence/interceptor/ScheduleUpdateInterceptor.java +++ b/src/main/java/com/nis/persistence/interceptor/ScheduleUpdateInterceptor.java @@ -331,6 +331,7 @@ public class ScheduleUpdateInterceptor extends BaseInterceptor{ if(schedule != null ) { BeanUtils.copyProperties(baseCfg, schedule,new String[]{"userRegion1","userRegion2","userRegion3","userRegion4","userRegion5"}); schedule.setTableName(tableName); + schedule.setType(1); } return schedule; } diff --git a/src/main/java/com/nis/quartz/ScheduleCfgJob.java b/src/main/java/com/nis/quartz/ScheduleCfgJob.java index 6c2bb14e0..24daaacd0 100644 --- a/src/main/java/com/nis/quartz/ScheduleCfgJob.java +++ b/src/main/java/com/nis/quartz/ScheduleCfgJob.java @@ -87,7 +87,7 @@ public class ScheduleCfgJob implements Job { List newlyCfg = null; int totalNum = 0; do { - newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit); + newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit,1); if(newlyCfg != null && newlyCfg.size() > 0) { totalNum += newlyCfg.size(); for(ScheduleCfg cfg : newlyCfg) {//先取消之前的定时配置 diff --git a/src/main/java/com/nis/quartz/ScheduleStatusJob.java b/src/main/java/com/nis/quartz/ScheduleStatusJob.java index 3d2de4d60..445fc21b9 100644 --- a/src/main/java/com/nis/quartz/ScheduleStatusJob.java +++ b/src/main/java/com/nis/quartz/ScheduleStatusJob.java @@ -1,12 +1,20 @@ package com.nis.quartz; +import java.util.Date; + import org.apache.log4j.Logger; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; import com.nis.domain.ScheduleCfg; +import com.nis.util.Constants; +import com.nis.util.DateUtil; +import com.nis.util.DictUtils; +import com.nis.web.dao.SchedulerDao; import com.nis.web.service.ScheduleService; import com.nis.web.service.SpringContextHolder; @@ -23,16 +31,45 @@ public class ScheduleStatusJob implements Job{ @Override public void execute(JobExecutionContext context) throws JobExecutionException { - //从trigger中 获取 配置信息 - JobDataMap jobDataMap = context.getTrigger().getJobDataMap(); - boolean isValid = jobDataMap.getBoolean("isValid"); - ScheduleCfg cfg = (ScheduleCfg)jobDataMap.get("cfg"); - Integer compileId = cfg.getCompileId(); - log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid )); - //配置下发,并修改 配置表的状态,保存下发记录等 - ScheduleService scheduleService = SpringContextHolder.getBean(ScheduleService.class); - scheduleService.issueCompileInfo(cfg, isValid?1:0); - log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid )); + + //全量同步状态 + String currentStatus = DictUtils.getDictLabel("currrent_sync_status", "status","0"); + //0:start:开始 1:init:初始化 2:doing:进行中 + + //全量同步过程中未执行的任务进入另一个job中,等待全量同步完成开始执行 + if(currentStatus.equals("0") || currentStatus.equals("1")||currentStatus.equals("2")) { + //配置下发,并修改 配置表的状态,保存下发记录等 + SchedulerDao schedulerDao = SpringContextHolder.getBean(SchedulerDao.class); + //从trigger中 获取 配置信息 + JobDataMap jobDataMap = context.getTrigger().getJobDataMap(); + boolean isValid = jobDataMap.getBoolean("isValid"); + + ScheduleCfg cfg = (ScheduleCfg)jobDataMap.get("cfg"); + cfg.setId(null);//新入库一个任务 + cfg.setType(2);//全量同步中未执行的任务 + cfg.setUserRegion1("single"); //只执行一次 + if(isValid) { + cfg.setCronValid("1900-01-01 01:01:01"); //无实际效果,仅仅为填充值 + cfg.setCronInvalid(""); + }else { + cfg.setCronValid(""); + cfg.setCronInvalid("1900-01-01 01:01:01");//无实际效果,仅仅为填充值 + } + schedulerDao.insert(cfg); + + }else { + //从trigger中 获取 配置信息 + JobDataMap jobDataMap = context.getTrigger().getJobDataMap(); + boolean isValid = jobDataMap.getBoolean("isValid"); + ScheduleCfg cfg = (ScheduleCfg)jobDataMap.get("cfg"); + Integer compileId = cfg.getCompileId(); + log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid )); + //配置下发,并修改 配置表的状态,保存下发记录等 + ScheduleService scheduleService = SpringContextHolder.getBean(ScheduleService.class); + scheduleService.issueCompileInfo(cfg, isValid?1:0); + log.debug(String.format("任务开始执行,compileId:%s,isValid:%s",compileId,isValid )); + } + } } diff --git a/src/main/java/com/nis/quartz/ScheduleSyncCfgJob.java b/src/main/java/com/nis/quartz/ScheduleSyncCfgJob.java new file mode 100644 index 000000000..f3bf6d574 --- /dev/null +++ b/src/main/java/com/nis/quartz/ScheduleSyncCfgJob.java @@ -0,0 +1,548 @@ +package com.nis.quartz; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.log4j.Logger; +import org.quartz.CalendarIntervalScheduleBuilder; +import org.quartz.CalendarIntervalTrigger; +import org.quartz.CronScheduleBuilder; +import org.quartz.DateBuilder; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.Job; +import org.quartz.JobBuilder; +import org.quartz.JobDataMap; +import org.quartz.JobDetail; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.JobKey; +import org.quartz.PersistJobDataAfterExecution; +import org.quartz.ScheduleBuilder; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.quartz.SimpleScheduleBuilder; +import org.quartz.SimpleTrigger; +import org.quartz.Trigger; +import org.quartz.TriggerBuilder; +import org.quartz.TriggerKey; +import org.quartz.impl.matchers.GroupMatcher; +import org.quartz.impl.triggers.CalendarIntervalTriggerImpl; +import org.quartz.impl.triggers.CronTriggerImpl; +import org.quartz.spi.MutableTrigger; + +import com.nis.domain.ScheduleCfg; +import com.nis.util.Constants; +import com.nis.util.DateUtil; +import com.nis.util.DateUtils; +import com.nis.util.DictUtils; +import com.nis.util.StringUtils; +import com.nis.web.dao.SchedulerDao; +import com.nis.web.service.SpringContextHolder; + +/** + * 定时任务 配置全量同步时未执行的定时任务加载 + * 1、每 n s 执行一次,每次读取 schedule_cfg 最新的数据 + * 2、删除或新增 定时任务 + * 3、单线程执行 + * @author ddm + * + */ +@DisallowConcurrentExecution +@PersistJobDataAfterExecution +public class ScheduleSyncCfgJob implements Job { + SimpleDateFormat sdf=new SimpleDateFormat(Constants.COMMON_DATE_FORMAT); + private static final Logger log = Logger.getLogger(ScheduleSyncCfgJob.class); + + /** + * 状态组,格式:statusGroup-compileId + */ + private static final String STATUS_GROUP = "syncGroup-"; + private static final String STATUS_JOB = "SYNC-JOB"; + /** + * 生效标识:valid-cronexp + */ + private static final String VALID_KEY = "valid-"; + /** + * 失效标识:invalid-cronexp + */ + private static final String INVALID_KEY = "invalid-"; + private static final JobKey STATUS_JOBKEY = JobKey.jobKey(STATUS_JOB, "syncGroup"); + private static final JobDetail STATUS_JOBDETAIL = JobBuilder.newJob(ScheduleStatusJob.class) + .withIdentity(STATUS_JOBKEY) + .storeDurably(true) + .build(); + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + Scheduler scheduler = context.getScheduler(); + SchedulerDao dao = SpringContextHolder.getBean(SchedulerDao.class); + JobDataMap dataMap = context.getJobDetail().getJobDataMap(); + long scheduleCfgId = dataMap.get("scheduleCfgId") == null ? 0:dataMap.getLong("scheduleCfgId"); + long limit = dataMap.get("limit") == null ? 1000:dataMap.getLong("limit"); + log.info(String.format("Sync定时配置任务开始扫描,scheduleCfgId:%s,limit:%s",scheduleCfgId,limit )); + List newlyCfg = null; + int totalNum = 0; + + //全量同步当前状态 0:start:开始 1:init:初始化 2:doing:进行中 + String currentStatus = DictUtils.getDictLabel("currrent_sync_status", "status","0"); + if(!(currentStatus.equals("0") || currentStatus.equals("1") || currentStatus.equals("2"))) { + do { + newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit,2); + if(newlyCfg != null && newlyCfg.size() > 0) { + totalNum += newlyCfg.size(); + for(ScheduleCfg cfg : newlyCfg) {//先取消之前的定时配置 + Integer compileId = cfg.getCompileId(); + try { + //取消之前所有的 trigger + GroupMatcher groupMatcher= GroupMatcher.triggerGroupEquals(STATUS_GROUP + compileId); + Set triggerKeys = scheduler.getTriggerKeys(groupMatcher); + if(triggerKeys != null && triggerKeys.size() > 0) { + for(TriggerKey tk : triggerKeys) { + scheduler.unscheduleJob(tk); + } + log.info(String.format("Sync定时任务取消成功,compile:%s", compileId)); + } + } catch (Exception e) { + log.error(String.format("Sync定时任务取消异常,compileId:%s", compileId),e); + } + } + int index=0; + for(ScheduleCfg cfg : newlyCfg) { + Integer compileId = cfg.getCompileId(); + try { + //判断状态,重新添加最新的 trigger + Integer isValid = cfg.getIsValid(); + Integer isAudit = cfg.getIsAudit(); + //添加定时任务的条件 + if((isValid == 1 && isAudit == 1) || (isValid == 0 && isAudit == 0)) { + //添加定时任务,包括valid 和 invalid + addJob(scheduler, cfg,index); + log.info(String.format("Sync定时任务添加成功,compile:%s", compileId)); + } + } catch (Exception e) { + log.error(String.format("Sync定时任务更新异常,compileId:%s", compileId),e); + } + index++; + } + //最后 保存此次 最后的id + ScheduleCfg lastCfg = newlyCfg.get(newlyCfg.size() -1); + scheduleCfgId = lastCfg.getId(); + dataMap.put("scheduleCfgId", scheduleCfgId); + log.info(String.format("Sync加载定时任务,total num :%s", newlyCfg.size())); + } + } while (newlyCfg != null && newlyCfg.size() > 0); + log.info(String.format("Sync定时配置任务结束执行,total num:%s",totalNum)); + } + log.info("全量同步中缓存的定时配置正在扫描(currentStatus:"+currentStatus+")"); + } + + + /** + * 将定时任务信息添加到 定时器框架中调度 + * @param scheduler + * @param cfg + * @throws SchedulerException + */ + /*public static void addJob(Scheduler scheduler,ScheduleCfg cfg) throws SchedulerException { + Integer compileId = cfg.getCompileId(); + String cronValid = cfg.getCronValid(); + String cronInvalid = cfg.getCronInvalid(); + Trigger validTrigger = createTrigger(cronValid, compileId, true, cfg); + Trigger invalidTrigger = createTrigger(cronInvalid, compileId, false, cfg); + boolean jobExist = scheduler.checkExists(STATUS_JOBKEY); + if(!jobExist) {//判断 job 是否存在,不存在添加 + scheduler.addJob(STATUS_JOBDETAIL, false); + } + boolean checkExists = scheduler.checkExists(validTrigger.getKey()); + if(!checkExists) {//判断 valid trigger 是否存在,不存在添加 + scheduler.scheduleJob(validTrigger); + }else { + log.warn(String.format("Trigger already exists:%s ", validTrigger.getKey().toString())); + } + checkExists = scheduler.checkExists(invalidTrigger.getKey()); + if(!checkExists) {//判断 invalid trigger 是否存在,不存在添加 + scheduler.scheduleJob(invalidTrigger); + }else { + log.warn(String.format("Trigger already exists:%s ", invalidTrigger.getKey().toString())); + } + }*/ + + + public static void addJob(Scheduler scheduler,ScheduleCfg cfg,int expire) throws SchedulerException { + List triList = createTrigger(cfg,expire); + boolean jobExist = scheduler.checkExists(STATUS_JOBKEY); + if(!jobExist) {//判断 job 是否存在,不存在添加 + scheduler.addJob(STATUS_JOBDETAIL, false); + } + for(Trigger tri : triList) { + boolean checkExists = scheduler.checkExists(tri.getKey()); + if(!checkExists) {//判断 valid trigger 是否存在,不存在添加 + log.debug(String.format("Sync定时任务添加,%s", tri.getKey())); + scheduler.scheduleJob(tri); + log.info(String.format("Sync定时任务添加成功,%s", tri.getKey())); + }else { + log.warn(String.format("Trigger(sync) already exists:%s ", tri.getKey().toString())); + } + } + } + + /** + * 将页面配置的内容 转换成 trigger + * @param cfg + * @return + */ + public static List createTrigger(ScheduleCfg cfg,int expire){ + String mode = cfg.getUserRegion1().toUpperCase();//定时任务运行模式:一次,每天,每周,每月 + List triList = null; + switch (mode) { + case "ALWAYS"://单次运行,但只创建单次生效触发器 + triList = createSimpleTrigger(cfg,expire); + break; + case "SINGLE"://单次运行 + triList = createSimpleTrigger(cfg,expire); + break; + case "EVERYDAY"://每天运行 0 0 0 2/1 * ? ,不符合要求,定义每天都执行,然后在 代码判断 间隔时间 + triList = createCalendarIntervalTrigger(cfg); + break; + case "EVERYWEEK"://每周运行 + triList = createCalendarIntervalTrigger(cfg); + break; + case "EVERYMONTH"://每月运行 + triList = createEveryMonthTrigger(cfg); + break; + default: + log.warn(String.format("unknown mode : %s ", mode)); + break; + } + return triList; + } + + + + + /** + * 将时间转换成 时分秒 + * @param time + * @return + */ + public static List parseTime(String time) { + if(StringUtils.isNoneBlank(time)) { + String[] split = time.split(":"); + List tl = new ArrayList(3); + for(String s : split) { + tl.add(Integer.valueOf(s)); + } + return tl; + } + return null; + } + + public static Trigger createCronTrigger(String cron,Integer compileId,boolean isValid,ScheduleCfg cfg) { + String triggerName = isValid ? (VALID_KEY + cron) : (INVALID_KEY + cron); + JobDataMap dataMap = new JobDataMap(); + dataMap.put("isValid", isValid); + dataMap.put("cfg", cfg); + return TriggerBuilder.newTrigger() + .withIdentity(createTiggerKey(triggerName, STATUS_GROUP+compileId)) + .withSchedule(CronScheduleBuilder.cronSchedule(cron)) + .usingJobData(dataMap) + .forJob(STATUS_JOBDETAIL) + .build(); + } + + + /** + * 创建全量同步时未执行的任务,每个任务均为单词任务 + * @param cfg + * @return + */ + public static List createSimpleTrigger(ScheduleCfg cfg,int expire){ + List triList = new ArrayList(); + Integer compileId = cfg.getCompileId(); + String cronValid = cfg.getCronValid(); + String cronInvalid = cfg.getCronInvalid(); + Date validDate = null; + Date invalidDate = null; + if(StringUtils.isNotBlank(cronValid)){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.MINUTE, (expire+1)); + validDate = c.getTime(); + + } + if(StringUtils.isNotBlank(cronInvalid)){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.MINUTE, (expire+2)); + invalidDate = c.getTime(); + } + JobDataMap dataMap = new JobDataMap(); + if(validDate!=null){//生效时间如果不为空,则创建定时生效触发器 + dataMap.put("isValid", true); + dataMap.put("cfg", cfg); + String triName = VALID_KEY + cfg.getUserRegion1() + "_" + cronValid; + Trigger trigger = TriggerBuilder.newTrigger() + .withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId)) + .withSchedule(SimpleScheduleBuilder.simpleSchedule()) + .usingJobData(dataMap) + .forJob(STATUS_JOBDETAIL) + .startAt(validDate) + .build(); + triList.add(trigger); + } + if(invalidDate!=null){//失效时间如果不为空,则创建定时失效触发器 + dataMap = new JobDataMap(); + dataMap.put("isValid", false); + dataMap.put("cfg", cfg); + String triName = INVALID_KEY + cfg.getUserRegion1() + "_" + cronInvalid; + Trigger trigger = TriggerBuilder.newTrigger() + .withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId)) + .withSchedule(SimpleScheduleBuilder.simpleSchedule()) + .usingJobData(dataMap) + .forJob(STATUS_JOBDETAIL) + .startAt(invalidDate) + .build(); + triList.add(trigger); + } + return triList; + } + + + /** + * 间隔 n 天 或 n 周执行 + * @param cfg + * @return + */ + public static List createCalendarIntervalTrigger(ScheduleCfg cfg) { + List triList = new ArrayList(); + Integer compileId = cfg.getCompileId(); + String cronValid = cfg.getCronValid(); + String cronInvalid = cfg.getCronInvalid(); + String dayOrWeek = cfg.getUserRegion1(); + Integer interval = Integer.valueOf(cfg.getUserRegion2()); + List validList = parseTime(cronValid); + List invalidList = parseTime(cronInvalid); + Date validStartTime = DateBuilder.todayAt(validList.get(0), validList.get(1), validList.get(2)); + Date invalidTime = DateBuilder.todayAt(invalidList.get(0), invalidList.get(1), invalidList.get(2)); + CalendarIntervalScheduleBuilder intervalBuilder = null; + if("EVERYDAY".equalsIgnoreCase(dayOrWeek)) { + intervalBuilder = CalendarIntervalScheduleBuilder.calendarIntervalSchedule().withIntervalInDays(interval); + //valid + JobDataMap dataMap = new JobDataMap(); + dataMap.put("isValid", true); + dataMap.put("cfg", cfg); + String triName = VALID_KEY + dayOrWeek+"("+interval+")" + "_" + DateUtils.formatDate(validStartTime, Constants.COMMON_DATE_FORMAT); + Trigger validTri = TriggerBuilder.newTrigger() + .withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId)) + .withSchedule(intervalBuilder) + .usingJobData(dataMap) + .forJob(STATUS_JOBDETAIL) + .startAt(validStartTime) + .build(); + triList.add(validTri); + //invalid + dataMap = new JobDataMap(); + dataMap.put("isValid", false); + dataMap.put("cfg", cfg); + triName = INVALID_KEY + dayOrWeek +"("+interval+")" + "_" + DateUtils.formatDate(invalidTime, Constants.COMMON_DATE_FORMAT); + validTri = TriggerBuilder.newTrigger() + .withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId)) + .withSchedule(intervalBuilder) + .usingJobData(dataMap) + .forJob(STATUS_JOBDETAIL) + .startAt(invalidTime) + .build(); + triList.add(validTri); + }else if("EVERYWEEK".equalsIgnoreCase(dayOrWeek)) { + intervalBuilder = CalendarIntervalScheduleBuilder.calendarIntervalSchedule().withIntervalInWeeks(interval); + String[] weeks = cfg.getUserRegion3().split(","); + for(String week : weeks) { + if(StringUtils.isNoneBlank(week)) { + Date temp = closestAfterWeek(validStartTime, Integer.valueOf(week)); + JobDataMap dataMap = new JobDataMap(); + dataMap.put("isValid", true); + dataMap.put("cfg", cfg); + String triName = VALID_KEY + dayOrWeek +week+"("+interval+")" + "_" + DateUtils.formatDate(temp, Constants.COMMON_DATE_FORMAT); + Trigger validTri = TriggerBuilder.newTrigger() + .withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId)) + .withSchedule(intervalBuilder) + .usingJobData(dataMap) + .forJob(STATUS_JOBDETAIL) + .startAt(temp) + .build(); + triList.add(validTri); + //invalid + dataMap = new JobDataMap(); + dataMap.put("isValid", false); + dataMap.put("cfg", cfg); + temp = closestAfterWeek(invalidTime, Integer.valueOf(week)); + triName = INVALID_KEY + dayOrWeek +week+"("+interval+")" + "_" + DateUtils.formatDate(temp, Constants.COMMON_DATE_FORMAT); + validTri = TriggerBuilder.newTrigger() + .withIdentity(createTiggerKey(triName, STATUS_GROUP+compileId)) + .withSchedule(intervalBuilder) + .usingJobData(dataMap) + .forJob(STATUS_JOBDETAIL) + .startAt(temp) + .build(); + triList.add(validTri); + } + } + } + return triList; + } + + /** + * 每月 执行 + * @param cfg + * @return + */ + public static List createEveryMonthTrigger(ScheduleCfg cfg){ + String dayWeek = cfg.getUserRegion3(); + String cronInvalid = cfg.getCronInvalid(); + String cronValid = cfg.getCronValid(); + StringBuilder cronSb = new StringBuilder(); + Trigger trigger = null; + List validList = parseTime(cronValid);//time 转换 + List invalidList = parseTime(cronInvalid);//time 转换 + List triList = new ArrayList(); + String userRegion4 = cfg.getUserRegion4().toUpperCase(); + if("day".equalsIgnoreCase(dayWeek)) {//指定天 + boolean hasL = userRegion4.contains("L"); + StringBuilder chooseSb = new StringBuilder(); + for(String str : userRegion4.split(",")) { + if(!"L".equalsIgnoreCase(str.trim())) { + chooseSb.append(",").append(str); + } + } + chooseSb.deleteCharAt(0); + cronSb.append(validList.get(2)).append(" ")//秒 + .append(validList.get(1)).append(" ")//分 + .append(validList.get(0)).append(" ")//小时 + .append(chooseSb.toString()).append(" ")//日 + .append(cfg.getUserRegion2()).append(" ")//月 + .append("?").append(" ");//周 + trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), true, cfg); + triList.add(trigger); + cronSb.setLength(0); + cronSb.append(invalidList.get(2)).append(" ")//秒 + .append(invalidList.get(1)).append(" ")//分 + .append(invalidList.get(0)).append(" ")//小时 + .append(chooseSb.toString()).append(" ")//日 + .append(cfg.getUserRegion2()).append(" ")//月 + .append("?").append(" ");//周 + trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), false, cfg); + triList.add(trigger); + if(hasL) {// 月的最后一天,quartz 不支持 1,L 这种指定,所以 L单独处理一下 + cronSb.setLength(0); + cronSb.append(validList.get(2)).append(" ")//秒 + .append(validList.get(1)).append(" ")//分 + .append(validList.get(0)).append(" ")//小时 + .append("L").append(" ")//日 + .append(cfg.getUserRegion2()).append(" ")//月 + .append("?").append(" ");//周 + trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), true, cfg); + triList.add(trigger); + cronSb.setLength(0); + cronSb.append(invalidList.get(2)).append(" ")//秒 + .append(invalidList.get(1)).append(" ")//分 + .append(invalidList.get(0)).append(" ")//小时 + .append("L").append(" ")//日 + .append(cfg.getUserRegion2()).append(" ")//月 + .append("?").append(" ");//周 + trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), false, cfg); + triList.add(trigger); + } + }else if ("week".equalsIgnoreCase(dayWeek)) {//指定周,1#2: 第一周的周二,4L:最后一周的周四 + for(String nthWeek : userRegion4.split(",")) {//第几周 + for(String week : cfg.getUserRegion5().split(",")) {//星期几 + cronSb.setLength(0); + cronSb.append(validList.get(2)).append(" ")//秒 + .append(validList.get(1)).append(" ")//分 + .append(validList.get(0)).append(" ")//小时 + .append("?").append(" ")//日 + .append(cfg.getUserRegion2()).append(" ");//月 + if("L".equalsIgnoreCase(nthWeek)) { + cronSb.append(week).append("L");//周 + }else { + cronSb.append(week).append("#").append(nthWeek);//周 + } + trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), true, cfg); + triList.add(trigger); + cronSb.setLength(0); + cronSb.append(invalidList.get(2)).append(" ")//秒 + .append(invalidList.get(1)).append(" ")//分 + .append(invalidList.get(0)).append(" ")//小时 + .append("?").append(" ")//日 + .append(cfg.getUserRegion2()).append(" ");//月 + if("L".equalsIgnoreCase(nthWeek)) { + cronSb.append(week).append("L");//周 + }else { + cronSb.append(week).append("#").append(nthWeek);//周 + } + trigger = createCronTrigger(cronSb.toString(), cfg.getCompileId(), false, cfg); + triList.add(trigger); + } + } + } + return triList; + } + + + /** + * 查找最近的 星期几 ,包括今天 + * @param date + * @param w 周一开始 1 -7 + * @return + */ + public static Date closestAfterWeek(Date date,int w) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + int i = cal.get(Calendar.DAY_OF_WEEK);//周日开始 1-7 + i = (i==1)? 7: i-1;//转换为 周一到 周日 1-7 + cal.add(Calendar.DAY_OF_MONTH, (i>w)?(7-(i-w)) : (w-i)); + return cal.getTime(); + } + + + public static TriggerKey createTiggerKey(String name,String group) { + TriggerKey key = new TriggerKey(name, group); + return key; + } + + /** + * jquery cron 生成的cron 表达式,quartz 不能直接使用,需要做些修改 + * @param cron + * @return + */ + public static String modifyCronExp(String cron) { + String[] cronArr = cron.split("\\s"); + if("*".equals(cronArr[4])) { + cronArr[4] = "?"; + }else { + cronArr[3] = "*"; + cronArr[2] = "?"; + } + return "0 " + StringUtils.join(cronArr, " "); + } + + + public static void main(String[] args) { + + CronTriggerImpl cron = new CronTriggerImpl(); + try { + String exp = "0 0 0 ? 1,2 1#4"; + cron.setCronExpression(exp); + System.out.println(cron); + } catch (ParseException e) { + e.printStackTrace(); + } + + + } + +} diff --git a/src/main/java/com/nis/util/ConfigServiceUtil.java b/src/main/java/com/nis/util/ConfigServiceUtil.java index 057d51181..bb44aca09 100644 --- a/src/main/java/com/nis/util/ConfigServiceUtil.java +++ b/src/main/java/com/nis/util/ConfigServiceUtil.java @@ -852,6 +852,7 @@ public class ConfigServiceUtil { throw new MaatConvertException(":"+result); } } catch (Exception e) { + e.printStackTrace(); throw e; }finally { if (response != null) { @@ -898,6 +899,7 @@ public class ConfigServiceUtil { throw new MaatConvertException(":"+result); } } catch (Exception e) { + e.printStackTrace(); throw e; }finally { if (response != null) { diff --git a/src/main/java/com/nis/web/controller/configuration/ConfigSynchronizationController.java b/src/main/java/com/nis/web/controller/configuration/ConfigSynchronizationController.java index 6659d014c..8b80e6f0b 100644 --- a/src/main/java/com/nis/web/controller/configuration/ConfigSynchronizationController.java +++ b/src/main/java/com/nis/web/controller/configuration/ConfigSynchronizationController.java @@ -72,6 +72,13 @@ public class ConfigSynchronizationController extends BaseController { dictService.updateDictItem(item); //删除字典缓存 CacheUtils.remove(Constants.CACHE_DICT_MAP); + + //全量同步之前等待一段时间,避免定时任务还未扫描到当前的同步状态。 + try{ + Thread.sleep(60000); + } catch (InterruptedException e) { + e.printStackTrace(); + } } } send(serviceId,model,request,response); diff --git a/src/main/java/com/nis/web/dao/SchedulerDao.java b/src/main/java/com/nis/web/dao/SchedulerDao.java index 16110a94e..a6f22ff3c 100644 --- a/src/main/java/com/nis/web/dao/SchedulerDao.java +++ b/src/main/java/com/nis/web/dao/SchedulerDao.java @@ -20,7 +20,7 @@ public interface SchedulerDao extends CrudDao { * @param size * @return */ - List findNewlyCfg(@Param("id")Long id,@Param("limit")Long limit); + List findNewlyCfg(@Param("id")Long id,@Param("limit")Long limit,@Param("type")int type); /** * 更新 del_flag 字段为删除标识 diff --git a/src/main/java/com/nis/web/dao/SchedulerDao.xml b/src/main/java/com/nis/web/dao/SchedulerDao.xml index 26aaee47b..933f21fb4 100644 --- a/src/main/java/com/nis/web/dao/SchedulerDao.xml +++ b/src/main/java/com/nis/web/dao/SchedulerDao.xml @@ -135,6 +135,7 @@ a.CFG_ID, a.IS_VALID, a.IS_AUDIT, + a.function_id, a.CREATOR_ID, a.CREATE_TIME, a.EDITOR_ID, @@ -149,6 +150,7 @@ del_Flag = 1 and id > #{id} + and type=#{type} order by a.id limit #{limit} @@ -176,7 +178,8 @@ user_region2, user_region3, user_region4, - user_region5 + user_region5, + type ) values ( #{name,jdbcType=VARCHAR}, #{cronValid,jdbcType=VARCHAR}, @@ -196,7 +199,8 @@ #{userRegion2,jdbcType=VARCHAR}, #{userRegion3,jdbcType=VARCHAR}, #{userRegion4,jdbcType=VARCHAR}, - #{userRegion5,jdbcType=VARCHAR} + #{userRegion5,jdbcType=VARCHAR}, + #{type,jdbcType=INTEGER} ) @@ -236,7 +240,19 @@ - update ${tableName} set is_valid = #{isValid} ,is_audit = 1 where compile_id = #{compileId} + update ${tableName} + + is_valid = #{isValid} , + is_audit = 1, + + audit_time=now(), + + where compile_id = #{compileId} diff --git a/src/main/java/com/nis/web/service/ScheduleService.java b/src/main/java/com/nis/web/service/ScheduleService.java index 50926aa83..4db3d8393 100644 --- a/src/main/java/com/nis/web/service/ScheduleService.java +++ b/src/main/java/com/nis/web/service/ScheduleService.java @@ -40,20 +40,65 @@ public class ScheduleService extends BaseService{ ScheduleExceInfo exceNew = dao.findScheduleExceNew(se); //2、如果已经下发,直接下发状态,否则下发配置 Integer issueResult = 1; + //是否下发内容 + Integer isIssueContent = 1; String errorInfo = null; String tableName = cfg.getTableName(); SchedulerTaskUtil scheduler = new SchedulerTaskUtil(); boolean udpateConfigStatus = false; - - try { - if(isValid == 1 && (exceNew == null || exceNew.getIsIssue() == 1)) {//生效配置需要下发 - udpateConfigStatus = scheduler.updateConfigByServiceAndCompile(cfg.getServiceId(), compileId, isValid, 1,configSynchronizationDao); - logger.info(String.format("定时器下发配置内容,compileId:%s,isValid:%s,issueResult:%s,errorInfo:%s",compileId,isValid,issueResult,errorInfo)); - }else{//只需修改状态 - udpateConfigStatus = scheduler.updateConfigByServiceAndCompile(cfg.getServiceId(), compileId, isValid, 0,configSynchronizationDao); - logger.info(String.format("定时器修改配置状态,compileId:%s,isValid:%s,issueResult:%s,errorInfo:%s",compileId,isValid,issueResult,errorInfo)); + //生效配置需要下发 + if(isValid == 1 && (exceNew == null || exceNew.getIsIssue() == 1)) { + isIssueContent=1; + }else { + //之下发状态 + isIssueContent=0; + } + + + //首先对数据库操作 + if(exceNew == null) { + //新增exce_new 表状态 + exceNew = new ScheduleExceInfo(); + exceNew.setCompileId(compileId); + exceNew.setIssueStatus(isValid); + exceNew.setExceTime(new Date()); + exceNew.setIssueResult(issueResult); + exceNew.setErrorInfo(errorInfo); + exceNew.setIsIssue(0); + exceNew.setScheduleId(cfg.getId()); + dao.insertScheduleExceNew(exceNew); + }else { + //修改 exce_new 表状态 + exceNew.setExceTime(new Date()); + exceNew.setIssueResult(issueResult); + exceNew.setErrorInfo(errorInfo); + exceNew.setScheduleId(cfg.getId()); + dao.updateScheduleExceNew(exceNew); + } + ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil(); + List> serviceList = serviceTemplate.getServiceListByServiceId(cfg.getServiceId()); + //根据编译ID查询配置表中的配置信息 + for(Map service:serviceList){ + //获取业务下的配置域 + List> cfgList = (List>) service.get("cfgList"); + //查询子域配置详情 + if(cfgList!=null){ + for(Map m:cfgList){ + String regionTable = m.get("tableName").toString(); + //更新配置域表的isValid字段 + dao.updateCfgTableStatus(regionTable, compileId, isValid); + } } - + } + //3、更新 配置表的 isValid 字段,添加 exce_log 记录 + dao.insertScheduleExceLog(exceNew); + dao.updateCfgTableStatus(tableName, compileId, isValid); + + + //数据库操作完成后与服务端交互 + try { + udpateConfigStatus = scheduler.updateConfigByServiceAndCompile(cfg.getServiceId(), compileId, isValid, isIssueContent,configSynchronizationDao); + logger.info(String.format("定时器下发配置内容,compileId:%s,isValid:%s,issueResult:%s,errorInfo:%s",compileId,isValid,issueResult,errorInfo)); } catch (NoSuchFieldException e) { udpateConfigStatus = false; e.printStackTrace(); @@ -70,46 +115,6 @@ public class ScheduleService extends BaseService{ // logger.info(String.format("配置状态更新,compileId:%s,isValid:%s,issueResult:%s,errorInfo:%s",compileId,isValid,issueResult,errorInfo)); - if(udpateConfigStatus){//配置更新成功 - if(exceNew == null) { - //新增exce_new 表状态 - exceNew = new ScheduleExceInfo(); - exceNew.setCompileId(compileId); - exceNew.setIssueStatus(isValid); - exceNew.setExceTime(new Date()); - exceNew.setIssueResult(issueResult); - exceNew.setErrorInfo(errorInfo); - exceNew.setIsIssue(0); - exceNew.setScheduleId(cfg.getId()); - dao.insertScheduleExceNew(exceNew); - }else { - //修改 exce_new 表状态 - exceNew.setExceTime(new Date()); - exceNew.setIssueResult(issueResult); - exceNew.setErrorInfo(errorInfo); - exceNew.setScheduleId(cfg.getId()); - dao.updateScheduleExceNew(exceNew); - } - ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil(); - List> serviceList = serviceTemplate.getServiceListByServiceId(cfg.getServiceId()); - //根据编译ID查询配置表中的配置信息 - for(Map service:serviceList){ - //获取业务下的配置域 - List> cfgList = (List>) service.get("cfgList"); - //查询子域配置详情 - if(cfgList!=null){ - for(Map m:cfgList){ - String regionTable = m.get("tableName").toString(); - //更新配置域表的isValid字段 - dao.updateCfgTableStatus(regionTable, compileId, isValid); - } - } - } - //3、更新 配置表的 isValid 字段,添加 exce_log 记录 - dao.insertScheduleExceLog(exceNew); - dao.updateCfgTableStatus(tableName, compileId, isValid); - } - } diff --git a/src/main/java/com/nis/web/service/configuration/ConfigSynchronizationService.java b/src/main/java/com/nis/web/service/configuration/ConfigSynchronizationService.java index ccfc1ff00..62c02b554 100644 --- a/src/main/java/com/nis/web/service/configuration/ConfigSynchronizationService.java +++ b/src/main/java/com/nis/web/service/configuration/ConfigSynchronizationService.java @@ -155,8 +155,8 @@ public class ConfigSynchronizationService extends BaseService{ Page page=new Page(request,response,Constants.MAAT_JSON_SEND_SIZE,"a"); handleCallbackData(className,page,entity,request,response,false); } - //如果业务没有配置数据,并且为最后一个业务,需要发送给服务接口一个结束标识 - if(!isFinished && lastServiceTag){ + //最后一个业务,发送一个结束标识 + if(lastServiceTag){ String json = "{}"; //如果是所有业务全量同步需要发送一个service=-1的请求,有助于服务端删除分组复用配置 if(StringUtil.isEmpty(serviceIdCondition)){ @@ -477,7 +477,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } } @@ -649,7 +649,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } } @@ -839,7 +839,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } } @@ -1010,7 +1010,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } } @@ -1339,7 +1339,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } @@ -1548,7 +1548,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } @@ -1703,7 +1703,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+compileId+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } @@ -1859,7 +1859,7 @@ public class ConfigSynchronizationService extends BaseService{ //调用服务接口配置全量更新 isFinished = ((!hasData)&&lastServiceTag)?true:false; FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+compileId+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); - JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,1,entity.getServiceId(),null,null); logger.info("全量下发响应信息:"+result.toString()); } @@ -2021,7 +2021,7 @@ public class ConfigSynchronizationService extends BaseService{ FileUtils.writeToFile("/home/ceiec/configSync/"+DateUtils.getDate("yyyy-MM-dd")+"/"+entity.getServiceId()+"_"+page.getPageNo()+"_"+System.currentTimeMillis()+".json", json, false); //调用服务接口同步回调类配置 isFinished = ((!hasData)&&lastServiceTag)?true:false; - JSONObject result = ConfigServiceUtil.configSync(json,2,entity.getServiceId(),entity.getTableName(),isFinished?"FINISHED":null); + JSONObject result = ConfigServiceUtil.configSync(json,2,entity.getServiceId(),entity.getTableName(),null); logger.info("全量下发响应信息:"+result.toString()); } } diff --git a/src/main/resources/applicationContext-quartz.xml b/src/main/resources/applicationContext-quartz.xml index c8d3a0a51..e597748a0 100644 --- a/src/main/resources/applicationContext-quartz.xml +++ b/src/main/resources/applicationContext-quartz.xml @@ -23,7 +23,7 @@ - + @@ -33,6 +33,24 @@ + + + + + + + + + + + + + + + + + + @@ -44,7 +62,8 @@ - + + diff --git a/src/main/resources/sql/20190328/alert_proc_statistics_config.sql b/src/main/resources/sql/20190328/alert_proc_statistics_config.sql new file mode 100644 index 000000000..cc102e10b --- /dev/null +++ b/src/main/resources/sql/20190328/alert_proc_statistics_config.sql @@ -0,0 +1,133 @@ +CREATE DEFINER=`root`@`%` PROCEDURE `proc_statistics_config`() +BEGIN + + DECLARE ntime VARCHAR(40);/*当前时间*/ + + DECLARE otime VARCHAR(40);/*上次统计时间*/ + + DECLARE nRow VARCHAR(40);/*本次统计条数*/ + + DECLARE tabName VARCHAR(500); + + DECLARE description VARCHAR(500); + + DECLARE deleteSql VARCHAR(500); + + DECLARE done INT;/*游标标识*/ + + DECLARE flag INT;/*循环标识*/ + + DECLARE t_error INT;/*错误标识*/ + + DECLARE proc_log_table VARCHAR(100);/*存储过程日志表*/ + + DECLARE proc_name VARCHAR(100);/*存储过程名称*/ + + DECLARE icursor CURSOR FOR SELECT tab_name FROM statistics_tables where is_valid=1; + + DECLARE CONTINUE HANDLER FOR NOT found SET done=1; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION set t_error=1; + + select max(statistic_time) into otime from cfg_num_statistics; + + SET done=0; + + SET t_error=0; + + SET proc_log_table='proc_exec_log'; + + SET proc_name='proc_statistics_config'; + + SET ntime=DATE_FORMAT(SYSDATE(),'%Y-%m-%d %H:%i:%S'); + + OPEN icursor; + + loop_iloop:LOOP + + FETCH icursor INTO tabName; + + SET description=tabName; + + set @descriptionStart=concat(description,'表统计start'); + + /*统计当前配置表数据到统计表中start*/ + + set @v_log_sql1 := concat('insert into ',proc_log_table,'(proc_name,table_name,log_time,description) values(?,?,?,?)'); + + PREPARE execs FROM @v_log_sql1; + + EXECUTE execs using proc_name,proc_log_table,ntime,@descriptionStart; + + DEALLOCATE PREPARE execs; + + COMMIT; + + + #没有定时任务前的统计:is_audit=1 && is_valid=1为approved + #set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,audit_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','audit_time,function_id,service_id,action,compile_id,if(is_audit=3,3,if(is_audit=2,2,if(is_audit=1,1,if(is_valid=0,0,if(is_valid,-1,-1))))) cfg_state from ',tabName); + #20190328 增加定时任务后is_audit=1 && (is_valid=1 || is_valid=0) 即为approved (为与界面显示保持一致,更改统计条件,此时的结果中approved并不代表所有有效的配置总数) + set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','function_id,service_id,action,compile_id,if(is_valid=-1,-1,if(is_valid=1,1,if(is_valid=0 && is_audit=0,0,if(is_valid=0 && is_audit=1,1,if(is_valid=0 && is_audit=2,2,if(is_valid=0 && is_audit=3,3,0)))))) cfg_state from ',tabName); + + + PREPARE execs FROM @insert_statistics_sql; + + EXECUTE execs; + + DEALLOCATE PREPARE execs; + + COMMIT; + + + + set @descriptionEnd=concat(description,'表统计end'); + + set @v_log_sql2 := concat('insert into ',proc_log_table,'(proc_name,table_name,log_time,description) values(?,?,?,?)'); + + PREPARE execs FROM @v_log_sql2; + + EXECUTE execs using proc_name,proc_log_table,ntime,@descriptionEnd; + + DEALLOCATE PREPARE execs; + + COMMIT; + + /*异常退出loop*/ + IF t_error=1 THEN + LEAVE loop_iloop; + END IF; + + /*循环结束退出loop*/ + IF done=1 THEN + + LEAVE loop_iloop; + + ELSE + + SET flag=0; + + END IF; + + IF flag=0 THEN + + SET done=0; + + END IF; + + END LOOP loop_iloop; + + CLOSE icursor; + /*取出本次统计条数*/ + SELECT count(statistic_time) INTO nRow from cfg_num_statistics where statistic_time=ntime; + + + IF t_error=1 THEN /*如果异常清楚本次数据*/ + delete from cfg_num_statistics where statistic_time=ntime; + COMMIT; + ELSEIF nRow > 0 THEN /*判断本次统计是否有数据录入,如果有则删除上次统计数据,如果没有则不清除上次统计数据*/ + + delete from cfg_num_statistics where statistic_time=otime; + COMMIT; + END IF; + COMMIT; +END \ No newline at end of file diff --git a/src/main/resources/sql/20190328/alert_scheduler_cfg.sql b/src/main/resources/sql/20190328/alert_scheduler_cfg.sql new file mode 100644 index 000000000..83dd0773b --- /dev/null +++ b/src/main/resources/sql/20190328/alert_scheduler_cfg.sql @@ -0,0 +1 @@ +ALTER TABLE schedule_cfg ADD type int(1) DEFAULT 1 COMMENT '1:定时任务;2:全量同步时未执行的任务'; \ No newline at end of file From 09405e06e1cc0b510237d2e6e6ec36b70b0d95ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E5=86=AC=E6=A2=85?= Date: Tue, 9 Apr 2019 09:11:16 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0type=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/nis/domain/ScheduleCfg.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nis/domain/ScheduleCfg.java b/src/main/java/com/nis/domain/ScheduleCfg.java index 27962c24b..f133ae1c3 100644 --- a/src/main/java/com/nis/domain/ScheduleCfg.java +++ b/src/main/java/com/nis/domain/ScheduleCfg.java @@ -14,6 +14,7 @@ public class ScheduleCfg extends BaseCfg{ private String cronValid;//生效cron表达式 private String cronInvalid;//失效cron表达式 private String whereStr;//动态where 条件 + private int type; public String getName() { return name; } @@ -38,6 +39,11 @@ public class ScheduleCfg extends BaseCfg{ public void setWhereStr(String whereStr) { this.whereStr = whereStr; } - + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } } From bea5312e9f635c12bed63ea65f608860c6ec1b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E5=86=AC=E6=A2=85?= Date: Thu, 28 Mar 2019 14:32:22 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E5=88=97Effective=20=E6=9C=89?= =?UTF-8?q?=E6=95=88=E9=85=8D=E7=BD=AE=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/statistics/ConfigureStatisticsDao.xml | 5 +++-- src/main/resources/messages/message_en.properties | 3 ++- src/main/resources/messages/message_ru.properties | 3 ++- src/main/resources/messages/message_zh_CN.properties | 3 ++- .../sql/20190328/alert_proc_statistics_config.sql | 7 +++---- src/main/webapp/WEB-INF/views/index.jsp | 4 ++++ 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/nis/web/dao/configuration/statistics/ConfigureStatisticsDao.xml b/src/main/java/com/nis/web/dao/configuration/statistics/ConfigureStatisticsDao.xml index 9fa01a7e6..0070ac773 100644 --- a/src/main/java/com/nis/web/dao/configuration/statistics/ConfigureStatisticsDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/statistics/ConfigureStatisticsDao.xml @@ -4,11 +4,12 @@ diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 96b31650b..aad27ea02 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1502,4 +1502,5 @@ schedule=Scheduler cancel_all=Cancel all configurations! pre_version=Previous Version approved_all=Approve all configurations! -protection_list_manage=Protection List Manage \ No newline at end of file +protection_list_manage=Protection List Manage +effective=Effective \ 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 0661058db..8514bf337 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1507,4 +1507,5 @@ schedule=Scheduler cancel_all=Cancel all configurations! pre_version=Previous Version approved_all=Approve all configurations! -protection_list_manage=Protection List Manage \ No newline at end of file +protection_list_manage=Protection List Manage +effective=Effective \ 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 84cc65b02..5e0770daa 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1500,4 +1500,5 @@ cancel_all=\u53D6\u6D88\u6240\u6709\u914D\u7F6E! pre_version=\u4e0a\u4e00\u7248 is_schduler=\u5b9a\u65f6\u5668 approved_all=\u5BA1\u6838\u901A\u8FC7\u6240\u6709\u914D\u7F6E! -protection_list_manage=\u5185\u7F6E\u4FDD\u62A4\u540D\u5355\u7BA1\u7406 \ No newline at end of file +protection_list_manage=\u5185\u7F6E\u4FDD\u62A4\u540D\u5355\u7BA1\u7406 +effective=\u6709\u6548 \ No newline at end of file diff --git a/src/main/resources/sql/20190328/alert_proc_statistics_config.sql b/src/main/resources/sql/20190328/alert_proc_statistics_config.sql index cc102e10b..a305c06ca 100644 --- a/src/main/resources/sql/20190328/alert_proc_statistics_config.sql +++ b/src/main/resources/sql/20190328/alert_proc_statistics_config.sql @@ -1,3 +1,4 @@ +drop PROCEDURE proc_statistics_config; CREATE DEFINER=`root`@`%` PROCEDURE `proc_statistics_config`() BEGIN @@ -64,10 +65,8 @@ BEGIN COMMIT; - #没有定时任务前的统计:is_audit=1 && is_valid=1为approved - #set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,audit_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','audit_time,function_id,service_id,action,compile_id,if(is_audit=3,3,if(is_audit=2,2,if(is_audit=1,1,if(is_valid=0,0,if(is_valid,-1,-1))))) cfg_state from ',tabName); - #20190328 增加定时任务后is_audit=1 && (is_valid=1 || is_valid=0) 即为approved (为与界面显示保持一致,更改统计条件,此时的结果中approved并不代表所有有效的配置总数) - set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','function_id,service_id,action,compile_id,if(is_valid=-1,-1,if(is_valid=1,1,if(is_valid=0 && is_audit=0,0,if(is_valid=0 && is_audit=1,1,if(is_valid=0 && is_audit=2,2,if(is_valid=0 && is_audit=3,3,0)))))) cfg_state from ',tabName); + #20190328 增加定时任务后is_audit=1 && (is_valid=1 || is_valid=0) 即为approved (增加cfg_state=4[is_valid=0 && is_audit=1],代表定时任务审核过的),而cfg_state=1仅仅代表审核通过且有效的,界面展示的approved值实际包含cfg_state=4和cfg_state=1 + set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','function_id,service_id,action,compile_id,if(is_valid=-1,-1,if(is_valid=1,1,if(is_audit=0,0,if(is_audit=1,4,if(is_audit=2,2,if(is_audit=3,3,0)))))) cfg_state from ',tabName); PREPARE execs FROM @insert_statistics_sql; diff --git a/src/main/webapp/WEB-INF/views/index.jsp b/src/main/webapp/WEB-INF/views/index.jsp index 76208af97..185a1052b 100644 --- a/src/main/webapp/WEB-INF/views/index.jsp +++ b/src/main/webapp/WEB-INF/views/index.jsp @@ -472,6 +472,7 @@ + @@ -510,6 +511,9 @@ <%-- ${serviceName } --%> + + ${statistics.effective } + ${statistics.approved } From 5e1095f2bb18c404473d0bdf8215effcc1ed5d3d Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Thu, 28 Mar 2019 17:29:28 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=BF=AE=E6=AD=A3HTTP(S)=E9=87=8D?= =?UTF-8?q?=E5=AE=9A=E5=90=91=E9=85=8D=E7=BD=AE=E5=AF=BC=E5=85=A5=E5=BA=94?= =?UTF-8?q?=E7=AD=94=E7=A0=81=E9=BB=98=E8=AE=A4=E5=80=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/DomainInterceptMonitTemplate.java | 2 +- .../excel/thread/CheckComplexStringFormatThread.java | 2 +- .../nis/util/excel/thread/CheckIpFormatThread.java | 2 +- .../util/excel/thread/CheckStringFormatThread.java | 2 +- .../basics/InnerProtectionListController.java | 3 --- .../service/basics/InnerProtectionListService.java | 1 - .../WEB-INF/views/cfg/intercept/interceptSubList.jsp | 12 ++++++------ 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/nis/domain/configuration/template/DomainInterceptMonitTemplate.java b/src/main/java/com/nis/domain/configuration/template/DomainInterceptMonitTemplate.java index 5d75c9519..2a8e6f2ae 100644 --- a/src/main/java/com/nis/domain/configuration/template/DomainInterceptMonitTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/DomainInterceptMonitTemplate.java @@ -12,7 +12,7 @@ public class DomainInterceptMonitTemplate extends StringAllNotDoLogTemplate{ private String userRegion5; private String cfgKeywords; - @ExcelField(title="intercept_intensity",dictType="INTERCEPT_DOMAIN_INTENSITY",align=2,sort=2) + @ExcelField(title="intercept_intensity",dictType="INTERCEPT_DOMAIN_INTENSITY",align=2,sort=12) public String getUserRegion5() { return userRegion5; } 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 1f8bb407a..14bb202f3 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java @@ -155,7 +155,7 @@ public class CheckComplexStringFormatThread implements Callable{ // 代理 HTTP(s)重定向 if (regionDict.getFunctionId().equals(208)) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { - baseStringCfg.setUserRegion1("301"); + baseStringCfg.setUserRegion1("302"); } String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码 String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL 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 7bd398430..fb8888cf0 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java @@ -439,7 +439,7 @@ public class CheckIpFormatThread implements Callable{ // 代理 HTTP(s)重定向 if (regionDict.getFunctionId().equals(208)) { if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) { - baseIpCfg.setUserRegion1("301"); + baseIpCfg.setUserRegion1("302"); } String userRegion1 = baseIpCfg.getUserRegion1();// 重定向应答码 String userRegion2 = baseIpCfg.getUserRegion2();// 重定向URL 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 2be4d90a0..143a1cd2d 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java @@ -205,7 +205,7 @@ public class CheckStringFormatThread implements Callable{ // 代理 HTTP(s)重定向 if (regionDict.getFunctionId().equals(208)) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { - baseStringCfg.setUserRegion1("301"); + baseStringCfg.setUserRegion1("302"); } String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码 String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL diff --git a/src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java b/src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java index a56a810d1..ae341bdf4 100644 --- a/src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java +++ b/src/main/java/com/nis/web/controller/basics/InnerProtectionListController.java @@ -1,18 +1,15 @@ package com.nis.web.controller.basics; -import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.mvc.support.RedirectAttributes; diff --git a/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java b/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java index 10d05824e..1c8ef0a96 100644 --- a/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java +++ b/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java @@ -10,7 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import com.google.common.collect.Lists; import com.nis.domain.Page; import com.nis.domain.basics.ProtectionListInfo; import com.nis.exceptions.MaatConvertException; diff --git a/src/main/webapp/WEB-INF/views/cfg/intercept/interceptSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/intercept/interceptSubList.jsp index 98f4d66a4..24c35879e 100644 --- a/src/main/webapp/WEB-INF/views/cfg/intercept/interceptSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/intercept/interceptSubList.jsp @@ -228,10 +228,10 @@
-
+
-
@@ -249,8 +249,8 @@
-
-
+
+
@@ -261,8 +261,8 @@
-
- +
+
From 91d93e7840533ce825cca5b4e49aaa760844ce73 Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Fri, 29 Mar 2019 15:12:28 +0800 Subject: [PATCH 09/17] =?UTF-8?q?Stream=E9=99=90=E9=80=9F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=AF=BC=E5=85=A5=E6=A8=A1=E6=9D=BF=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?'=E4=B8=A2=E5=8C=85=E7=8E=87'=E5=B1=9E=E6=80=A7=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3APP=E7=AD=96=E7=95=A5=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=B9=B6=E4=B8=8B=E5=8F=91isValid=E4=B8=BA0(?= =?UTF-8?q?=E6=97=A0=E6=95=88)bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nis/util/excel/ImportBigExcel.java | 2 +- .../nis/util/excel/thread/CheckIpFormatThread.java | 8 +++++++- .../java/com/nis/web/controller/BaseController.java | 13 ++++++++++++- .../controller/configuration/ntc/IpController.java | 5 +++++ src/main/java/com/nis/web/service/BaseService.java | 3 ++- src/main/webapp/static/pages/scripts/importExcel.js | 10 ++++++++++ 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/nis/util/excel/ImportBigExcel.java b/src/main/java/com/nis/util/excel/ImportBigExcel.java index ecbde94c3..2a54e2c23 100644 --- a/src/main/java/com/nis/util/excel/ImportBigExcel.java +++ b/src/main/java/com/nis/util/excel/ImportBigExcel.java @@ -423,7 +423,7 @@ public class ImportBigExcel extends XLSXCovertCSVReader{ throw new RuntimeException("regionDict is null!"); } if(dataList.size()==0) { - throw new ServiceException(props.getProperty("noneData", "noneData")); + throw new ServiceException(props.getProperty("no_data", "no_data")); }else if(this.hasImportLimit&&dataList.size()>(Constants.IMPORT_LIMIT+1)) { throw new ServiceException(props.getProperty("import_limit_is", "The maximum import size is")+" "+Constants.IMPORT_LIMIT); } 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 fb8888cf0..7fc55e9ec 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java @@ -132,10 +132,16 @@ public class CheckIpFormatThread implements Callable{ // 特殊字段验证 // packet ip ratelimit - if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) { + if (serviceDict!=null && serviceDict.getAction().intValue() == 64 && (serviceDict.getFunctionId().intValue() == 5 + || serviceDict.getFunctionId().intValue() == 63 + || serviceDict.getFunctionId().intValue() == 407 + || serviceDict.getFunctionId().intValue() == 408) ) { String userRegion1 = IpRateLimitTemplate.userRegion1; baseIpCfg.setUserRegion1(userRegion1); if("0".equals(userRegion1)) { + if(StringUtils.isBlank(baseIpCfg.getUserRegion2())) { + baseIpCfg.setUserRegion2("0.1"); + } String userRegion2 = baseIpCfg.getUserRegion2(); try { // Double ratelimt= Double.parseDouble(userRegion2); diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 86b3235c8..c3f22d280 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -1534,6 +1534,9 @@ public class BaseController { || regionDict.getFunctionId().equals(566)) { // APP Feature IP BlockingQueue list = ei.getDataList(IpAllNotDoLogTemplate.class ); ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,asnGroupInfos, list); + }else if((regionDict.getFunctionId().equals(63) || regionDict.getFunctionId().equals(407) || regionDict.getFunctionId().equals(408)) && serviceDict!=null && serviceDict.getAction().equals(64)) { // Policies -> Stream + BlockingQueue list = ei.getDataList(IpRateLimitTemplate.class); + ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,asnGroupInfos, list); }else { BlockingQueue list = ei.getDataList(IpAllTemplate.class ); ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list); @@ -1628,6 +1631,9 @@ public class BaseController { String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend"); SpecificServiceCfg specificServiceCfg = null; if (serviceDict!=null&&(serviceDict.getServiceId().intValue() == 33 || serviceDict.getServiceId().intValue() == 145 + || serviceDict.getServiceId().intValue() == 1056 + || serviceDict.getServiceId().intValue() == 1059 + || serviceDict.getServiceId().intValue() == 1060 || serviceDict.getServiceId().intValue() == 35 || serviceDict.getServiceId().intValue() == 147 || serviceDict.getServiceId().intValue() == 36 @@ -1902,6 +1908,9 @@ public class BaseController { } if (serviceDict!=null&&(serviceDict.getServiceId().intValue() == 33 || serviceDict.getServiceId().intValue() == 145 + || serviceDict.getServiceId().intValue() == 1056 + || serviceDict.getServiceId().intValue() == 1059 + || serviceDict.getServiceId().intValue() == 1060 || serviceDict.getServiceId().intValue() == 35 || serviceDict.getServiceId().intValue() == 147 || serviceDict.getServiceId().intValue() == 36 @@ -2487,7 +2496,9 @@ public class BaseController { } else if(regionDict.getFunctionId().equals(405) || regionDict.getFunctionId().equals(563) || regionDict.getFunctionId().equals(565) || regionDict.getFunctionId().equals(566)) { // APP Feature IP ei.loadInitParams(IpAllNotDoLogTemplate.class, msgProp, regionDict, serviceDict); - } else { + } else if((regionDict.getFunctionId().equals(63) || regionDict.getFunctionId().equals(407) || regionDict.getFunctionId().equals(408)) && serviceDict.getAction().equals(64)){ // Policies -> Stream + ei.loadInitParams(IpRateLimitTemplate.class, msgProp, regionDict, serviceDict); + }else { ei.loadInitParams(IpAllTemplate.class, msgProp, regionDict, serviceDict); } } else if (regionDict.getRegionType().equals(2)) {// 字符串类 diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java index fda97e046..af31023be 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java @@ -429,6 +429,11 @@ public class IpController extends BaseController{ ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllNotDoLogTemplate.class, 2); excel.setDataList(pro,classList,null). write(request,response, fileName).dispose(); + }else if((regionDict.getFunctionId().equals(63)|| regionDict.getFunctionId().equals(407) || regionDict.getFunctionId().equals(408)) && serviceDict.getAction().equals(64)){// Policies -> Stream + List classList=new ArrayList(); + ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2); + excel.setDataList(pro,classList,null). + write(request,response, fileName).dispose(); }else{ List classList=new ArrayList(); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2); diff --git a/src/main/java/com/nis/web/service/BaseService.java b/src/main/java/com/nis/web/service/BaseService.java index af2fed8a0..5a25841dd 100644 --- a/src/main/java/com/nis/web/service/BaseService.java +++ b/src/main/java/com/nis/web/service/BaseService.java @@ -2344,7 +2344,8 @@ public abstract class BaseService { try{ batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); for(int index = 0; index < appPolicyCfgs.size();index++){ - AppPolicyCfg _cfg = appPolicyCfgs.get(index); + AppPolicyCfg _cfg = new AppPolicyCfg(); + BeanUtils.copyProperties(appPolicyCfgs.get(index), _cfg); ((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppPolicyCfgForBatch(_cfg); } diff --git a/src/main/webapp/static/pages/scripts/importExcel.js b/src/main/webapp/static/pages/scripts/importExcel.js index 85bdc0264..651ee1d70 100644 --- a/src/main/webapp/static/pages/scripts/importExcel.js +++ b/src/main/webapp/static/pages/scripts/importExcel.js @@ -67,6 +67,16 @@ function switchService(){ $(".service").removeClass("hidden"); } + // App Identify -> RateLimit隐藏SubscribeID + if(functionId == 63){ + var action = $("input[name='serviceDictId']:checked").attr("action"); + var label = $(".region").find("input[configservicetype='subscribe_id']").parents("label:first"); + if(action == 64){ + $(label).hide(); + }else{ + $(label).show(); + } + } } /** * 模板下载 From e4cf2aa1b4e7f8f63ff35b53b938e9bd80a60f03 Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Fri, 29 Mar 2019 15:36:54 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=EF=BC=8C=E9=80=89=E4=B8=ADIP=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/static/pages/scripts/importExcel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/static/pages/scripts/importExcel.js b/src/main/webapp/static/pages/scripts/importExcel.js index 651ee1d70..435018316 100644 --- a/src/main/webapp/static/pages/scripts/importExcel.js +++ b/src/main/webapp/static/pages/scripts/importExcel.js @@ -72,6 +72,7 @@ function switchService(){ var action = $("input[name='serviceDictId']:checked").attr("action"); var label = $(".region").find("input[configservicetype='subscribe_id']").parents("label:first"); if(action == 64){ + $("input[name='regionDictIds'][regiontype='1']").prop("checked",true); $(label).hide(); }else{ $(label).show(); From 2809d1890df7957b94044cf1a3e97d8f91b0eccd Mon Sep 17 00:00:00 2001 From: shangguanyanfei Date: Fri, 29 Mar 2019 18:14:18 +0800 Subject: [PATCH 11/17] =?UTF-8?q?1.=E5=AE=9A=E6=97=B6=E5=8E=BB=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E7=95=8C=E9=9D=A2=E5=92=8C=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E9=87=8F=E5=85=A5=E5=BA=93=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E6=96=B0=E5=A2=9E=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86?= =?UTF-8?q?-=E7=AE=A1=E7=90=86=E5=91=98=E7=94=A8=E6=88=B7=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E7=95=8C=E9=9D=A2=E5=88=97=E8=A1=A8=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=202.=E5=AE=9E=E6=97=B6=E6=89=AB=E6=8F=8F=E6=AD=A4?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E7=95=8C=E9=9D=A2=E5=92=8C=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E7=9A=84=E9=85=8D=E7=BD=AE=E9=87=8F=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=80=E8=87=B4=EF=BC=8C=E4=B8=8D=E4=B8=80=E8=87=B4=EF=BC=8C?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=94=A8=E6=88=B7=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/nis/domain/SysUserWarn.java | 92 +++++++++++++++ .../java/com/nis/domain/SysUserWarnData.java | 46 ++++++++ .../com/nis/domain/SysUserWarnRecvData.java | 67 +++++++++++ src/main/java/com/nis/util/Constants.java | 4 + .../sys/StatisticSysUserWarnNumber.java | 110 ++++++++++++++++++ .../controller/sys/SysUserWarnController.java | 61 ++++++++++ .../java/com/nis/web/dao/SysUserWarnDao.java | 22 ++++ .../java/com/nis/web/dao/SysUserWarnDao.xml | 91 +++++++++++++++ .../nis/web/service/SysUserWarnService.java | 72 ++++++++++++ .../resources/messages/message_en.properties | 7 +- .../resources/messages/message_ru.properties | 107 ++++++++--------- .../messages/message_zh_CN.properties | 35 +++--- src/main/resources/nis.properties | 4 +- src/main/resources/spring-mvc.xml | 5 + .../resources/sql/20190329/add_sys_menu.sql | 2 + .../sql/20190329/create_sys_user_warn.sql | 9 ++ src/main/webapp/WEB-INF/views/home.jsp | 27 ++++- .../WEB-INF/views/sys/sysUserWarnList.jsp | 105 +++++++++++++++++ 18 files changed, 793 insertions(+), 73 deletions(-) create mode 100644 src/main/java/com/nis/domain/SysUserWarn.java create mode 100644 src/main/java/com/nis/domain/SysUserWarnData.java create mode 100644 src/main/java/com/nis/domain/SysUserWarnRecvData.java create mode 100644 src/main/java/com/nis/web/controller/sys/StatisticSysUserWarnNumber.java create mode 100644 src/main/java/com/nis/web/controller/sys/SysUserWarnController.java create mode 100644 src/main/java/com/nis/web/dao/SysUserWarnDao.java create mode 100644 src/main/java/com/nis/web/dao/SysUserWarnDao.xml create mode 100644 src/main/java/com/nis/web/service/SysUserWarnService.java create mode 100644 src/main/resources/sql/20190329/add_sys_menu.sql create mode 100644 src/main/resources/sql/20190329/create_sys_user_warn.sql create mode 100644 src/main/webapp/WEB-INF/views/sys/sysUserWarnList.jsp diff --git a/src/main/java/com/nis/domain/SysUserWarn.java b/src/main/java/com/nis/domain/SysUserWarn.java new file mode 100644 index 000000000..177007e97 --- /dev/null +++ b/src/main/java/com/nis/domain/SysUserWarn.java @@ -0,0 +1,92 @@ +package com.nis.domain; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlTransient; + +import org.apache.poi.ss.formula.functions.T; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +public class SysUserWarn { + + private String serviceId; //业务Id + private String serviceDesc;//业务描述 + private Integer interfaceCfgTotal;//界面配置数量 + + private Integer systemCfgTotal;//服务端配置数量 + + private Date time;//时间 + private String remark;//备注 + + private Integer id;//serviceID + private String tableName;//表名 + /** + * 当前实体分页对象 + */ + protected Page page; + + public String getServiceId() { + return serviceId; + } + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + public String getServiceDesc() { + return serviceDesc; + } + public void setServiceDesc(String serviceDesc) { + this.serviceDesc = serviceDesc; + } + public Integer getInterfaceCfgTotal() { + return interfaceCfgTotal; + } + public void setInterfaceCfgTotal(Integer interfaceCfgTotal) { + this.interfaceCfgTotal = interfaceCfgTotal; + } + public Integer getSystemCfgTotal() { + return systemCfgTotal; + } + public void setSystemCfgTotal(Integer systemCfgTotal) { + this.systemCfgTotal = systemCfgTotal; + } + public Date getTime() { + return time; + } + public void setTime(Date time) { + this.time = time; + } + public String getRemark() { + return remark; + } + public void setRemark(String remark) { + this.remark = remark; + } + public Integer getId() { + return id; + } + public void setId(Integer id) { + this.id = id; + } + public String getTableName() { + return tableName; + } + public void setTableName(String tableName) { + this.tableName = tableName; + } + @JsonIgnore + @XmlTransient + public Page getPage() { + if (page == null){ + page = new Page(); + } + return page; + } + + public Page setPage(Page page) { + this.page = page; + return page; + } + + +} diff --git a/src/main/java/com/nis/domain/SysUserWarnData.java b/src/main/java/com/nis/domain/SysUserWarnData.java new file mode 100644 index 000000000..c66ae9e19 --- /dev/null +++ b/src/main/java/com/nis/domain/SysUserWarnData.java @@ -0,0 +1,46 @@ +package com.nis.domain; + +import java.util.List; +import java.util.Map; + +public class SysUserWarnData { + + private Map> effective; + private Integer effectiveCount; + private Map> obsolete; + private Integer obsoleteCount; + + + public Map> getEffective() { + return effective; + } + public void setEffective(Map> effective) { + this.effective = effective; + } + public Integer getEffectiveCount() { + return effectiveCount; + } + public void setEffectiveCount(Integer effectiveCount) { + this.effectiveCount = effectiveCount; + } + public Map> getObsolete() { + return obsolete; + } + public void setObsolete(Map> obsolete) { + this.obsolete = obsolete; + } + public Integer getObsoleteCount() { + return obsoleteCount; + } + public void setObsoleteCount(Integer obsoleteCount) { + this.obsoleteCount = obsoleteCount; + } + @Override + public String toString() { + return "SysUserWarnData [effective=" + effective + ", effectiveCount=" + effectiveCount + ", obsolete=" + + obsolete + ", obsoleteCount=" + obsoleteCount + "]"; + } + + + +} diff --git a/src/main/java/com/nis/domain/SysUserWarnRecvData.java b/src/main/java/com/nis/domain/SysUserWarnRecvData.java new file mode 100644 index 000000000..ec15535c6 --- /dev/null +++ b/src/main/java/com/nis/domain/SysUserWarnRecvData.java @@ -0,0 +1,67 @@ +package com.nis.domain; + +public class SysUserWarnRecvData { + private Integer status; + private Integer businessCode; + private String reason; + private String msg; + private String fromuri; + private String logSource; + private String traceCode; + private SysUserWarnData data; + + + public Integer getStatus() { + return status; + } + public void setStatus(Integer status) { + this.status = status; + } + public Integer getBusinessCode() { + return businessCode; + } + public void setBusinessCode(Integer businessCode) { + this.businessCode = businessCode; + } + public String getReason() { + return reason; + } + public void setReason(String reason) { + this.reason = reason; + } + public String getMsg() { + return msg; + } + public void setMsg(String msg) { + this.msg = msg; + } + public String getFromuri() { + return fromuri; + } + public void setFromuri(String fromuri) { + this.fromuri = fromuri; + } + public String getLogSource() { + return logSource; + } + public void setLogSource(String logSource) { + this.logSource = logSource; + } + public String getTraceCode() { + return traceCode; + } + public void setTraceCode(String traceCode) { + this.traceCode = traceCode; + } + public SysUserWarnData getData() { + return data; + } + public void setData(SysUserWarnData data) { + this.data = data; + } + + + + + +} diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 195e5d2e6..9fd57f34f 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -834,4 +834,8 @@ public final class Constants { * 配置保护名单字典key */ public static final String CACHE_PROTECTION_LIST_DICT = "protetionListDict"; + /** + * 管理员用户预警查询服务配置总量接口 + */ + public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService",""); } diff --git a/src/main/java/com/nis/web/controller/sys/StatisticSysUserWarnNumber.java b/src/main/java/com/nis/web/controller/sys/StatisticSysUserWarnNumber.java new file mode 100644 index 000000000..6e4a5860b --- /dev/null +++ b/src/main/java/com/nis/web/controller/sys/StatisticSysUserWarnNumber.java @@ -0,0 +1,110 @@ +package com.nis.web.controller.sys; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.nis.domain.SysUserWarn; +import com.nis.domain.SysUserWarnData; +import com.nis.domain.SysUserWarnRecvData; +import com.nis.util.Constants; +import com.nis.util.ServiceConfigTemplateUtil; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.service.SysUserWarnService; +/** + * 定时查询 界面配置总量和 服务配置总量 并添加到 sys_user_warn表中 + * + * + */ +public class StatisticSysUserWarnNumber { + + private Logger logger = Logger.getLogger(this.getClass()); + + + @Autowired + protected SysUserWarnService sysUserWarnService; + + @Autowired + private HttpServletRequest request; + + + + public void insertTotalInfo() { + logger.info("定时统计业务号的界面配置总量和服务配置总量-开始。。。。。。。。。。。。。。"); + long start=System.currentTimeMillis(); + //获取界面配置的所有业务信息 + List> serviceList = ServiceConfigTemplateUtil.getServiceList(); + getSysData(serviceList); + long end=System.currentTimeMillis(); + logger.info("定时统计业务号的界面配置总量和服务配置总量-结束:"+(end-start)+"。。。。。。。。。。。。。。"); + + } + + + public void getSysData(List> serviceList){ + //调用服务端接口,查询所有业务服务端的配置总量 + try{ + Map params = new HashMap(); + params.put("service", -1); + String url = Constants.SERVICE_URL + Constants.CONFIG_BY_SERVICE; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + SysUserWarnRecvData fromJson = gson.fromJson(recv, new TypeToken() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + SysUserWarnData data = fromJson.getData(); + Map> effective = data.getEffective(); + List listTotal =new ArrayList(); + for (Map map1 : serviceList) { + SysUserWarn entity=new SysUserWarn(); + entity.setId(Integer.parseInt(map1.get("id").toString())); + entity.setTableName(map1.get("tableName").toString()); + //根据serviceID和表名查询界面各个业务的配置数量 + Integer cfgCount = sysUserWarnService.getCfgCount(entity); + //查询服务端的各个业务的配置数量 + List list = effective.get(map1.get("id")); + SysUserWarn sysUserWarn=new SysUserWarn(); + sysUserWarn.setServiceId(map1.get("id").toString()); + sysUserWarn.setServiceDesc(map1.get("desc").toString()); + if(cfgCount>0){ + sysUserWarn.setInterfaceCfgTotal(cfgCount); + }else{ + sysUserWarn.setInterfaceCfgTotal(0); + } + if(list !=null && list.size()>0){ + sysUserWarn.setSystemCfgTotal(list.size()); + }else { + sysUserWarn.setSystemCfgTotal(0); + } + sysUserWarn.setTime(new Date()); + listTotal.add(sysUserWarn); + } + //判断表中是否有数据 + Integer total = sysUserWarnService.getAllInfoCount(); + if(total !=null && total>0){//说明有数据 先删除 后添加 + sysUserWarnService.deleteAllData(); + sysUserWarnService.insert(listTotal); + }else{// 没有 直接 添加 + sysUserWarnService.insert(listTotal); + } + } + } + + }catch(Exception e) { + logger.error("更新所有业务的配置数量失败", e); + + } + } +} diff --git a/src/main/java/com/nis/web/controller/sys/SysUserWarnController.java b/src/main/java/com/nis/web/controller/sys/SysUserWarnController.java new file mode 100644 index 000000000..4e811fcd0 --- /dev/null +++ b/src/main/java/com/nis/web/controller/sys/SysUserWarnController.java @@ -0,0 +1,61 @@ +package com.nis.web.controller.sys; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.nis.domain.Page; +import com.nis.domain.SysUserWarn; +import com.nis.util.ServiceConfigTemplateUtil; +import com.nis.web.controller.BaseController; +import com.nis.web.service.SysUserWarnService; + +@Controller +@RequestMapping(value = "${adminPath}/sys/warn") +public class SysUserWarnController extends BaseController{ + + @Autowired + protected SysUserWarnService sysUserWarnService; + + + + @RequiresPermissions("sys:warnList:view") + @RequestMapping(value = {"userWarnList", ""}) + public String list(@ModelAttribute("warn") SysUserWarn warn, Model model,HttpServletRequest request + ,HttpServletResponse response) { + Page pageCondition = new Page(request, response,"r"); + Properties msgProp = getMsgProp(); + Page page = sysUserWarnService.getAllList(pageCondition,warn,msgProp); + model.addAttribute("warn", warn); + model.addAttribute("page", page); + return "/sys/sysUserWarnList"; + } + + @RequiresPermissions("sys:warnList:view") + @ResponseBody + @RequestMapping(value = {"serviceSum", ""}) + public SysUserWarn findServiceSum() { + SysUserWarn findServiceSum = sysUserWarnService.findServiceSum(); + return findServiceSum; + } + + public static void main(String[] args) { + + List> serviceList = ServiceConfigTemplateUtil.getServiceList(); + System.out.println(serviceList); + for (Map map : serviceList) { + System.out.println(map.get("id")); + System.out.println(map.get("tableName")); + } + } +} diff --git a/src/main/java/com/nis/web/dao/SysUserWarnDao.java b/src/main/java/com/nis/web/dao/SysUserWarnDao.java new file mode 100644 index 000000000..3978a7224 --- /dev/null +++ b/src/main/java/com/nis/web/dao/SysUserWarnDao.java @@ -0,0 +1,22 @@ +package com.nis.web.dao; + +import java.util.List; + +import com.nis.domain.SysUserWarn; + +@MyBatisDao +public interface SysUserWarnDao extends CrudDao{ + + //查询所有的数据 + public List getAllList(SysUserWarn entity); + //查询总的记录数 + public Integer getAllInfoCount(); + //查询 所有数据中界面总量 和 服务总量 + public SysUserWarn getAllSum(SysUserWarn entity); + //根据serviceID和表名查询业务配置的数量 + public Integer getCfgCount(SysUserWarn entity); + //新增 + public int insert(List list); + //删除所有的数据 + public int deleteAllData(); +} diff --git a/src/main/java/com/nis/web/dao/SysUserWarnDao.xml b/src/main/java/com/nis/web/dao/SysUserWarnDao.xml new file mode 100644 index 000000000..d38d881d8 --- /dev/null +++ b/src/main/java/com/nis/web/dao/SysUserWarnDao.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + insert into sys_user_warn ( + service_id, + service_desc, + interface_cfg_total, + system_cfg_total, + time, + remark + )values + + ( + #{item.serviceId,jdbcType=VARCHAR}, + #{item.serviceDesc,jdbcType=VARCHAR}, + #{item.interfaceCfgTotal,jdbcType=INTEGER}, + #{item.systemCfgTotal,jdbcType=INTEGER}, + #{item.time,jdbcType=TIMESTAMP}, + #{item.remark,jdbcType=VARCHAR} + ) + + + + + + + + delete from sys_user_warn + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/SysUserWarnService.java b/src/main/java/com/nis/web/service/SysUserWarnService.java new file mode 100644 index 000000000..b66abd20c --- /dev/null +++ b/src/main/java/com/nis/web/service/SysUserWarnService.java @@ -0,0 +1,72 @@ +package com.nis.web.service; + +import java.util.List; +import java.util.Properties; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.nis.domain.Page; +import com.nis.domain.SysUserWarn; +import com.nis.web.dao.SysUserWarnDao; + +@Service +public class SysUserWarnService extends BaseService{ + + @Autowired + private SysUserWarnDao sysUserWarnDao; + + //查询所有的数据 + public Page getAllList(Page page,SysUserWarn entity,Properties msgProp){ + + entity.setPage(page); + List allList = sysUserWarnDao.getAllList(entity); + if(allList !=null && allList.size()>0){ + SysUserWarn obj=new SysUserWarn(); + obj.setServiceId(entity.getServiceId()); + SysUserWarn allSum = sysUserWarnDao.getAllSum(obj); + SysUserWarn sysWarn=new SysUserWarn(); + String report_total = msgProp.getProperty("report_total"); + sysWarn.setServiceId(report_total); + sysWarn.setServiceDesc("--"); + sysWarn.setInterfaceCfgTotal(allSum.getInterfaceCfgTotal()); + sysWarn.setSystemCfgTotal(allSum.getSystemCfgTotal()); + sysWarn.setTime(allList.get(0).getTime()); + allList.add(0, sysWarn); + } + + page.setList(allList); + return page; + } + //根据serviceID和表名查询业务配置的数量 + public Integer getAllInfoCount(){ + + return sysUserWarnDao.getAllInfoCount(); + } + + //根据serviceID和表名查询业务配置的数量 + public Integer getCfgCount(SysUserWarn entity){ + + return sysUserWarnDao.getCfgCount(entity); + } + //新增 + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public int insert(List list){ + return sysUserWarnDao.insert(list); + + } + //删除所有的数据 + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public int deleteAllData(){ + return sysUserWarnDao.deleteAllData(); + + } + //查询 所有业务 界面总量和服务总量的和 + public SysUserWarn findServiceSum(){ + SysUserWarn obj=new SysUserWarn(); + SysUserWarn allSum = sysUserWarnDao.getAllSum(obj); + return allSum; + } + +} diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index aad27ea02..611155593 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1481,7 +1481,7 @@ reedit=Please re-edit! intercep_domain_required_tip=Domain is required packets=packets GByte=GByte -#\u5B9A\u65F6\u5668\u53C2\u6570 +#\u5b9a\u65f6\u5668\u53c2\u6570 interval=Recure every month=Months day=Days @@ -1503,4 +1503,7 @@ cancel_all=Cancel all configurations! pre_version=Previous Version approved_all=Approve all configurations! protection_list_manage=Protection List Manage -effective=Effective \ No newline at end of file +effective=Effective +admin_user_warn=Admin User Warn +interface_total=Interface Total +service_total=Service Total \ 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 8514bf337..0da2cf990 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1323,7 +1323,7 @@ address_pool_id=ID \u043f\u0443\u043b \u0430\u0434\u0440\u0435\u0441\u043e\u0432 outgoing_unicast_total_size=\u0417\u0430\u043a\u0430\u0447\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b voip_sample_reject=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u0446\u043e\u0432 VOIP \u0430\u0443\u0434\u0438\u043e available_ip=\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 IP -block_by_app_server_ip=DNS-\u0421\u043F\u0443\u0444\u0438\u043D\u0433 +block_by_app_server_ip=DNS-\u0421\u043f\u0443\u0444\u0438\u043d\u0433 certificate_file=\u0424\u0430\u0439\u043b \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 address_pool=\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0443\u043b\u0430 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 transfer_bytes=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0431\u0430\u0439\u0442\u043e\u0432 @@ -1370,7 +1370,7 @@ keyword_log_tips=\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u conn_record=\u0417\u0430\u043f\u0438\u0441\u0438 \u041f\u043e\u0434\u043a\u044e\u0447\u0435\u043d\u0438\u0439 bps=\u0413\u0431\u0438\u0442/\u0441 bps_percent=Bps Percent -pps=\u041F\u0430\u043A\u0435\u0442/\u0441 +pps=\u041f\u0430\u043a\u0435\u0442/\u0441 pps_percent=pps Percent spoofing_ip_object=\u041f\u0443\u043b IP \u0421\u043f\u0443\u0444\u0438\u043d\u0433 spoofing_ip_policy=IP \u0421\u043f\u0443\u0444\u0438\u043d\u0433 @@ -1382,13 +1382,13 @@ d_asn=DASN asn_conn_report=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 ASN https_url_report=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 HTTP(s) URL url=URL -sum=\u0421\u0443\u043C\u043C\u0430 +sum=\u0421\u0443\u043c\u043c\u0430 url_count=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e URL ip_range_report=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0425\u043e\u0441\u0442\u043e\u0432 \u0432 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u0445 \u0438 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 ip_start=\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 IP ip_end=\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 IP -ip_start_num=\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u041D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043E\u0432 -ip_end_num=\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u041A\u043E\u043D\u0435\u0447\u043D\u044B\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043E\u0432 +ip_start_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 +ip_end_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 ip_sub=IP-\u043f\u043e\u0434\u0441\u0435\u0442\u044c start_ip=\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 IP end_ip=\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 IP @@ -1403,21 +1403,21 @@ ip_spoofing_group_manage=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\ min_tcp=\u041c\u0438\u043d. max_tcp=\u041c\u0430\u043a\u0441. APP_TCP_SESSION_BYTE=\u0421\u0435\u0430\u043d\u0441 -ip_count=\u0415\u0434\u0438\u043D\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439 IP-\u0430\u0434\u0440\u0435\u0441 +ip_count=\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 IP-\u0430\u0434\u0440\u0435\u0441 counnection_count=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 asn=ASN Unique_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041a\u043b\u0438\u0435\u043d\u0442\u0430 IP ip=IP country=\u0421\u0442\u0440\u0430\u043d\u0430 unique_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041a\u043b\u0438\u0435\u043d\u0442\u0430 IP -import_limit_is=\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0438\u043C\u043F\u043E\u0440\u0442\u0430 -upload_limit_is=\u041E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0444\u0430\u0439\u043B\u0430 -count=\u041F\u043E\u0434\u0441\u0447\u0435\u0442 -do_blacklist=\u0427\u0435\u0440\u043D\u044B\u0439 \u0421\u043F\u0438\u0441\u043E\u043A -l3_header_error=\u0422\u043E\u043B\u044C\u043A\u043E \u0447\u0435\u0442\u044B\u0440\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043F\u0440\u0438\u0437\u043D\u0430\u043A\u0438 \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u0432\u0432\u0435\u0434\u0435\u043D\u044B \u0432 -IP_HEADER=IP \u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430 -ICMP_HEADER=ICMP \u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430 -offset_expression=\u0421\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430 +import_limit_is=\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 +upload_limit_is=\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 +count=\u041f\u043e\u0434\u0441\u0447\u0435\u0442 +do_blacklist=\u0427\u0435\u0440\u043d\u044b\u0439 \u0421\u043f\u0438\u0441\u043e\u043a +l3_header_error=\u0422\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u0432 +IP_HEADER=IP \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 +ICMP_HEADER=ICMP \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 +offset_expression=\u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 cfg_custom=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0421\u0442\u043e\u043b\u0431\u0446\u044b event_report=\u041e\u0442\u0447\u0435\u0442 \u043e \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0438 ntc_event_monitor_report=\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u041c\u043e\u043d\u0438\u0442\u043e\u0440 \u041e\u0442\u0447\u0435\u0442 @@ -1432,33 +1432,33 @@ letter_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041f\u config_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 monitor_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 control_num=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f -contains_non_hex_char=\u0421\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u043D\u0435 \u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043D\u044B\u0435 \u0441\u0438\u043C\u0432\u043E\u043B\u044B -max_length=\u041C\u0430\u043A\u0441. \u0414\u043B\u0438\u043D\u0430 -min_length=\u041C\u0438\u043D. \u0414\u043B\u0438\u043D\u0430 -length_error=\u041E\u0448\u0438\u0431\u043A\u0430 \u0441 \u0414\u043B\u0438\u043D\u043E\u0439 -duplicate=\u0414\u0443\u0431\u043B\u0438\u043A\u0430\u0442 -print=\u041F\u0435\u0447\u0430\u0442\u044C +contains_non_hex_char=\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b +max_length=\u041c\u0430\u043a\u0441. \u0414\u043b\u0438\u043d\u0430 +min_length=\u041c\u0438\u043d. \u0414\u043b\u0438\u043d\u0430 +length_error=\u041e\u0448\u0438\u0431\u043a\u0430 \u0441 \u0414\u043b\u0438\u043d\u043e\u0439 +duplicate=\u0414\u0443\u0431\u043b\u0438\u043a\u0430\u0442 +print=\u041f\u0435\u0447\u0430\u0442\u044c traffic_connect_log=\u0416\u0443\u0440\u043d\u0430\u043b \u0422\u0440\u0430\u0444\u0438\u043a\u0430 -keyword_log_to_url=\u041E\u0442 \u041A\u043B\u044E\u0447\u0435\u0432\u043E\u0433\u043E \u0421\u043B\u043E\u0432\u0430 \u0414\u043E URL -http_log=HTTP \u0436\u0443\u0440\u043D\u0430\u043B\u044B -cut_sample_tool=\u0418\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442 \u0434\u043B\u044F \u0432\u044B\u0440\u0435\u0437\u043E\u043A \u043E\u0431\u0440\u0430\u0437\u0446\u0430 +keyword_log_to_url=\u041e\u0442 \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0421\u043b\u043e\u0432\u0430 \u0414\u043e URL +http_log=HTTP \u0436\u0443\u0440\u043d\u0430\u043b\u044b +cut_sample_tool=\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u044b\u0440\u0435\u0437\u043e\u043a \u043e\u0431\u0440\u0430\u0437\u0446\u0430 hex_minlength_3=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u0438\u043d\u043e\u0439 3 hex_minlength_4=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u0438\u043d\u043e\u0439 4 hex_minlength_8=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u0438\u043d\u043e\u0439 8 hex_minlength_16=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u0438\u043d\u043e\u0439 16 need_input=\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e max_input=\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 -no_need_input=\u041D\u0435 \u043D\u0443\u0436\u043D\u043E \u0437\u0430\u043F\u043E\u043B\u043D\u044F\u0442\u044C \u043F\u0440\u0438\u0437\u043D\u0430\u043A\u0438 -close_link=\u0417\u0430\u043A\u0440\u044B\u0442\u043E\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 -asn_group=ASN \u0433\u0440\u0443\u043F\u043F\u0430 -can_not_edit_issued_ans_group=\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u0443\u044E \u0433\u0440\u0443\u043F\u043F\u0443 ASN -can_not_delete_asn_group_with_audited_ip=\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 ASN \u0441 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u043D\u044B\u043C IP-\u0430\u0434\u0440\u0435\u0441\u043E\u043C -organization=\u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F -mismatch=\u041D\u0435\u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 -can_not_delete_asn_group_with_audited_ip_address=\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 ASN \u0441 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u043D\u044B\u043C \u043F\u0430\u043A\u0435\u0442\u043E\u043C IP-\u0430\u0434\u0440\u0435\u0441\u0430 -country_code=\u041A\u043E\u0434 \u0421\u0442\u0440\u0430\u043D\u044B -asn_name=\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 ASN -details=\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0441\u0442\u0438 +no_need_input=\u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 +close_link=\u0417\u0430\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 +asn_group=ASN \u0433\u0440\u0443\u043f\u043f\u0430 +can_not_edit_issued_ans_group=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 ASN +can_not_delete_asn_group_with_audited_ip=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 ASN \u0441 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u044b\u043c IP-\u0430\u0434\u0440\u0435\u0441\u043e\u043c +organization=\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f +mismatch=\u041d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 +can_not_delete_asn_group_with_audited_ip_address=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 ASN \u0441 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u044b\u043c \u043f\u0430\u043a\u0435\u0442\u043e\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430 +country_code=\u041a\u043e\u0434 \u0421\u0442\u0440\u0430\u043d\u044b +asn_name=\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 ASN +details=\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 NTC_ASN_NUMBER=ASN application_layer_protocol=L7 \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b traffic_statistics=\u041f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0430\u044f \u0421\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0422\u0440\u0430\u0444\u0438\u043a\u0430 @@ -1467,10 +1467,10 @@ protocol_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 app_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 service_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0421\u0435\u0440\u0432\u0438\u0441\u043e\u0432 website_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0412\u0435\u0431-\u0441\u0430\u0439\u0442\u043e\u0432 -not_exist=\u041D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 -real_time=\u0412 \u0440\u0435\u0430\u043B\u044C\u043D\u043E\u043C \u0432\u0440\u0435\u043C\u0435\u043D\u0438 -history=\u0418\u0441\u0442\u043E\u0440\u0438\u044F -all_columns_hidden=\u0412\u0441\u0435 \u0441\u0442\u043E\u043B\u0431\u0446\u044B \u0441\u043A\u0440\u044B\u0442\u044B! +not_exist=\u041d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 +real_time=\u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 +history=\u0418\u0441\u0442\u043e\u0440\u0438\u044f +all_columns_hidden=\u0412\u0441\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0441\u043a\u0440\u044b\u0442\u044b! no_log=\u041d\u0435\u0442 \u0416\u0443\u0440\u043d\u0430\u043b\u043e\u0432 all_log=\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0416\u0443\u0440\u043d\u0430\u043b \u0438 \u0416\u0443\u0440\u043d\u0430\u043b-\u0444\u0430\u0439\u043b framework_log=\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0416\u0443\u0440\u043d\u0430\u043b @@ -1483,29 +1483,32 @@ ip_existed=IP \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u044 user_check=\u0414\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043d\u044f\u0442, \u043d\u0435\u043b\u044c\u0437\u044f \u0443\u0434\u0430\u043b\u0438\u0442\u044c! deletedAsnTip=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u2116 cfgId \u0441 ASN asnId \u0431\u044b\u043b\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430; reedit=\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0437\u0430\u043d\u043e\u0432\u043e! -intercep_domain_required_tip=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0434\u043E\u043C\u0435\u043D -packets=\u041F\u0430\u043A\u0435\u0442\u044B +intercep_domain_required_tip=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043c\u0435\u043d +packets=\u041f\u0430\u043a\u0435\u0442\u044b GByte=GByte -#\u5B9A\u65F6\u5668\u53C2\u6570 -interval=\u041F\u0440\u043E\u043C\u0435\u0436\u0443\u0442\u043E\u043A -month=\u041C\u0435\u0441\u044F\u0446\u044B -day=\u0414\u043D\u0438 +#\u5b9a\u65f6\u5668\u53c2\u6570 +interval=\u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a +month=\u041c\u0435\u0441\u044f\u0446\u044b +day=\u0414\u043d\u0438 week=weeks -startTime=\u041D\u0430\u0447\u0430\u0442\u044C -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 +startTime=\u041d\u0430\u0447\u0430\u0442\u044c +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 on=On is_schduler=Scheduler validate_error=Unexpected error occurred while validating v4_num=IPv4 Number v6_num=IPv6 Number -always=\u041F\u043E\u0441\u0442\u043E\u044F\u043D\u043D\u043E +always=\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e schedule=Scheduler cancel_all=Cancel all configurations! pre_version=Previous Version approved_all=Approve all configurations! protection_list_manage=Protection List Manage -effective=Effective \ No newline at end of file +effective=Effective +admin_user_warn=Admin User Warn +interface_total=Interface Total +service_total=Service Total \ 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 5e0770daa..6d6ba3e84 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -231,7 +231,7 @@ delete_failed_admin=\u5220\u9664\u5931\u8d25\uff0c\u7ba1\u7406\u5458\u7528\u6237 audit_success=\u5ba1\u6838\u6210\u529f audit_failed=\u5ba1\u6838\u5931\u8d25 turning_page=\u6b63\u5728\u4e3a\u60a8\u8df3\u8f6c\u9875\u9762 -login_timeout=\u767B\u5F55\u8D85\u65F6,\u8bf7\u91cd\u65b0\u767b\u5f55\u3002 +login_timeout=\u767b\u5f55\u8d85\u65f6,\u8bf7\u91cd\u65b0\u767b\u5f55\u3002 captcha_error=\u9a8c\u8bc1\u7801\u4e0d\u6b63\u786e enter_captcha=\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801 input=\u8bf7\u8f93\u5165 @@ -1481,24 +1481,27 @@ reedit=\u8bf7\u91cd\u65b0\u7f16\u8f91\uff01 intercep_domain_required_tip=\u57df\u540d\u4fe1\u606f\u5fc5\u987b\u914d\u7f6e packets=packets GByte=GByte -#\u5B9A\u65F6\u5668\u53C2\u6570 -interval=\u95F4\u9694 +#\u5b9a\u65f6\u5668\u53c2\u6570 +interval=\u95f4\u9694 month=\u6708 -day=\u65E5 -startTime=\u5F00\u59CB\u65F6\u95F4 -endTime=\u7ED3\u675F\u65F6\u95F4 -single=\u5355\u6B21 -everyDay=\u6BCF\u5929 -everyWeek=\u6BCF\u5468 -everyMonth=\u6BCF\u6708 -validate_error=\u9A8C\u8BC1\u65F6\u53D1\u751F\u610F\u5916\u9519\u8BEF +day=\u65e5 +startTime=\u5f00\u59cb\u65f6\u95f4 +endTime=\u7ed3\u675f\u65f6\u95f4 +single=\u5355\u6b21 +everyDay=\u6bcf\u5929 +everyWeek=\u6bcf\u5468 +everyMonth=\u6bcf\u6708 +validate_error=\u9a8c\u8bc1\u65f6\u53d1\u751f\u610f\u5916\u9519\u8bef v4_num=IPv4 Number v6_num=IPv6 Number -always=\u957F\u671F +always=\u957f\u671f schedule=Scheduler -cancel_all=\u53D6\u6D88\u6240\u6709\u914D\u7F6E! +cancel_all=\u53d6\u6d88\u6240\u6709\u914d\u7f6e! pre_version=\u4e0a\u4e00\u7248 is_schduler=\u5b9a\u65f6\u5668 -approved_all=\u5BA1\u6838\u901A\u8FC7\u6240\u6709\u914D\u7F6E! -protection_list_manage=\u5185\u7F6E\u4FDD\u62A4\u540D\u5355\u7BA1\u7406 -effective=\u6709\u6548 \ No newline at end of file +approved_all=\u5ba1\u6838\u901a\u8fc7\u6240\u6709\u914d\u7f6e! +protection_list_manage=\u5185\u7f6e\u4fdd\u62a4\u540d\u5355\u7ba1\u7406 +effective=\u6709\u6548 +admin_user_warn=\u7ba1\u7406\u5458\u7528\u6237\u9884\u8b66 +interface_total=\u754c\u9762\u603b\u91cf +service_total=\u670d\u52a1\u603b\u91cf \ No newline at end of file diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index f163f5c49..05d8e0163 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -621,4 +621,6 @@ ntcHttpRecordLog=v1/ntcHttpRecordLogs trafficAppPpsTrend=v1/trafficAppPpsTrend trafficAppBpsTrend=v1/trafficAppBpsTrend #vpn cgi error info -cgiError=cannot connect to vpnserver,Connection to the server has failed,Specified object can not be found,Too many users,User already exists,Too many created users,The destination server is not a VPN server,The connection has been interrupted, \ No newline at end of file +cgiError=cannot connect to vpnserver,Connection to the server has failed,Specified object can not be found,Too many users,User already exists,Too many created users,The destination server is not a VPN server,The connection has been interrupted, +#\u83b7\u53d6\u670d\u52a1\u914d\u7f6e\u603b\u91cf\u63a5\u53e3 +getConfigByService=v1/getConfigByService \ No newline at end of file diff --git a/src/main/resources/spring-mvc.xml b/src/main/resources/spring-mvc.xml index a094efb76..cae9c675a 100644 --- a/src/main/resources/spring-mvc.xml +++ b/src/main/resources/spring-mvc.xml @@ -109,6 +109,11 @@ + + + + + 管理员用户预警 +INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1252', '2', '0,1,2,', 'admin_user_warn', '管理员用户预警', '5060', '/sys/warn/userWarnList', '', '', '1', 'sys:warnList:view', '1', '2019-03-28 10:06:26', '1', '2019-03-28 11:36:42', '', '1', NULL, '0', '0', NULL); \ No newline at end of file diff --git a/src/main/resources/sql/20190329/create_sys_user_warn.sql b/src/main/resources/sql/20190329/create_sys_user_warn.sql new file mode 100644 index 000000000..a338836ba --- /dev/null +++ b/src/main/resources/sql/20190329/create_sys_user_warn.sql @@ -0,0 +1,9 @@ +CREATE TABLE `sys_user_warn` ( + `service_id` int(11) NOT NULL COMMENT '业务ID', + `service_desc` varchar(255) DEFAULT '' COMMENT '业务描述', + `interface_cfg_total` int(11) DEFAULT NULL COMMENT '界面配置数量', + `system_cfg_total` int(11) DEFAULT NULL COMMENT '服务配置数量', + `time` datetime DEFAULT NULL COMMENT '数据插入时间', + `remark` varchar(255) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`service_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员用户预警表'; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/home.jsp b/src/main/webapp/WEB-INF/views/home.jsp index 85c81911a..8ae35af48 100644 --- a/src/main/webapp/WEB-INF/views/home.jsp +++ b/src/main/webapp/WEB-INF/views/home.jsp @@ -71,9 +71,32 @@ $("#searchText").click(function(){ $(this).val(""); }); - + //定时查询界面配置总量和服务配置总量 是否一致 + t2 = window.setInterval("getServiceSum()",5*60*1000); + //去掉定时器的方法 + //window.clearInterval(t2); + }); - + var t2; + //获取界面总量和服务总量 + function getServiceSum(){ + $.ajax({ + type:'post', + async:false, + cache:false, + url:'${ctx}/sys/warn/serviceSum', + dataType:"json", + success: function(data){ + if(data !=null && (data.interfaceCfgTotal !=data.systemCfgTotal)){ + top.$.jBox.tip("界面配置总量和服务配置总量不一致!"); + } + }, + error: function(){ +     top.$.jBox.tip("界面配置总量和服务配置总量查询失败!"); +         window.clearInterval(t2); + } + }); + } //页面跳转函数 level:级别,1顶级,2有子级。name:菜单名称,有多级#间隔。url:访问路径。object:点击元素对象。 function page_turn(id, functionId,level, name, url,obj){ //$(".page-bar").removeClass("hidden"); diff --git a/src/main/webapp/WEB-INF/views/sys/sysUserWarnList.jsp b/src/main/webapp/WEB-INF/views/sys/sysUserWarnList.jsp new file mode 100644 index 000000000..b94a6b637 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/sys/sysUserWarnList.jsp @@ -0,0 +1,105 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + <spring:message code="admin_user_warn"/> + + + + + +
+ +

+ +

+ +
+
+
+
+ + + + +
+ +
+
+
+ +
+ +
+
+ +
+ + +
+ + +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
${log.serviceId }${log.serviceDesc }${log.interfaceCfgTotal }${log.systemCfgTotal }
+
${page}
+
+
+
+
+
+ + \ No newline at end of file From 85da9461e516fd3a716430ce3d80a46b61dfeb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E5=86=AC=E6=A2=85?= Date: Mon, 1 Apr 2019 10:10:33 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E5=86=B2=E7=AA=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/nis.properties | 92 ++++++++++++++++--------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index f163f5c49..a9a3e6a8e 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -219,14 +219,14 @@ clusterBStartTime=1503504000725 isCommit=true ############################################################################################################################################ ############################################################################################################################################ -httpUrl=http://10.0.7.14:9999/galaxy-service/service/cfg/ +httpUrl=http://192.168.10.192:9999/galaxy-service/service/cfg/ maatCfg=v1/configSources fileUploadCfg=v1/fileUploadSources callbackCfg=v1/commonSources fileDigestCfg=v1/fileDigestSources configIdSources=v1/configPzIdSources #logBaseUrl=http://10.0.6.242:8080/galaxy-service/service/log/v1/ -logBaseUrl=http://10.0.7.14:9999/galaxy-service/service/log/ +logBaseUrl=http://192.168.10.192:9999/galaxy-service/service/log/ ntcPzReport=v1/ntcPzReport ntcServiceReport=v1/ntcServiceReport ntcTagReport=v1/ntcTagReport @@ -270,7 +270,7 @@ mmLogoDetectionLog=v1/mmLogoDetectionLogs mmFaceRecognizationLog=v1/mmFaceRecognizationLogs ######################################## #\u5927\u5c4f\u56fe\u8868\u5c55\u793a\u670d\u52a1\u63a5\u53e3 -dashboardUrl=http://10.0.7.14:9999/galaxy-service/service/log/ +dashboardUrl=http://192.168.10.192:9999/galaxy-service/service/log/ trafficIpActive=v1/trafficIpActive trafficProtocol=v1/trafficProtocol trafficApp=v1/trafficApp @@ -444,43 +444,43 @@ mm_logo_detection_region=MM_LOGO_DETECTION mm_face_recognization_region=MM_FACE_RECOGNIZATION #\u6837\u4f8b\u6587\u4ef6\u751f\u6210\u7a0b\u5e8f -audio_sample_create_proc=/home/ceiec/av_feature_gen/audio_convert_proc -video_sample_create_proc=/home/ceiec/av_feature_gen/extract_frame_feature -picture_sample_create_proc=/home/ceiec/av_feature_gen/picture_convert_proc -speaker_sample_create_proc=java -jar /home/sampleTest.jar -logo_sample_create_proc=/home/ceiec/av_feature_gen/logo_convert_proc -face_sample_create_proc=/home/ceiec/av_feature_gen/face_convert_proc -audio_sample_proc_param_is_quotation=true -video_sample_proc_param_is_quotation=true -picture_sample_proc_param_is_quotation=true -speaker_sample_proc_param_is_quotation=true -logo_sample_proc_param_is_quotation=true -face_sample_proc_param_is_quotation=true -audio_sample_proc_param_is_translation=false -video_sample_proc_param_is_translation=false -picture_sample_proc_param_is_translation=false -speaker_sample_proc_param_is_translation=false -logo_sample_proc_param_is_translation=false -face_sample_proc_param_is_translation=false +#audio_sample_create_proc=/home/ceiec/av_feature_gen/audio_convert_proc +#video_sample_create_proc=/home/ceiec/av_feature_gen/extract_frame_feature +#picture_sample_create_proc=/home/ceiec/av_feature_gen/picture_convert_proc +#speaker_sample_create_proc=java -jar /home/sampleTest.jar +#logo_sample_create_proc=/home/ceiec/av_feature_gen/logo_convert_proc +#face_sample_create_proc=/home/ceiec/av_feature_gen/face_convert_proc +#audio_sample_proc_param_is_quotation=true +#video_sample_proc_param_is_quotation=true +#picture_sample_proc_param_is_quotation=true +#speaker_sample_proc_param_is_quotation=true +#logo_sample_proc_param_is_quotation=true +#face_sample_proc_param_is_quotation=true +#audio_sample_proc_param_is_translation=false +#video_sample_proc_param_is_translation=false +#picture_sample_proc_param_is_translation=false +#speaker_sample_proc_param_is_translation=false +#logo_sample_proc_param_is_translation=false +#face_sample_proc_param_is_translation=false #\u672c\u5730\u6d4b\u8bd5 -#audio_sample_create_proc=java -jar D\:\\sampleTest.jar -#video_sample_create_proc=java -jar D\:\\sampleTest.jar -#picture_sample_create_proc=java -jar D\:\\sampleTest.jar -#speaker_sample_create_proc=java -jar D\:\\sampleTest.jar -#logo_sample_create_proc=java -jar D\:\\sampleTest.jar -#face_sample_create_proc=java -jar D\:\\sampleTest.jar -#audio_sample_proc_param_is_quotation=false -#video_sample_proc_param_is_quotation=false -#picture_sample_proc_param_is_quotation=false -#speaker_sample_proc_param_is_quotation=false -#logo_sample_proc_param_is_quotation=false -#face_sample_proc_param_is_quotation=false -#audio_sample_proc_param_is_translation=true -#video_sample_proc_param_is_translation=true -#picture_sample_proc_param_is_translation=true -#speaker_sample_proc_param_is_translation=true -#logo_sample_proc_param_is_translation=true -#face_sample_proc_param_is_translation=true +audio_sample_create_proc=java -jar E\:\\sampleTest.jar +video_sample_create_proc=java -jar E\:\\sampleTest.jar +picture_sample_create_proc=java -jar E\:\\sampleTest.jar +speaker_sample_create_proc=java -jar E\:\\sampleTest.jar +logo_sample_create_proc=java -jar E\:\\sampleTest.jar +face_sample_create_proc=java -jar E\:\\sampleTest.jar +audio_sample_proc_param_is_quotation=false +video_sample_proc_param_is_quotation=false +picture_sample_proc_param_is_quotation=false +speaker_sample_proc_param_is_quotation=false +logo_sample_proc_param_is_quotation=false +face_sample_proc_param_is_quotation=false +audio_sample_proc_param_is_translation=true +video_sample_proc_param_is_translation=true +picture_sample_proc_param_is_translation=true +speaker_sample_proc_param_is_translation=true +logo_sample_proc_param_is_translation=true +face_sample_proc_param_is_translation=true #http\u81ea\u5b9a\u4e49\u57df\u76f8\u5173\u53c2\u6570 http_header_user_region_key=HTTP_HEADER http_header_dict_module=HTTP_HEADER_DISTRICT @@ -544,7 +544,7 @@ ipv4_ip_subnet_regexp_original=^(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.( #\u57df\u540d\u9a8c\u8bc1\u6b63\u5219 domain_regexp=^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$ #IP\u590d\u7528maat json\u4e2d\u7684ip region\u5355\u6b21send \u6700\u5927\u4e2a\u6570 -maat_json_send_size=20000 +maat_json_send_size=10000 #\u5bfc\u5165\u9a8c\u8bc1\u7684\u7ebf\u7a0b\u6570\u91cf mulity_thread_size=5 ntcRadiusReport=v2/ntcRadiusReport @@ -565,7 +565,7 @@ userPasswordSet=UserPasswordSet userDelete=UserDelete userGet=UserGet userList=UserList -ip_reuse_call_cgi_url=http://10.4.10.32:8090/command +ip_reuse_call_cgi_url=http://192.168.11.137:8090/command ipNumGet=IpNumGet allIpGet=AllIpGet #\u6d41\u91cf\u7edf\u8ba1\u5e26\u5bbd\u8be6\u60c5 @@ -577,7 +577,7 @@ trafficBandwidthTrans=v1/trafficBandwidthTrans trafficProtocolList=v1/trafficProtocolList trafficAppList=v1/trafficAppList ntcActionEntranceReport=v1/ntcActionEntranceReport -redis.host=10.0.4.2:6379 +redis.host=192.168.10.192:6384 redis.expire=1800 redis.timeout=10000 dns_spoofing_ip_desc=Default Spoofing IP @@ -599,14 +599,14 @@ trafficWebsiteListNoTime=v1/trafficWebsiteListNoTime trafficTopicList=v1/trafficTopicList trafficDomainTrans=v1/trafficDomainTrans #maximum number to import -import_limit=10000 +import_limit=20000 trafficPortActiveFiveMinute=v1/trafficPortActiveFiveMinute trendTotalReport=v1/trendTotalReport #\u4e8b\u4ef6\u76d1\u6d4b/\u5c01\u5835 ntcEventsMonitorOrBlock=v1/ntcEventsMonitorOrBlock #\u91cd\u70b9\u4fdd\u969c\u4e8b\u4ef6 ntcEventKeyProtection=v1/ntcEventKeyProtection -dashboardUrlV2=http://10.0.7.14:9999/galaxy-service/service/log/v2/ +dashboardUrlV2=http://192.168.10.192:9999/galaxy-service/service/log/v2/ trafficAreaStat=v1/trafficAreaStat logServiceTopn=v1/logServiceTopn blockAndDropStat=v1/blockAndDropStat @@ -621,4 +621,6 @@ ntcHttpRecordLog=v1/ntcHttpRecordLogs trafficAppPpsTrend=v1/trafficAppPpsTrend trafficAppBpsTrend=v1/trafficAppBpsTrend #vpn cgi error info -cgiError=cannot connect to vpnserver,Connection to the server has failed,Specified object can not be found,Too many users,User already exists,Too many created users,The destination server is not a VPN server,The connection has been interrupted, \ No newline at end of file +cgiError=cannot connect to vpnserver,Connection to the server has failed,Specified object can not be found,Too many users,User already exists,Too many created users,The destination server is not a VPN server,The connection has been interrupted, +#\u83b7\u53d6\u670d\u52a1\u914d\u7f6e\u603b\u91cf\u63a5\u53e3 +getConfigByService=v1/getConfigByService \ No newline at end of file From 6eea9ee15b6eef184f522a5b0dd0580a1c88f892 Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Mon, 1 Apr 2019 10:13:24 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=9D=E6=8A=A4=E5=90=8D=E5=8D=95=E7=AE=A1=E7=90=86=E8=8F=9C?= =?UTF-8?q?=E5=8D=95sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/sql/20190401/add_sys_menu.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/main/resources/sql/20190401/add_sys_menu.sql diff --git a/src/main/resources/sql/20190401/add_sys_menu.sql b/src/main/resources/sql/20190401/add_sys_menu.sql new file mode 100644 index 000000000..0f4ed0e0f --- /dev/null +++ b/src/main/resources/sql/20190401/add_sys_menu.sql @@ -0,0 +1,2 @@ +-- 配置保护名单管理 +INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('109', '0,1,109,', 'protection_list_manage', '内置保护名单管理', '5060', '/basics/innerProtectionList/list', '', 'fa fa-sticky-note-o', '1', 'basic:inner_protection_list:list', '1', '2019-03-25 15:28:34', '1', '2019-03-26 15:04:47', '', '1', NULL, '0', '0', NULL); From b372f4a9d822b332ab5cc9a37e640f623f34a16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E5=86=AC=E6=A2=85?= Date: Mon, 1 Apr 2019 11:44:17 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=8E=89=E7=95=8C=E9=9D=A2=E5=92=8C=E6=9C=8D=E5=8A=A1=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=80=BB=E9=87=8F=E7=BB=9F=E8=AE=A1=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=EF=BC=9B=20=E8=B0=83=E6=95=B4=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E7=9A=84=E6=9C=80=E5=A4=A7=E9=99=90=E5=88=B6=E4=B8=BA?= =?UTF-8?q?2w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/nis.properties | 86 +++++++++++++++---------------- src/main/resources/spring-mvc.xml | 4 +- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index a9a3e6a8e..fecad0e0c 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -219,14 +219,14 @@ clusterBStartTime=1503504000725 isCommit=true ############################################################################################################################################ ############################################################################################################################################ -httpUrl=http://192.168.10.192:9999/galaxy-service/service/cfg/ +httpUrl=http://10.0.7.14:9999/galaxy-service/service/cfg/ maatCfg=v1/configSources fileUploadCfg=v1/fileUploadSources callbackCfg=v1/commonSources fileDigestCfg=v1/fileDigestSources configIdSources=v1/configPzIdSources #logBaseUrl=http://10.0.6.242:8080/galaxy-service/service/log/v1/ -logBaseUrl=http://192.168.10.192:9999/galaxy-service/service/log/ +logBaseUrl=http://10.0.7.14:9999/galaxy-service/service/log/ ntcPzReport=v1/ntcPzReport ntcServiceReport=v1/ntcServiceReport ntcTagReport=v1/ntcTagReport @@ -270,7 +270,7 @@ mmLogoDetectionLog=v1/mmLogoDetectionLogs mmFaceRecognizationLog=v1/mmFaceRecognizationLogs ######################################## #\u5927\u5c4f\u56fe\u8868\u5c55\u793a\u670d\u52a1\u63a5\u53e3 -dashboardUrl=http://192.168.10.192:9999/galaxy-service/service/log/ +dashboardUrl=http://10.0.7.14:9999/galaxy-service/service/log/ trafficIpActive=v1/trafficIpActive trafficProtocol=v1/trafficProtocol trafficApp=v1/trafficApp @@ -444,43 +444,43 @@ mm_logo_detection_region=MM_LOGO_DETECTION mm_face_recognization_region=MM_FACE_RECOGNIZATION #\u6837\u4f8b\u6587\u4ef6\u751f\u6210\u7a0b\u5e8f -#audio_sample_create_proc=/home/ceiec/av_feature_gen/audio_convert_proc -#video_sample_create_proc=/home/ceiec/av_feature_gen/extract_frame_feature -#picture_sample_create_proc=/home/ceiec/av_feature_gen/picture_convert_proc -#speaker_sample_create_proc=java -jar /home/sampleTest.jar -#logo_sample_create_proc=/home/ceiec/av_feature_gen/logo_convert_proc -#face_sample_create_proc=/home/ceiec/av_feature_gen/face_convert_proc -#audio_sample_proc_param_is_quotation=true -#video_sample_proc_param_is_quotation=true -#picture_sample_proc_param_is_quotation=true -#speaker_sample_proc_param_is_quotation=true -#logo_sample_proc_param_is_quotation=true -#face_sample_proc_param_is_quotation=true -#audio_sample_proc_param_is_translation=false -#video_sample_proc_param_is_translation=false -#picture_sample_proc_param_is_translation=false -#speaker_sample_proc_param_is_translation=false -#logo_sample_proc_param_is_translation=false -#face_sample_proc_param_is_translation=false +audio_sample_create_proc=/home/ceiec/av_feature_gen/audio_convert_proc +video_sample_create_proc=/home/ceiec/av_feature_gen/extract_frame_feature +picture_sample_create_proc=/home/ceiec/av_feature_gen/picture_convert_proc +speaker_sample_create_proc=java -jar /home/sampleTest.jar +logo_sample_create_proc=/home/ceiec/av_feature_gen/logo_convert_proc +face_sample_create_proc=/home/ceiec/av_feature_gen/face_convert_proc +audio_sample_proc_param_is_quotation=true +video_sample_proc_param_is_quotation=true +picture_sample_proc_param_is_quotation=true +speaker_sample_proc_param_is_quotation=true +logo_sample_proc_param_is_quotation=true +face_sample_proc_param_is_quotation=true +audio_sample_proc_param_is_translation=false +video_sample_proc_param_is_translation=false +picture_sample_proc_param_is_translation=false +speaker_sample_proc_param_is_translation=false +logo_sample_proc_param_is_translation=false +face_sample_proc_param_is_translation=false #\u672c\u5730\u6d4b\u8bd5 -audio_sample_create_proc=java -jar E\:\\sampleTest.jar -video_sample_create_proc=java -jar E\:\\sampleTest.jar -picture_sample_create_proc=java -jar E\:\\sampleTest.jar -speaker_sample_create_proc=java -jar E\:\\sampleTest.jar -logo_sample_create_proc=java -jar E\:\\sampleTest.jar -face_sample_create_proc=java -jar E\:\\sampleTest.jar -audio_sample_proc_param_is_quotation=false -video_sample_proc_param_is_quotation=false -picture_sample_proc_param_is_quotation=false -speaker_sample_proc_param_is_quotation=false -logo_sample_proc_param_is_quotation=false -face_sample_proc_param_is_quotation=false -audio_sample_proc_param_is_translation=true -video_sample_proc_param_is_translation=true -picture_sample_proc_param_is_translation=true -speaker_sample_proc_param_is_translation=true -logo_sample_proc_param_is_translation=true -face_sample_proc_param_is_translation=true +#audio_sample_create_proc=java -jar D\:\\sampleTest.jar +#video_sample_create_proc=java -jar D\:\\sampleTest.jar +#picture_sample_create_proc=java -jar D\:\\sampleTest.jar +#speaker_sample_create_proc=java -jar D\:\\sampleTest.jar +#logo_sample_create_proc=java -jar D\:\\sampleTest.jar +#face_sample_create_proc=java -jar D\:\\sampleTest.jar +#audio_sample_proc_param_is_quotation=false +#video_sample_proc_param_is_quotation=false +#picture_sample_proc_param_is_quotation=false +#speaker_sample_proc_param_is_quotation=false +#logo_sample_proc_param_is_quotation=false +#face_sample_proc_param_is_quotation=false +#audio_sample_proc_param_is_translation=true +#video_sample_proc_param_is_translation=true +#picture_sample_proc_param_is_translation=true +#speaker_sample_proc_param_is_translation=true +#logo_sample_proc_param_is_translation=true +#face_sample_proc_param_is_translation=true #http\u81ea\u5b9a\u4e49\u57df\u76f8\u5173\u53c2\u6570 http_header_user_region_key=HTTP_HEADER http_header_dict_module=HTTP_HEADER_DISTRICT @@ -544,7 +544,7 @@ ipv4_ip_subnet_regexp_original=^(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.( #\u57df\u540d\u9a8c\u8bc1\u6b63\u5219 domain_regexp=^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$ #IP\u590d\u7528maat json\u4e2d\u7684ip region\u5355\u6b21send \u6700\u5927\u4e2a\u6570 -maat_json_send_size=10000 +maat_json_send_size=20000 #\u5bfc\u5165\u9a8c\u8bc1\u7684\u7ebf\u7a0b\u6570\u91cf mulity_thread_size=5 ntcRadiusReport=v2/ntcRadiusReport @@ -565,7 +565,7 @@ userPasswordSet=UserPasswordSet userDelete=UserDelete userGet=UserGet userList=UserList -ip_reuse_call_cgi_url=http://192.168.11.137:8090/command +ip_reuse_call_cgi_url=http://10.4.10.32:8090/command ipNumGet=IpNumGet allIpGet=AllIpGet #\u6d41\u91cf\u7edf\u8ba1\u5e26\u5bbd\u8be6\u60c5 @@ -577,7 +577,7 @@ trafficBandwidthTrans=v1/trafficBandwidthTrans trafficProtocolList=v1/trafficProtocolList trafficAppList=v1/trafficAppList ntcActionEntranceReport=v1/ntcActionEntranceReport -redis.host=192.168.10.192:6384 +redis.host=10.0.4.2:6379 redis.expire=1800 redis.timeout=10000 dns_spoofing_ip_desc=Default Spoofing IP @@ -606,7 +606,7 @@ trendTotalReport=v1/trendTotalReport ntcEventsMonitorOrBlock=v1/ntcEventsMonitorOrBlock #\u91cd\u70b9\u4fdd\u969c\u4e8b\u4ef6 ntcEventKeyProtection=v1/ntcEventKeyProtection -dashboardUrlV2=http://192.168.10.192:9999/galaxy-service/service/log/v2/ +dashboardUrlV2=http://10.0.7.14:9999/galaxy-service/service/log/v2/ trafficAreaStat=v1/trafficAreaStat logServiceTopn=v1/logServiceTopn blockAndDropStat=v1/blockAndDropStat diff --git a/src/main/resources/spring-mvc.xml b/src/main/resources/spring-mvc.xml index cae9c675a..83926c54b 100644 --- a/src/main/resources/spring-mvc.xml +++ b/src/main/resources/spring-mvc.xml @@ -110,10 +110,10 @@ - + Date: Mon, 1 Apr 2019 11:46:59 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=B4=E9=9A=94=E8=87=B3=E5=B0=91=E4=B8=BA?= =?UTF-8?q?1=E5=88=86=E9=92=9F=E7=9A=84=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jquery-validation/1.11.0/localization/messages_en.js | 3 ++- .../jquery-validation/1.11.0/localization/messages_ru.js | 3 ++- .../jquery-validation/1.11.0/localization/messages_zh.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js index cff038c88..022af28de 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js @@ -90,6 +90,7 @@ log_trend:"Log Trend", info:"Prompt", protect_warn:"Policy with relax precondition may consume too much resources.Use with cautions!", - log_no_data:"This hour no data" + log_no_data:"This hour no data", + expireTip:"Start time and end time interval is at least 1 minute" }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js index 9f7490a33..c02c07f4f 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js @@ -90,6 +90,7 @@ log_trend:"Журнал Тенденция", info:"Инфо", protect_warn:"Policy with relax precondition may consume too much resources.Use with cautions!", - log_no_data:"Нет данных за этот час" + log_no_data:"Нет данных за этот час", + expireTip:"Start time and end time interval is at least 1 minute" }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js index 11cf137d9..59c5a67cc 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js @@ -90,6 +90,7 @@ log_trend:"日志趋势", info:"提示", protect_warn:"该策略执行条件过于宽泛,会消耗较多的计算资源。慎用!", - log_no_data:"本小时无数据" + log_no_data:"本小时无数据", + expireTip:"开始时间结束时间间隔至少为1分钟" }); }(jQuery)); From 04db6bcb47060372f6d8ac0ab5c001673d65d5d7 Mon Sep 17 00:00:00 2001 From: shangguanyanfei Date: Mon, 1 Apr 2019 16:32:56 +0800 Subject: [PATCH 16/17] =?UTF-8?q?1.=E5=85=AC=E5=85=B1=E7=9A=84Scheduler?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=BC=80=E5=A7=8B=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=92=8C=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E4=B9=8B?= =?UTF-8?q?=E5=B7=AE=E4=B8=8D=E8=83=BD=E5=B0=8F=E4=BA=8E1=E5=88=86?= =?UTF-8?q?=E9=92=9F=E7=9A=84=E6=A0=A1=E9=AA=8C=202.=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E7=9A=84Scheduler=E7=95=8C=E9=9D=A2=E5=8D=95=E6=AC=A1=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E4=B8=AD=E7=9A=84=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E4=B8=8D=E8=83=BD=E5=B0=8F=E4=BA=8E=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=97=B6=E9=97=B4=E5=8A=A0=E4=B8=8A2=E5=88=86?= =?UTF-8?q?=E9=92=9F=E7=9A=84=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/include/form/scheduleNew.jsp | 96 +++++++++++++++++-- .../1.11.0/localization/messages_en.js | 3 +- .../1.11.0/localization/messages_ru.js | 3 +- .../1.11.0/localization/messages_zh.js | 3 +- 4 files changed, 93 insertions(+), 12 deletions(-) diff --git a/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp b/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp index fb2909188..42820a24b 100644 --- a/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp +++ b/src/main/webapp/WEB-INF/include/form/scheduleNew.jsp @@ -16,8 +16,36 @@ $(function(){ //获取国际化文件 var title=$.validator.messages.compareDate; + var diff=$.validator.messages.expireTip; + var tip=$.validator.messages.compareTip; var date="2019-03-25 "; - //day 时间验证 + //one 开始时间不能小于当前时间加上2分钟 验证 + jQuery.validator.addMethod("oneStartDate",function(value,element){ + var flagTypeSame=true; + var singleValid = $("#singleValid").val(); + if(singleValid !=null && singleValid !=""){ + var date =new Date(); + var min=date.getMinutes(); + date.setMinutes(min+2); + if(date <= (new Date(singleValid.replace(/-/g,"\/")))){ + flagTypeSame=true; + }else{ + flagTypeSame=false; + } + } + return flagTypeSame; + },tip); + //one 结束时间不能小于开始时间验证 + jQuery.validator.addMethod("oneDate",function(value,element){ + var flagTypeSame=true; + var singleValid = $("#singleValid").val(); + var singleInvalid = $("#singleInvalid").val(); + if(singleValid !=null && singleValid !="" && singleInvalid !=null && singleInvalid !=""){ + flagTypeSame=CompareDate(singleValid,singleInvalid); + } + return flagTypeSame; + },title); + //day 结束时间不能小于开始时间验证 jQuery.validator.addMethod("dayDate",function(value,element){ var flagTypeSame=true; var dayValid = $("#dayValid").val(); @@ -27,7 +55,7 @@ } return flagTypeSame; },title); - //week 时间验证 + //week 结束时间不能小于开始时间验证 jQuery.validator.addMethod("weekDate",function(value,element){ var flagTypeSame=true; var weekValid = $("#weekValid").val(); @@ -37,7 +65,7 @@ } return flagTypeSame; },title); - //month 时间验证 + //month 结束时间不能小于开始时间验证 jQuery.validator.addMethod("monthDate",function(value,element){ var flagTypeSame=true; var monthValid = $("#monthValid").val(); @@ -47,11 +75,61 @@ } return flagTypeSame; },title); - + //一次 验证时间差 + jQuery.validator.addMethod("oneDiffDate",function(value,element){ + var flagTypeSame=true; + var singleValid = $("#singleValid").val(); + var singleInvalid = $("#singleInvalid").val(); + if(singleValid !=null && singleValid !="" && singleInvalid !=null && singleInvalid !=""){ + flagTypeSame=timeToDiffer(singleValid,singleInvalid); + } + return flagTypeSame; + },diff); + //day 验证时间差 + jQuery.validator.addMethod("dayDiffDate",function(value,element){ + var flagTypeSame=true; + var dayValid = $("#dayValid").val(); + var dayInvalid = $("#dayInvalid").val(); + if(dayValid !=null && dayValid !="" && dayInvalid !=null && dayInvalid !=""){ + flagTypeSame=timeToDiffer(date+dayValid,date+dayInvalid); + } + return flagTypeSame; + },diff); + //week 验证时间差 + jQuery.validator.addMethod("weekDiffDate",function(value,element){ + var flagTypeSame=true; + var weekValid = $("#weekValid").val(); + var weekInvalid = $("#weekInvalid").val(); + if(weekValid !=null && weekValid !="" && weekInvalid !=null && weekInvalid !=""){ + flagTypeSame=timeToDiffer(date+weekValid,date+weekInvalid); + } + return flagTypeSame; + },diff); + //month 验证时间差 + jQuery.validator.addMethod("monthDiffDate",function(value,element){ + var flagTypeSame=true; + var monthValid = $("#monthValid").val(); + var monthInvalid = $("#monthInvalid").val(); + if(monthValid !=null && monthValid !="" && monthInvalid !=null && monthInvalid !=""){ + flagTypeSame=timeToDiffer(date+monthValid,date+monthInvalid); + } + return flagTypeSame; + },diff); //比较两个时间的大小 function CompareDate(d1,d2){ return ((new Date(d1.replace(/-/g,"\/"))) <= (new Date(d2.replace(/-/g,"\/")))); } + //计算两个时间的差 是否大于1分钟 + function timeToDiffer(d1,d2){ + var dateBegin = new Date(d1.replace(/-/g,"\/"));//将-转化为/,使用new Date + var dateEnd = new Date(d2.replace(/-/g,"\/")) + var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数 + if(dateDiff<(60*1000)){ + return false; + }else{ + return true; + } + } //day week 切换 function initDayWeek(){ var dayWeekCheck = $("input.dayWeek:checked"); @@ -183,14 +261,14 @@
- +
- +
@@ -216,7 +294,7 @@
- +
@@ -256,7 +334,7 @@
- +
@@ -361,7 +439,7 @@
- +
diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js index 022af28de..10a80a420 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js @@ -91,6 +91,7 @@ info:"Prompt", protect_warn:"Policy with relax precondition may consume too much resources.Use with cautions!", log_no_data:"This hour no data", - expireTip:"Start time and end time interval is at least 1 minute" + expireTip:"Start time and end time interval is at least 1 minute", + compareTip:"Start time should not be less than the current time plus 2 minutes." }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js index c02c07f4f..84615a9af 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js @@ -91,6 +91,7 @@ info:"Инфо", protect_warn:"Policy with relax precondition may consume too much resources.Use with cautions!", log_no_data:"Нет данных за этот час", - expireTip:"Start time and end time interval is at least 1 minute" + expireTip:"Start time and end time interval is at least 1 minute", + compareTip:"Start time should not be less than the current time plus 2 minutes." }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js index 59c5a67cc..981daba6e 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js @@ -91,6 +91,7 @@ info:"提示", protect_warn:"该策略执行条件过于宽泛,会消耗较多的计算资源。慎用!", log_no_data:"本小时无数据", - expireTip:"开始时间结束时间间隔至少为1分钟" + expireTip:"开始时间结束时间间隔至少为1分钟", + compareTip:"开始时间不能小于当前时间加上2分钟 " }); }(jQuery)); From f6405c6f042e7f18466b2ced952def962272f495 Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Tue, 2 Apr 2019 11:50:12 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=9D=E6=8A=A4?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E5=8A=9F=E8=83=BD=E6=94=B9=E4=B8=BA=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/template/P2pIpTemplate.java | 2 +- .../basics/InnerProtectionListService.java | 4 +- .../webapp/static/global/scripts/common.js | 54 ++++++++++++------- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/nis/domain/configuration/template/P2pIpTemplate.java b/src/main/java/com/nis/domain/configuration/template/P2pIpTemplate.java index ae2223d4c..74de95655 100644 --- a/src/main/java/com/nis/domain/configuration/template/P2pIpTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/P2pIpTemplate.java @@ -10,7 +10,7 @@ public class P2pIpTemplate extends IpAllTemplate { private String userRegion2; - @ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=2) + @ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=5) public String getUserRegion2() { return userRegion2; } diff --git a/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java b/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java index 1c8ef0a96..611144f2e 100644 --- a/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java +++ b/src/main/java/com/nis/web/service/basics/InnerProtectionListService.java @@ -96,7 +96,9 @@ public class InnerProtectionListService extends BaseService{ if(dictMap.containsKey(info.getTargetType())) { putList = dictMap.get(info.getTargetType()); } - putList.add(info.getKeyword()); + if(!putList.contains(info.getKeyword())) { + putList.add(info.getKeyword()); + } dictMap.put(info.getTargetType(), putList); } CacheUtils.put(Constants.CACHE_PROTECTION_LIST_DICT, dictMap); diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index 74ebd6c64..cbf14de7a 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -34,7 +34,6 @@ $(function(){ type:'get', url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo', dataType:"json", - async:false, success:function(data){ if(data != null){ protectionData = data; @@ -42,18 +41,15 @@ $(function(){ var list = data[key]; $("."+key).each(function(){ if(!$(this).hasClass("tags")){ - this.setAttribute("onblur","protectedListWarn(this,'"+list+"')"); + this.setAttribute("onblur","protectedListWarn(this,'"+key+"')"); } - protectedListWarn(this,list); + protectedListWarn(this,key); }); - } - } - } }); - + //增加描述新增时的文字长度限制 $("form input[name='cfgDesc']").attr("maxlength","128"); $("form input[name='cfgDesc']").addClass("required"); @@ -459,7 +455,7 @@ $(function(){ var tagObj = $(this); for(var key in protectionData){ if(tagObj.hasClass(key)){ - protectedListWarn(tagObj,protectionData[key]); + protectedListWarn(tagObj,key); } } }, @@ -476,7 +472,7 @@ $(function(){ var tagObj = $(this); for(var key in protectionData){ if(tagObj.hasClass(key)){ - protectedListWarn(tagObj,protectionData[key]); + protectedListWarn(tagObj,key); } } } @@ -1746,15 +1742,35 @@ function addPrintTableCss(rowValue,cellValue,tableIdValue,cssName){ } } /**保护名单提醒**/ -function protectedListWarn(obj,protectedList){ - $(obj).next(".fa-warning").remove(); - var value = $(obj).val(); - if(value != ""){ - protectedList = typeof(protectedList) == 'string' ? protectedList.split(",") : protectedList; - if(protectedList.indexOf(value) >= 0){ - //$(obj).after(""+$.validator.messages.protect_warn+""); - $.jBox.info($.validator.messages.protect_warn,$.validator.messages.info); - $('.jbox-body .jbox-icon').css('top','55px'); +function protectedListWarn(obj,tagKey){ + var pathName = window.document.location.pathname.substring(0,window.document.location.pathname.lastIndexOf("/nis")+4); + $.ajax({ + type:'get', + url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo', + dataType:"json", + success:function(data){ + if(data != null){ + for(var key in data){ + var list = data[key]; + $("."+key).each(function(){ + if(!$(this).hasClass("tags")){ + this.setAttribute("onblur","protectedListWarn(this,'"+key+"')"); + } + }); + } + + $(obj).next(".fa-warning").remove(); + var value = $(obj).val(); + var protectedList = data[tagKey]; + if(value != "" && typeof(protectedList) != "undefined"){ + if(protectedList.indexOf(value) >= 0){ // 关键字匹配则弹出提示框 + $.jBox.info($.validator.messages.protect_warn,$.validator.messages.info); + $('.jbox-body .jbox-icon').css('top','55px'); + } + } + + } } - } + }); + }