diff options
| author | doufenghu <[email protected]> | 2019-01-10 16:18:59 +0600 |
|---|---|---|
| committer | doufenghu <[email protected]> | 2019-01-10 16:18:59 +0600 |
| commit | f7dacd45f499d4b57eec3878e236eb68a68d323d (patch) | |
| tree | 7ad1d45311019d7d122d97a4b58d3e5d469fefa2 | |
| parent | cf971bff32ca82d64a84ff797f65f126eec41ee8 (diff) | |
fix(https监控):将https监控统计修改为,关注网站统计
6 files changed, 73 insertions, 5 deletions
diff --git a/src/main/java/com/nis/galaxy/template/ForBlockingInterface.java b/src/main/java/com/nis/galaxy/template/ForBlockingInterface.java index 5d6dfe9..a109f21 100644 --- a/src/main/java/com/nis/galaxy/template/ForBlockingInterface.java +++ b/src/main/java/com/nis/galaxy/template/ForBlockingInterface.java @@ -16,8 +16,6 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; @@ -190,8 +188,8 @@ public class ForBlockingInterface { /** * 实时打点图 10s */ -// @Scheduled(cron = "${10s.scheduled.cron.plan}") -// @SchedulerLock(name = "blocking.realtime.point", lockAtLeastForString = "PT4S", lockAtMostForString = "PT8S") + @Scheduled(cron = "${10s.scheduled.cron.plan}") + @SchedulerLock(name = "blocking.realtime.point", lockAtLeastForString = "PT4S", lockAtMostForString = "PT8S") public void getPointMapOf10s() { if (!Boolean.parseBoolean(scheduledBlockEnable)) { return; diff --git a/src/main/java/com/nis/galaxy/template/ForEventsInterface.java b/src/main/java/com/nis/galaxy/template/ForEventsInterface.java index 9f397e9..4082138 100644 --- a/src/main/java/com/nis/galaxy/template/ForEventsInterface.java +++ b/src/main/java/com/nis/galaxy/template/ForEventsInterface.java @@ -199,6 +199,7 @@ public class ForEventsInterface { List contentValue = null; try { contentValue = eventsService.getSpecificWebsites(end); + } catch (Exception e) { logger.error("特定网站监控\t查询异常\trestTemplate", e); } @@ -514,7 +515,10 @@ public class ForEventsInterface { List contentValue = null; String type = "HttpsMonitor"; try { - contentValue = eventsService.getTypeMonitorReject(start, end, type); + // contentValue = eventsService.getTypeMonitorReject(start, end, type); + + contentValue = eventsService.getFocusWebsite(start, end); //修改大屏为关注网站接口 + } catch (Exception e) { logger.error("HTTPS监控TOP10\t查询异常\trestTemplate", e); } diff --git a/src/main/java/com/nis/galaxy/web/dao/EventsDao.java b/src/main/java/com/nis/galaxy/web/dao/EventsDao.java index f73ed73..7559da9 100644 --- a/src/main/java/com/nis/galaxy/web/dao/EventsDao.java +++ b/src/main/java/com/nis/galaxy/web/dao/EventsDao.java @@ -27,6 +27,8 @@ public interface EventsDao { List<EventsSpecificWebsites> getSpecificWebsites(@Param("end") String end); + List<EventsSpecificWebsites> getFocusWebsite(@Param("start") String start, @Param("end") String end); + List<EventsAudioMonitor> getEventsAudioMonitor(@Param("push") String push, @Param("start") String start, @Param("end") String end); Date getEventsAudioMonitorLastTime(@Param("end") String end); diff --git a/src/main/java/com/nis/galaxy/web/service/EventsService.java b/src/main/java/com/nis/galaxy/web/service/EventsService.java index 466ea85..e2f2957 100644 --- a/src/main/java/com/nis/galaxy/web/service/EventsService.java +++ b/src/main/java/com/nis/galaxy/web/service/EventsService.java @@ -52,6 +52,11 @@ public interface EventsService { */ List<EventsSpecificWebsites> getSpecificWebsites(String end); + + + List<EventsSpecificWebsites> getFocusWebsite(String start, String end); + + /** * 事件监测 * diff --git a/src/main/java/com/nis/galaxy/web/service/impl/EventsServiceImpl.java b/src/main/java/com/nis/galaxy/web/service/impl/EventsServiceImpl.java index a479a47..acdf1a5 100644 --- a/src/main/java/com/nis/galaxy/web/service/impl/EventsServiceImpl.java +++ b/src/main/java/com/nis/galaxy/web/service/impl/EventsServiceImpl.java @@ -304,6 +304,36 @@ public class EventsServiceImpl implements EventsService { return list; } + + + + @Override + public List<EventsSpecificWebsites> getFocusWebsite(String start, String end) { + List<EventsSpecificWebsites> list = new ArrayList<>(); + long timeMillisStart = System.currentTimeMillis(); + try { + list = eventsDao.getFocusWebsite(start, end); + } catch (Exception e) { + logger.error("特定网站监控\t查询异常\tserviceImpl", e); + } + logger.info("特定网站监控耗时:" + (System.currentTimeMillis() - timeMillisStart)); + if (ListUtils.isEmptyList(list) && ConfigUtil.testData) { + logger.info("特定网站监控------->测试数据"); + int i = (int) (Math.random() * 100); + list.add(new EventsSpecificWebsites(end, "Facebook", i + 100)); + list.add(new EventsSpecificWebsites(end, "Wikipedia", i + 90)); + list.add(new EventsSpecificWebsites(end, "Reddit", i + 80)); + list.add(new EventsSpecificWebsites(end, "Qq", i + 50)); + list.add(new EventsSpecificWebsites(end, "Taobao", i + 30)); + list.add(new EventsSpecificWebsites(end, "Tmall", i + 25)); + list.add(new EventsSpecificWebsites(end, "Baidu", i + 20)); + list.add(new EventsSpecificWebsites(end, "Souhu", i + 15)); + list.add(new EventsSpecificWebsites(end, "Google", i + 10)); + list.add(new EventsSpecificWebsites(end, "Wikipedia", i + 6)); + } + return list; + } + /** * 事件监测 * @@ -728,6 +758,7 @@ public class EventsServiceImpl implements EventsService { List<EventsNameNumTime> list = new ArrayList<>(); try { list = eventsDao.getHttpsMonitor(start, startDate, endDate, serviceId); + } catch (Exception e) { logger.error(logMark + "\t查询异常\tserviceImpl", e); } diff --git a/src/main/resources/mybatis/mapper/EventsMapper.xml b/src/main/resources/mybatis/mapper/EventsMapper.xml index a73ee45..0d1fd7f 100644 --- a/src/main/resources/mybatis/mapper/EventsMapper.xml +++ b/src/main/resources/mybatis/mapper/EventsMapper.xml @@ -115,6 +115,34 @@ LIMIT 10; ]]> </select> + + + <select id="getFocusWebsite" resultType="com.nis.galaxy.domain.EventsSpecificWebsites"> + <![CDATA[ + SELECT #{end} AS time,t.website AS name,COALESCE(SUM(s.link_sum),0) AS num + FROM (SELECT t.id,w.website FROM ui_website_domain_topic t + LEFT JOIN + (SELECT item_code webid,item_value website + FROM ui_sys_data_dictionary_item + WHERE type=1 + AND dictionary_id=111 + ) w + ON w.webid = t.website_service_id ) t + RIGHT JOIN + (SELECT web_id,SUM(link_num) AS link_sum + FROM TRAFFIC_HTTP_STATISTIC + WHERE + stat_time >= #{start} + AND stat_time < #{end} + GROUP BY web_id ) s + ON s.web_id = t.id + GROUP BY t.website + HAVING name is not null + ORDER BY num desc + LIMIT 10; + ]]> + </select> + <!--音频监控 小时/次--> <select id="getEventsAudioMonitor" resultType="com.nis.galaxy.domain.EventsAudioMonitor"> <