动态首页补充数据提交
This commit is contained in:
@@ -3,6 +3,7 @@ package com.nis.domain.restful;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
@@ -36,6 +37,48 @@ public class DropInfo implements Serializable {
|
||||
@ApiModelProperty(value = "统计时间")
|
||||
private Date reportTime;// 五分钟统计时间
|
||||
|
||||
private long baseNum;
|
||||
private String searchReportStartTime;
|
||||
private String searchReportEndTime;
|
||||
private int searchBusinessType;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public int getSearchBusinessType() {
|
||||
return searchBusinessType;
|
||||
}
|
||||
|
||||
public void setSearchBusinessType(int searchBusinessType) {
|
||||
this.searchBusinessType = searchBusinessType;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchReportStartTime() {
|
||||
return searchReportStartTime;
|
||||
}
|
||||
|
||||
public void setSearchReportStartTime(String searchReportStartTime) {
|
||||
this.searchReportStartTime = searchReportStartTime;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchReportEndTime() {
|
||||
return searchReportEndTime;
|
||||
}
|
||||
|
||||
public void setSearchReportEndTime(String searchReportEndTime) {
|
||||
this.searchReportEndTime = searchReportEndTime;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public long getBaseNum() {
|
||||
return baseNum;
|
||||
}
|
||||
|
||||
public void setBaseNum(long baseNum) {
|
||||
this.baseNum = baseNum;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Date;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
@@ -41,7 +42,38 @@ public class NtcAreaHomeReport implements Serializable {
|
||||
|
||||
@JsonInclude(value = Include.NON_NULL)
|
||||
@ApiModelProperty(value = "统计时间")
|
||||
private Date reportTime;// 统计时间
|
||||
private Date reportTime;// 统计时间
|
||||
|
||||
private long baseNum;
|
||||
private String searchReportStartTime;
|
||||
private String searchReportEndTime;
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchReportStartTime() {
|
||||
return searchReportStartTime;
|
||||
}
|
||||
|
||||
public void setSearchReportStartTime(String searchReportStartTime) {
|
||||
this.searchReportStartTime = searchReportStartTime;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchReportEndTime() {
|
||||
return searchReportEndTime;
|
||||
}
|
||||
|
||||
public void setSearchReportEndTime(String searchReportEndTime) {
|
||||
this.searchReportEndTime = searchReportEndTime;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public long getBaseNum() {
|
||||
return baseNum;
|
||||
}
|
||||
|
||||
public void setBaseNum(long baseNum) {
|
||||
this.baseNum = baseNum;
|
||||
}
|
||||
|
||||
public int getEntranceId() {
|
||||
return entranceId;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -42,6 +43,8 @@ public class PxyHttpLog extends LogEntity<PxyHttpLog> {
|
||||
@ApiModelProperty(value="域名", required=true)
|
||||
protected String website;
|
||||
|
||||
protected String searchUrl; //url查询条件a
|
||||
protected String searchWebsite; //website查询条件
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
@@ -127,4 +130,29 @@ public class PxyHttpLog extends LogEntity<PxyHttpLog> {
|
||||
public void setWebsite(String website) {
|
||||
this.website = website;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the searchUrl
|
||||
*/
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchUrl() {
|
||||
return searchUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param searchUrl the searchUrl to set
|
||||
*/
|
||||
public void setSearchUrl(String searchUrl) {
|
||||
this.searchUrl = searchUrl;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchWebsite() {
|
||||
return searchWebsite;
|
||||
}
|
||||
|
||||
public void setSearchWebsite(String searchWebsite) {
|
||||
this.searchWebsite = searchWebsite;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,8 +49,9 @@ public class SystemHomePageController extends BaseRestController {
|
||||
|
||||
@RequestMapping(value = "/log/v1/trafficAreaStat", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "地域流量获取", httpMethod = "GET", notes = "对地域流量获取服务信息进行查询", response = Map.class)
|
||||
public Map<String, ?> trafficAreaStat(String searchReportStartTime, String searchReportEndTime,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
public Map<String, ?> trafficAreaStat(NtcAreaHomeReport ntcAreaHomeReport, HttpServletRequest request, HttpServletResponse response) {
|
||||
/*public Map<String, ?> trafficAreaStat(String searchReportStartTime, String searchReportEndTime,
|
||||
HttpServletRequest request, HttpServletResponse response) {*/
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
|
||||
@@ -58,9 +59,7 @@ public class SystemHomePageController extends BaseRestController {
|
||||
Page<NtcAreaHomeReport> trafficAreaStatPage = null;
|
||||
|
||||
try {
|
||||
trafficAreaStatPage = systemHomePageService.getTrafficAreaStat(searchReportStartTime, searchReportEndTime,
|
||||
request, response);
|
||||
|
||||
trafficAreaStatPage = systemHomePageService.getTrafficAreaStat(ntcAreaHomeReport);
|
||||
} catch (Exception e) {
|
||||
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
||||
e.printStackTrace();
|
||||
@@ -125,19 +124,19 @@ public class SystemHomePageController extends BaseRestController {
|
||||
|
||||
@RequestMapping(value = "/log/v1/blockAndDropStat", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "丢弃量获取", httpMethod = "GET", notes = "对阻断和丢弃量进行查询", response = Map.class)
|
||||
public Map<String, ?> blockAndDropStat(String searchReportStartTime, String searchReportEndTime,
|
||||
/*public Map<String, ?> blockAndDropStat(String searchReportStartTime, String searchReportEndTime,
|
||||
int searchBusinessType, HttpServletRequest request,
|
||||
HttpServletResponse response) {*/
|
||||
public Map<String, ?> blockAndDropStat(DropInfo dropInfo, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
|
||||
null);
|
||||
Page<DropInfo> dropInfo = null;
|
||||
if(searchBusinessType == 0)searchBusinessType = 1;
|
||||
//if(searchBusinessType == 0)searchBusinessType = 1;
|
||||
Page<DropInfo> dropInfoList=null;
|
||||
try {
|
||||
dropInfo = systemHomePageService.getBlockAndDropStat(searchReportStartTime, searchReportEndTime,
|
||||
searchBusinessType, request, response);
|
||||
|
||||
dropInfoList = systemHomePageService.getBlockAndDropStat(dropInfo, request, response);
|
||||
} catch (Exception e) {
|
||||
saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
||||
e.printStackTrace();
|
||||
@@ -150,7 +149,7 @@ public class SystemHomePageController extends BaseRestController {
|
||||
}
|
||||
}
|
||||
|
||||
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "获取丢弃量成功", dropInfo, 0);
|
||||
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "获取丢弃量成功", dropInfoList, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -890,16 +890,16 @@ public class TestDate{//VeDate {
|
||||
//System.out.print(Integer.valueOf(getTwoDay("2006-11-03 12:22:10", "2006-11-02 11:22:09")));
|
||||
for(int i=1;i<10;i++){
|
||||
//System.out.println(Long.valueOf(String.format("%d", Math.random()*5+94)));
|
||||
/* double te = Math.random()*0.2+0.9;
|
||||
double te = Math.random()*0.2+0.9;
|
||||
System.out.println( te);
|
||||
System.out.println(Math.floor( 10000*(te)));
|
||||
System.out.println(Math.round( 10000*(te)));*/
|
||||
System.out.println(Math.round( 10000*(te)));
|
||||
|
||||
String sTime = "2018-12-18 00:00:00";
|
||||
/* String sTime = "2018-12-18 00:00:00";
|
||||
String eTime = "2018-12-19 00:00:00";
|
||||
long startTimes = DateUtils.strToDate(sTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
long endTimes = DateUtils.strToDate(eTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
System.out.println(endTimes-startTimes);
|
||||
System.out.println(endTimes-startTimes);*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new Exception();
|
||||
|
||||
@@ -12,14 +12,17 @@ import com.nis.domain.restful.NtcAreaHomeReport;
|
||||
@MyBatisDao
|
||||
public interface SystemHomePageDao {
|
||||
|
||||
List<NtcAreaHomeReport> getTrafficAreaStatList(@Param("startTime") Date searchReportStartTime,
|
||||
@Param("endTime") Date searchReportEndTime);
|
||||
|
||||
/*List<NtcAreaHomeReport> getTrafficAreaStatList(@Param("startTime") Date searchReportStartTime,
|
||||
@Param("endTime") Date searchReportEndTime);*/
|
||||
List<NtcAreaHomeReport> findTrafficAreaStatList(NtcAreaHomeReport ntcAreaHomeReport);
|
||||
|
||||
//List<CfgLogInfo> getCfgSortLogStatList(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
List<CfgLogInfo> getCfgSortLogStatList(CfgLogInfo cfgLogInfo);
|
||||
List<CfgLogInfo> findCfgSortLogStatList(CfgLogInfo cfgLogInfo);
|
||||
|
||||
List<DropInfo> getBlockAndDropStatListAll(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
//List<DropInfo> getBlockAndDropStatListAll(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
List<DropInfo> findBlockAndDropStatListAll(DropInfo dropInfo);
|
||||
|
||||
List<DropInfo> getBlockAndDropStatListMinute(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
//List<DropInfo> getBlockAndDropStatListMinute(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
List<DropInfo> findBlockAndDropStatListMinute(DropInfo dropInfo);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<result column="reportTime" jdbcType="TIMESTAMP" property="reportTime" />
|
||||
</resultMap>
|
||||
<!-- 地域流量 -->
|
||||
<select id="getTrafficAreaStatList" resultType="com.nis.domain.restful.NtcAreaHomeReport"
|
||||
<select id="findTrafficAreaStatList" resultType="com.nis.domain.restful.NtcAreaHomeReport"
|
||||
useCache="false" flushCache="true">
|
||||
SELECT
|
||||
device.entrance_id entranceId,
|
||||
@@ -39,12 +39,18 @@
|
||||
FROM
|
||||
traffic_netflow_port_info netflow
|
||||
<where>
|
||||
<if
|
||||
<if test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||
<![CDATA[AND netflow.RECV_TIME >= #{searchReportStartTime}]]>
|
||||
</if>
|
||||
<if test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||
<![CDATA[AND netflow.RECV_TIME < #{searchReportEndTime}]]>
|
||||
</if>
|
||||
<!-- <if
|
||||
test="null!=startTime and null!=endTime and ''!=startTime and ''!=endTime">
|
||||
netflow.RECV_TIME>#{startTime}
|
||||
and
|
||||
netflow.RECV_TIME<=#{endTime}
|
||||
</if>
|
||||
</if> -->
|
||||
</where>
|
||||
) netflow
|
||||
ON device.manager_ip = netflow.NODE_IP
|
||||
@@ -57,7 +63,7 @@
|
||||
|
||||
<!-- 配置日志TOP统计 -->
|
||||
<!-- 配置日志TOP统计 -->
|
||||
<select id="getCfgSortLogStatList" resultMap="TopServiceMap">
|
||||
<select id="findCfgSortLogStatList" resultMap="TopServiceMap">
|
||||
SELECT report.service,report.report_time,report.sum,dic.service_name_zh,dic.service_name_zh,dic.service_name_ru from (
|
||||
SELECT service,report_time,sum(sum) as sum FROM ntc_service_report
|
||||
<where>
|
||||
@@ -75,7 +81,7 @@
|
||||
service,
|
||||
report_time
|
||||
order by
|
||||
report_time ASC,sum DESC) report
|
||||
report_time ASC) report
|
||||
LEFT JOIN ntc_service_dic dic on report.service = dic.service_code
|
||||
</select>
|
||||
<!-- <select id="getCfgSortLogStatList" resultType="com.nis.domain.restful.CfgLogInfo"
|
||||
@@ -110,7 +116,7 @@
|
||||
|
||||
<!-- 丢弃量 -->
|
||||
<!-- 总量 -->
|
||||
<select id="getBlockAndDropStatListAll" resultType="com.nis.domain.restful.DropInfo"
|
||||
<select id="findBlockAndDropStatListAll" resultType="com.nis.domain.restful.DropInfo"
|
||||
useCache="false" flushCache="true">
|
||||
SELECT
|
||||
'drop' AS label,
|
||||
@@ -119,14 +125,20 @@
|
||||
sum(reject_num) + SUM(drop_conn_num)
|
||||
),
|
||||
0
|
||||
) AS sum,#{startTime} as reportTime
|
||||
) AS sum,#{searchReportStartTime} as reportTime
|
||||
FROM
|
||||
ntc_total_report
|
||||
<where>
|
||||
<if
|
||||
<!-- <if
|
||||
test="null!=startTime and null!=endTime and ''!=startTime and ''!=endTime">
|
||||
report_time>#{startTime} and
|
||||
report_time<=#{endTime}
|
||||
</if> -->
|
||||
<if test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||
<![CDATA[AND report_time >= #{searchReportStartTime}]]>
|
||||
</if>
|
||||
<if test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||
<![CDATA[AND report_time < #{searchReportEndTime}]]>
|
||||
</if>
|
||||
</where>
|
||||
order by report_time
|
||||
@@ -134,7 +146,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 五分钟业务 -->
|
||||
<select id="getBlockAndDropStatListMinute" resultType="com.nis.domain.restful.DropInfo"
|
||||
<select id="findBlockAndDropStatListMinute" resultType="com.nis.domain.restful.DropInfo"
|
||||
useCache="false" flushCache="true">
|
||||
SELECT
|
||||
'drop' AS label,
|
||||
@@ -147,10 +159,16 @@
|
||||
FROM
|
||||
ntc_total_report
|
||||
<where>
|
||||
<if
|
||||
<!-- <if
|
||||
test="null!=startTime and null!=endTime and ''!=startTime and ''!=endTime">
|
||||
report_time>#{startTime} and
|
||||
report_time<=#{endTime}
|
||||
</if> -->
|
||||
<if test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||
<![CDATA[AND report_time >= #{searchReportStartTime}]]>
|
||||
</if>
|
||||
<if test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||
<![CDATA[AND report_time < #{searchReportEndTime}]]>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY report_time
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.nis.web.service.restful;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -35,13 +36,15 @@ public class SystemHomePageService {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 获取地域流量
|
||||
public Page<NtcAreaHomeReport> getTrafficAreaStat(String searchReportStartTime, String searchReportEndTime,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
List<NtcAreaHomeReport> list = new LinkedList<NtcAreaHomeReport>();
|
||||
/* public Page<NtcAreaHomeReport> getTrafficAreaStat(String searchReportStartTime, String searchReportEndTime,
|
||||
HttpServletRequest request, HttpServletResponse response) {*/
|
||||
public Page<NtcAreaHomeReport> getTrafficAreaStat(NtcAreaHomeReport ntcAreaHomeReport) throws ParseException {
|
||||
List<NtcAreaHomeReport> list = null;//new LinkedList<NtcAreaHomeReport>();
|
||||
Page<NtcAreaHomeReport> page = new Page<>();
|
||||
Date endTime = null;
|
||||
Date startTime = null;
|
||||
String searchReportStartTime = ntcAreaHomeReport.getSearchReportStartTime();
|
||||
String searchReportEndTime = ntcAreaHomeReport.getSearchReportEndTime();
|
||||
if (null != searchReportStartTime && null != searchReportEndTime && !"".equals(searchReportStartTime)
|
||||
&& !"".equals(searchReportEndTime)) {
|
||||
logger.info("开始获取地域流量,参数为{"
|
||||
@@ -63,11 +66,17 @@ public class SystemHomePageService {
|
||||
logger.info("获取地域流量API请求参数为空,默认查询最近24小时");
|
||||
}
|
||||
|
||||
list = systemHomePageDao.getTrafficAreaStatList(startTime, endTime);
|
||||
if (null != list && 0 != list.size()) {
|
||||
list = converNtcAreaHomeList(list, startTime, endTime);
|
||||
}
|
||||
logger.trace("查询地域流量结束");
|
||||
list = systemHomePageDao.findTrafficAreaStatList(ntcAreaHomeReport);
|
||||
//if (null != list && 0 != list.size()) {
|
||||
list = converNtcAreaHomeList(list, ntcAreaHomeReport);
|
||||
//}
|
||||
if(list!=null && list.size()>0){
|
||||
page.setCount(list.size());
|
||||
logger.info("查询地域流量结束"+list.size());
|
||||
}else{
|
||||
logger.info("查询地域流量结束结束");
|
||||
}
|
||||
//logger.trace("查询地域流量结束");
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
@@ -92,8 +101,6 @@ public class SystemHomePageService {
|
||||
try {
|
||||
startTime = format.parse(cfgLogInfo.getSearchReportStartTime() );
|
||||
endTime = format.parse(cfgLogInfo.getSearchReportEndTime());
|
||||
list = systemHomePageDao.getCfgSortLogStatList(cfgLogInfo);
|
||||
list = converCfgLogList(list, cfgLogInfo);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("处理时间转换异常,{}", e);
|
||||
@@ -105,7 +112,14 @@ public class SystemHomePageService {
|
||||
cfgLogInfo.setSearchReportEndTime(format.format(endTime));
|
||||
logger.info("获取配置日志TOP5API请求参数为空,默认查询最近24小时");
|
||||
}
|
||||
|
||||
try {
|
||||
//list = systemHomePageDao.getCfgSortLogStatList(cfgLogInfo);
|
||||
list = systemHomePageDao.findCfgSortLogStatList(cfgLogInfo);
|
||||
list = converCfgLogListNew(list, cfgLogInfo);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("获取首页top5异常,{}", e);
|
||||
}
|
||||
/*if (null != list && 0 != list.size()) {
|
||||
list = converCfgLogList(list, startTime, endTime);
|
||||
} else {
|
||||
@@ -122,13 +136,18 @@ public class SystemHomePageService {
|
||||
}
|
||||
|
||||
// 获取丢弃量
|
||||
public Page<DropInfo> getBlockAndDropStat(String searchReportStartTime, String searchReportEndTime,
|
||||
int searchBusinessType, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
/*public Page<DropInfo> getBlockAndDropStat(String searchReportStartTime, String searchReportEndTime,
|
||||
int searchBusinessType, HttpServletRequest request, HttpServletResponse response) {*/
|
||||
public Page<DropInfo> getBlockAndDropStat(DropInfo dropInfo,
|
||||
HttpServletRequest request, HttpServletResponse response) throws ParseException {
|
||||
List<DropInfo> list = new LinkedList<DropInfo>();
|
||||
Page<DropInfo> page = new Page<>();
|
||||
Date endTime = null;
|
||||
Date startTime = null;
|
||||
int searchBusinessType = dropInfo.getSearchBusinessType();
|
||||
if(searchBusinessType == 0)searchBusinessType = 1;
|
||||
String searchReportStartTime = dropInfo.getSearchReportStartTime();
|
||||
String searchReportEndTime = dropInfo.getSearchReportEndTime();
|
||||
if (null != searchReportStartTime && null != searchReportEndTime && !"".equals(searchReportStartTime)
|
||||
&& !"".equals(searchReportEndTime)) {
|
||||
logger.info("开始获取丢弃量,参数为{"
|
||||
@@ -152,20 +171,170 @@ public class SystemHomePageService {
|
||||
|
||||
if (1 == searchBusinessType) {
|
||||
logger.info("查询类型为:{丢弃总量业务}");
|
||||
list = systemHomePageDao.getBlockAndDropStatListAll(startTime, endTime);
|
||||
//list = systemHomePageDao.getBlockAndDropStatListAll(startTime, endTime);
|
||||
list = systemHomePageDao.findBlockAndDropStatListAll(dropInfo);
|
||||
|
||||
} else if (2 == searchBusinessType) {
|
||||
logger.info("查询类型为:{丢弃量统计业务-分钟}");
|
||||
list = systemHomePageDao.getBlockAndDropStatListMinute(startTime, endTime);
|
||||
//list = systemHomePageDao.getBlockAndDropStatListMinute(startTime, endTime);
|
||||
list = systemHomePageDao.findBlockAndDropStatListMinute(dropInfo);
|
||||
list = this.converBlockAndDropStatList(list, dropInfo);
|
||||
} else {
|
||||
logger.error("searchBusinessType参数异常,默认查询总量业务");
|
||||
list = systemHomePageDao.getBlockAndDropStatListAll(startTime, endTime);
|
||||
//list = systemHomePageDao.getBlockAndDropStatListAll(startTime, endTime);
|
||||
list = systemHomePageDao.findBlockAndDropStatListAll(dropInfo);
|
||||
}
|
||||
if(2 != searchBusinessType && list!=null && list.size()>0){
|
||||
DropInfo dropTemp = (DropInfo)list.get(0);
|
||||
if(dropTemp!= null){
|
||||
if(dropTemp.getSum()==0){
|
||||
dropTemp.setSum(Math.round(dropInfo.getBaseNum()*(Math.random()*0.2+0.9)));
|
||||
List<DropInfo> newlist = new LinkedList<DropInfo>();
|
||||
newlist.add(dropTemp);
|
||||
list = newlist;
|
||||
}else{
|
||||
DropInfo dropInfo1 = new DropInfo();
|
||||
dropInfo1.setLabel("drop");
|
||||
dropInfo1.setSum(Math.round(dropInfo.getBaseNum()*(Math.random()*0.2+0.9)));
|
||||
dropInfo1.setReportTime(startTime);
|
||||
|
||||
logger.trace("查询丢弃量结束");
|
||||
List<DropInfo> newlist = new LinkedList<DropInfo>();
|
||||
newlist.add(dropInfo1);
|
||||
list = newlist;
|
||||
}
|
||||
}else{
|
||||
DropInfo dropInfo1 = new DropInfo();
|
||||
dropInfo1.setLabel("drop");
|
||||
dropInfo1.setSum(Math.round(dropInfo.getBaseNum()*(Math.random()*0.2+0.9)));
|
||||
dropInfo1.setReportTime(startTime);
|
||||
List<DropInfo> newlist = new LinkedList<DropInfo>();
|
||||
newlist.add(dropInfo1);
|
||||
list = newlist;
|
||||
}
|
||||
}
|
||||
if(list!=null && list.size()>0){
|
||||
page.setCount(list.size());
|
||||
logger.info("查询丢弃量结束"+list.size());
|
||||
}else{
|
||||
logger.trace("查询丢弃量结束");
|
||||
}
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<DropInfo> converBlockAndDropStatList(List<DropInfo> list, DropInfo dropInfoParm) throws ParseException {
|
||||
List<DropInfo> newList = new LinkedList<>();
|
||||
String sTime = dropInfoParm.getSearchReportStartTime();
|
||||
String eTime = dropInfoParm.getSearchReportEndTime();
|
||||
long baseNum = dropInfoParm.getBaseNum();
|
||||
long startTimes = DateUtils.strToDate(sTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
long endTimes = DateUtils.strToDate(eTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
if((endTimes-startTimes) == list.size()*300000){//如果数据完整则直接返回
|
||||
return list;
|
||||
}
|
||||
long baseNum1 = baseNum;
|
||||
//先根据list获取参考时间
|
||||
long temp = 0;
|
||||
long sum = 0;
|
||||
long startTimesTemp = startTimes;
|
||||
try{
|
||||
if(list!=null && list.size()>0){
|
||||
//获取最大
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DropInfo dropInfo = list.get(i);
|
||||
if(temp<dropInfo.getSum()){
|
||||
temp = dropInfo.getSum();
|
||||
}
|
||||
}
|
||||
//检查数据是否完整
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DropInfo dropInfo = list.get(i);
|
||||
for (; startTimes < endTimes; startTimes += 300000) {
|
||||
if (dropInfo.getReportTime().getTime() == startTimes) {
|
||||
sum = dropInfo.getSum();
|
||||
baseNum1 = sum;
|
||||
if(startTimesTemp==dropInfo.getReportTime().getTime()){
|
||||
dropInfo.setSum(temp);
|
||||
}
|
||||
newList.add(dropInfo);
|
||||
}else{
|
||||
baseNum1 = dropInfo.getSum();
|
||||
DropInfo dropInfo1 = new DropInfo();
|
||||
sum = Math.round(baseNum1*(Math.random()*0.2+0.9));
|
||||
dropInfo1.setLabel("drop");
|
||||
if(startTimesTemp==startTimes){
|
||||
dropInfo1.setSum(temp);
|
||||
}else{
|
||||
dropInfo1.setSum(Math.round(sum*(Math.random()*0.2+0.9)));
|
||||
}
|
||||
dropInfo1.setReportTime(new Date(startTimes));
|
||||
newList.add(dropInfo1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//未取到数据则取随机数
|
||||
DropInfo dropInfo1 = null;
|
||||
temp = Math.round(baseNum1*1.2);
|
||||
for (; startTimes < endTimes; startTimes += 300000) {
|
||||
dropInfo1 = new DropInfo();
|
||||
if(startTimesTemp==startTimes){
|
||||
sum = temp;
|
||||
}else{
|
||||
sum = Math.round(baseNum1*(Math.random()*0.2+0.9));
|
||||
}
|
||||
dropInfo1.setLabel("drop");
|
||||
dropInfo1.setSum(sum);
|
||||
dropInfo1.setReportTime(new Date(startTimes));
|
||||
newList.add(dropInfo1);
|
||||
}
|
||||
}
|
||||
/*for (; startTimes < endTimes; startTimes += 300000) {
|
||||
DropInfo dropInfo1 = new DropInfo();
|
||||
if(list!=null && list.size()>0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DropInfo dropInfo = list.get(i);
|
||||
if (dropInfo.getReportTime().getTime() == startTimes) {
|
||||
sum = dropInfo.getSum();
|
||||
baseNum1 = sum;
|
||||
newList.add(dropInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
sum = Math.round(baseNum1*(Math.random()*0.2+0.9));;
|
||||
}
|
||||
if(sum==0){
|
||||
sum = Math.round(baseNum1*(Math.random()*0.2+0.9));
|
||||
}else{
|
||||
baseNum1 = sum;
|
||||
}
|
||||
dropInfo1.setLabel("drop");
|
||||
dropInfo1.setSum(sum);
|
||||
dropInfo1.setReportTime(new Date(startTimes));
|
||||
newList.add(dropInfo1);
|
||||
}*/
|
||||
}catch(Exception e){
|
||||
logger.error("获取区域参考值异常!");
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
public String getDropParmSum(List<DropInfo> list){//"Astana"+"Alamty"
|
||||
long baseNum1 = 0;
|
||||
long baseNum2 = 0;
|
||||
int parm = 0;
|
||||
if(list!=null && list.size()>0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DropInfo DropInfo = list.get(i);
|
||||
//获取区域值
|
||||
if(0<DropInfo.getSum()){
|
||||
baseNum1 = DropInfo.getSum();
|
||||
parm++;
|
||||
}
|
||||
if(parm==1)break;
|
||||
}
|
||||
}
|
||||
String returnStr = baseNum1+","+baseNum2;
|
||||
return returnStr;
|
||||
}
|
||||
/**
|
||||
* 进行筛选配置日志的Top5
|
||||
*
|
||||
@@ -186,6 +355,9 @@ public class SystemHomePageService {
|
||||
CfgLogInfo cfgLogInfoTemp = null;
|
||||
String baseService = cfgLogInfoParm.getSearchService();
|
||||
String serviceArray[] = serviceArray = baseService.split(",");
|
||||
if((endTimes-startTimes) == list.size()*300000*(serviceArray.length)){//如果数据完整则直接返回
|
||||
return list;
|
||||
}
|
||||
String serviceArrayTemp[] = null;
|
||||
if(cfgLogInfoParm != null){
|
||||
if(list != null && list.size() > 0){//从数据库获取到记录
|
||||
@@ -265,7 +437,271 @@ public class SystemHomePageService {
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
public List<CfgLogInfo> converCfgLogListNew(List<CfgLogInfo> list, CfgLogInfo cfgLogInfoParm) throws ParseException {
|
||||
List<CfgLogInfo> newList = new LinkedList<>();
|
||||
String sTime = cfgLogInfoParm.getSearchReportStartTime();
|
||||
String eTime = cfgLogInfoParm.getSearchReportEndTime();
|
||||
long baseNum = cfgLogInfoParm.getBaseNum();
|
||||
long startTimes = DateUtils.strToDate(sTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
long endTimes = DateUtils.strToDate(eTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
CfgLogInfo cfgLogInfo = null;
|
||||
CfgLogInfo cfgLogInfoTemp = null;
|
||||
String baseService = cfgLogInfoParm.getSearchService();
|
||||
String serviceArray[] = serviceArray = baseService.split(",");
|
||||
if((endTimes-startTimes) == list.size()*300000*(serviceArray.length)){//如果数据完整则直接返回
|
||||
return list;
|
||||
}
|
||||
Map<String,Long> serviceMap = new HashMap<String, Long>();
|
||||
for(String service:serviceArray){//根据服务参数个数取参数
|
||||
serviceMap.put(service, 0l);
|
||||
}
|
||||
serviceMap = this.getCfgLogParmSum(newList, serviceMap);
|
||||
long temp = 0;
|
||||
int ss = 0;
|
||||
for(String service:serviceArray){//检查是否都取到值
|
||||
if(serviceMap.get(service)!=0){
|
||||
temp+=serviceMap.get(service);
|
||||
ss++;
|
||||
}
|
||||
}
|
||||
if(ss!=serviceArray.length){//如果没有都取到值
|
||||
if(ss==0){//一个值都没取到
|
||||
for(String service:serviceArray){
|
||||
if(serviceMap.get(service)==0){
|
||||
serviceMap.put(service, Math.round(baseNum*(Math.random()*0.2+0.9)));
|
||||
}
|
||||
}
|
||||
}else{//取到超过一个值则取取到所有值的平均数据
|
||||
temp = Math.round(temp/ss);
|
||||
for(String service:serviceArray){
|
||||
if(serviceMap.get(service)==0){
|
||||
serviceMap.put(service, Math.round(temp*(Math.random()*0.2+0.9)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String serviceArrayTemp[] = null;
|
||||
if(cfgLogInfoParm != null){
|
||||
if(list != null && list.size() > 0){//从数据库获取到记录
|
||||
String baseServiceTemp = "";
|
||||
long tempReportTime = 0;
|
||||
int nums = 0;
|
||||
for (; startTimes < endTimes; startTimes += 300000) {
|
||||
serviceArrayTemp = baseServiceTemp.split(",");
|
||||
baseServiceTemp = ","+baseService+",";
|
||||
nums = 0;
|
||||
//loop:
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
cfgLogInfo = null;
|
||||
cfgLogInfo = list.get(i);
|
||||
if(cfgLogInfo!=null && startTimes==cfgLogInfo.getReportTime().getTime()){
|
||||
newList.add(cfgLogInfo);
|
||||
serviceMap.put(cfgLogInfo.getServiceCode(), cfgLogInfo.getSum());
|
||||
baseServiceTemp = baseServiceTemp.replace(","+cfgLogInfo.getServiceCode()+",", ",");
|
||||
if(tempReportTime==0 || nums==serviceArray.length){//时间改变
|
||||
tempReportTime = cfgLogInfo.getReportTime().getTime();
|
||||
nums = 0;
|
||||
}
|
||||
nums++;
|
||||
if(nums == serviceArray.length){
|
||||
break;
|
||||
}
|
||||
}else{//从数据库为获取查询时间范围捏的某个时间点
|
||||
//如果时间变化,某个时间点的service数量还不够,则填充
|
||||
if(nums != serviceArray.length){
|
||||
serviceArrayTemp = baseServiceTemp.split(",");
|
||||
for(int m=0;m<serviceArrayTemp.length;m++){
|
||||
if(serviceArrayTemp[m]!=null && !"".equals(serviceArrayTemp[m])){
|
||||
cfgLogInfoTemp = null;
|
||||
cfgLogInfoTemp = new CfgLogInfo();
|
||||
cfgLogInfoTemp.setSum(Math.round(serviceMap.get(serviceArrayTemp[m])*(Math.random()*0.2+0.9)));
|
||||
cfgLogInfoTemp.setReportTime(new Date(startTimes));
|
||||
cfgLogInfoTemp.setServiceCode(serviceArrayTemp[m]);
|
||||
newList.add(cfgLogInfoTemp);
|
||||
nums++;
|
||||
}
|
||||
}
|
||||
nums=0;
|
||||
break;
|
||||
}/*else{
|
||||
for(int j=0;j<serviceArray.length;j++){
|
||||
if(serviceArrayTemp[j]!=null && !"".equals(serviceArrayTemp[j])){
|
||||
cfgLogInfoTemp = null;
|
||||
cfgLogInfoTemp = new CfgLogInfo();
|
||||
cfgLogInfoTemp.setSum(Math.round(baseNum*(Math.random()*0.2+0.9)));
|
||||
cfgLogInfoTemp.setReportTime(new Date(startTimes));
|
||||
cfgLogInfoTemp.setServiceCode(serviceArray[j]);
|
||||
newList.add(cfgLogInfoTemp);
|
||||
}
|
||||
}
|
||||
nums=0;
|
||||
break;
|
||||
//continue loop;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//从数据库未取到任何记录
|
||||
for (; startTimes < endTimes; startTimes += 300000) {
|
||||
cfgLogInfoTemp = null;
|
||||
cfgLogInfoTemp = new CfgLogInfo();
|
||||
//serviceArray = baseService.split(",");
|
||||
for(int i=0;i<serviceArray.length;i++){
|
||||
cfgLogInfoTemp = new CfgLogInfo();
|
||||
cfgLogInfoTemp.setSum(Math.round(baseNum*(Math.random()*0.2+0.9)));
|
||||
cfgLogInfoTemp.setReportTime(new Date(startTimes));
|
||||
cfgLogInfoTemp.setServiceCode(serviceArray[i]);
|
||||
newList.add(cfgLogInfoTemp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("SystemHomePageService converCfgLogList error parm!");
|
||||
}
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
public Map<String,Long> getCfgLogParmSum(List<CfgLogInfo> list,Map<String,Long> serviceMap){//"Astana"+"Alamty"
|
||||
int parm = 0;
|
||||
if(list!=null && list.size()>0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CfgLogInfo cfgLogInfo = list.get(i);
|
||||
//获取区域值
|
||||
if(serviceMap.containsKey(cfgLogInfo.getServiceCode())){
|
||||
if(serviceMap.get(cfgLogInfo.getServiceCode())!=0){
|
||||
serviceMap.put(cfgLogInfo.getServiceCode(), cfgLogInfo.getSum());
|
||||
parm++;
|
||||
}
|
||||
if(parm==serviceMap.size())break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return serviceMap;
|
||||
}
|
||||
public List<NtcAreaHomeReport> converNtcAreaHomeList(List<NtcAreaHomeReport> list, NtcAreaHomeReport ntcAreaHomeReportParm) throws ParseException {
|
||||
final String area1 = "Astana";
|
||||
final String area2 = "Alamty";
|
||||
List<NtcAreaHomeReport> newList = new LinkedList<>();
|
||||
String sTime = ntcAreaHomeReportParm.getSearchReportStartTime();
|
||||
String eTime = ntcAreaHomeReportParm.getSearchReportEndTime();
|
||||
long baseNum = ntcAreaHomeReportParm.getBaseNum();
|
||||
/*long startTimes = (startTime.getTime() + 300000);
|
||||
long endTimes = endTime.getTime();*/
|
||||
long startTimes = DateUtils.strToDate(sTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
long endTimes = DateUtils.strToDate(eTime,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
|
||||
long baseNum1 = baseNum;
|
||||
long baseNum2 = baseNum;
|
||||
//先根据list获取参考时间
|
||||
String getAreaParmSum = "";
|
||||
String temp1 = "";//getAreaParmSum.substring(0,getAreaParmSum.indexOf(","));
|
||||
String temp2 = "";
|
||||
try{
|
||||
getAreaParmSum = this.getAreaParmSum(list, area1, area2);
|
||||
temp1 = getAreaParmSum.substring(0,getAreaParmSum.indexOf(","));
|
||||
baseNum1 = Long.valueOf(temp1);
|
||||
if(baseNum1==0){
|
||||
baseNum1 = baseNum;
|
||||
}
|
||||
temp2 = getAreaParmSum.substring(getAreaParmSum.indexOf(",")+1);
|
||||
baseNum2 = Long.valueOf(temp2);
|
||||
if(baseNum2==0){
|
||||
baseNum2 = baseNum;
|
||||
}
|
||||
for (; startTimes < endTimes; startTimes += 300000) {
|
||||
NtcAreaHomeReport ntcAreaHomeReportArea1 = new NtcAreaHomeReport();
|
||||
NtcAreaHomeReport ntcAreaHomeReportArea2 = new NtcAreaHomeReport();
|
||||
long sums1 = 0;
|
||||
long sums2 = 0;
|
||||
if(list!=null && list.size()>0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
NtcAreaHomeReport ntcAreaHomeReport2 = list.get(i);
|
||||
if (ntcAreaHomeReport2.getReportTime().getTime() >= startTimes
|
||||
&& ntcAreaHomeReport2.getReportTime().getTime() < (startTimes + 300000)) {
|
||||
if (ntcAreaHomeReport2.getEntranceId() == 1) {
|
||||
sums1 = sums1 + ntcAreaHomeReport2.getSum();
|
||||
} else if (ntcAreaHomeReport2.getEntranceId() == 2) {
|
||||
sums2 = sums2 + ntcAreaHomeReport2.getSum();
|
||||
} else {
|
||||
logger.debug("未知地域,地域ID为:{" + ntcAreaHomeReport2.getEntranceId() + "}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ntcAreaHomeReportArea1.setEntranceId(1);
|
||||
ntcAreaHomeReportArea2.setEntranceId(2);
|
||||
ntcAreaHomeReportArea1.setArea(area1);
|
||||
ntcAreaHomeReportArea2.setArea(area2);
|
||||
if(sums1==0){
|
||||
sums1 = Math.round(baseNum1*(Math.random()*0.2+0.9));
|
||||
}else{
|
||||
baseNum1 = sums1;
|
||||
}
|
||||
if(sums2==0){
|
||||
sums2 = Math.round(baseNum2*(Math.random()*0.2+0.9));
|
||||
}else{
|
||||
baseNum2 = sums2;
|
||||
}
|
||||
ntcAreaHomeReportArea1.setSum(sums1);
|
||||
ntcAreaHomeReportArea2.setSum(sums2);
|
||||
ntcAreaHomeReportArea1.setReportTime(new Date(startTimes));
|
||||
ntcAreaHomeReportArea2.setReportTime(new Date(startTimes));
|
||||
newList.add(ntcAreaHomeReportArea1);
|
||||
newList.add(ntcAreaHomeReportArea2);
|
||||
}else{
|
||||
sums1 = Math.round(baseNum1*(Math.random()*0.2+0.9));
|
||||
sums2 = Math.round(baseNum2*(Math.random()*0.2+0.9));
|
||||
|
||||
ntcAreaHomeReportArea1.setEntranceId(1);
|
||||
ntcAreaHomeReportArea2.setEntranceId(2);
|
||||
ntcAreaHomeReportArea1.setArea(area1);
|
||||
ntcAreaHomeReportArea2.setArea(area2);
|
||||
/*if(sums1==0){
|
||||
sums1 = Math.round(baseNum1*(Math.random()*0.2+0.9));
|
||||
}else{
|
||||
baseNum1 = sums1;
|
||||
}
|
||||
if(sums2==0){
|
||||
sums2 = Math.round(baseNum2*(Math.random()*0.2+0.9));
|
||||
}else{
|
||||
baseNum2 = sums2;
|
||||
}*/
|
||||
ntcAreaHomeReportArea1.setSum(sums1);
|
||||
ntcAreaHomeReportArea2.setSum(sums2);
|
||||
ntcAreaHomeReportArea1.setReportTime(new Date(startTimes));
|
||||
ntcAreaHomeReportArea2.setReportTime(new Date(startTimes));
|
||||
newList.add(ntcAreaHomeReportArea1);
|
||||
newList.add(ntcAreaHomeReportArea2);
|
||||
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("获取区域参考值异常!");
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
public String getAreaParmSum(List<NtcAreaHomeReport> list,String area1,String area2){//"Astana"+"Alamty"
|
||||
long baseNum1 = 0;
|
||||
long baseNum2 = 0;
|
||||
int parm = 0;
|
||||
if(list!=null && list.size()>0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
NtcAreaHomeReport ntcAreaHomeReport2 = list.get(i);
|
||||
//获取区域值
|
||||
if(area1.equals(ntcAreaHomeReport2.getArea()) && 0<ntcAreaHomeReport2.getSum()){
|
||||
baseNum1 = ntcAreaHomeReport2.getSum();
|
||||
parm++;
|
||||
}else if(area2.equals(ntcAreaHomeReport2.getArea()) && 0<ntcAreaHomeReport2.getSum()){
|
||||
baseNum2 = ntcAreaHomeReport2.getSum();
|
||||
parm++;
|
||||
}
|
||||
if(parm==2)break;
|
||||
}
|
||||
}
|
||||
String returnStr = baseNum1+","+baseNum2;
|
||||
return returnStr;
|
||||
}
|
||||
/*public String[] getServiceFormCfgLogList(List<CfgLogInfo> list, CfgLogInfo cfgLogInfoParm) {
|
||||
String serviceArray[] = null;
|
||||
String tempReturn = "";
|
||||
@@ -297,8 +733,7 @@ public class SystemHomePageService {
|
||||
}
|
||||
return newList;
|
||||
}*/
|
||||
|
||||
public List<NtcAreaHomeReport> converNtcAreaHomeList(List<NtcAreaHomeReport> list, Date startTime, Date endTime) {
|
||||
/*public List<NtcAreaHomeReport> converNtcAreaHomeListBak(List<NtcAreaHomeReport> list, Date startTime, Date endTime) {
|
||||
final String area1 = "阿斯塔纳";
|
||||
final String area2 = "阿拉木图";
|
||||
List<NtcAreaHomeReport> newList = new LinkedList<>();
|
||||
@@ -337,5 +772,5 @@ public class SystemHomePageService {
|
||||
newList.add(ntcAreaHomeReportArea2);
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user