流量统计app.协议。域名增加多条件查询,主题统计series中算法第二级数据增加排序功能,保证界面数据规律排序
This commit is contained in:
@@ -312,14 +312,14 @@ public class DashboardServiceController extends BaseRestController {
|
||||
*/
|
||||
@RequestMapping(value = "trafficProtocolList", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "协议统计占比与报表", httpMethod = "GET", notes = "对应协议统计详情占比与报表")
|
||||
public Map<String, ?> trafficProtocolList(String beginDate, String endDate, Model model, HttpServletRequest request,
|
||||
public Map<String, ?> trafficProtocolList(Integer[] protoType,String beginDate, String endDate, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
|
||||
null);
|
||||
List<HashMap> list = new ArrayList<HashMap>();
|
||||
try {
|
||||
List<Map> ipActiveList = dashboardService.getProtocolList(beginDate, endDate);
|
||||
List<Map> ipActiveList = dashboardService.getProtocolList(beginDate, endDate,protoType);
|
||||
if (ipActiveList != null && ipActiveList.size() > 0) {
|
||||
String jsonString = JsonMapper.toJsonString(ipActiveList);
|
||||
list = (java.util.List<HashMap>) JsonMapper.fromJsonList(jsonString, HashMap.class);
|
||||
@@ -507,7 +507,7 @@ public class DashboardServiceController extends BaseRestController {
|
||||
*/
|
||||
@RequestMapping(value = "trafficAppList", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "App统计占比与报表", httpMethod = "GET", notes = "对应App统计详情占比与报表")
|
||||
public Map<String, ?> trafficAppList(Integer appType, String beginDate, String endDate, Model model,
|
||||
public Map<String, ?> trafficAppList(Integer[] appType, String beginDate, String endDate, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
|
||||
@@ -697,7 +697,7 @@ public class DashboardServiceController extends BaseRestController {
|
||||
|
||||
@RequestMapping(value = "trafficWebsiteListNoTime", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "网站流量分析详情统计", httpMethod = "GET", notes = "对应网站http分类显示")
|
||||
public Map<String, ?> trafficWebsiteListNoTime(Integer domain,Integer entranceId , @RequestParam String beginDate, @RequestParam String endDate,Model model, HttpServletRequest request,
|
||||
public Map<String, ?> trafficWebsiteListNoTime(Integer domain[],Integer entranceId , @RequestParam String beginDate, @RequestParam String endDate,Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
@@ -13,5 +13,5 @@ public interface TrafficAppStatisticDao {
|
||||
|
||||
TrafficAppStatistic getMaxStatTime();
|
||||
List<Map> appChart(@Param("statTime")Date statTime);
|
||||
List<Map> getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer appType);
|
||||
List<Map> getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer[] appType);
|
||||
}
|
||||
@@ -32,11 +32,12 @@
|
||||
SELECT app_type,SUM(link_num) AS link_num,SUM(c2s_pkt_num+s2c_pkt_num) AS packets,
|
||||
((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024) AS GByte
|
||||
FROM traffic_app_statistic WHERE
|
||||
<if test="beginTime!=null and endTime!=null">
|
||||
stat_time >= #{beginTime} and stat_time <= #{endTime}
|
||||
</if>
|
||||
<if test="appType!=null and appType!=''">
|
||||
and app_type=#{appType}
|
||||
<![CDATA[ stat_time>= #{beginTime} and stat_time<= #{endTime}]]>
|
||||
<if test="appType!=null">
|
||||
and app_type in
|
||||
<foreach collection="appType" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY app_type ) p
|
||||
LEFT JOIN ui_code_app_dic c ON p.app_type=c.view_code ORDER BY p.GByte DESC
|
||||
|
||||
@@ -29,7 +29,7 @@ public interface TrafficHttpStatisticDao {
|
||||
List<Map> getTrafficHttpStatistic(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
|
||||
List getIdByWebSiteId(@Param("websiteId") Integer websiteId);
|
||||
|
||||
List<Map> getTrafficHttpDomain(@Param("beginDate")Date beginDate,@Param("endDate") Date endDate,@Param("domain")Integer domain,@Param("entranceId")Integer entranceId);
|
||||
List<Map> getTrafficHttpDomain(@Param("beginDate")Date beginDate,@Param("endDate") Date endDate,@Param("domain")Integer[] domain,@Param("entranceId")Integer entranceId);
|
||||
List<TrafficHttpFocusStatistic> getDomainTrans(@Param("entranceId")Integer entranceId,@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("domain")Integer domain);
|
||||
|
||||
}
|
||||
@@ -127,7 +127,10 @@ FROM
|
||||
sum(c2s_pkt_num + s2c_pkt_num) pktCount from traffic_http_focus_statistic t where
|
||||
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate}]]>
|
||||
<if test="domain!=null">
|
||||
and web_id=#{domain}
|
||||
and web_id in
|
||||
<foreach collection="domain" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="entranceId!=null">
|
||||
and entrance_id=#{entranceId}
|
||||
|
||||
@@ -13,5 +13,6 @@ public interface TrafficProtocolStatisticDao {
|
||||
|
||||
TrafficProtocolStatistic getMaxStatTime();
|
||||
List<Map> protocolChart(@Param("statTime")Date statTime);
|
||||
List<Map> getProtocolList(@Param("statTime")Date statTime,@Param("beginTime")String beginTime,@Param("endTime")String endTime);
|
||||
List<Map> getProtocolList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("protoType")Integer[] protoType);
|
||||
|
||||
}
|
||||
@@ -29,11 +29,12 @@
|
||||
SELECT proto_type,SUM(link_num) AS link_num,SUM(c2s_pkt_num+s2c_pkt_num) AS packets,
|
||||
((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024) AS GByte
|
||||
FROM traffic_protocol_statistic WHERE
|
||||
<if test="beginTime==null or endTime==null">
|
||||
stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
</if>
|
||||
<if test="beginTime!=null and endTime!=null">
|
||||
stat_time >= #{beginTime} and stat_time <= #{endTime}
|
||||
<![CDATA[ stat_time>= #{beginTime} and stat_time<= #{endTime}]]>
|
||||
<if test="protoType!=null">
|
||||
and proto_type in
|
||||
<foreach collection="protoType" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY proto_type ) p
|
||||
LEFT JOIN ui_code_protocol_type_dic c ON p.proto_type=c.view_code ORDER BY p.GByte DESC
|
||||
|
||||
@@ -592,13 +592,13 @@ public class DashboardService extends BaseService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map> getProtocolList(String startTime, String endTime) {
|
||||
TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime();
|
||||
public List<Map> getProtocolList(String startTime, String endTime,Integer[] protoType) {
|
||||
// TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
if (maxStatTime != null && maxStatTime.getStatTime() != null) {
|
||||
Date statTime = maxStatTime.getStatTime();
|
||||
list = trafficProtocolStatisticDao.getProtocolList(statTime, startTime, endTime);
|
||||
}
|
||||
// if (maxStatTime != null && maxStatTime.getStatTime() != null) {
|
||||
// Date statTime = maxStatTime.getStatTime();
|
||||
list = trafficProtocolStatisticDao.getProtocolList(startTime, endTime,protoType);
|
||||
// }
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ public class DashboardService extends BaseService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map> getAppList(String startTime, String endTime, Integer appType) {
|
||||
public List<Map> getAppList(String startTime, String endTime, Integer[] appType) {
|
||||
// TrafficAppStatistic maxStatTime = trafficAppStatisticDao.getMaxStatTime();
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
// if (maxStatTime != null && maxStatTime.getStatTime() != null) {
|
||||
@@ -830,7 +830,7 @@ public class DashboardService extends BaseService {
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public List<Map> getWebsiteDetails(Date beginDate, Date endDate, Integer domain, Integer entranceId) {
|
||||
public List<Map> getWebsiteDetails(Date beginDate, Date endDate, Integer domain[], Integer entranceId) {
|
||||
List<Map> list = trafficHttpStatisticDao.getTrafficHttpDomain(beginDate, endDate, domain, entranceId);
|
||||
return list;
|
||||
}
|
||||
@@ -997,7 +997,10 @@ public class DashboardService extends BaseService {
|
||||
// String linkNumStr = String.valueOf(webIdAndCountMap.get("linkNum"));
|
||||
// String packetsStr = String.valueOf(webIdAndCountMap.get("pktCount"));
|
||||
if (countStr != null) {
|
||||
count += Long.parseLong(countStr);// 将count累加
|
||||
Long pl = (Long.parseLong(countStr))/(1024*1024*1024);
|
||||
if(pl>0) {
|
||||
count += Long.parseLong(countStr);// 将count累加 转换单位小于0的不加
|
||||
}
|
||||
}
|
||||
// if (linkNumStr != null) {
|
||||
// linkNum += Long.parseLong(linkNumStr);// 将count累加
|
||||
@@ -1011,6 +1014,27 @@ public class DashboardService extends BaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(list, new Comparator<Object>() {
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
if(o1==null&&o2!=null){
|
||||
return 1;
|
||||
}
|
||||
if(o1!=null&&o2==null){
|
||||
return -1;
|
||||
}
|
||||
if(o1==o2&&o1==null){
|
||||
return 0;
|
||||
}
|
||||
Map m1=(Map)o1;
|
||||
Map m2=(Map)o2;
|
||||
Object ob1 = m1.get("byteCount");
|
||||
Object ob2 = m2.get("byteCount");
|
||||
Long b1=Long.parseLong(ob1.toString());
|
||||
Long b2=Long.parseLong(ob2.toString());
|
||||
return -(b1).compareTo(b2);
|
||||
}
|
||||
});
|
||||
if (list.size() > 0) {
|
||||
viewMap.put("count", count);
|
||||
// viewMap.put("linkNum", linkNum);
|
||||
|
||||
Reference in New Issue
Block a user