diff --git a/src/main/java/com/nis/domain/dashboard/ConfigStatistic.java b/src/main/java/com/nis/domain/dashboard/ConfigStatistic.java new file mode 100644 index 000000000..02bfd2ee7 --- /dev/null +++ b/src/main/java/com/nis/domain/dashboard/ConfigStatistic.java @@ -0,0 +1,116 @@ +package com.nis.domain.dashboard; + +import com.nis.domain.report.BaseReport; +import com.nis.util.excel.ExcelField; + +public class ConfigStatistic extends BaseReport{ + private static final long serialVersionUID = 8905927100915123026L; + + @ExcelField(title="cfg_id",sort=1) + private String cfgId; + @ExcelField(title="config_describe",sort=2) + private String cfgDesc; + private String serviceId; + private String tableName;//表名 + private String beginDate; + private String endDate; + private String area;//区域 + private String operator;//运营商 + private String chartType;//图表类型 + + public String getBeginDate() { + return beginDate; + } + + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getCfgId() { + return cfgId; + } + + public void setCfgId(String cfgId) { + this.cfgId = cfgId; + } + + public String getCfgDesc() { + return cfgDesc; + } + + public void setCfgDesc(String cfgDesc) { + this.cfgDesc = cfgDesc; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public Long getSum() { + return sum; + } + + public void setSum(Long sum) { + this.sum = sum; + } + + public Integer getService() { + return service; + } + + public void setService(Integer service) { + this.service = service; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getOperator() { + return operator; + } + + public void setOperator(String operator) { + this.operator = operator; + } + + public String getChartType() { + return chartType; + } + + public void setChartType(String chartType) { + this.chartType = chartType; + } +} diff --git a/src/main/java/com/nis/domain/dashboard/codedic/CodeDomainDic.java b/src/main/java/com/nis/domain/dashboard/codedic/CodeDomainDic.java new file mode 100644 index 000000000..8ecf78a2e --- /dev/null +++ b/src/main/java/com/nis/domain/dashboard/codedic/CodeDomainDic.java @@ -0,0 +1,94 @@ +package com.nis.domain.dashboard.codedic; + +import java.io.Serializable; +import java.util.Date; + +public class CodeDomainDic implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 8878203808371459079L; + + private Integer id; + + private String websiteServiceId; + + private String domain; + + private String topicId; + + private Date createTime; + + private String creatorId; + + private Integer isValid; + + private String ican; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getWebsiteServiceId() { + return websiteServiceId; + } + + public void setWebsiteServiceId(String websiteServiceId) { + this.websiteServiceId = websiteServiceId; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public String getTopicId() { + return topicId; + } + + public void setTopicId(String topicId) { + this.topicId = topicId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getCreatorId() { + return creatorId; + } + + public void setCreatorId(String creatorId) { + this.creatorId = creatorId; + } + + public Integer getIsValid() { + return isValid; + } + + public void setIsValid(Integer isValid) { + this.isValid = isValid; + } + + public String getIcan() { + return ican; + } + + public void setIcan(String ican) { + this.ican = ican; + } + + +} diff --git a/src/main/java/com/nis/domain/report/BaseReport.java b/src/main/java/com/nis/domain/report/BaseReport.java index 663dfb9a4..a4b303e4b 100644 --- a/src/main/java/com/nis/domain/report/BaseReport.java +++ b/src/main/java/com/nis/domain/report/BaseReport.java @@ -9,6 +9,7 @@ package com.nis.domain.report; import com.nis.domain.BaseEntity; +import com.nis.util.excel.ExcelField; /** * @ClassName: BaseReportLog.java @@ -25,6 +26,7 @@ public class BaseReport extends BaseEntity{ */ private static final long serialVersionUID = -6190203013788730697L; + @ExcelField(title="config_log_total",sort=3) protected Long sum; protected Integer service; protected String reportTime; diff --git a/src/main/java/com/nis/util/CodeDicUtils.java b/src/main/java/com/nis/util/CodeDicUtils.java index f161f5b3e..1f5e183cd 100644 --- a/src/main/java/com/nis/util/CodeDicUtils.java +++ b/src/main/java/com/nis/util/CodeDicUtils.java @@ -7,6 +7,7 @@ import com.nis.domain.dashboard.SysIspInfo; import com.nis.domain.dashboard.codedic.CodeAppDic; import com.nis.domain.dashboard.codedic.CodeBehaviorTypeDic; import com.nis.domain.dashboard.codedic.CodeBrowserTypeDic; +import com.nis.domain.dashboard.codedic.CodeDomainDic; import com.nis.domain.dashboard.codedic.CodeOsTypeDic; import com.nis.domain.dashboard.codedic.CodeProtocolTypeDic; import com.nis.domain.dashboard.codedic.CodeServiceTypeDic; @@ -14,6 +15,7 @@ import com.nis.domain.dashboard.codedic.CodeWebServiceDic; import com.nis.web.dao.dashboard.codedic.CodeAppDicDao; import com.nis.web.dao.dashboard.codedic.CodeBehaviorTypeDicDao; import com.nis.web.dao.dashboard.codedic.CodeBrowserTypeDicDao; +import com.nis.web.dao.dashboard.codedic.CodeDomainDicDao; import com.nis.web.dao.dashboard.codedic.CodeOsTypeDicDao; import com.nis.web.dao.dashboard.codedic.CodeProtocolTypeDicDao; import com.nis.web.dao.dashboard.codedic.CodeResult; @@ -31,6 +33,7 @@ public class CodeDicUtils { private final static CodeServiceTypeDicDao codeServiceTypeDicDao = SpringContextHolder.getBean(CodeServiceTypeDicDao.class); private final static CodeWebServiceDicDao codeWebServiceDicDao = SpringContextHolder.getBean(CodeWebServiceDicDao.class); private final static CodeSysIspInfoDicDao codeSysIspInfoDicDao = SpringContextHolder.getBean(CodeSysIspInfoDicDao.class); + private final static CodeDomainDicDao codeDomainDicDao = SpringContextHolder.getBean(CodeDomainDicDao.class); private static final String APP_CODE="appCode"; @@ -42,6 +45,7 @@ public class CodeDicUtils { private static final String WEB_CODE="webCode"; private static final String ISP_CODE="ispCode"; + private static final String DOMAIN_CODE="domainCode"; /** * 适用于大屏图表标签显示 */ @@ -178,6 +182,23 @@ public class CodeDicUtils { } } return result; + }else if (name.equals(DOMAIN_CODE)) { +// List codeDicList = (List) CacheUtils.get(WEB_CODE); +// if(StringUtil.isEmpty(codeDicList)){ +// codeDicList = codeWebServiceDicDao.getCodeDicList(); +// CacheUtils.put(WEB_CODE, codeDicList); +// } + List codeDicList = codeDomainDicDao.getCodeDicList(); + if(codeDicList!=null&&codeDicList.size()>0){ + for (int i = 0; i < codeDicList.size(); i++) { + CodeResult codeResult = new CodeResult(); + codeResult.setItem(codeDicList.get(i).getDomain()); + codeResult.setCode(String.valueOf(codeDicList.get(i).getId())); + + result.add(codeResult); + } + } + return result; } return result; } diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 2a56bbb95..7a57c1c84 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -795,4 +795,42 @@ public final class Constants { * 管理员用户预警查询服务配置总量接口 */ public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService",""); + /** + * 获取配置统计页面列表的配置总量接口 + */ + public static final String NTC_PZ_COUNT_REPORT = Configurations.getStringProperty("ntcPzCountReport",""); + /** + * 查询的是流量统计菜单-配置统计中BandWidth统计的数据接口 + */ + public static final String TRAFFIC_BANDWIDTH_TRANS_THREE_NEW=Configurations.getStringProperty("trafficBandwidthTransThreeNew","trafficBandwidthTransThreeNew"); + /** + * 查询的是流量统计菜单-配置统计中RulesType统计的数据接口 + */ + public static final String NTC_ACTION_ENTRANCE_REPORT_NEW=Configurations.getStringProperty("ntcActionEntranceReportNew","ntcActionEntranceReportNew"); + /** + * 查询的是流量统计菜单-配置统计中Protocol统计的数据接口 + */ + public static final String TRAFFIC_PROTOCOL_STATISTIC_NEW=Configurations.getStringProperty("trafficProtocolStatisticNew","trafficProtocolStatisticNew"); + /** + * 查询的是流量统计菜单-配置统计中APP统计的数据接口 + */ + public static final String TRAFFIC_APP_STATISTIC_NEW=Configurations.getStringProperty("trafficAppStatisticNew","trafficAppStatisticNew"); + /** + * 查询的是流量统计菜单-配置统计中Domains统计的数据接口 + */ + public static final String TRAFFIC_DOMAIN_STATISTIC_NEW=Configurations.getStringProperty("trafficDomainStatisticNew","trafficDomainStatisticNew"); + /** + * 查询的是流量统计菜单-配置统计中ClientIP统计的数据接口 + */ + public static final String TRAFFIC_SOURCE_IP_STATISTIC_NEW=Configurations.getStringProperty("trafficSourceIPStatisticNew","trafficSourceIPStatisticNew"); + /** + * 查询的是流量统计菜单-配置统计中ServerIP统计的数据接口 + */ + public static final String TRAFFIC_DEST_IP_STATISTIC_NEW=Configurations.getStringProperty("trafficDestIPStatisticNew","trafficDestIPStatisticNew"); + /** + * 查询的是流量统计菜单-配置统计中SubscriberID统计的数据接口 + */ + public static final String TRAFFIC_SUBSCRIBER_ID_STATISTIC_NEW=Configurations.getStringProperty("trafficSubscriberIDStatisticNew","trafficSubscriberIDStatisticNew"); + + } diff --git a/src/main/java/com/nis/web/controller/dashboard/ConfigStatisticsController.java b/src/main/java/com/nis/web/controller/dashboard/ConfigStatisticsController.java new file mode 100644 index 000000000..25b353817 --- /dev/null +++ b/src/main/java/com/nis/web/controller/dashboard/ConfigStatisticsController.java @@ -0,0 +1,1649 @@ +package com.nis.web.controller.dashboard; + +import java.net.URISyntaxException; +import java.text.DecimalFormat; +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.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.http.client.utils.URIBuilder; +import org.joda.time.DateTime; +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.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.beust.jcommander.internal.Maps; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.SysUser; +import com.nis.domain.configuration.WebsiteDomainTopic; +import com.nis.domain.dashboard.ConfigStatistic; +import com.nis.domain.maat.LogRecvData; +import com.nis.util.CodeDicUtils; +import com.nis.util.Constants; +import com.nis.util.DateUtils; +import com.nis.util.LogUtils; +import com.nis.util.ServiceConfigTemplateUtil; +import com.nis.util.StringUtil; +import com.nis.util.StringUtils; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; +import com.nis.web.dao.dashboard.codedic.CodeResult; +import com.nis.web.security.UserUtils; +import com.nis.web.service.configuration.statistics.ConfigStatisticService; + +import net.sf.json.JSONObject; + +@Controller +@RequestMapping("${adminPath}/dashboard/traffic") +public class ConfigStatisticsController extends BaseController { + + @Autowired + protected ConfigStatisticService configStatisticService; + + @RequestMapping(value="/commonNewList") + public String configStatistic(Model model,String concent,String detail,String dimension,String area, + String operator,String timeSize,String chartType,String beginDate,String endDate){ + if (StringUtils.isNotBlank(beginDate) && StringUtils.isNotBlank(endDate)) { + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + }else{ + Calendar cal = Calendar. getInstance (); + cal.setTime(new Date()); + String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + if(concent ==null || concent.equals("1")){ + ConfigStatistic entity=new ConfigStatistic(); + entity.setBeginDate(oneHoursAgo); + entity.setEndDate(now); + model.addAttribute("log", entity); + }else{ + model.addAttribute("beginDate", oneHoursAgo); + model.addAttribute("endDate", now); + } + } + model.addAttribute("concent", concent); + model.addAttribute("detail", detail); + model.addAttribute("dimension", dimension); + model.addAttribute("area", area); + model.addAttribute("operator", operator); + model.addAttribute("timeSize", timeSize); + model.addAttribute("chartType", chartType); + return "/dashboard/commonNew"; + } + /** + * BandWidth 数据查询 + */ + @RequestMapping(value="bandWidthTransThreeNew") + @ResponseBody + public Map bandWidthTransThree(String beginDate,String endDate,String searchQuotaType,String searchDirection, + String timeSize,Integer [] operator,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + Map map = new HashMap(); + String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_THREE_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&searchQuotaType="+searchQuotaType; + + if(!StringUtil.isEmpty(searchDirection)) { + url=url+"&searchDirection="+searchDirection; + } + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); +// logger.debug("bandWidthTransThreeNew服务查询数据成功"); + Map result = (Map)fromJsonList.get("data"); + model.addAttribute("searchDirection", searchDirection); + return result; + } catch (Exception e) { + e.printStackTrace(); + logger.error("带宽详情数据获取错误"+e); + LogUtils.saveLog(request, null, e, null); + } + return map; + } + // 配置统计列表数据查询 + @RequestMapping(value = { "/configStatistic" }) + public String configStatisticList(@ModelAttribute("log") ConfigStatistic log, Model model, HttpServletRequest request, + HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + if(page.getOrderBy().equals("") || page.getOrderBy() ==null){ + params.put("orderBy", "sum desc"); + }else{ + params.put("orderBy", page.getOrderBy()); + } + // 判断请求参数 + if (StringUtils.isNotBlank(log.getBeginDate()) + && StringUtils.isNotBlank(log.getEndDate())) { + params.put("searchReportStartTime", log.getBeginDate()); + params.put("searchReportEndTime", log.getEndDate()); + } else { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + String endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + String beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + + params.put("searchReportStartTime", beginDate); + params.put("searchReportEndTime", endDate); + log.setBeginDate(beginDate); + log.setEndDate(endDate); + } + if(!StringUtil.isEmpty(log.getTime())) { + if(log.getTime().equals("1")){ + params.put("searchBusinessType", "2"); + }/*else{ + params.put("searchBusinessType", log.getTime()); + }*/else if(log.getTime().equals("2")){ + params.put("searchBusinessType", "3"); + }else if(log.getTime().equals("3")){ + params.put("searchBusinessType", "4"); + }else if(log.getTime().equals("4")){ + params.put("searchBusinessType", "5"); + }else if(log.getTime().equals("5")){ + params.put("searchBusinessType", "6"); + } + }else{ + params.put("searchBusinessType", "2"); + } + String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_COUNT_REPORT; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + //查询配置描述 + for (ConfigStatistic entity1 : data.getList()) { + entity1.setServiceId(String.valueOf(entity1.getService())); + //获取界面配置的所有业务信息 + List> serviceList = ServiceConfigTemplateUtil.getServiceList(); + for (Map map1 : serviceList) { + if(entity1.getServiceId().equals(map1.get("id").toString())){ + entity1.setTableName(map1.get("tableName").toString()); + break; + } + } + String cfgDesc=""; + if(entity1.getServiceId().equals("400")){//ASN IP(特殊的业务,需单独查询) + cfgDesc = configStatisticService.getASNIPCfgDesc(entity1.getCfgId()); + }else if(entity1.getServiceId().equals("1028")){// APP IP + cfgDesc = configStatisticService.getAPPIPCfgDesc(entity1.getCfgId()); + }else{ + cfgDesc = configStatisticService.getCfgDescByCfgId(entity1); + } + entity1.setCfgDesc(cfgDesc); + } + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + model.addAttribute("page", page); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + LogUtils.saveLog(request, null, e, null); + } + + model.addAttribute("concent", "1"); + return "/dashboard/commonNew"; + } + + // 配置统计列表内容导出 + @RequestMapping(value = "configStatisticListExport") + public void asnExport(@ModelAttribute("log") ConfigStatistic log, Model model, String hColumns, String type, + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + page.setPageSize(-1); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("orderBy", "sum desc"); + // 判断请求参数 + if (StringUtils.isNotBlank(log.getBeginDate()) + && StringUtils.isNotBlank(log.getEndDate())) { + params.put("searchReportStartTime", log.getBeginDate()); + params.put("searchReportEndTime", log.getEndDate()); + } else { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + String endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + String beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + + params.put("searchReportStartTime", beginDate); + params.put("searchReportEndTime", endDate); + log.setBeginDate(beginDate); + log.setEndDate(endDate); + } + if(!StringUtil.isEmpty(log.getTime())) { + if(log.getTime().equals("1")){ + params.put("searchBusinessType", "2"); + }else if(log.getTime().equals("2")){ + params.put("searchBusinessType", "3"); + }else if(log.getTime().equals("3")){ + params.put("searchBusinessType", "4"); + }else if(log.getTime().equals("4")){ + params.put("searchBusinessType", "5"); + }else if(log.getTime().equals("5")){ + params.put("searchBusinessType", "6"); + } + }else{ + params.put("searchBusinessType", "2"); + } + String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_COUNT_REPORT; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + //查询配置描述 + for (ConfigStatistic entity1 : list) { + entity1.setServiceId(String.valueOf(entity1.getService())); + //获取界面配置的所有业务信息 + List> serviceList = ServiceConfigTemplateUtil.getServiceList(); + for (Map map1 : serviceList) { + if(entity1.getServiceId().equals(map1.get("id").toString())){ + entity1.setTableName(map1.get("tableName").toString()); + break; + } + } + String cfgDesc=""; + if(entity1.getServiceId().equals("400")){//ASN IP(特殊的业务,需单独查询) + cfgDesc = configStatisticService.getASNIPCfgDesc(entity1.getCfgId()); + }else if(entity1.getServiceId().equals("1028")){// APP IP + cfgDesc = configStatisticService.getAPPIPCfgDesc(entity1.getCfgId()); + }else{ + cfgDesc = configStatisticService.getCfgDescByCfgId(entity1); + } + entity1.setCfgDesc(cfgDesc); + } + } + } + // + titleList.add("config_statistics"); + classMap.put("config_statistics", ConfigStatistic.class); + SysUser user = UserUtils.getUser(); + hColumns += ",s_asn,d_asn,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip," + + "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac," + + "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,"; + + String cfgIndexInfoNoExport = "," + hColumns; + noExportMap.put("config_statistics", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + ConfigStatistic configStatistic = new ConfigStatistic(); + long sums = 0; + for (ConfigStatistic entity : list) { + if (null != entity.getSum() && !"".equals(entity.getSum())) { + sums += entity.getSum(); + } + + } + String report_total = msgProp.getProperty("report_total"); + configStatistic.setCfgId(report_total); + configStatistic.setCfgDesc("--"); + configStatistic.setSum(sums); + list.add(configStatistic); + + dataMap.put("config_statistics", list); + String timeRange=msgProp.getProperty("config_statistics","config_statistics"); + if(log.getBeginDate()!=null){ + timeRange+=" "+msgProp.getProperty("begin_date")+":"+log.getBeginDate(); + } + if(log.getEndDate()!=null){ + timeRange+=" "+msgProp.getProperty("end_date")+":"+log.getEndDate(); + } + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "Configuration_Statistics", titleList, classMap, + dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "Configuration_Statistics", titleList, classMap, + dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("Configuration_Statistics export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + LogUtils.saveLog(request, null, e, null); + } + } + @RequestMapping("configTrans") + public String configTrans(Model model,Integer cfgId,String beginDate,String endDate,String timeSize,String chartType,String cfgDesc){ + model.addAttribute("timeSize", timeSize); + model.addAttribute("cfgId", cfgId); + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + model.addAttribute("chartType_1", chartType); + if(!cfgDesc.equals("undefined") && !cfgDesc.equals("") && cfgDesc !=null){ + model.addAttribute("cfgDesc", cfgDesc); + }else{ + model.addAttribute("cfgDesc", ""); + } + return "/dashboard/configStatisticTrans"; + } + /** + *配置统计图表数据查询 + */ + @RequestMapping("ajaxConfigStatistic") + @ResponseBody + public List ajaxConfigStatistic(String cfgId,String timeSize,String cfgDesc,@RequestParam(required=false)String beginDate, + @RequestParam(required=false)String endDate,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + List resultList = new ArrayList(); + String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT; + url=url+"?pageSize=-1&searchCfgId="+cfgId; + if(!StringUtil.isEmpty(timeSize)) { + if(timeSize.equals("1")){ + url=url+"&searchBusinessType=2"; + }else if(timeSize.equals("2")){ + url=url+"&searchBusinessType=3"; + }else if(timeSize.equals("3")){ + url=url+"&searchBusinessType=4"; + }else if(timeSize.equals("4")){ + url=url+"&searchBusinessType=5"; + }else if(timeSize.equals("5")){ + url=url+"&searchBusinessType=6"; + } + }else{ + url=url+"&searchBusinessType=2"; + } + try { + if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){ + Calendar cal = Calendar. getInstance (); + cal.setTime(new Date()); + endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + } + URIBuilder uriBuilder = new URIBuilder(url); + uriBuilder.addParameter("searchReportStartTime",beginDate); + uriBuilder.addParameter("searchReportEndTime",endDate); + url=uriBuilder.toString(); + + String json = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(json, new TypeToken(){}.getType()); + fromJsonList=(Map) fromJsonList.get("data"); + logger.debug("配置ID趋势数据"+fromJsonList); + JSONObject obj=JSONObject.fromObject(json); + resultList =getList(fromJsonList); + + } catch (Exception e) { + e.printStackTrace(); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } + + public List getList(Map dateList){ + List> resultList = new ArrayList>(); + try { + List> mapList=(List>) dateList.get("list"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Map maps=new HashMap(); + List list=new ArrayList(); + Double total=0.0; + for (Map map : mapList) { + Double[] logs=new Double[2]; + Double sum=Double.valueOf(String.valueOf(map.get("sum"))); + Double date=Double.valueOf(sdf.parse(String.valueOf(map.get("reportTime"))).getTime()); + total+=sum; + logs[0]=date; + logs[1]=sum; + list.add(logs); + } + maps.put("sum",total); + maps.put("result", list); + resultList.add(maps); + } catch (Exception e) { + e.printStackTrace(); + } + return resultList; + } + + // Rules Type (监测 阻断) + @RequestMapping(value={"newtrafficBlockMonitorList"}) + public String serviceBlockList(@RequestParam("searchAction")String searchAction,Model model,String concent, + String detail,String dimension,String area,String operator,String timeSize,String chartType,String beginDate,String endDate){ + if (StringUtils.isNotBlank(beginDate) && StringUtils.isNotBlank(endDate)) { + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + }else{ + Calendar cal = Calendar. getInstance (); + cal.setTime(new Date()); + String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + model.addAttribute("beginDate", oneHoursAgo); + model.addAttribute("endDate", now); + + } + model.addAttribute("searchAction", searchAction); + model.addAttribute("concent", concent); + model.addAttribute("detail", detail); + model.addAttribute("dimension", dimension); + model.addAttribute("area", area); + model.addAttribute("operator", operator); + model.addAttribute("timeSize", timeSize); + model.addAttribute("chartType", chartType); + return "/dashboard/commonNew"; + } + + /** + * Rules Type (监测 阻断)数据查询 + */ + @RequestMapping(value="actionEntranceTransNew") + @ResponseBody + public List actionTrans(String beginDate,String endDate,String timeSize,String entranceId,@RequestParam("searchAction")String searchAction,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + List resultList = new ArrayList(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String url = Constants.DASHBOARD_URL+Constants.NTC_ACTION_ENTRANCE_REPORT_NEW; + url=url+"?searchAction="+searchAction; + try { + url = urlAddDate(url,beginDate,endDate); + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + } + if(entranceId.equals("astana")){ + url=url+"&searchEntranceId="+1; + }else if(entranceId.equals("almaty")){ + url=url+"&searchEntranceId="+2; + } + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); +// logger.debug(searchAction+"动作数据"+fromJsonList); + resultList = (ArrayList) fromJsonList.get("data"); + } catch (Exception e) { + e.printStackTrace(); + logger.error(searchAction+"动作详情数据获取错误"+e); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } + + /** + * + * + * url路径时间参数格式化 + * @param url + * @param beginDate + * @param endDate + * @return + * @throws URISyntaxException + */ + public String urlAddDate(String url,String beginDate,String endDate) throws URISyntaxException{ + if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){ + Calendar cal = Calendar. getInstance (); + cal.setTime(new Date()); + endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime()); + } + URIBuilder uriBuilder = new URIBuilder(url); + uriBuilder.addParameter("beginDate",beginDate); + uriBuilder.addParameter("endDate",endDate); + return uriBuilder.toString(); + } + + //根据时间粒度格式化时间格式(5分钟 小时 天 月 年) + public static String getFormatMinute(String timeSize ,Date date) { + DateTime dateTime = new DateTime(date); + if(timeSize.equals("1")){ + int minute = dateTime.getMinuteOfHour(); + int formatMinute = minute % 5; + minute = minute - formatMinute; + dateTime = dateTime.withMinuteOfHour(minute).withSecondOfMinute(0).withMillisOfSecond(0); + return dateTime.toString("yyyy-MM-dd HH:mm:ss"); + }else if(timeSize.equals("2")){ + return dateTime.withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0).toString("yyyy-MM-dd HH:mm:ss"); + }else if(timeSize.equals("3")){ + return dateTime.withMillisOfDay(0).toString("yyyy-MM-dd HH:mm:ss"); + }else if(timeSize.equals("4")){ + return dateTime.dayOfMonth().withMinimumValue().millisOfDay().withMinimumValue().toString("yyyy-MM-dd HH:mm:ss"); + }else{ + return dateTime.withMonthOfYear(1).withDayOfMonth(1).millisOfDay().withMinimumValue().toString("yyyy-MM-dd HH:mm:ss"); + } + } + + + /** + * 协议统计图和列数据 + */ + @RequestMapping(value="protocolListNew") + @ResponseBody + public List protocolListNew(Model model,Integer entranceId,Integer[] protoType,String timeSize,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,HttpServletRequest request){ + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Map fromJsonList = new HashMap(); + List list = new ArrayList(); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_PROTOCOL_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + if(protoType!=null){ + for (Integer dom : protoType) { + if(dom!=null){ + url=url+"&protoType="+dom; + } + } + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(!StringUtil.isEmpty(timeSize)) { + + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(entranceId!=null){ + url=url+"&entranceId="+entranceId; + } + /*if (!StringUtil.isEmpty(searchQuotaType)) { + url=url+"&searchQuotaType="+searchQuotaType; + }*/ + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); + list = (ArrayList) fromJsonList.get("data"); + Long totalSUnq=0l; + Long totalDUnq=0l; + Long totalLink=0l; + Long totalPackets=0l; + Double totalGByte=0d; + DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); + DecimalFormat df = new DecimalFormat("0.0000000000"); + List protocolCodeList = CodeDicUtils.getCodeList("protocolCode"); + //两个时间段之间的秒数 + double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); + if(!StringUtil.isEmpty(list)){ + for (Object object : list) { + Map m=(Map) object; + Double value1 = Double.parseDouble(m.get("protoId").toString()); + m.put("protocolId", lf.format(m.get("protoId"))); + totalGByte+=Double.parseDouble(m.get("GByte").toString()); + m.put("GByte", df.format(m.get("GByte"))); + m.put("sUnqNum", lf.format(m.get("sUnqNum"))); + totalSUnq+=Long.parseLong( m.get("sUnqNum").toString()); + m.put("dUnqNum", lf.format(m.get("dUnqNum"))); + totalDUnq+=Long.parseLong( m.get("dUnqNum").toString()); + m.put("packets", lf.format(m.get("packets"))); + m.put("linkNum", lf.format(m.get("linkNum"))); + double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; + m.put("pps",lf.format(avgPacket)); + double avgByte=Double.parseDouble(m.get("GByte").toString())*8/allSeconds; + m.put("bps",f.format(avgByte)); + totalLink+=Long.parseLong( m.get("linkNum").toString()); + totalPackets+=Long.parseLong(m.get("packets").toString()); + // + for (CodeResult code : protocolCodeList) { + Double value3 = Double.valueOf(code.getCode()); + if(value1.equals(value3)){ + m.put("protocolType", code.getItem()); + break; + } + } + } + for (Object object : list) { + Map m=(Map) object; + m.put("totalSUnq", totalSUnq); + m.put("totalDUnq", totalDUnq); + m.put("totalLink", totalLink); + m.put("totalPackets", totalPackets); + m.put("totalGByte", totalGByte); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("协议数据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return list; + } + + //跳转协议类型趋势图页面 + @RequestMapping("protocolsTrans") + public String protocolsTrans(Model model,String protocolId,String protocolType,String beginDate,String endDate, + String timeSize,String chartType,String dimension,String area,String operator){ + model.addAttribute("timeSize", timeSize); + model.addAttribute("protocolId", protocolId); + model.addAttribute("protocolType", protocolType); + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + model.addAttribute("chartType_1", chartType); + model.addAttribute("dimension", dimension); + model.addAttribute("operator", operator); + model.addAttribute("area", area); + return "/dashboard/newProtocolsTrans"; + } + /** + *Protocols图表数据查询 + */ + @RequestMapping("ajaxProtocolsStatistic") + @ResponseBody + public List ajaxProtocolsStatistic(String protocolType,String protocolId,String timeSize,String area,String dimension,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List resultList = new ArrayList(); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_PROTOCOL_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&protoType="+protocolId; + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(!StringUtil.isEmpty(area)){ + url=url+"&entranceId="+area; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(dimension.equals("bps")){ + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + }else if(dimension.equals("uniq client ip count")){ + url=url+"&searchQuotaType=4"; + }else if(dimension.equals("uniq server ip count")){ + url=url+"&searchQuotaType=5"; + } + String json = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(json, new TypeToken(){}.getType()); + + List> resultLists = new ArrayList>(); + List> mapList=(List>) fromJsonList.get("data"); + Map maps=new HashMap(); + List list=new ArrayList(); + Double total=0.0; + for (Map map : mapList) { + Double[] logs=new Double[2]; + Double sum=Double.valueOf(String.valueOf(map.get("sum"))); + Double date=Double.valueOf(String.valueOf(map.get("reportTime"))); + total+=sum; + logs[0]=date; + logs[1]=sum; + list.add(logs); + } + maps.put("sum",total); + maps.put("result", list); + resultLists.add(maps); + + resultList=resultLists; + } catch (Exception e) { + e.printStackTrace(); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } + + /** + * App详情统计图跟表 + */ + @RequestMapping(value="appListNew") + @ResponseBody + public List appListNew(Integer entranceId,@RequestParam(value="appType",required=false)Integer[] appType,String timeSize,Integer[] operator, + @RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List list = new ArrayList(); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + if(appType!=null){ + for (Integer dom : appType) { + if(dom!=null){ + url=url+"&appType="+dom; + } + } + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(entranceId!=null){ + url=url+"&entranceId="+entranceId; + } + /*if (!StringUtil.isEmpty(searchQuotaType)) { + url=url+"&searchQuotaType="+searchQuotaType; + }*/ + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); + list = (ArrayList) fromJsonList.get("data"); + Long totalSUnq=0l; + Long totalDUnq=0l; + Long totalLink=0l; + Long totalPackets=0l; + Double totalGByte=0d; + DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); + DecimalFormat df = new DecimalFormat("0.0000000000"); + //两个时间段之间的秒数 + double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); + List appCodeList = CodeDicUtils.getCodeList("appCode"); + if(!StringUtil.isEmpty(list)){ + for (Object object : list) { + Map m=(Map) object; + Double value1 = Double.parseDouble(m.get("appId").toString()); + m.put("appId", lf.format(m.get("appId"))); + totalGByte+=Double.parseDouble(m.get("GByte").toString()); + m.put("GByte", df.format(m.get("GByte"))); + m.put("sUnqNum", lf.format(m.get("sUnqNum"))); + totalSUnq+=Long.parseLong( m.get("sUnqNum").toString()); + m.put("dUnqNum", lf.format(m.get("dUnqNum"))); + totalDUnq+=Long.parseLong( m.get("dUnqNum").toString()); + m.put("packets", lf.format(m.get("packets"))); + m.put("linkNum", lf.format(m.get("linkNum"))); + double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; + m.put("pps",lf.format(avgPacket)); + double avgByte=Double.parseDouble(m.get("GByte").toString())*8/allSeconds; + m.put("bps",f.format(avgByte)); + totalLink+=Long.parseLong( m.get("linkNum").toString()); + totalPackets+=Long.parseLong(m.get("packets").toString()); + // 协议没匹配的匹配app码表 + for (CodeResult code : appCodeList) { + Double value3 = Double.valueOf(code.getCode()); + if(value1.equals(value3)){ + m.put("appType", code.getItem()); + break; + } + } + } + for (Object object : list) { + Map m=(Map) object; + m.put("totalSUnq", totalSUnq); + m.put("totalDUnq", totalDUnq); + m.put("totalLink", totalLink); + m.put("totalPackets", totalPackets); + m.put("totalGByte", totalGByte); + } + } + + } catch (Exception e) { + e.printStackTrace(); + logger.error("app 数据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return list; + } + + //跳转APP趋势图页面 + @RequestMapping("appTransList") + public String appTransList(Model model,String appId,String appType,String beginDate,String endDate, + String timeSize,String chartType,String dimension,String area,String operator){ + model.addAttribute("timeSize", timeSize); + model.addAttribute("appId", appId); + model.addAttribute("appType", appType); + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + model.addAttribute("operator", operator); + model.addAttribute("chartType_1", chartType); + model.addAttribute("dimension", dimension); + model.addAttribute("area", area); + return "/dashboard/newAppTrans"; + } + /** + *APP 图表数据查询 + */ + @RequestMapping("ajaxAppStatistic") + @ResponseBody + public List ajaxAppStatistic(String appId,String appType,String timeSize,String area,String dimension,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + List resultList = new ArrayList(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&appType="+appId; + if(!StringUtil.isEmpty(timeSize)) {//时间粒度 + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(!StringUtil.isEmpty(area)){//地域 + url=url+"&entranceId="+area; + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + }else if(dimension.equals("uniq client ip count")){ + url=url+"&searchQuotaType=4"; + }else if(dimension.equals("uniq server ip count")){ + url=url+"&searchQuotaType=5"; + } + String json = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(json, new TypeToken(){}.getType()); + + List> resultLists = new ArrayList>(); + List> mapList=(List>) fromJsonList.get("data"); + Map maps=new HashMap(); + List list=new ArrayList(); + Double total=0.0; + for (Map map : mapList) { + Double[] logs=new Double[2]; + Double sum=Double.valueOf(String.valueOf(map.get("sum"))); + Double date=Double.valueOf(String.valueOf(map.get("reportTime"))); + total+=sum; + logs[0]=date; + logs[1]=sum; + list.add(logs); + } + maps.put("sum",total); + maps.put("result", list); + resultLists.add(maps); + resultList=resultLists; + } catch (Exception e) { + e.printStackTrace(); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } + + /** + * domain统计图跟表 + */ + @RequestMapping(value="domainListNew") + @ResponseBody + public List domainListNew(Integer entranceId,Integer[] domain,Model model,String timeSize,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List list = new ArrayList(); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_DOMAIN_STATISTIC_NEW; + try { + url=urlAddDate(url, beginDate, endDate); + if(domain!=null){ + for (Integer dom : domain) { + if(dom!=null){ + url=url+"&domain="+dom; + } + } + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(entranceId!=null){ + url=url+"&entranceId="+entranceId; + } + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); + list = (ArrayList) fromJsonList.get("data"); + Long totalSUnq=0l; + Long totalDUnq=0l; + Long totalLink=0l; + Long totalPackets=0l; + Double totalGByte=0d; + DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); + DecimalFormat df = new DecimalFormat("0.0000000000"); + //两个时间段之间的秒数 + double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); + List domainCodeList = CodeDicUtils.getCodeList("domainCode"); + if(!StringUtil.isEmpty(list)){ + for (Object object : list) { + Map m=(Map) object; + Double value1 = Double.parseDouble(m.get("domainId").toString()); + m.put("domain", lf.format(m.get("domainId"))); + totalGByte+=Double.parseDouble(m.get("GByte").toString()); + m.put("GByte", df.format(m.get("GByte"))); + m.put("sUnqNum", lf.format(m.get("sUnqNum"))); + totalSUnq+=Long.parseLong( m.get("sUnqNum").toString()); + m.put("dUnqNum", lf.format(m.get("dUnqNum"))); + totalDUnq+=Long.parseLong( m.get("dUnqNum").toString()); + m.put("packets", lf.format(m.get("packets"))); + m.put("linkNum", lf.format(m.get("linkNum"))); + double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; + m.put("pps",lf.format(avgPacket)); + double avgByte=Double.parseDouble(m.get("GByte").toString())*8/allSeconds; + m.put("bps",f.format(avgByte)); + totalLink+=Long.parseLong( m.get("linkNum").toString()); + totalPackets+=Long.parseLong(m.get("packets").toString()); + // 协议没匹配的匹配app码表 + for (CodeResult code : domainCodeList) { + Double value3 = Double.valueOf(code.getCode()); + if(value1.equals(value3)){ + m.put("domainName", code.getItem()); + break; + } + } + } + for (Object object : list) { + Map m=(Map) object; + m.put("totalSUnq", totalSUnq); + m.put("totalDUnq", totalDUnq); + m.put("totalLink", totalLink); + m.put("totalPackets", totalPackets); + m.put("totalGByte", totalGByte); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("域名数据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return list; + } + + //跳转Domain趋势图页面 + @RequestMapping("domainTransList") + public String domainTransList(Model model,String domain,String domainName,String beginDate,String endDate, + String timeSize,String chartType,String dimension,String area,String operator){ + model.addAttribute("timeSize", timeSize); + model.addAttribute("domainName", domainName); + model.addAttribute("domain", domain); + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + model.addAttribute("chartType_1", chartType); + model.addAttribute("operator", operator); + model.addAttribute("dimension", dimension); + model.addAttribute("area", area); + return "/dashboard/newDomainTrans"; + } + + /** + *Domain 图表数据查询 + */ + @RequestMapping("ajaxDomainStatistic") + @ResponseBody + public List ajaxDomainStatistic(String domain,String domainName,String timeSize,String area,String dimension,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + List resultList = new ArrayList(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String url = Constants.LOG_BASE_URL+Constants.TRAFFIC_DOMAIN_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&domain="+domain; + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(!StringUtil.isEmpty(area)){//地域 + url=url+"&entranceId="+area; + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + }else if(dimension.equals("uniq client ip count")){ + url=url+"&searchQuotaType=4"; + }else if(dimension.equals("uniq server ip count")){ + url=url+"&searchQuotaType=5"; + } + + String json = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(json, new TypeToken(){}.getType()); + + List> resultLists = new ArrayList>(); + List> mapList=(List>) fromJsonList.get("data"); + Map maps=new HashMap(); + List list=new ArrayList(); + Double total=0.0; + for (Map map : mapList) { + Double[] logs=new Double[2]; + Double sum=Double.valueOf(String.valueOf(map.get("sum"))); + Double date=Double.valueOf(String.valueOf(map.get("reportTime"))); + total+=sum; + logs[0]=date; + logs[1]=sum; + list.add(logs); + } + maps.put("sum",total); + maps.put("result", list); + resultLists.add(maps); + resultList=resultLists; + + } catch (Exception e) { + e.printStackTrace(); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } + /** + * Active Client IP 统计图跟列表 + */ + @RequestMapping(value="activeClientIPListNew") + @ResponseBody + public List activeClientIPListNew(Integer entranceId,String timeSize,@RequestParam(value="beginDate",required=false)String beginDate, + Integer[] operator,@RequestParam(value="endDate",required=false)String endDate,String dimension,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List list = new ArrayList(); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_SOURCE_IP_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&flagId=0"; + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(entranceId!=null){ + url=url+"&entranceId="+entranceId; + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + } + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); + list = (ArrayList) fromJsonList.get("data"); + Long totalLink=0l; + Long totalPackets=0l; + Double totalGByte=0d; + DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); + DecimalFormat df = new DecimalFormat("0.0000000000"); + //两个时间段之间的秒数 + double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); + if(!StringUtil.isEmpty(list)){ + for (Object object : list) { + Map m=(Map) object; +// Double value1 = Double.parseDouble(m.get("sIp").toString()); + m.put("sIp", m.get("sIp")); + totalGByte+=Double.parseDouble(m.get("GByte").toString()); + m.put("GByte", df.format(m.get("GByte"))); + m.put("packets", lf.format(m.get("packets"))); + m.put("linkNum", lf.format(m.get("linkNum"))); + double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; + m.put("pps",lf.format(avgPacket)); + double avgByte=Double.parseDouble(m.get("GByte").toString())*8/allSeconds; + m.put("bps",f.format(avgByte)); + totalLink+=Long.parseLong( m.get("linkNum").toString()); + totalPackets+=Long.parseLong(m.get("packets").toString()); + } + for (Object object : list) { + Map m=(Map) object; + m.put("totalLink", totalLink); + m.put("totalPackets", totalPackets); + m.put("totalGByte", totalGByte); + } + } + + } catch (Exception e) { + e.printStackTrace(); + logger.error("ClientIP据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return list; + } + + //跳转client IP趋势图页面 + @RequestMapping("clientIPTransList") + public String clientIPTransList(Model model,String sIp,String beginDate,String endDate,String timeSize, + String chartType,String dimension,String area,String operator){ + model.addAttribute("timeSize", timeSize); + model.addAttribute("sIp", sIp); + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + model.addAttribute("chartType_1", chartType); + model.addAttribute("operator", operator); + model.addAttribute("dimension", dimension); + model.addAttribute("area", area); + return "/dashboard/newActiveClientIPTrans"; + } + /** + *client IP 图表数据查询 + */ + @RequestMapping("ajaxClientIPStatistic") + @ResponseBody + public List ajaxClientIPStatistic(String sIp,String timeSize,String area,String dimension,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + List resultList = new ArrayList(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_SOURCE_IP_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&sIp="+sIp; + if(!StringUtil.isEmpty(timeSize)) {//时间粒度 + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(!StringUtil.isEmpty(area)){//地域 + url=url+"&entranceId="+area; + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + } + String json = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(json, new TypeToken(){}.getType()); + + List> resultLists = new ArrayList>(); + List> mapList=(List>) fromJsonList.get("data"); + Map maps=new HashMap(); + List list=new ArrayList(); + Double total=0.0; + for (Map map : mapList) { + Double[] logs=new Double[2]; + Double sum=Double.valueOf(String.valueOf(map.get("sum"))); + Double date=Double.valueOf(String.valueOf(map.get("reportTime"))); + total+=sum; + logs[0]=date; + logs[1]=sum; + list.add(logs); + } + maps.put("sum",total); + maps.put("result", list); + resultLists.add(maps); + resultList=resultLists; + } catch (Exception e) { + e.printStackTrace(); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } + /** + * Active Server IP 统计图跟列表 + */ + @RequestMapping(value="activeServerIPListNew") + @ResponseBody + public List activeServerIPListNew(Integer entranceId,String timeSize,@RequestParam(value="beginDate",required=false)String beginDate, + @RequestParam(value="endDate",required=false)String endDate,String dimension,Integer[] operator,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List list = new ArrayList(); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_DEST_IP_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&flagId=0"; + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(entranceId!=null){ + url=url+"&entranceId="+entranceId; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + } + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); + list = (ArrayList) fromJsonList.get("data"); + Long totalLink=0l; + Long totalPackets=0l; + Double totalGByte=0d; + DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); + DecimalFormat df = new DecimalFormat("0.0000000000"); + //两个时间段之间的秒数 + double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); + if(!StringUtil.isEmpty(list)){ + for (Object object : list) { + Map m=(Map) object; + m.put("dIp", m.get("dIp")); + totalGByte+=Double.parseDouble(m.get("GByte").toString()); + m.put("GByte", df.format(m.get("GByte"))); + m.put("packets", lf.format(m.get("packets"))); + m.put("linkNum", lf.format(m.get("linkNum"))); + double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; + m.put("pps",lf.format(avgPacket)); + double avgByte=Double.parseDouble(m.get("GByte").toString())*8/allSeconds; + m.put("bps",f.format(avgByte)); + totalLink+=Long.parseLong( m.get("linkNum").toString()); + totalPackets+=Long.parseLong(m.get("packets").toString()); + } + for (Object object : list) { + Map m=(Map) object; + m.put("totalLink", totalLink); + m.put("totalPackets", totalPackets); + m.put("totalGByte", totalGByte); + } + } + + } catch (Exception e) { + e.printStackTrace(); + logger.error("ServerIP数据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return list; + } + + //跳转server IP趋势图页面 + @RequestMapping("serverIPTransList") + public String serverIPTransList(Model model,String dIp,String beginDate,String endDate,String timeSize,String operator,String chartType,String dimension,String area){ + model.addAttribute("timeSize", timeSize); + model.addAttribute("dIp", dIp); + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + model.addAttribute("chartType_1", chartType); + model.addAttribute("operator", operator); + model.addAttribute("dimension", dimension); + model.addAttribute("area", area); + return "/dashboard/newActiveServerIPTrans"; + } + /** + *server IP 图表数据查询 + */ + @RequestMapping("ajaxServerIPStatistic") + @ResponseBody + public List ajaxServerIPStatistic(String dIp,String timeSize,String area,String dimension,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + List resultList = new ArrayList(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_DEST_IP_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&dIp="+dIp; + if(!StringUtil.isEmpty(timeSize)) {//时间粒度 + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + + if(!StringUtil.isEmpty(area)){//地域 + url=url+"&entranceId="+area; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + } + String json = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(json, new TypeToken(){}.getType()); + + List> resultLists = new ArrayList>(); + List> mapList=(List>) fromJsonList.get("data"); + Map maps=new HashMap(); + List list=new ArrayList(); + Double total=0.0; + for (Map map : mapList) { + Double[] logs=new Double[2]; + Double sum=Double.valueOf(String.valueOf(map.get("sum"))); + Double date=Double.valueOf(String.valueOf(map.get("reportTime"))); + total+=sum; + logs[0]=date; + logs[1]=sum; + list.add(logs); + } + maps.put("sum",total); + maps.put("result", list); + resultLists.add(maps); + resultList=resultLists; + + } catch (Exception e) { + e.printStackTrace(); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } + + /** + * SubscriberID 统计图跟列表 + */ + @RequestMapping(value="subscriberIDListNew") + @ResponseBody + public List activeSubscriberIDListNew(Integer entranceId,String timeSize,@RequestParam(value="beginDate",required=false)String beginDate, + @RequestParam(value="endDate",required=false)String endDate,String dimension,Integer[] operator,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List list = new ArrayList(); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_SUBSCRIBER_ID_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&flagId=0"; + if(!StringUtil.isEmpty(timeSize)) { + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + if(entranceId!=null){ + url=url+"&entranceId="+entranceId; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + } + String string = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(string, new TypeToken(){}.getType()); + list = (ArrayList) fromJsonList.get("data"); + Long totalLink=0l; + Long totalPackets=0l; + Double totalGByte=0d; + DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); + DecimalFormat df = new DecimalFormat("0.0000000000"); + //两个时间段之间的秒数 + double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); + if(!StringUtil.isEmpty(list)){ + for (Object object : list) { + Map m=(Map) object; + m.put("subscribeId", m.get("subscribeId")); + totalGByte+=Double.parseDouble(m.get("GByte").toString()); + m.put("GByte", df.format(m.get("GByte"))); + m.put("packets", lf.format(m.get("packets"))); + m.put("linkNum", lf.format(m.get("linkNum"))); + double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; + m.put("pps",lf.format(avgPacket)); + double avgByte=Double.parseDouble(m.get("GByte").toString())*8/allSeconds; + m.put("bps",f.format(avgByte)); + totalLink+=Long.parseLong( m.get("linkNum").toString()); + totalPackets+=Long.parseLong(m.get("packets").toString()); + } + for (Object object : list) { + Map m=(Map) object; + m.put("totalLink", totalLink); + m.put("totalPackets", totalPackets); + m.put("totalGByte", totalGByte); + } + } + + /* Map m = new HashMap(); + m.put("subscribeId", "123"); + m.put("GByte", df.format(933749.61)); + m.put("packets", lf.format(986834603595l)); + m.put("linkNum", lf.format(390387318474l)); + m.put("pps",lf.format(380723)); + m.put("bps",f.format(2.88)); + totalLink+=Long.parseLong("390387318474"); + totalPackets+=Long.parseLong("986834603595"); + totalGByte+=Double.parseDouble("933749.61"); + + Map m1 = new HashMap(); + m1.put("subscribeId", "456"); + m1.put("GByte", df.format(29563.84)); + m1.put("packets", lf.format(43623009686l)); + m1.put("linkNum", lf.format(11121127992l)); + m1.put("pps",lf.format(16830)); + m1.put("bps",f.format(0.09)); + totalLink+=Long.parseLong("11121127992"); + totalPackets+=Long.parseLong("43623009686"); + totalGByte+=Double.parseDouble("29563.84"); + + m.put("totalLink", totalLink); + m.put("totalPackets", totalPackets); + m.put("totalGByte", totalGByte); + + m1.put("totalLink", totalLink); + m1.put("totalPackets", totalPackets); + m1.put("totalGByte", totalGByte); + + list.add(m); + list.add(m1);*/ + } catch (Exception e) { + e.printStackTrace(); + logger.error("SubscriberID数据获取错误"+e); + list.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return list; + } + + //跳转SubscriberID趋势图页面 + @RequestMapping("subscriberIDTransList") + public String subscriberIDTransList(Model model,String subscribeId,String beginDate,String endDate,String timeSize,String operator,String chartType,String dimension,String area){ + model.addAttribute("timeSize", timeSize); + model.addAttribute("subscribeId", subscribeId); + model.addAttribute("beginDate", beginDate); + model.addAttribute("endDate", endDate); + model.addAttribute("chartType_1", chartType); + model.addAttribute("operator", operator); + model.addAttribute("dimension", dimension); + model.addAttribute("area", area); + return "/dashboard/newSubscriberIDTrans"; + } + + /** + *SubscriberID 图表数据查询 + */ + @RequestMapping("ajaxSubscriberIDStatistic") + @ResponseBody + public List ajaxSubscriberIDStatistic(String subscribeId,String timeSize,String area,String dimension,Integer[] operator, + @RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,Model model,HttpServletRequest request){ + Map fromJsonList = new HashMap(); + List resultList = new ArrayList(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_SUBSCRIBER_ID_STATISTIC_NEW; + try { + url=urlAddDate(url,beginDate,endDate); + url=url+"&subscribeId="+subscribeId; + if(!StringUtil.isEmpty(timeSize)) {//时间粒度 + /*if(timeSize.equals("1")){ + url=url+"&searchBusinessType=2"; + }else{ + url=url+"&searchBusinessType="+timeSize; + }*/ + url=url+"&searchBusinessType="+timeSize; + }else{ + url=url+"&searchBusinessType=1"; + } + + if(!StringUtil.isEmpty(area)){//地域 + url=url+"&entranceId="+area; + } + if(operator!=null){ + for (Integer oper : operator) { + if(oper!=null){ + url=url+"&deviceId="+oper; + } + } + } + if(dimension.equals("bps")){//统计维度 + url=url+"&searchQuotaType=1"; + }else if(dimension.equals("pps")){ + url=url+"&searchQuotaType=2"; + }else if(dimension.equals("link count")){ + url=url+"&searchQuotaType=3"; + } + String json = HttpClientUtil.get(url); + Gson gson = new GsonBuilder().create(); + fromJsonList = gson.fromJson(json, new TypeToken(){}.getType()); + + List> resultLists = new ArrayList>(); + List> mapList=(List>) fromJsonList.get("data"); + Map maps=new HashMap(); + List list=new ArrayList(); + Double total=0.0; + for (Map map : mapList) { + Double[] logs=new Double[2]; + Double sum=Double.valueOf(String.valueOf(map.get("sum"))); + Double date=Double.valueOf(String.valueOf(map.get("reportTime"))); + total+=sum; + logs[0]=date; + logs[1]=sum; + list.add(logs); + } + maps.put("sum",total); + maps.put("result", list); + resultLists.add(maps); + resultList=resultLists; + /*List> s= new ArrayList>(); + Map s1=new HashMap<>(); + s1.put("sum", "800"); + s1.put("reportTime", "2019-05-17 07:00:00"); + Map s2=new HashMap<>(); + s2.put("sum", "600"); + s2.put("reportTime", "2019-05-17 08:00:00"); + Map s3=new HashMap<>(); + s3.put("sum", "900"); + s3.put("reportTime", "2019-05-17 09:00:00"); + + s.add(s1); + s.add(s2); + s.add(s3); + fromJsonList.put("list", s); + resultList =getList(fromJsonList);*/ + + } catch (Exception e) { + e.printStackTrace(); + resultList.add(Maps.newHashMap("error","request_service_failed")); + LogUtils.saveLog(request, null, e, null); + } + return resultList; + } +} diff --git a/src/main/java/com/nis/web/dao/dashboard/codedic/CodeDomainDicDao.java b/src/main/java/com/nis/web/dao/dashboard/codedic/CodeDomainDicDao.java new file mode 100644 index 000000000..6b705c83d --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/codedic/CodeDomainDicDao.java @@ -0,0 +1,11 @@ +package com.nis.web.dao.dashboard.codedic; + +import java.util.List; + +import com.nis.domain.dashboard.codedic.CodeDomainDic; +import com.nis.web.dao.MyBatisDao; + +@MyBatisDao +public interface CodeDomainDicDao { + List getCodeDicList(); +} diff --git a/src/main/java/com/nis/web/dao/dashboard/codedic/CodeDomainDicDao.xml b/src/main/java/com/nis/web/dao/dashboard/codedic/CodeDomainDicDao.xml new file mode 100644 index 000000000..a839fd2ef --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/codedic/CodeDomainDicDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + id, website_service_id, domain, topic_Id, creator_id, is_valid + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/codedic/ConfigStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/codedic/ConfigStatisticDao.java new file mode 100644 index 000000000..bf4e99414 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/codedic/ConfigStatisticDao.java @@ -0,0 +1,15 @@ +package com.nis.web.dao.dashboard.codedic; + +import com.nis.domain.dashboard.ConfigStatistic; +import com.nis.web.dao.MyBatisDao; + +@MyBatisDao +public interface ConfigStatisticDao { + + + String getCfgDescByCfgId(ConfigStatistic entity); + + String getASNIPCfgDesc(String cfgId); + + String getAPPIPCfgDesc(String cfgId); +} diff --git a/src/main/java/com/nis/web/dao/dashboard/codedic/ConfigStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/codedic/ConfigStatisticDao.xml new file mode 100644 index 000000000..097dfe117 --- /dev/null +++ b/src/main/java/com/nis/web/dao/dashboard/codedic/ConfigStatisticDao.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/statistics/ConfigStatisticService.java b/src/main/java/com/nis/web/service/configuration/statistics/ConfigStatisticService.java new file mode 100644 index 000000000..5cb0650ca --- /dev/null +++ b/src/main/java/com/nis/web/service/configuration/statistics/ConfigStatisticService.java @@ -0,0 +1,37 @@ +package com.nis.web.service.configuration.statistics; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.nis.domain.dashboard.ConfigStatistic; +import com.nis.web.dao.dashboard.codedic.ConfigStatisticDao; +import com.nis.web.service.BaseService; + +@Service +public class ConfigStatisticService extends BaseService{ + + @Autowired + private ConfigStatisticDao configStatisticDao; + + + public String getCfgDescByCfgId(ConfigStatistic entity){ + + String cfgDesc=configStatisticDao.getCfgDescByCfgId(entity); + + return cfgDesc; + } + + public String getASNIPCfgDesc(String cfgId){ + + String cfgDesc=configStatisticDao.getASNIPCfgDesc(cfgId); + + return cfgDesc; + } + + public String getAPPIPCfgDesc(String cfgId){ + + String cfgDesc=configStatisticDao.getAPPIPCfgDesc(cfgId); + + return cfgDesc; + } +} diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 03cc93c14..300096c66 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1589,4 +1589,20 @@ action_manipulate=Manipulate method=Method ddos_log=DDoS other_system_ddos_log_menu=DDoS Attack Chain -other_system_ddos_report_menu=DDoS Statistics \ No newline at end of file +other_system_ddos_report_menu=DDoS Statistics +statistics=Statistics +config_log_total=Configuration Log Total +statis_dimension=Statistics Dimension +time_granularity=Time Granularity +minute=Minute +hour=Hour +year=Year +chart_type=Chart Type +line_chart=Line Chart +bar_chart=Bar Chart +pie_chart=Pie Chart +statistical_content=Statistical Content +statistical_detail=Statistical Detail +statistical_dimension=Statistical Dimension +subscriber_id=Subscriber ID +subscriber_statistical=Subscriber Statistical \ 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 844431d51..7f6525c66 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -547,7 +547,7 @@ ftp_ip=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f dns_ip=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f DNS IP dns_domain=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043e\u043c\u0435\u043d\u0430 DNS action=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 -has_prohibit_delete= только удаляет незаконченные настройки и отменяет проверку конфигурации +has_prohibit_delete=\u807d\u890c\u82af\u8c22\u891c\u6cfb\u82af \u890d\u5199\u90aa\u8c22\u891f\u68b0\u890c \u85aa\u68b0\u87f9\u90aa\u6cfb\u82af\u85aa\u8914\u68b0\u85aa\u85aa\u8918\u68b0 \u85aa\u90aa\u890b\u890c\u8909\u82af\u6cc4\u6cfb\u61c8 \u61c8 \u82af\u890c\u5c51\u68b0\u85aa\u891f\u68b0\u890c \u950c\u8909\u82af\u80c1\u68b0\u8909\u6cfb\u890d \u6cfb\u82af\u85aa\u890e\u61c8\u8c10\u890d\u8909\u90aa\u8911\u61c8\u61c8 has_prohibit_nopass=\u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0430 has_prohibit_pass=\u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0430 multiple_keywords_tip=\u041c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432,\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435 \u0438\u0445 \u043a\u043b\u0430\u0432\u0438\u0448\u0435\u0439 "Enter". @@ -1513,7 +1513,7 @@ admin_user_warn=\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u04 interface_total=\u041e\u0431\u0449\u0435\u0435 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 service_total=\u041e\u0431\u0449\u0435\u0435 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0421\u0435\u0440\u0432\u0438\u0441\u0430 none_file_tip=\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b%21 -the_same_ip_type=IP-\u0430\u0434\u0440\u0435\u0441 \u043A\u043B\u0438\u0435\u043D\u0442\u0430 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043E\u043B\u0436\u043D\u044B \u0438\u043C\u0435\u0442\u044C \u043E\u0434\u0438\u043D \u0438 \u0442\u043E\u0442 \u0436\u0435 \u0442\u0438\u043F. +the_same_ip_type=IP-\u0430\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0442\u0438\u043f. src_ip_pattern=\u0424\u043e\u0440\u043c\u0430\u0442 ip \u041a\u043b\u0438\u0435\u043d\u0442\u0430 dest_ip_pattern=\u0424\u043e\u0440\u043c\u0430\u0442 ip \u0421\u0435\u0440\u0432\u0435\u0440\u0430 src_port_pattern=\u0424\u043e\u0440\u043c\u0430\u0442 \u041f\u043e\u0440\u0442\u0430 \u041a\u043b\u0438\u0435\u043d\u0442\u0430 @@ -1531,7 +1531,7 @@ range_cross=\u041d\u0430\u0439\u0434\u0435\u043d\u044b \u043f\u0435\u0440\u0435\ app_ip_correlation=\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 public_private_file_error=\u041d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e-\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430. https_url_format_tip=URL(http[s]://xxx.xx) -hijack_file_strategy=\u0417\u0430\u0445\u0432\u0430\u0442 \u0444\u0430\u0439\u043B +hijack_file_strategy=\u0417\u0430\u0445\u0432\u0430\u0442 \u0444\u0430\u0439\u043b profile_name=Profile Name file_insert_script=File Insert Script format=Format @@ -1591,4 +1591,20 @@ action_manipulate=Manipulate method=Method ddos_log=DDoS other_system_ddos_log_menu=DDoS Chain Attack -other_system_ddos_report_menu=DDoS Statistics \ No newline at end of file +other_system_ddos_report_menu=DDoS Statistics +statistics=Statistics +config_log_total=Configuration Log Total +statis_dimension=Statistics Dimension +time_granularity=Time Granularity +minute=Minute +hour=Hour +year=Year +chart_type=Chart Type +line_chart=Line Chart +bar_chart=Bar Chart +pie_chart=Pie Chart +statistical_content=Statistical Content +statistical_detail=Statistical Detail +statistical_dimension=Statistical Dimension +subscriber_id=Subscriber ID +subscriber_statistical=Subscriber Statistical \ 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 13d2bd51b..4c19e555b 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -706,7 +706,7 @@ ir_type=\u590d\u7528\u7c7b\u578b dns_strategy_id=DNS\u7b56\u7565ID no_strategy=\u9ed8\u8ba4\u7b56\u7565 domain=\u57df\u540d -app_ip_config=APP\u534F\u8BAEIP\u914D\u7F6E +app_ip_config=APP\u534f\u8baeIP\u914d\u7f6e bytes=\u5b57\u8282 app_http_config=APP HTTP\u7279\u5f81 app_domain_config=APP\u57df\u540d\u7279\u5f81 @@ -1134,10 +1134,10 @@ label_proto_source=\u534f\u8bae\u6765\u6e90 label_behav_source=\u884c\u4e3a\u6765\u6e90 label_app_source=\u5e94\u7528\u6765\u6e90 packet=\u5305 -stream=\u6D41 +stream=\u6d41 protocol_menu=Protocol advanced=Advanced -protocol_identify=\u57FA\u7840\u534F\u8BAE +protocol_identify=\u57fa\u7840\u534f\u8bae MM_FILE_DIGEST=\u6587\u4ef6\u6458\u8981 NTC_ASN_IP=ASN NTC_STREAMING_MEDIA_URL=URL @@ -1255,9 +1255,9 @@ user_behavior_data=\u7528\u6237\u7edf\u8ba1 ip_behavior_data=\u7528\u6237IP\u7edf\u8ba1 not_valid_domain=%s\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u57df\u540d cert_not_match_domain=\u57df\u540d\u4e0e\u6240\u9009\u8bc1\u4e66\u4fe1\u606f\u4e0d\u7b26\u5408\uff01 -certificate_file_error=\u8BC1\u4E66\u683C\u5F0F\u9519\u8BEF +certificate_file_error=\u8bc1\u4e66\u683c\u5f0f\u9519\u8bef PXY_OBJ_TRUSTED_CA_CERT=\u53ef\u4fe1\u8bc1\u4e66 -crl_file_error=CRL\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF +crl_file_error=CRL\u6587\u4ef6\u683c\u5f0f\u9519\u8bef crl_issuer_error=crl\u6587\u4ef6\u7684issuer\u4e0e\u8bc1\u4e66\u6587\u4ef6\u7684issuer\u4e0d\u5339\u914d cert_name=\u8bc1\u4e66\u540d\u79f0 add_crl_file=Add CRL File @@ -1508,14 +1508,14 @@ 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 -unapproved_all=\u5ba1\u6838\u4E0D\u901a\u8fc7\u6240\u6709\u914d\u7f6e! +unapproved_all=\u5ba1\u6838\u4e0d\u901a\u8fc7\u6240\u6709\u914d\u7f6e! delete_all=\u5220\u9664\u6240\u6709\u914d\u7f6e! -none_file_tip=\u8BF7\u9009\u62E9\u6587\u4EF6! +none_file_tip=\u8bf7\u9009\u62e9\u6587\u4ef6! the_same_ip_type=\u6e90IP\u4e0e\u76ee\u7684IP\u7684IP\u7c7b\u578b\u5fc5\u987b\u76f8\u540c -src_ip_pattern=\u6E90IP\u683C\u5F0F -dest_ip_pattern=\u76EE\u7684IP\u683C\u5F0F -src_port_pattern=\u6E90\u7AEF\u53E3\u683C\u5F0F -dest_port_pattern=\u76EE\u7684\u7AEF\u53E3\u683C\u5F0F +src_ip_pattern=\u6e90IP\u683c\u5f0f +dest_ip_pattern=\u76ee\u7684IP\u683c\u5f0f +src_port_pattern=\u6e90\u7aef\u53e3\u683c\u5f0f +dest_port_pattern=\u76ee\u7684\u7aef\u53e3\u683c\u5f0f url_group_configuration=URL \u5206\u7ec4\u914d\u7f6e dns_keyword_group_configuration=DNS \u5173\u952e\u5b57\u5206\u7ec4\u914d\u7f6e app_ip_correlation=APP IP \u901a\u8054 @@ -1525,68 +1525,84 @@ common_group=Common \u5206\u7ec4 dns_keyword_group_manage=DNS \u5173\u952e\u5b57\u5206\u7ec4\u7ba1\u7406 old_asn_group_manage=ASN \u5206\u7ec4 url_group_manage=URL \u5206\u7ec4 \u7ba1\u7406 -range_cross=\u6E90IP\u4E0E\u76EE\u7684IP\u8303\u56F4\u6709\u4EA4\u53C9 -app_ip_correlation=APP\u5173\u8054\u7279\u5F81IP\u914D\u7F6E -public_private_file_error=\u516C\u79C1\u94A5\u8BC1\u4E66\u4E0D\u5339\u914D +range_cross=\u6e90IP\u4e0e\u76ee\u7684IP\u8303\u56f4\u6709\u4ea4\u53c9 +app_ip_correlation=APP\u5173\u8054\u7279\u5f81IP\u914d\u7f6e +public_private_file_error=\u516c\u79c1\u94a5\u8bc1\u4e66\u4e0d\u5339\u914d https_url_format_tip=URL(http[s]://xxx.xx) -hijack_file_strategy=\u52AB\u6301\u6587\u4EF6 -profile_name=\u6587\u4EF6\u540D\u79F0 -file_insert_script=\u6CE8\u5165\u811A\u672C\u6587\u4EF6 -format=\u683C\u5F0F -file_quote_disable_delete=\u6587\u4EF6\u88AB\u5F15\u7528 \u4E0D\u53EF\u5220\u9664 -vlan=\u865A\u62DF\u5C40\u57DF\u7F51 +hijack_file_strategy=\u52ab\u6301\u6587\u4ef6 +profile_name=\u6587\u4ef6\u540d\u79f0 +file_insert_script=\u6ce8\u5165\u811a\u672c\u6587\u4ef6 +format=\u683c\u5f0f +file_quote_disable_delete=\u6587\u4ef6\u88ab\u5f15\u7528 \u4e0d\u53ef\u5220\u9664 +vlan=\u865a\u62df\u5c40\u57df\u7f51 mac=MAC\u5730\u5740 -mirror_addr_list=\u76EE\u6807\u6807\u8BC6\u5217\u8868 -mirror_addr_type=\u76EE\u6807\u6807\u8BC6\u7C7B\u578B -target_name=\u76EE\u6807\u540D\u79F0 -traffic_mirror_address=\u6D41\u91CF\u8F6C\u53D1\u76EE\u7684\u5730\u5740 -content_name=\u5185\u5BB9\u540D\u79F0 -visit_response_page=\u8BBF\u95EE\u963B\u65AD\u9875\u9762 -none_profile_tip=\u8BF7\u9009\u62E9\u6587\u4EF6! +mirror_addr_list=\u76ee\u6807\u6807\u8bc6\u5217\u8868 +mirror_addr_type=\u76ee\u6807\u6807\u8bc6\u7c7b\u578b +target_name=\u76ee\u6807\u540d\u79f0 +traffic_mirror_address=\u6d41\u91cf\u8f6c\u53d1\u76ee\u7684\u5730\u5740 +content_name=\u5185\u5bb9\u540d\u79f0 +visit_response_page=\u8bbf\u95ee\u963b\u65ad\u9875\u9762 +none_profile_tip=\u8bf7\u9009\u62e9\u6587\u4ef6! #---------------------------pxy intercept------------------------------------ -min_should_less_than_max=\u6700\u5C0FSSL\u7248\u672C\u5E94\u5C0F\u4E8E\u6700\u5927SSL\u7248\u672C -exclusions_ev_cert=\u6392\u9664EV\u8BC1\u4E66 -exclusions_cert_transparency=\u6392\u9664\u8BC1\u4E66\u900F\u660E -exclusions_client_cert_req=\u6392\u9664\u5BA2\u6237\u7AEF\u8BC1\u4E66\u8BF7\u6C42 +min_should_less_than_max=\u6700\u5c0fSSL\u7248\u672c\u5e94\u5c0f\u4e8e\u6700\u5927SSL\u7248\u672c +exclusions_ev_cert=\u6392\u9664EV\u8bc1\u4e66 +exclusions_cert_transparency=\u6392\u9664\u8bc1\u4e66\u900f\u660e +exclusions_client_cert_req=\u6392\u9664\u5ba2\u6237\u7aef\u8bc1\u4e66\u8bf7\u6c42 exclusions_pinning=\u6392\u9664Pinning -cert_verify_approach_cn=\u63A5\u8FD1CN -cert_verify_approach_issuer=\u63A5\u8FD1\u53D1\u5E03\u8005 -cert_verify_approach_self_signed=\u63A5\u8FD1\u81EA\u7B7E\u540D -cert_verify_approach_expiration=\u63A5\u8FD1\u8FC7\u671F -cert_verify_fail_method=\u5931\u8D25\u65B9\u6CD5 -ssl_ver_min=\u6700\u5C0FSSL\u7248\u672C -ssl_ver_max=\u6700\u5927SSL\u7248\u672C -ssl_ver_mirror_client=\u955C\u50CF\u5BA2\u6237\u7AEF -ssl_ver_allow_http2= \u5141\u8BB8 Http2 -decrypt_mirror_enable=\u542F\u7528\u955C\u50CF -decrypt_mirror_mirror_profile=\u955C\u50CF\u6982\u8981 +cert_verify_approach_cn=\u63a5\u8fd1CN +cert_verify_approach_issuer=\u63a5\u8fd1\u53d1\u5e03\u8005 +cert_verify_approach_self_signed=\u63a5\u8fd1\u81ea\u7b7e\u540d +cert_verify_approach_expiration=\u63a5\u8fd1\u8fc7\u671f +cert_verify_fail_method=\u5931\u8d25\u65b9\u6cd5 +ssl_ver_min=\u6700\u5c0fSSL\u7248\u672c +ssl_ver_max=\u6700\u5927SSL\u7248\u672c +ssl_ver_mirror_client=\u955c\u50cf\u5ba2\u6237\u7aef +ssl_ver_allow_http2= \u5141\u8bb8 Http2 +decrypt_mirror_enable=\u542f\u7528\u955c\u50cf +decrypt_mirror_mirror_profile=\u955c\u50cf\u6982\u8981 exclusions=\u6392\u9664 -ev_cert=EV\u8BC1\u4E66 -cert_transparency=\u8BC1\u4E66\u900F\u660E -client_cert_req=\u5BA2\u6237\u7AEF\u8BC1\u4E66\u8BF7\u6C42 +ev_cert=EV\u8bc1\u4e66 +cert_transparency=\u8bc1\u4e66\u900f\u660e +client_cert_req=\u5ba2\u6237\u7aef\u8bc1\u4e66\u8bf7\u6c42 pinning=Pinning cn=CN -self_signed=\u81EA\u7B7E\u540D -expiration=\u8FC7\u671F -approach=\u63A5\u8FD1 -cert_verify=\u8BC1\u4E66\u9A8C\u8BC1 -ssl_version=SSL\u7248\u672C -mirror_client=\u955C\u50CF\u5BA2\u6237\u7AEF -allow_http2=\u5141\u8BB8 Http2 -min=\u6700\u5C0F +self_signed=\u81ea\u7b7e\u540d +expiration=\u8fc7\u671f +approach=\u63a5\u8fd1 +cert_verify=\u8bc1\u4e66\u9a8c\u8bc1 +ssl_version=SSL\u7248\u672c +mirror_client=\u955c\u50cf\u5ba2\u6237\u7aef +allow_http2=\u5141\u8bb8 Http2 +min=\u6700\u5c0f max=\u6700\u5927 -decrypt_mirror=\u89E3\u5BC6\u955C\u50CF -enable=\u542F\u7528 +decrypt_mirror=\u89e3\u5bc6\u955c\u50cf +enable=\u542f\u7528 forward=Forward -decrypt_mirror_enable_on=\u5982\u679C\u542F\u52A8\u9009\u9879\u7684\u503C\u662F1\uFF0C\u5219\u955C\u50CF\u6587\u4EF6\u9009\u9879\u9700\u8981\u9009\u62E9 -ssl_ver_mirror_client_on=\u5982\u679C\u955C\u50CF\u5BA2\u6237\u7AEF\u9009\u9879\u7684\u503C\u662F1\uFF0C\u5219\u6700\u5927\u6700\u5C0FSSL\u7248\u672C\u53F7\u4F1A\u88AB\u5FFD\u7565 +decrypt_mirror_enable_on=\u5982\u679c\u542f\u52a8\u9009\u9879\u7684\u503c\u662f1\uff0c\u5219\u955c\u50cf\u6587\u4ef6\u9009\u9879\u9700\u8981\u9009\u62e9 +ssl_ver_mirror_client_on=\u5982\u679c\u955c\u50cf\u5ba2\u6237\u7aef\u9009\u9879\u7684\u503c\u662f1\uff0c\u5219\u6700\u5927\u6700\u5c0fSSL\u7248\u672c\u53f7\u4f1a\u88ab\u5ffd\u7565 #---------------------------Proxy Manipulate------------------------------------ -profile_info=\u6587\u4EF6 -http_manipulation=HTTP(S)\u64CD\u63A7 -action_hijack=\u52AB\u6301 -action_insert=\u6CE8\u5165 -action_manipulate=\u64CD\u63A7 -method=\u65B9\u6CD5 +profile_info=\u6587\u4ef6 +http_manipulation=HTTP(S)\u64cd\u63a7 +action_hijack=\u52ab\u6301 +action_insert=\u6ce8\u5165 +action_manipulate=\u64cd\u63a7 +method=\u65b9\u6cd5 ddos_log=DDoS -other_system_ddos_log_menu=DDoS\u653B\u51FB\u94FE -other_system_ddos_report_menu=DDoS\u653B\u51FB\u6001\u52BF \ No newline at end of file +other_system_ddos_log_menu=DDoS\u653b\u51fb\u94fe +other_system_ddos_report_menu=DDoS\u653b\u51fb\u6001\u52bf +statistics=\u7edf\u8ba1 +config_log_total=\u914d\u7f6e\u65e5\u5fd7\u603b\u91cf +statis_dimension=\u7edf\u8ba1\u7ef4\u5ea6 +time_granularity=\u65f6\u95f4\u7c92\u5ea6 +minute=\u5206\u949f +hour=\u5c0f\u65f6 +year=\u5e74 +chart_type=\u56fe\u8868\u7c7b\u578b +line_chart=\u6298\u7ebf\u56fe +bar_chart=\u6761\u5f62\u56fe +pie_chart=\u997c\u56fe +statistical_content=\u7edf\u8ba1\u5185\u5bb9 +statistical_detail=\u7edf\u8ba1\u660e\u7ec6 +statistical_dimension=\u7edf\u8ba1\u7ef4\u5ea6 +subscriber_id=\u7528\u6237 +subscriber_statistical=\u7528\u6237\u7edf\u8ba1 \ No newline at end of file diff --git a/src/main/resources/sql/20190529/add_menu.sql b/src/main/resources/sql/20190529/add_menu.sql new file mode 100644 index 000000000..1fdd53e79 --- /dev/null +++ b/src/main/resources/sql/20190529/add_menu.sql @@ -0,0 +1,3 @@ + +#实时报表-流量统计下新增的统计菜单 +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 ( '875', '0,1,780,875,', 'statistics', 'Statistics', '39', '/dashboard/traffic/configStatistic', '', '', '1', '', '1', '2019-05-06 14:07:08', '1', '2019-05-27 15:24:41', '', '1', NULL, '0', '0', NULL); diff --git a/src/main/webapp/WEB-INF/views/dashboard/commonNew.jsp b/src/main/webapp/WEB-INF/views/dashboard/commonNew.jsp new file mode 100644 index 000000000..f33b2484e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/commonNew.jsp @@ -0,0 +1,1028 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+ + + + + +
+
+
+
+
+ +
+
+
+
+ +
+ + +
+
+
+
+
+ +
+ + +
+
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+ +
+
+ +
+ + +
+
+
+ + +
+ href="javascript:;"> + + +
+
+ + +
+ + +
+ +
+
+ +
+ + + + <%@include file="/WEB-INF/views/dashboard/newConfigStatistic.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newActionList.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newBandWidthList.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newProtocolTypeList.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newAppTypeList.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newDomainsList.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newActiveClientIPList.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newActiveServerIPList.jsp"%> + + + <%@include file="/WEB-INF/views/dashboard/newSubscriberIDList.jsp"%> + +
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/configStatisticTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/configStatisticTrans.jsp new file mode 100644 index 000000000..0565e4b70 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/configStatisticTrans.jsp @@ -0,0 +1,389 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + <spring:message code="config_statistics"></spring:message> + + + + + +
+ +
+ + + + + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newActionList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newActionList.jsp new file mode 100644 index 000000000..759af3d08 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newActionList.jsp @@ -0,0 +1,399 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + +
+ + + + +<%-- --%> + +<%-- --%> + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newActiveClientIPList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newActiveClientIPList.jsp new file mode 100644 index 000000000..b17dcf137 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newActiveClientIPList.jsp @@ -0,0 +1,647 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+
+
+
+ + +
+ +
+
+
+
+
+ + + + + + + + + + + + + +
+
/ ,
+
  
+
+
+ + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newActiveClientIPTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/newActiveClientIPTrans.jsp new file mode 100644 index 000000000..5283d3100 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newActiveClientIPTrans.jsp @@ -0,0 +1,366 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newActiveServerIPList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newActiveServerIPList.jsp new file mode 100644 index 000000000..cca13f828 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newActiveServerIPList.jsp @@ -0,0 +1,647 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+
+
+
+ + +
+ +
+
+
+
+
+ + + + + + + + + + + + + +
+
/ ,
+
  
+
+
+ + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newActiveServerIPTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/newActiveServerIPTrans.jsp new file mode 100644 index 000000000..9fc74ac62 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newActiveServerIPTrans.jsp @@ -0,0 +1,366 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newAppTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/newAppTrans.jsp new file mode 100644 index 000000000..a980d738c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newAppTrans.jsp @@ -0,0 +1,368 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newAppTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newAppTypeList.jsp new file mode 100644 index 000000000..34f5ef09a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newAppTypeList.jsp @@ -0,0 +1,703 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+
+
+
+ + +
+ +
+
+
+
+
+ + + + + + + + + + + + + + + +
  
+
/ ,
+
  
+
+
+ + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newBandWidthList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newBandWidthList.jsp new file mode 100644 index 000000000..f79368ee6 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newBandWidthList.jsp @@ -0,0 +1,561 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +<%-- --%> + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newConfigStatistic.jsp b/src/main/webapp/WEB-INF/views/dashboard/newConfigStatistic.jsp new file mode 100644 index 000000000..b197a2ce6 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newConfigStatistic.jsp @@ -0,0 +1,66 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +
+ +
+ + + + + + + + + + + + + + + + + +
${log.cfgId}${log.cfgDesc }${log.sum }
+
${page}
+ +
+ +
+ + + + + + diff --git a/src/main/webapp/WEB-INF/views/dashboard/newDomainTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/newDomainTrans.jsp new file mode 100644 index 000000000..d78c53340 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newDomainTrans.jsp @@ -0,0 +1,387 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + <spring:message code="domain_name"></spring:message> + + + + + +
+
+ + + + + + + + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newDomainsList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newDomainsList.jsp new file mode 100644 index 000000000..d056a45dd --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newDomainsList.jsp @@ -0,0 +1,665 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + + + +
+ +
+
+
+ + + +
+
+
+ + +
+ +
+
+
+
+
+ + + + + + + + + + + + + + + +
  
+ +
/ ,
+
  
+ +
+ +
+ + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newProtocolTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newProtocolTypeList.jsp new file mode 100644 index 000000000..8b953df73 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newProtocolTypeList.jsp @@ -0,0 +1,699 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + + +
+
+
+
+
+ + + <%--
+ +
--%> +
+
+
+
+ + + + + + + + + <%-- --%> + + + <%-- --%> + + + <%-- --%> + + + +
   () () ()
+
/ ,
+
  
+
+
+ + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newProtocolsTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/newProtocolsTrans.jsp new file mode 100644 index 000000000..8284fcc06 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newProtocolsTrans.jsp @@ -0,0 +1,368 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newSubscriberIDList.jsp b/src/main/webapp/WEB-INF/views/dashboard/newSubscriberIDList.jsp new file mode 100644 index 000000000..f18d0413b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newSubscriberIDList.jsp @@ -0,0 +1,647 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+
+
+
+ + +
+ +
+
+
+
+
+ + + + + + + + + + + + + +
+
/ ,
+
  
+
+
+ + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/newSubscriberIDTrans.jsp b/src/main/webapp/WEB-INF/views/dashboard/newSubscriberIDTrans.jsp new file mode 100644 index 000000000..8cc48b1ec --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/newSubscriberIDTrans.jsp @@ -0,0 +1,366 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + + +<%-- --%> + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/static/global/scripts/pzLog.js b/src/main/webapp/static/global/scripts/pzLog.js index dc84db96e..5d52c64b3 100644 --- a/src/main/webapp/static/global/scripts/pzLog.js +++ b/src/main/webapp/static/global/scripts/pzLog.js @@ -679,3 +679,243 @@ function logSearch(cfgId,serviceId){ } /*======================新增按照需求指定时间范围,如取到天、小时等end=====================================*/ + + +//************************************时间粒度为 5分钟 小时 天 月 年 时间的切换*********************** +function getTimeDiffsDate(granule,unit,date){ + var diff=date; + switch(unit){ + case 'h'://小时为单位 + diff.setHours(diff.getHours()-granule); + break; + case 'd'://天为单位 + diff.setDate(diff.getDate()-granule); + break; + case 'm'://月为单位 + diff.setMonth(diff.getMonth()-granule); + break; + case 'y'://年为单位 + diff.setFullYear(diff.getFullYear()-granule); + break; + default: + diff.setHours(diff.getHours()-granule); + } + + return diff; +} +/*======================新增按照需求指定时间范围,如取到天、小时等start=====================================*/ +//startTimeSelector:输入框开始时间选择器; +//endTimeSelector:输入框结束时间选择器; +//granule:时间粒度(数字); +//unit:时间粒度单位(h-小时,d-天,w-周,m-月,y-年); +//formate:时间格式;默认格式:yyyy-MM-dd hh:mm:ss +//future:选择的时间是否可以为未来时间 true or false 默认false(不能为未来时间) +//formatParm有效时间范围参数:yyyy-MM-dd HH例如时间范围限制到小时:yyyy-MM-dd HH:00:00;yyyy-MM-dd例如时间范围限制到天:yyyy-MM-dd 00:00:00 +function setEndTimeByFormats(startTimeSelector,endTimeSelector,granule,unit,formate,future,formatParm){ + + 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" + } + var endStr=""; + if(strIsBlank(formatParm)){ + formatParm = formate; + }else{ + if((formate.length-formatParm.length) == 3){ + endStr=":00"; + }else if((formate.length-formatParm.length) == 6){ + endStr=":00:00"; + }else if((formate.length-formatParm.length) == 9){ + endStr=" 00:00:00"; + }else if((formate.length-formatParm.length) == 12){ + endStr="-01 00:00:00"; + }else if((formate.length-formatParm.length) == 15){ + endStr="-01-01 00:00:00"; + }else{ + endStr=""; + } + } + + if(future==null || future==undefined){ + future=false; + } + var startTimeVal=$(startTimeSelector).val(); + var endTimeVal=$(endTimeSelector).val(); + //alert(startTimeVal); + //alert(endTimeVal); + //alert(startTimeVal.substr(0,formatParm.length-1); + 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); + startTime = new Date(dateFtt(formatParm,startTime)+endStr); + endTime = new Date(dateFtt(formatParm,endTime)+endStr); + if(unit =='y'){ + if(endTime.getFullYear()-startTime.getFullYear()>granule||endTime.getTime()-startTime.getTime()<=0){ + var timeChange=dateFtt(formate,endTime); + startTime=getTimeDiffsDate(granule,unit,new Date(timeChange)); + } + }else{ + if(endTime.getTime()-startTime.getTime()>diff||endTime.getTime()-startTime.getTime()<=0){//startTime不在时间粒度之内 + var timeChange=dateFtt(formate,endTime); + startTime=getTimeDiffsDate(granule,unit,new Date(timeChange)); +// startTime=new Date(endTime.getTime()-diff); + } + } + } + + }else{ + if(strIsBlank(startTimeVal)){//startTime and endTime 都为空 + endTime=new Date(); + if(unit =='y'){ + var timeChange=dateFtt(formate,endTime); + startTime=getTimeDiffsDate(1,unit,new Date(timeChange)); + }else{ + startTime=new Date(endTime.getTime()-diff); + } + }else{//startTime 不为空,endTime为空 + setStartTimeByFormats(startTimeSelector,endTimeSelector,granule,unit,formate,future); + return; + } + } + + $(startTimeSelector).val(dateFtt(formatParm,startTime)+endStr); + $(endTimeSelector).val(dateFtt(formatParm,endTime)+endStr); + +} + +//startTimeSelector:输入框开始时间选择器; +//endTimeSelector:输入框结束时间选择器; +//granule:时间粒度(数字); +//unit:时间粒度单位(h-小时,d-天,w-周,m-月); +//formate:时间格式;默认格式:yyyy-MM-dd hh:mm:ss +//future:选择的时间是否可以为未来时间 true or false 默认false(不能为未来时间) +function setStartTimeByFormats(startTimeSelector,endTimeSelector,granule,unit,formate,future,formatParm){ + + 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" + } + + var endStr=""; + if(strIsBlank(formatParm)){ + formatParm = formate; + }else{ + if((formate.length-formatParm.length) == 3){ + endStr=":00"; + }else if((formate.length-formatParm.length) == 6){ + endStr=":00:00"; + }else if((formate.length-formatParm.length) == 9){ + endStr=" 00:00:00"; + }else if((formate.length-formatParm.length) == 12){ + endStr="-01 00:00:00"; + }else if((formate.length-formatParm.length) == 15){ + endStr="-01-01 00:00:00"; + }else{ + endStr=""; + } + } + 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{ + startTime = new Date(dateFtt(formatParm,startTime)+endStr); + endTime=new Date(startTime.getTime()+diff); + } + }else{//startTime和endTime都不为空 + endTime=new Date(endTimeVal); + startTime = new Date(dateFtt(formatParm,startTime)+endStr); + endTime = new Date(dateFtt(formatParm,endTime)+endStr); + if(unit =='y'){ + if(endTime.getFullYear()-startTime.getFullYear()>granule||endTime.getTime()-startTime.getTime()<=0){//endTime不在时间粒度之内 + + if(startTime.getFullYear()+granule>new Date().getFullYear()){ + endTime=new Date(); + var timeChange=new Date(); + startTime=getTimeDiffsDate(1,unit,timeChange); + }else{ + endTime.setFullYear(startTime.getFullYear()+granule); + } + } + }else{ + if(endTime.getTime()-startTime.getTime()>diff||endTime.getTime()-startTime.getTime()<=0){//endTime不在时间粒度之内 + + if(startTime.getTime()+diff>currentTime){ + endTime=new Date(); + var timeChange=new Date(); + startTime=getTimeDiffsDate(1,unit,timeChange); + }else{ + if(unit =='y' ){ + endTime.setFullYear(startTime.getFullYear()+1); + }else if(unit =='m' && granule==12){ + endTime.setFullYear(startTime.getFullYear()+1); + endTime.setMonth(startTime.getMonth()); + }else{ + endTime=new Date(startTime.getTime()+diff); + } + } + } + } + + } + }else{ + if(strIsBlank(endTimeVal)){//startTime和endTime 都为空 + endTime=new Date(); + startTime=new Date(endTime.getTime()-diff); + + }else{ + setEndTimeByFormats(startTimeSelector,endTimeSelector,granule,unit,formate,future); + return; + } + } + $(startTimeSelector).val(dateFtt(formatParm,startTime)+endStr); + $(endTimeSelector).val(dateFtt(formatParm,endTime)+endStr); +} + +