diff --git a/src/main/java/com/nis/util/excel/ExportExcel.java b/src/main/java/com/nis/util/excel/ExportExcel.java index ad4edaaff..f1925e545 100644 --- a/src/main/java/com/nis/util/excel/ExportExcel.java +++ b/src/main/java/com/nis/util/excel/ExportExcel.java @@ -1038,7 +1038,12 @@ public class ExportExcel { } // APP Payload if(region.getFunctionId().equals(563)) { - commentStr=commentStr+"▶"+"L3_header:"+msgProp.getProperty("need_input")+"'headerType'"+"\n"; + commentStr=commentStr+"▶"+"L3_header:"+msgProp.getProperty("need_input")+"'headerType', "+ + msgProp.getProperty("no_need_input")+"'"+ + msgProp.getProperty("key_word")+"'、'"+ + msgProp.getProperty("match_method")+"'、'"+ + msgProp.getProperty("is_hex")+"'、'"+ + msgProp.getProperty("is_case_insenstive")+"'"+"\n"; index++; } } @@ -2611,5 +2616,60 @@ public class ExportExcel { log.debug("Export success."); */ } + + + public ExportExcel ajaxDataList(List>dataMap,String code){ + for (int i = 0; i < dataMap.size(); i++) { + Row row = this.addRow(sheets.get(code),rownums.get(code),code); + int colunm = 0; + List list=dataMap.get(i); + for (int j = 0; j < list.size(); j++) { + this.addCell(row, colunm++,list.get(j), 0,null); + } + } + return this; + } + + + public ExportExcel(String titleName,String code,String titleTime,List headerList){ + this.wb = new SXSSFWorkbook(500); + int j=0; + sheets=new HashMap<>(); + rownums=new HashMap<>(); + Sheet sheet = wb.createSheet(titleName); + if(!StringUtils.isEmpty(titleTime)){ + rownums.put(code, 1); + }else{ + rownums.put(code, 0); + } + sheets.put(code, sheet); + this.styles = createStyles(wb); + if(!StringUtils.isEmpty(titleTime)){ + //添加一行数据 + CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,headerList.size()-1); + CellStyle style = styles.get("data"); + Row timeRow = sheet.createRow(0); + timeRow.setHeightInPoints(16); + Cell cellt = timeRow.createCell(0); + cellt.setCellValue(titleTime); + sheet.addMergedRegion(callRangeAddress); + sheet.autoSizeColumn(0); + setBorderStyle(CellStyle.BORDER_THIN,callRangeAddress,sheet,wb); + } + Integer rownum=rownums.get(code); + Row headerRow = sheet.createRow(rownum++); + headerRow.setHeightInPoints(16); + for (int i = 0; i < headerList.size(); i++) { + Cell cell = headerRow.createCell(i); + cell.setCellStyle(styles.get("header")); + cell.setCellValue(headerList.get(i)); + sheet.autoSizeColumn(i); + } + for (int i = 0; i < headerList.size(); i++) { + int colWidth = sheet.getColumnWidth(i)*2; + sheet.setColumnWidth(i, colWidth < 3000 ? 3000 : colWidth); + } + j++; + } } diff --git a/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java index 106d24e7e..8d5080f0e 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckAppFeatureComplexStringFormatThread.java @@ -92,21 +92,63 @@ public class CheckAppFeatureComplexStringFormatThread implements Callable 128) { errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";"); } - if(baseStringCfg.getCfgKeywords().length() < 4 || baseStringCfg.getCfgKeywords().length() > 1024){ - errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";"); - } if (regionDict.getRegionType().equals(3)) { String keyword = baseStringCfg.getCfgKeywords(); String district = baseStringCfg.getDistrict(); - if (StringUtils.isBlank(keyword)) { - errInfo.append( - String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";"); + if(!district.equals("L3_header")) {// district="L3_header"时 不校验keyword + + if (StringUtils.isBlank(keyword)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";"); + }else if(keyword.length() < 4 || keyword.length() > 1024){// 关键字长度限制 + errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";"); + } + + if (mulityKeywordsP.equals("0")) { + if (keyword.indexOf("\n") > -1) { + errInfo.append( + String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";"); + } + Matcher m = pattern.matcher(keyword); + if (m.find()) { + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + keyword + "'") + ";"); + } + } else { + boolean has = false; + Set keywordSet=Sets.newHashSet(); + + for (String key : keyword.split("\n")) { + Matcher m = pattern.matcher(key); + if (m.find()) { + has = true; + errInfo.append(String.format(prop.getProperty("has_invisible_char"), + prop.getProperty("key_word") + " '" + key + "'") + ";"); + break; + } + if(!keywordSet.contains(key)) { + keywordSet.add(key); + }else { + errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";"); + } + } + if (!has) { + if(keyword.replaceAll("\n","").length()>1024) { + errInfo.append(String.format(prop.getProperty("most_keywords"), + prop.getProperty("key_word")) + ";"); + }else { + String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR); + baseStringCfg.setCfgKeywords(reWord); + } + } + } } + if (StringUtils.isNotBlank(dirtrictP)) { if (StringUtils.isBlank(district)) { if (dirtrictP.indexOf(",") == -1) { @@ -127,185 +169,149 @@ public class CheckAppFeatureComplexStringFormatThread implements Callable -1) { - errInfo.append( - String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";"); - } - Matcher m = pattern.matcher(keyword); - if (m.find()) { - errInfo.append(String.format(prop.getProperty("has_invisible_char"), - prop.getProperty("key_word") + " '" + keyword + "'") + ";"); - } - } else { - boolean has = false; - Set keywordSet=Sets.newHashSet(); - - for (String key : keyword.split("\n")) { - Matcher m = pattern.matcher(key); - if (m.find()) { - has = true; - errInfo.append(String.format(prop.getProperty("has_invisible_char"), - prop.getProperty("key_word") + " '" + key + "'") + ";"); - break; - } - if(!keywordSet.contains(key)) { - keywordSet.add(key); - }else { - errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";"); - } - } - if (!has) { - if(keyword.replaceAll("\n","").length()>1024) { - errInfo.append(String.format(prop.getProperty("most_keywords"), - prop.getProperty("key_word")) + ";"); - }else { - String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR); - baseStringCfg.setCfgKeywords(reWord); - } - } - } - Integer exprType = baseStringCfg.getExprType(); - boolean has = false; - if (exprType == null) { - if (exprTypeP.indexOf(",") == -1) { - if (mulityKeywordsP.equals("0") && exprTypeP.equals("1")) { - throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); - } - baseStringCfg.setExprType(Integer.parseInt(exprTypeP)); - } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("0")) { - baseStringCfg.setExprType(0); - } else if (exprTypeP.indexOf("1") > -1 && mulityKeywordsP.equals("1") - && keyword.indexOf("\n") > -1) { - baseStringCfg.setExprType(1); - } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("1") - && keyword.indexOf("\n") == -1) { - baseStringCfg.setExprType(0); - } else { - baseStringCfg.setExprType(Integer.parseInt(exprTypeP.split(",")[0])); - } - // errInfo.append(String.format(prop.getProperty("can_not_null"), - // prop.getProperty("expression_type"))+";"); - } else { - for (String exp : exprTypeP.split(",")) { - if (exp.equals(exprType.toString())) { - has = true; - break; - } - } - if (!has) { - errInfo.append( - String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type")) - + ";"); - } - has = false; - } - exprType = baseStringCfg.getExprType(); - Integer matchMethod = baseStringCfg.getMatchMethod(); - if (matchMethod == null) { - if (matchMethodP.indexOf(",") == -1) { - if (exprTypeP.equals("1") && !matchMethodP.equals("0")) { - throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); - } - baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP)); - } else if (exprType != null && exprType.intValue() == 1) { - if (matchMethodP.indexOf("0") > -1) { - baseStringCfg.setMatchMethod(0); - } else { - throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); - } - - } else { - baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP.split(",")[0])); - } - // errInfo.append(String.format(prop.getProperty("can_not_null"), - // prop.getProperty("match_method"))+";"); - } else { - for (String exp : matchMethodP.split(",")) { - if (exp.equals(matchMethod.toString())) { - has = true; - break; - } - } - if (!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method")) - + ";"); - } - } - Integer isHex = baseStringCfg.getIsHex(); - Integer isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); - if (isHex == null || isCaseInsenstive == null) { - if (isHex == null) { - if (hexP.indexOf("0")>-1 || hexP.indexOf("2")>-1) { - baseStringCfg.setIsHex(0); - } else if (hexP.indexOf("1")>-1) { - baseStringCfg.setIsHex(1); - } else { - errInfo.append( - String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex")) + ";"); - } - } - if (isCaseInsenstive == null) { - if (hexP.indexOf("0")>-1 || hexP.indexOf("1")>-1) { - baseStringCfg.setIsCaseInsenstive(0); - } else if (hexP.indexOf("2")>-1) { - baseStringCfg.setIsCaseInsenstive(1); - } else { - errInfo.append(String.format(prop.getProperty("can_not_null"), - prop.getProperty("is_case_insenstive")) + ";"); - } - } - } else { - if (isHex.intValue() != 0 && isHex.intValue() != 1) { - errInfo.append( - String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); - } - 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 != null && isCaseInsenstive != null) { - if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { - baseStringCfg.setIsHexbin(0); - } else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 0) { - baseStringCfg.setIsHexbin(1); - } else if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 1) { - baseStringCfg.setIsHexbin(2); - } else if (hexP.indexOf("1") != -1 && isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) {// 只有是十六进制且取值正确的时候, 才进行(十六进制)与(大小写敏感)的校验 - errInfo.append(prop.getProperty("hex_case_insensitive")+ ";"); - } - } + if(!district.equals("L3_header")) {// district="L3_header"时 不校验exprType、matchMethod、isHex、isCaseInsenstive,为固定值 + Integer exprType = baseStringCfg.getExprType(); + boolean has = false; + if (exprType == null) { + if (exprTypeP.indexOf(",") == -1) { + if (mulityKeywordsP.equals("0") && exprTypeP.equals("1")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); + } + baseStringCfg.setExprType(Integer.parseInt(exprTypeP)); + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("0")) { + baseStringCfg.setExprType(0); + } else if (exprTypeP.indexOf("1") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") > -1) { + baseStringCfg.setExprType(1); + } else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("1") + && keyword.indexOf("\n") == -1) { + baseStringCfg.setExprType(0); + } else { + baseStringCfg.setExprType(Integer.parseInt(exprTypeP.split(",")[0])); + } + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("expression_type"))+";"); + } else { + for (String exp : exprTypeP.split(",")) { + if (exp.equals(exprType.toString())) { + has = true; + break; + } + } + if (!has) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type")) + + ";"); + } + has = false; + } + exprType = baseStringCfg.getExprType(); + Integer matchMethod = baseStringCfg.getMatchMethod(); + if (matchMethod == null) { + if (matchMethodP.indexOf(",") == -1) { + if (exprTypeP.equals("1") && !matchMethodP.equals("0")) { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); + } + baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP)); + } else if (exprType != null && exprType.intValue() == 1) { + if (matchMethodP.indexOf("0") > -1) { + baseStringCfg.setMatchMethod(0); + } else { + throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId()); + } + + } else { + baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP.split(",")[0])); + } + // errInfo.append(String.format(prop.getProperty("can_not_null"), + // prop.getProperty("match_method"))+";"); + } else { + for (String exp : matchMethodP.split(",")) { + if (exp.equals(matchMethod.toString())) { + has = true; + break; + } + } + if (!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method")) + + ";"); + } + } + Integer isHex = baseStringCfg.getIsHex(); + Integer isCaseInsenstive = baseStringCfg.getIsCaseInsenstive(); + if (isHex == null || isCaseInsenstive == null) { + if (isHex == null) { + if (hexP.indexOf("0")>-1 || hexP.indexOf("2")>-1) { + baseStringCfg.setIsHex(0); + } else if (hexP.indexOf("1")>-1) { + baseStringCfg.setIsHex(1); + } else { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex")) + ";"); + } + } + if (isCaseInsenstive == null) { + if (hexP.indexOf("0")>-1 || hexP.indexOf("1")>-1) { + baseStringCfg.setIsCaseInsenstive(0); + } else if (hexP.indexOf("2")>-1) { + baseStringCfg.setIsCaseInsenstive(1); + } else { + errInfo.append(String.format(prop.getProperty("can_not_null"), + prop.getProperty("is_case_insenstive")) + ";"); + } + } + } else { + if (isHex.intValue() != 0 && isHex.intValue() != 1) { + errInfo.append( + String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex")) + ";"); + } + 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 != null && isCaseInsenstive != null) { + if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) { + baseStringCfg.setIsHexbin(0); + } else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 0) { + baseStringCfg.setIsHexbin(1); + } else if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 1) { + baseStringCfg.setIsHexbin(2); + } else if (hexP.indexOf("1") != -1 && isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) {// 只有是十六进制且取值正确的时候, 才进行(十六进制)与(大小写敏感)的校验 + errInfo.append(prop.getProperty("hex_case_insensitive")+ ";"); + } + } + } // APP Payload L3_HEADER的特殊属性限制 if(baseStringCfg.getDistrict().equals("L3_header")) { String headerType = baseStringCfg.getHeaderType(); @@ -318,7 +324,13 @@ public class CheckAppFeatureComplexStringFormatThread implements Callable map=JSONObject.fromObject(jsonObject); + List> list=(List>) map.get("book"); + List heard=(List) map.get("heard"); + String titleTime=String.valueOf(map.get("titleTime")); + String titleCode=String.valueOf(map.get("titleCode")); + _ajaxExport(request,response,titleCode, titleTime, heard, list); + } + +} + diff --git a/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java b/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java index 52b9c744a..f34f8a9d8 100644 --- a/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java @@ -581,7 +581,7 @@ public class AppMultiFeatureCfgService extends BaseService { count++; } - if((count >0 || count <5) && (!errorFlag) && (ipHeaderFlag)) {// 清空错误信息 + if((0 <%@ include file="/WEB-INF/include/taglib.jsp"%> - +<%-- --%> - - +<%-- --%> <%-- --%> @@ -91,6 +95,8 @@ function searchList(){ loading(); var start=$("#beginDate").val(); var end=$("#endDate").val(); + $("#beginDateh").val(start); + $("#endDateh").val(end); if(start==''||end==''||end==null||start==null){ window.location.reload(); }else{ @@ -100,9 +106,10 @@ function searchList(){ // 局点信息 function showActionTransChart(xData,series){ var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart('chart', { chart:{ -// type: 'area', + type: 'area', zoomType: 'x' }, exporting: { @@ -133,15 +140,23 @@ function showActionTransChart(xData,series){ text: null }, xAxis: { - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', }, labels: { rotation: -45, //倾斜的角度 - }, + } }, yAxis: { title: { @@ -149,6 +164,18 @@ function showActionTransChart(xData,series){ }, min:0 }, + tooltip: { + dateTimeLabelFormats: { + millisecond: '%Y-%m-%d %H:%M:%S', + second: '%Y-%m-%d %H:%M:%S', + minute: '%Y-%m-%d %H:%M:%S', + hour: '%Y-%m-%d %H:%M:%S', + day: '%Y-%m-%d %H:%M:%S', + week: '%Y-%m-%d %H:%M:%S', + month: '%Y-%m-%d %H:%M:%S', + year: '%Y-%m-%d %H:%M:%S' + } + }, credits:{//是否有highcharts水印 enabled:false }, @@ -185,10 +212,9 @@ function showActionTransChart(xData,series){ var series=new Array(); var total=[]; if(rs!=null&&rs.length>0){ - xData=rs[0].statTime; $(rs).each(function(i, d) { total.push( - sum(d.count) + d.sum ) var entrance=""; if(d!=null&&d.entranceId==1){ @@ -199,7 +225,10 @@ function showActionTransChart(xData,series){ } series.push({ name: entrance, - data: d.count + data: d.result, + marker: { + enabled: false + } }); }) }else{ @@ -226,15 +255,38 @@ function showActionTransChart(xData,series){ (function(H) { var nowDate=new Date(); H.Chart.prototype.downloadXLS = function() { - var start=$("#beginDate").val(); - var end=$("#endDate").val(); + var start=$("#beginDateh").val(); + var end=$("#endDateh").val(); var div = document.createElement('div'), xlsxRows = [], xlsxColumns = []; div.style.display = 'none'; document.body.appendChild(div); rows = this.getDataRows(true); - xlsxRows = H.map(rows.slice(1), function(row) { + /* 调用后台接口导出 */ + var total = JSON.parse($("#total").val()); + var map={}; + $(rows).each(function(i,d){ + // 去掉多余属性 + delete d.name; + delete d.x; + delete d.xValues; + }) + total.unshift(''); + rows.shift(); // 删除一个重复行 + var heard = rows.shift(); // 删除一个重复行 + rows.push(total) + var title=[]; + title.push('',start+"--"+end); + map["titleTime"]=title; + map["heard"]=heard; + map["book"]=rows; + map["titleCode"]=''+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(); + var exports = JSON.stringify(map); + aJaxImportPost("${ctx}/export/ajaxExport",{"exports":exports}); + + + /* xlsxRows = H.map(rows.slice(1), function(row) { return H.map(row, function(column) { return { type: typeof column === 'number' ? 'number' : 'string', @@ -281,7 +333,7 @@ function showActionTransChart(xData,series){ sheet: { data: xlsxRows } - }); + }); */ }; }(Highcharts)); (function(H) { @@ -301,11 +353,11 @@ function showActionTransChart(xData,series){ } }) data.push({ - num1:"", + num1:"", num2:total }) - var start = $("#beginDate").val(); - var end = $("#endDate").val(); + var start = $("#beginDateh").val(); + var end = $("#endDateh").val(); exportCsv({ title:["",start+"--"+end], titleForKey:["num1","num2","num3"], diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp index 2e4a1b06e..889254622 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp @@ -42,8 +42,12 @@
- + <%-- --%> +
@@ -52,7 +56,7 @@
+ value="" onclick="WdatePicker({el:'endDate',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:getMaxDate(7) })"/>
@@ -115,7 +119,7 @@
- +<%-- --%> @@ -445,7 +449,17 @@ function protocolTypeChart(rs){ }, tooltip: { headerFormat: '{series.name}
', - pointFormat: '{point.name}: {point.percentage:.2f}%' + pointFormat: '{point.name}: {point.percentage:.2f}%', + dateTimeLabelFormats: { + millisecond: '%Y-%m-%d %H:%M:%S', + second: '%Y-%m-%d %H:%M:%S', + minute: '%Y-%m-%d %H:%M:%S', + hour: '%Y-%m-%d %H:%M:%S', + day: '%Y-%m-%d %H:%M:%S', + week: '%Y-%m-%d %H:%M:%S', + month: '%Y-%m-%d %H:%M:%S', + year: '%Y-%m-%d %H:%M:%S' + } }, series: [{ name: "App", diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp index f7930e7eb..5d514dfe5 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficBandwidthList.jsp @@ -32,8 +32,10 @@
- + +
@@ -41,15 +43,17 @@
- + +
-
+ @@ -122,6 +126,8 @@ function searchList(){ loading(); var start=$("#beginDate").val(); var end=$("#endDate").val(); + $("#beginDateh").val(start); + $("#endDateh").val(end); if(start==''||end==''||end==null||start==null){ window.location.reload(); }else{ @@ -383,20 +389,51 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){ }, */ series:ydata }); - } (function(H) { H.Chart.prototype.downloadXLS = function() { var nowDate=new Date(); - var start=$("#beginDate").val(); - var end=$("#endDate").val(); + var start=$("#beginDateh").val(); + var end=$("#endDateh").val(); var div = document.createElement('div'), xlsxRows = [], xlsxColumns = []; div.style.display = 'none'; document.body.appendChild(div); rows = this.getDataRows(true); - xlsxRows = H.map(rows.slice(1), function(row) { + /* 调用后台接口导出 */ + var total = []; + var map={}; + $(rows).each(function(i,d){ + if(d!=null){ + if(i==0){ + if(d[0].indexOf("Astana") != -1){ + total=JSON.parse($("#total").val()); + } + if(d[0].indexOf("Alamty") != -1){ + total=JSON.parse($("#total2").val()); + } + } + } + // 去掉多余属性 + delete d.name; + delete d.x; + delete d.xValues; + }) + total.unshift(''); + rows.shift(); // 删除一个重复行 + var heard = rows.shift(); // 删除一个重复行 + rows.push(total) + var title=[]; + title.push('',start+"--"+end); + map["titleTime"]=title; + map["heard"]=heard; + map["book"]=rows; + map["titleCode"]=''+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(); + var exports = JSON.stringify(map); + aJaxImportPost("${ctx}/export/ajaxExport",{"exports":exports}); + + /* xlsxRows = H.map(rows.slice(1), function(row) { return H.map(row, function(column) { return { type: typeof column === 'number' ? 'number' : 'string', @@ -433,26 +470,23 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){ b.push({ type:"string", value:start+'--'+end - }) - xlsxRows.unshift(b) - - - - zipcelx({ + }); */ +// xlsxRows.unshift(b) + /* zipcelx({ filename: ''+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(), sheet: { data: xlsxRows } - }); + }); */ }; }(Highcharts)); - function setTime(){ + /* function setTime(){ var chooseDate=new Date($('#beginDate').val()); chooseDate=chooseDate.setDate(chooseDate.getDate()+1); var modifyTime=new Date(chooseDate); $('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); - } + } */ (function(H) { H.Chart.prototype.downloadCSV = function() { var rows = this.getDataRows(true); @@ -475,13 +509,12 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){ } } }) - console.log(total) data.push({ - num1:"", + num1:"", num2:total }) - var start = $("#beginDate").val(); - var end = $("#endDate").val(); + var start = $("#beginDateh").val(); + var end = $("#endDateh").val(); exportCsv({ title:["",start+"--"+end], titleForKey:["num1","num2","num3"], diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp index 900278a3a..a114bfc78 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficDomainTrans.jsp @@ -65,15 +65,20 @@ $(document).ready(function(){ var xData=new Array(); var series=new Array(); var total = 0; + console.log(rs) if(rs!=null&&rs.length>0){ - xData=rs[0].statTime; + /* xData=rs[0].statTime; $(rs[0].count).each(function(i,d) { total+=d - }) + })*/ + total=rs[0].sum; series.push({ name: 'unique', - data: rs[0].count - }); + data: rs[0].result, + marker: { + enabled: false + } + }); }else{ series.push({ name: 'unique', @@ -98,7 +103,7 @@ function showDomainTrans(xData,series){ var domainName= $("#domainName").val(); var chart = Highcharts.chart('chart', { chart:{ -// type: 'area', + type: 'area', zoomType: 'x' }, exporting: { @@ -129,8 +134,16 @@ function showDomainTrans(xData,series){ text: domainName }, xAxis: { - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', @@ -148,6 +161,18 @@ function showDomainTrans(xData,series){ legend: { enabled:false }, + tooltip: { + dateTimeLabelFormats: { + millisecond: '%Y-%m-%d %H:%M:%S', + second: '%Y-%m-%d %H:%M:%S', + minute: '%Y-%m-%d %H:%M:%S', + hour: '%Y-%m-%d %H:%M:%S', + day: '%Y-%m-%d %H:%M:%S', + week: '%Y-%m-%d %H:%M:%S', + month: '%Y-%m-%d %H:%M:%S', + year: '%Y-%m-%d %H:%M:%S' + } + }, plotOptions: { series: { lineWidth:1, diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp index 40e87c59e..988fbbea9 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp @@ -32,8 +32,10 @@
- +
@@ -42,7 +44,7 @@
+ value="" onclick="WdatePicker({el:'endDate',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:getMaxDate(7) })"/> @@ -92,7 +94,7 @@ - +<%-- --%> - +<%-- --%> <%-- --%> @@ -179,9 +187,10 @@ function searchList(){ function showIpActiveChart(xData,series){ var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart('chart', { chart:{ - //type: 'area', + type: 'area', zoomType: 'x' }, exporting: { @@ -206,12 +215,20 @@ function showIpActiveChart(xData,series){ }, xAxis: { //tickInterval:tickInterval, - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', - }, + } }, noData:{ style: {//设置字体颜色 @@ -233,8 +250,19 @@ function showIpActiveChart(xData,series){ } }, tooltip: { - pointFormat: ':{series.name} :{point.y}
' - }, + pointFormat: ':{series.name} :{point.y}
', + dateTimeLabelFormats: { + millisecond: '%Y-%m-%d %H:%M:%S', + second: '%Y-%m-%d %H:%M:%S', + minute: '%Y-%m-%d %H:%M:%S', + hour: '%Y-%m-%d %H:%M:%S', + day: '%Y-%m-%d %H:%M:%S', + week: '%Y-%m-%d %H:%M:%S', + month: '%Y-%m-%d %H:%M:%S', + year: '%Y-%m-%d %H:%M:%S' + } + + }, yAxis: { title: { text: 'bytes' @@ -266,16 +294,17 @@ function showIpActiveChart(xData,series){ var xData=new Array(); var series=new Array(); if(rs!=null&&rs.length>0){ - xData=rs[0].statTime; $(rs).each(function(i, d) { - total.push( - sum(d.linkNum) - ) - series.push({ - name: d.ipAddr, - data: d.linkNum - }); - }) + total.push(d.sum) + series.push({ + name: d.ipAddr, + data: d.result, + marker: { + enabled: false + } + }); + }) + console.log(rs) }else{ series.push({ name: " ", diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp index 2b9c6f5cf..ee31c6193 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficPortActiveList.jsp @@ -28,18 +28,25 @@
- - + --> + +
- -
+ + +
@@ -57,7 +64,7 @@ - +<%-- --%> <%-- --%> @@ -111,9 +118,10 @@ function searchList(){ function showPortActiveChart(xData,series){ var nowDate=new Date(); + Highcharts.setOptions({ global: { useUTC: false } }); var chart = Highcharts.chart('chart', { chart:{ -// type: 'area', + type: 'area', zoomType: 'x' }, exporting: { @@ -160,8 +168,16 @@ function showPortActiveChart(xData,series){ text: null }, xAxis: { - type:'category', - categories: xData, + type:'datetime', + dateTimeLabelFormats: { + second: '%H:%M:%S', + minute: '%H:%M', + hour: '%H:%M', + day: '%m-%d', + week: '%m-%d', + month: '%Y-%m', + year: '%Y' + }, title: { text: 'time', align:'high', @@ -172,6 +188,18 @@ function showPortActiveChart(xData,series){ text: 'bytes' } }, + tooltip: { + dateTimeLabelFormats: { + millisecond: '%Y-%m-%d %H:%M:%S', + second: '%Y-%m-%d %H:%M:%S', + minute: '%Y-%m-%d %H:%M:%S', + hour: '%Y-%m-%d %H:%M:%S', + day: '%Y-%m-%d %H:%M:%S', + week: '%Y-%m-%d %H:%M:%S', + month: '%Y-%m-%d %H:%M:%S', + year: '%Y-%m-%d %H:%M:%S' + } + }, credits:{//是否有highcharts水印 enabled:false }, @@ -199,14 +227,16 @@ function showPortActiveChart(xData,series){ var series=new Array(); var total = []; if(rs!=null&&rs.length>0){ - xData=rs[0].statTime; $(rs).each(function(i, d) { total.push( - sum(d.sum) + d.sum ) series.push({ name: d.port, - data: d.sum + data: d.result, + marker: { + enabled: false + } }); }) }else{ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp index b9dfa4692..3f2d50484 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp @@ -32,8 +32,10 @@
- +
@@ -42,7 +44,7 @@
+ value="" onclick="WdatePicker({el:'endDate',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:getMaxDate(7) })"/>
@@ -105,7 +107,7 @@
- +<%-- --%> @@ -440,8 +442,18 @@ function protocolTypeChart(rs){ }, tooltip: { headerFormat: '{series.name}
', - pointFormat: '{point.name}: {point.percentage:.2f}%' - }, + pointFormat: '{point.name}: {point.percentage:.2f}%', + dateTimeLabelFormats: { + millisecond: '%Y-%m-%d %H:%M:%S', + second: '%Y-%m-%d %H:%M:%S', + minute: '%Y-%m-%d %H:%M:%S', + hour: '%Y-%m-%d %H:%M:%S', + day: '%Y-%m-%d %H:%M:%S', + week: '%Y-%m-%d %H:%M:%S', + month: '%Y-%m-%d %H:%M:%S', + year: '%Y-%m-%d %H:%M:%S' + } + }, series: [{ name: "Protocol", colorByPoint: true, diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp index 2c3e08c2d..ee8af6dfd 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp @@ -46,10 +46,14 @@ - + onclick="WdatePicker({onpicked:setTime,dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'endDate\')}'});"/> --> +
@@ -58,9 +62,11 @@
- + onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'#F{$dp.$D(\'beginDate\',{d:7})}'});"/> --> + @@ -162,7 +168,7 @@ - +<%-- --%> @@ -529,7 +535,17 @@ function webTypeChart(rs){ }, tooltip: { headerFormat: '{series.name}
', - pointFormat: '{point.name}: {point.percentage:.2f}%' + pointFormat: '{point.name}: {point.percentage:.2f}%', + dateTimeLabelFormats: { + millisecond: '%Y-%m-%d %H:%M:%S', + second: '%Y-%m-%d %H:%M:%S', + minute: '%Y-%m-%d %H:%M:%S', + hour: '%Y-%m-%d %H:%M:%S', + day: '%Y-%m-%d %H:%M:%S', + week: '%Y-%m-%d %H:%M:%S', + month: '%Y-%m-%d %H:%M:%S', + year: '%Y-%m-%d %H:%M:%S' + } }, series: [{ name: "Domain", diff --git a/src/main/webapp/WEB-INF/views/home.jsp b/src/main/webapp/WEB-INF/views/home.jsp index 66fc8440e..68c7ac16c 100644 --- a/src/main/webapp/WEB-INF/views/home.jsp +++ b/src/main/webapp/WEB-INF/views/home.jsp @@ -193,7 +193,7 @@ function changeFrameHeight() { var paddingHeight = 11; //update for dynamicHomePage E - //iframe.contents().find(".page-content").addClass("page-content-body"); + iframe.contents().find(".page-content").addClass("page-content-body"); iframe.prop("height",clientHeight-headerHeight-barHeight-footerHeight-paddingHeight); menuHeight(); } diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp index 15c801739..798d55cb1 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ipList.jsp @@ -111,8 +111,10 @@
+ <%-- --%> + value="${log.searchFoundStartTime}" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setStartTime('#searchFoundStartTime','#searchFoundEndTime',1,'d','yyyy-MM-dd hh:mm:ss',false)"/>
@@ -121,7 +123,7 @@
+ value="${log.searchFoundEndTime}" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setEndTime('#searchFoundStartTime','#searchFoundEndTime',1,'d','yyyy-MM-dd hh:mm:ss',false)"/>
diff --git a/src/main/webapp/WEB-INF/views/report/list.jsp b/src/main/webapp/WEB-INF/views/report/list.jsp index cac9f6098..ca8f70e5a 100644 --- a/src/main/webapp/WEB-INF/views/report/list.jsp +++ b/src/main/webapp/WEB-INF/views/report/list.jsp @@ -74,13 +74,13 @@ $(document).ready(function() { loading(''); var suffix = $(this).data("export-type"); - totaltb(1,-1); + //totaltb(1,-1); getExportHead(); var te = $(".in table").tableExport({ headings:true, footers:true, formats:[suffix], - fileName: getFileName(), + fileName: getFileName('csv'), bootstrap:false }); $(".exportFirst").remove(); @@ -114,16 +114,21 @@ $(document).ready(function() { } - function getFileName() { + function getFileName(type) { var cfgName = $("[name=cfgName2]").val() + "_"; if ("${bean.serviceId}") { var action = $("[name=serviceId]").find('[value=' + "${bean.serviceId}" + ']').text() + "_"; } else { var action = ""; } - var reportType = $("[name=reportType]").find('[value=' + "${bean.reportType}" + ']').text() + "_"; + var reportType = $("[name=reportType]").find('[value=' + "${bean.reportType}" + ']').text() //var reportTime = "${bean.reportTime}"; - return cfgName + action + reportType + getStringFormatDate(); + if(type=='xlsx'){ + return cfgName + action + reportType; + }else{ + return cfgName + action + reportType + "_"+ getStringFormatDate(); + } + } function getStringFormatDate() { @@ -353,10 +358,11 @@ function customColumnClick(){ if(rows.length > 1){ var trtotal=""; if(reportBusinessType=="src_ip_report"){ - trtotal+=""; + trtotal+=""; }else{ trtotal+=""; } + for (var k = 0; k < list.length; k++) { trtotal+=""+list[k]+""; } @@ -437,8 +443,76 @@ function customColumnClick(){ iframe: true, append: null }); - pagination(); + pagination(30); } + + + function getExport(url){ + loading(''); + var reportBusinessType=$("#reportBusinessType").val() + var tableId="tagTable"; + if(reportBusinessType=="label_report"){ + tableId="tagTable"; + }else if(reportBusinessType=="lwhh_report"){ + tableId="lwhhTable"; + }else if(reportBusinessType=="src_ip_report"){ + tableId="contentTable1"; + }else if(reportBusinessType=="attr_type_report"){ + tableId="attrTypeTable"; + }else if(reportBusinessType=="dest_ip_report"){ + tableId="destIpTable"; + }else if(reportBusinessType=="isp_report"){ + tableId="entranceIdTable"; + } + var timeType = $("#reportType").find("option:selected").text(); + var time = $("#intype").val(); + var tabName = $("#liwhite").find("li[class='active'] a").attr("title"); + var titleCode= getFileName('xlsx'); + var heardTime=" "+timeType+":"+time+" "+tabName; + pagination(99999999); + var tb=document.getElementById(tableId); + var rows=tb.rows; + var list=new Array(); + list.splice(0,list.length); + var column=[]; //获取标题 + var index=[];//获取数据列下标 + var num=0; + $("#"+tableId+" thead tr th").each(function(){ + if($(this).is(":visible")){ + column.push($(this).text().trim()); + index.push(num); + } + num++; + }); + for(var i=1 ; i 20){ + rowMap.push(rows[i].cells[n].title); + }else{ + rowMap.push(rows[i].cells[n].innerHTML.trim()); + } + }else{ + rowMap.push(rows[i].cells[n].innerHTML.trim()); + } + + } + list[i-1]=rowMap; + } + var map={}; + map.heard=column; + map.book=list; + map.titleTime=heardTime; + map.titleCode=titleCode; + var exports=JSON.stringify(map); + aJaxImportPost(url,{"exports":exports}); + pagination(30); + closeTip(); + } + + -
+
<%-- diff --git a/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js b/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js index aee446312..ffec23b35 100644 --- a/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js +++ b/src/main/webapp/static/global/plugins/highcharts/js/offline-exporting.js @@ -277,20 +277,19 @@ License: www.highcharts.com/license downloadPNG: { textKey: "downloadPNG", onclick: function () { - console.log(this) this.legend.itemStyle.color='#000000' this.exportChartLocal() this.legend.itemStyle.color='#ffffff' - console.log('ok') - console.log(this) } }, downloadJPEG: { textKey: "downloadJPEG", onclick: function () { + this.legend.itemStyle.color='#000000' this.exportChartLocal({ type: "image/jpeg" }) + this.legend.itemStyle.color='#ffffff' } }, downloadSVG: { diff --git a/src/main/webapp/static/global/scripts/pzLog.js b/src/main/webapp/static/global/scripts/pzLog.js index 4ad93aea6..e972d7107 100644 --- a/src/main/webapp/static/global/scripts/pzLog.js +++ b/src/main/webapp/static/global/scripts/pzLog.js @@ -6,13 +6,26 @@ $(function(){ getTotalLog(); }); -function setTime(){ +/*function setTime(){ var chooseDate=new Date($('#beginDate').val()); chooseDate=chooseDate.setDate(chooseDate.getDate()+7); var modifyTime=new Date(chooseDate); $('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); +}*/ +function setTime(dayData){ + var useTime=$('#beginDate').val(); + if(useTime==''){ + return; + } + var chooseDate=new Date(useTime); + chooseDate=chooseDate.setDate(chooseDate.getDate()+dayData); + var now =new Date(); + if(now.getTime()=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds())); } - function setTimee(){ var chooseDate=new Date($('#searchFoundStartTime').val()); chooseDate=chooseDate.setDate(chooseDate.getDate()+1); @@ -21,6 +34,68 @@ function setTimee(){ } +function currentTime() { + var now = new Date(); + + var year = now.getFullYear(); + var month = now.getMonth() + 1; + var day = now.getDate(); + + var hh = now.getHours(); + var mm = now.getMinutes(); + + var clock = year + "-"; + + if (month < 10) clock += "0"; + clock += month + "-"; + + if (day < 10) clock += "0"; + clock += day + " "; + + if (hh < 10) clock += "0"; + clock += hh + ":"; + + if (mm < 10) clock += '0'; + clock += mm; + return (clock); +} +function getMaxDate(day){ + var clock=currentTime(); + var dt; + var times=0; + dt=$("#beginDate").val(); + if(dt!=''){ + times =Date.parse(dt.replace(/-/g,'/'))+day*24*60*60*1000;//时间间隔为10天 + + if(times-Date.parse(clock.replace(/-/g,'/'))<0){ + var d1 = new Date(times); + var year = d1.getFullYear(); + var month = d1.getMonth() + 1; //月份以0开头 + var day = d1.getDate(); + + var hh = d1.getHours(); + var mm = d1.getMinutes(); + + var clock = year + "-"; + + if (month < 10) clock += "0"; + clock += month + "-"; + + if (day < 10) clock += "0"; + clock += day + " "; + + if (hh < 10) clock += "0"; + clock += hh + ":"; + + if (mm < 10) clock += '0'; + clock += mm; + + } + } + return clock; +} + + var getTotalLog=function(){ /* td需要配置属性有,audit,functionId,compileId,action @@ -208,3 +283,185 @@ var switchMenu = function(topMenuId,functionId,oldMenuName){ }); //loading('onloading'); } +/*======================时间验证方法start===========================*/ +//startTimeSelector:输入框开始时间选择器; +//endTimeSelector:输入框结束时间选择器; +//granule:时间粒度(数字); +//unit:时间粒度单位(h-小时,d-天,w-周,m-月); +//formate:时间格式;默认格式:yyyy-MM-dd hh:mm:ss +//future:选择的时间是否可以为未来时间 true or false 默认false(不能为未来时间) +function setEndTime(startTimeSelector,endTimeSelector,granule,unit,formate,future){ + + if(strIsBlank(granule)||strIsBlank(unit)){ + console.log("时间粒度或时间单位为空"); + return; + } + + if(strIsBlank(startTimeSelector)||strIsBlank(endTimeSelector)){ + console.log("时间输入框选择器为空"); + return; + } + + if(strIsBlank(formate)){ + formate="yyyy-MM-dd hh:mm:ss" + } + if(future==null || future==undefined){ + future=false; + } + var startTimeVal=$(startTimeSelector).val(); + var endTimeVal=$(endTimeSelector).val(); + + var startTime; + var endTime; + + var diff=getTimeDiff(granule,unit);//得到时间粒度差值 + + if(!strIsBlank(endTimeVal)){ + endTime=new Date(endTimeVal); + var currentTime=new Date().getTime(); + if(!future&&endTime.getTime()>currentTime){ //endTime不能是未来时间 + endTime=new Date(); + } + if(strIsBlank(startTimeVal)){ + startTime=new Date(endTime.getTime()-diff); + }else{//startTime和endTime都不为空 + startTime=new Date(startTimeVal); + if(endTime.getTime()-startTime.getTime()>diff||endTime.getTime()-startTime.getTime()<=0){//startTime不在时间粒度之内 + startTime=new Date(endTime.getTime()-diff); + } + } + + }else{ + if(strIsBlank(startTimeVal)){//startTime and endTime 都为空 + endTime=new Date(); + startTime=new Date(endTime.getTime()-diff); + }else{//startTime 不为空,endTime为空 + setStartTime(startTimeSelector,endTimeSelector,granule,unit,formate,future); + return; + } + } + + $(startTimeSelector).val(dateFtt(formate,startTime)); + $(endTimeSelector).val(dateFtt(formate,endTime)); +} + +//startTimeSelector:输入框开始时间选择器; +//endTimeSelector:输入框结束时间选择器; +//granule:时间粒度(数字); +//unit:时间粒度单位(h-小时,d-天,w-周,m-月); +//formate:时间格式;默认格式:yyyy-MM-dd hh:mm:ss +//future:选择的时间是否可以为未来时间 true or false 默认false(不能为未来时间) +function setStartTime(startTimeSelector,endTimeSelector,granule,unit,formate,future){ + + if(strIsBlank(granule)||strIsBlank(unit)){ + console.log("时间粒度或时间单位为空"); + return; + } + + if(strIsBlank(startTimeSelector)||strIsBlank(endTimeSelector)){ + console.log("时间输入框选择器为空"); + return; + } + + if(strIsBlank(formate)){ + formate="yyyy-MM-dd hh:mm:ss" + } + + if(future==null || future==undefined){ + future=false; + } + var startTimeVal=$(startTimeSelector).val(); + var endTimeVal=$(endTimeSelector).val(); + + var startTime; + var endTime; + + var diff=getTimeDiff(granule,unit);//得到时间粒度差值 + + if(!strIsBlank(startTimeVal)){ + startTime=new Date(startTimeVal); + var currentTime=new Date().getTime(); + if(!future&&startTime.getTime()>currentTime){//startTime是一个超过当前时间值 + startTime=new Date(currentTime-diff); + } + if(strIsBlank(endTimeVal)){ + if(startTime.getTime()+diff>currentTime){ + endTime=new Date(); + }else{ + endTime=new Date(startTime.getTime()+diff); + } + }else{//startTime和endTime都不为空 + endTime=new Date(endTimeVal); + if(endTime.getTime()-startTime.getTime()>diff||endTime.getTime()-startTime.getTime()<=0){//endTime不在时间粒度之内 + + if(startTime.getTime()+diff>currentTime){ + endTime=new Date(); + startTime=new Date(endTime.getTime()-5*60*1000); + }else{ + endTime=new Date(startTime.getTime()+diff); + } + } + } + }else{ + if(strIsBlank(endTimeVal)){//startTime和endTime 都为空 + endTime=new Date(); + startTime=new Date(endTime.getTime()-diff); + + }else{ + setEndTime(startTimeSelector,endTimeSelector,granule,unit,formate,future); + return; + } + } + + $(startTimeSelector).val(dateFtt(formate,startTime)); + $(endTimeSelector).val(dateFtt(formate,endTime)); +} + +function strIsBlank(obj){ + if(obj==null || obj==undefined|| obj==''){ + return true; + }else{ + return false; + } +} + +/*得到时间差值 单位毫秒*/ +function getTimeDiff(granule,unit){ + var diff=0; + switch(unit){ + case 'h'://小时为单位 + diff=granule*60*60*1000; + break; + case 'd'://天为单位 + diff=granule*24*60*60*1000; + break; + case 'w'://周为单位 + diff=granule*7*24*60*60*1000; + break; + case 'm'://月为单位 + diff=granule*30*24*60*60*1000; + break; + default: + diff=granule*60*60*1000; + } + return diff; +} + +function dateFtt(fmt,date){ +var o = { +"M+" : date.getMonth()+1, //月份 +"d+" : date.getDate(), //日 +"h+" : date.getHours(), //小时 +"m+" : date.getMinutes(), //分 +"s+" : date.getSeconds(), //秒 +"q+" : Math.floor((date.getMonth()+3)/3), //季度 +"S" : date.getMilliseconds() //毫秒 +}; +if(/(y+)/.test(fmt)) +fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); +for(var k in o) +if(new RegExp("("+ k +")").test(fmt)) +fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); +return fmt; +} +/*======================时间验证方法end===========================*/ \ No newline at end of file diff --git a/src/main/webapp/static/pages/scripts/echart.js b/src/main/webapp/static/pages/scripts/echart.js index 9cd32e2f4..28e80b01f 100644 --- a/src/main/webapp/static/pages/scripts/echart.js +++ b/src/main/webapp/static/pages/scripts/echart.js @@ -4,10 +4,78 @@ chart: { events: { beforePrint: function () { + chart_main.xAxis[0].update({ + labels:{ + style:{ + color:'#000000' + } + } + }) + chart_3.xAxis[0].update({ + labels:{ + style:{ + color:'#000000' + } + } + }) + chart_main.yAxis[0].update({ + labels:{ + style:{ + color:'#000000' + } + } + }) + chart_3.yAxis[0].update({ + title: { + style: {//设置字体颜色 + color: '#000000', + fontFamily:'Microsoft YaHei' + } + }, + labels:{ + style:{ + color:'#000000' + } + } + }) $('.highcharts-legend text').css('color','#000000'); $('.highcharts-legend text').css('fill','#000000'); }, afterPrint: function () { + chart_3.xAxis[0].update({ + labels:{ + style:{ + color:'#ffffff' + } + } + }) + chart_main.xAxis[0].update({ + labels:{ + style:{ + color:'#ffffff' + } + } + }) + chart_main.yAxis[0].update({ + labels:{ + style:{ + color:'#ffffff' + } + } + }) + chart_3.yAxis[0].update({ + title: { + style: {//设置字体颜色 + color: '#ffffff', + fontFamily:'Microsoft YaHei' + } + }, + labels:{ + style:{ + color:'#ffffff' + } + } + }) $('.highcharts-legend text').css('color','#ffffff'); $('.highcharts-legend text').css('fill','#ffffff'); } @@ -67,6 +135,9 @@ allowHTML:true, filename:'Protocol-Type'+addDateName(), chartOptions: { + chart:{ + backgroundColor: 'rgba(255, 255, 255, 1)' + }, plotOptions: { series: { dataLabels: { @@ -240,7 +311,7 @@ data: [pktNum,byteLen], });*/ }); - var chart = Highcharts.chart('chart_main', { + chart_main = Highcharts.chart('chart_main', { chart: { backgroundColor: 'rgba(255, 255, 255, 0)', plotBackgroundColor:null, @@ -261,14 +332,32 @@ allowHTML:true, filename:'Active-IP'+addDateName(), chartOptions: { + chart:{ + backgroundColor: 'rgba(255, 255, 255, 1)' + }, plotOptions: { series: { dataLabels: { enabled: true, - allowOverlap: true, // 允许数据标签重叠 - }, - }, - } + color:'#000000' + } + } + }, + xAxis: [{ + categories: xData, + labels: { + style: { + color: '#000000' + } + } + }], + yAxis: [{ + labels: { + style: { + color: '#000000' + } + } + }] }, buttons: { contextButton: { @@ -292,7 +381,14 @@ fill: '#51586f' } } - } + }, + menuItems: [ + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[0],// 打印 + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[1],// jpeg + 'downloadPNG','downloadPDF', + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[4],// excel + Highcharts.getOptions().exporting.buttons.contextButton.menuItems[3],// cvs + ] } } }, @@ -466,7 +562,7 @@ data: [pktNum,byteLen], });*/ }); - var chart = Highcharts.chart('chart_3',{ + chart_3 = Highcharts.chart('chart_3',{ chart: { backgroundColor: 'rgba(255, 255, 255, 0)', plotBackgroundColor:null, @@ -485,7 +581,43 @@ exporting: { allowHTML:true, filename:'App'+addDateName(), - buttons: exportingButton('#415262') + buttons: exportingButton('#415262'), + chartOptions: { + chart:{ + backgroundColor: 'rgba(255, 255, 255, 1)' + }, + plotOptions: { + series: { + dataLabels: { + enabled: true, + color:'#000000' + } + } + }, + xAxis: [{ + categories: xData, + labels: { + style: { + color: '#000000' + } + } + }], + yAxis: [{ + title: { + text: unit, + align:'high', + style: {//设置字体颜色 + color: '#000000', + fontFamily:'Microsoft YaHei' + } + }, + labels: { + style: { + color: '#000000' + } + } + }] + } }, noData:{ style: {//设置字体颜色 @@ -638,6 +770,9 @@ function echart_2(rs){ allowHTML:true, filename:'BS'+addDateName(), chartOptions: { + chart:{ + backgroundColor: 'rgba(255, 255, 255, 1)' + }, plotOptions: { series: { dataLabels: { @@ -791,6 +926,9 @@ function echart_5(rs){ allowHTML:true, filename:'BS'+addDateName(), chartOptions: { + chart:{ + backgroundColor: 'rgba(255, 255, 255, 1)' + }, plotOptions: { series: { dataLabels: { @@ -939,6 +1077,9 @@ function echart_4(rs){ allowHTML:true, filename:'Website'+addDateName(), chartOptions: { + chart:{ + backgroundColor: 'rgba(255, 255, 255, 1)' + }, plotOptions: { series: { dataLabels: { @@ -1086,6 +1227,9 @@ function echart_6(rs){ allowHTML:true, filename:'Website'+addDateName(), chartOptions: { + chart:{ + backgroundColor: 'rgba(255, 255, 255, 1)' + }, plotOptions: { series: { dataLabels: { @@ -1241,6 +1385,9 @@ function echart_topic_domain(rs){ allowHTML:true, filename:'Service'+addDateName(), chartOptions: { + chart: { + backgroundColor: 'rgba(255, 255, 255, 1)' + }, plotOptions: { series: { dataLabels: { diff --git a/src/main/webapp/static/pages/scripts/pageLogs.js b/src/main/webapp/static/pages/scripts/pageLogs.js index 205d548ae..385f3e2dd 100644 --- a/src/main/webapp/static/pages/scripts/pageLogs.js +++ b/src/main/webapp/static/pages/scripts/pageLogs.js @@ -112,4 +112,24 @@ Date.prototype.Format = function (fmt) { for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; -} \ No newline at end of file +} + +function aJaxImportPost(url, params) { + // 创建form元素 + var temp_form = document.createElement("form"); + // 设置form属性 + temp_form .action = url; + temp_form .target = "_self"; + temp_form .method = "post"; + temp_form .style.display = "none"; + // 处理需要传递的参数 + for (var x in params) { + var opt = document.createElement("textarea"); + opt.name = x; + opt.value = params[x]; + temp_form .appendChild(opt); + } + document.body.appendChild(temp_form); + // 提交表单 + temp_form .submit(); +}