用户工具

站点工具


分享:技术:交易监控:交易监控中间件_实现

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

分享:技术:交易监控:交易监控中间件_实现 [2017/07/02 23:06]
gxx 创建
分享:技术:交易监控:交易监控中间件_实现 [2017/07/03 09:47] (当前版本)
gxx
行 266: 行 266:
  <!-- 服务层AOP end -->  <!-- 服务层AOP end -->
 </​code>​ </​code>​
-===== spring-mcv.xml ===== + 
-<code xml spring-mcv.xml>+===== LaCreditServiceImpl.java ===== 
 +<code java LaCreditServiceImpl.java>​ 
 +/** 
 + * 信用卡服务接口实现类 
 + * 
 + * @author Gxx 
 + */ 
 +@Service("​laCreditService"​) 
 +public class LaCreditServiceImpl implements LaCreditService { 
 +    /** 
 +     * 查询是否显示信用卡管理菜单 
 +     * 
 +     * @param request 
 +     * @return 
 +     */ 
 +    @LogMethodTime(isMonitor = true, monitorMethodType = MonitorMethodTypeEnum.PROVIDE_OUT,​ methodName = "​查询是否显示信用卡管理菜单",​ resv1="​{request[0].custNo}",​ resv2="​{response}"​) 
 +    @Override 
 +    public boolean queryShowCreditMenu(QueryShowCreditMenuRequest request) { 
 +        ... 
 +    } 
 +
 +</​code>​ 
 +===== spring-mvc.xml ===== 
 +<code xml spring-mvc.xml>
  <!-- 扫描控制器类 -->  <!-- 扫描控制器类 -->
  <​context:​component-scan base-package="​com.shhxzq.fin.lifeapp"​ />  <​context:​component-scan base-package="​com.shhxzq.fin.lifeapp"​ />
行 1950: 行 1973:
 </​dependency>​ </​dependency>​
 </​code>​ </​code>​
 +===== 界面相关 =====
 +界面功能(查询明细,统计,实时监控)我在config_center上做了一套,后端查询record_app的实现。
  
 +所以以下代码不属于lifeapp,属于config_center+record_app
 +==== query.ftl ====
 +<code html query.ftl>​
 +<​!DOCTYPE html>
 +<!--
 +This is a starter template page. Use this page to start your new project from
 +scratch. This page gets rid of all links and provides the needed markup only.
 +-->
 +<​html>​
 +<​head>​
 +<meta charset="​utf-8">​
 +<meta http-equiv="​X-UA-Compatible"​ content="​IE=edge">​
 +<​title>​查看监控</​title>​
 +<!-- Tell the browser to be responsive to screen width -->
 +<meta
 + content="​width=device-width,​ initial-scale=1,​ maximum-scale=1,​ user-scalable=no"​
 + name="​viewport">​
 +<!-- Bootstrap 3.3.6 -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​bootstrap/​css/​bootstrap.min.css">​
 +<!-- Font Awesome -->
 +<link rel="​stylesheet"​
 + href="​https://​cdnjs.cloudflare.com/​ajax/​libs/​font-awesome/​4.5.0/​css/​font-awesome.min.css">​
 +<!-- Ionicons -->
 +<!-- <link rel="​stylesheet"​
 + href="​https://​cdnjs.cloudflare.com/​ajax/​libs/​ionicons/​2.0.1/​css/​ionicons.min.css">​ -->
 +<!-- Theme style -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​dist/​css/​AdminLTE.min.css">​
 +<!-- AdminLTE Skins. We have chosen the skin-blue for this starter
 +        page. However, you can choose any other skin. Make sure you
 +        apply the skin class to the body tag so the changes take effect.
 +  -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​dist/​css/​skins/​skin-blue.min.css">​
 +
 +<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
 +<!-- WARNING: Respond.js doesn'​t work if you view the page via file:// -->
 +<!--[if lt IE 9]>
 +  <script src="​https://​oss.maxcdn.com/​html5shiv/​3.7.3/​html5shiv.min.js"></​script>​
 +  <script src="​https://​oss.maxcdn.com/​respond/​1.4.2/​respond.min.js"></​script>​
 +  <​![endif]-->​
 +<!-- daterange picker -->
 +<link rel="​stylesheet"​
 + href="​${rc.contextPath}/​plugins/​daterangepicker/​daterangepicker.css">​
 +<!-- bootstrap datepicker -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​plugins/​datepicker/​datepicker3.css">​
 +<!-- bootstrap datetimepicker -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​plugins/​datetimepicker/​bootstrap-datetimepicker.css">​
 +
 +<​!--自动换行-->​
 +<​style>​
 +td {
 + word-wrap:​break-word;​
 + word-break:​break-all;​
 +}
 +</​style>​
 +
 +<script src="​${rc.contextPath}/​js/​base.js"></​script>​
 +
 +<script type="​text/​javascript">​
 + var contextPath = "​${rc.contextPath}/";​
 + var monitorArray = new Array();//​监控信息集合
 + var pageSize = 10;//​每页大小
 + var activePage = 1;//​当前页数
 + var totalPage = 0;//​总页数
 + var totalCount = 0;//总数
 + var isRequesting = false;//​是否正在与服务器端交互
 +
 + //​查询监控信息
 + function queryMonitor(){
 + if(isRequesting){
 + showAttention("​正在与服务器端交互,请稍等!"​);​
 + return;
 + }
 + isRequesting = true;
 + $("#​monitor_table"​).css("​display",​ "​none"​);​
 + $.ajax({
 + type: '​POST',​
 + url: '​${rc.contextPath}/​monitor/​query.htm',​
 + data: '​methodRoute='​ + $("#​method_route"​).val() + '&​methodType='​ + $("#​method_type"​).val() + '&​outerSystem='​ + $("#​outer_system"​).val() + 
 + '&​isException='​ + $("#​is_exception"​).val() + '&​beginTime='​ + $("#​begin_time"​).val() + '&​endTime='​ + $("#​end_time"​).val() + 
 + '&​beginUsedTime='​ + $("#​begin_used_time"​).val() + '&​endUsedTime='​ + $("#​end_used_time"​).val() + '&​ip='​ + $("#​ip"​).val() + '&​resv1='​ + $("#​resv1"​).val() + '&​resv2='​ + $("#​resv2"​).val() + 
 + '&​resv3='​ + $("#​resv3"​).val() + '&​pageSize='​ + pageSize + '&​activePage='​ + activePage,
 + success: function(data) {
 + isRequesting = false;
 + var obj = data;
 + monitorArray = obj.list;
 + totalPage = obj.totalPage;​
 + totalCount = obj.totalCount;​
 + if(totalPage == 0){
 + totalPage = 1;
 + activePage = 1;
 + }
 + showMonitor();​
 + showSuccess("​查询监控成功!"​);​
 + }
 + });
 + }
 + //​用户监控信息
 + function showMonitor(){
 + var content = "<​div class='​box-header with-border'>​ <h3 class='​box-title'>​查询结果</​h3>"​
 + +"<​div class='​box-tools pull-right'>"​
 +                 +"<​button type='​button'​ class='​btn btn-box-tool'​ data-widget='​collapse'>"​
 +                 +"<​i class='​fa fa-minus'></​i>"​
 +                 +"</​button>"​
 +                 +"<​button type='​button'​ class='​btn btn-box-tool'​ data-widget='​remove'><​i class='​fa fa-times'></​i></​button>"​
 +               +"</​div></​div>"​
 + +"<​div class='​box-body table-responsive no-padding'>"​
 + +"<​table class='​table table-bordered table-hover'​ style='​width:​ 2500px;'>"​
 + +"<​tbody>"​
 + +"<​tr>"​
 + +"<​th class='​text-center'>​主键</​th>"​
 + +"<​th class='​text-center'>​系统日期</​th>"​
 + +"<​th class='​text-center'>​系统时间</​th>"​
 + +"<​th class='​text-center'>​方法路径</​th>"​
 + +"<​th class='​text-center'>​方法名称</​th>"​
 + +"<​th class='​text-center'>​方法类型</​th>"​
 + +"<​th class='​text-center'>​外部系统</​th>"​
 + +"<​th class='​text-center'>​入参</​th>"​
 + +"<​th class='​text-center'>​出参</​th>"​
 + +"<​th class='​text-center'>​是否异常发生</​th>"​
 + +"<​th class='​text-center'>​开始时间</​th>"​
 + +"<​th class='​text-center'>​结束时间</​th>"​
 + +"<​th class='​text-center'>​耗时(毫秒)</​th>"​
 + +"<​th class='​text-center'>​机器ip</​th>"​
 + +"<​th class='​text-center'>​备注字段1</​th>"​
 + +"<​th class='​text-center'>​备注字段2</​th>"​
 + +"<​th class='​text-center'>​备注字段3</​th>"​
 + +"</​tr>";​
 + if(monitorArray.length == 0){
 + content += "<​tr><​td class='​text-center'​ colspan='​17'>​无相关数据!</​td></​tr>";​
 + } else {
 + for(var i=0;​i<​monitorArray.length;​i++){
 + var obj = monitorArray[i];​
 + content += "<​tr id='​tr_"​ + obj["​id"​] + "'>"​
 + +"<​td class='​text-center'>"​ + obj["​id"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​sysDate"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​sysTime"​] + "</​td>"​
 + +"<​td style='​width:​ 300px;​overflow:​auto;'>"​ + obj["​methodRoute"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​methodName"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​methodType"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​outerSystem"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​request"​] + "</​td>"​
 + +"<​td class='​text-center'​ style='​width:​ 300px;​overflow:​auto;'>"​ + obj["​response"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​isException"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​beginTime"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​endTime"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​usedTime"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​ip"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​resv1"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​resv2"​] + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj["​resv3"​] + "</​td>"​
 + +"</​tr>";​
 + }
 + }
 +
 + content += "</​tbody>"​
 + +"</​table>"​
 + +"</​div>";​
 +
 + content += getTfoot();
 +
 + $("#​monitor_table"​).html(content);​
 + $("#​monitor_table"​).css("​display",​ "​block"​);​
 + }
 + function getTfoot(){
 + var content = "<​div class='​box-footer clearfix'>"​ + 
 + "<​ul class='​pagination pagination-sm no-margin pull-right'>"​ + 
 + "<​li>"​ + "<​a>​总数:​["​ + totalCount + "] 总页数:​["​ + totalPage + "​]</​a>"​ + "</​li>"​ +
 + "<​li><​a href=\"​javascript:​ jump2page(1)\"​ title=\"​首页\">&​laquo;​ 首页</​a></​li>"; ​  
 +     if(activePage > 1){
 + content += "<​li><​a href=\"​javascript:​ jump2page("​ + (activePage-1) + "​)\"​ title=\"​上一页\">&​laquo;​ 上一页</​a></​li>";​
 +     }
 + //​显示前2页,本页,后2页
 + for(var i=activePage-2;​i<​activePage+3;​i++){
 + if(i >= 1 && i <= totalPage){
 + content += "<​li"​ + (i==activePage?"​ class='​active'":""​) + "><​a href=\"​javascript:​ jump2page("​ + i + "​)\"​ class=\"​number"​ + ((i==activePage)?"​ current":""​) + "​\"​ title=\""​ + i + "​\">"​ + i + "</​a></​li>";​
 + }
 + }
 +     if(activePage < totalPage){
 + content += "<​li><​a href=\"​javascript:​ jump2page("​ + (activePage+1) + "​)\"​ title=\"​下一页\">​下一页 &​raquo;</​a></​li>";​
 + }
 + content += "<​li><​a href=\"​javascript:​ jump2page("​ + totalPage + "​)\"​ title=\"​尾页\">​尾页 &​raquo;</​a></​li>"​ + 
 +                 "</​ul>"​ + 
 +                 "</​div>";​
 +     return content;
 + }
 + function jump2page(index){
 + activePage = index;
 + queryMonitor();​
 + }
 +
 + //​统计监控信息
 + function countMonitor(){
 + if(isRequesting){
 + showAttention("​正在与服务器端交互,请稍等!"​);​
 + return;
 + }
 + isRequesting = true;
 + $("#​monitor_table"​).css("​display",​ "​none"​);​
 + $.ajax({
 + type: '​POST',​
 + url: '​${rc.contextPath}/​monitor/​count.htm',​
 + data: '​methodRoute='​ + $("#​method_route"​).val() + '&​methodType='​ + $("#​method_type"​).val() + '&​outerSystem='​ + $("#​outer_system"​).val() + 
 + '&​isException='​ + $("#​is_exception"​).val() + '&​beginTime='​ + $("#​begin_time"​).val() + '&​endTime='​ + $("#​end_time"​).val() + 
 + '&​beginUsedTime='​ + $("#​begin_used_time"​).val() + '&​endUsedTime='​ + $("#​end_used_time"​).val() + '&​ip='​ + $("#​ip"​).val() + '&​resv1='​ + $("#​resv1"​).val() + '&​resv2='​ + $("#​resv2"​).val() + 
 + '&​resv3='​ + $("#​resv3"​).val() + '&​pageSize='​ + pageSize + '&​activePage='​ + activePage,
 + success: function(data) {
 + isRequesting = false;
 + showCountMonitor(data);​
 + showSuccess("​统计监控成功!"​);​
 + }
 + });
 + }
 + //​统计监控信息
 + function showCountMonitor(obj){
 + var content = "<​div class='​box-header with-border'>​ <h3 class='​box-title'>​统计结果</​h3>"​
 + +"<​div class='​box-tools pull-right'>"​
 +                 +"<​button type='​button'​ class='​btn btn-box-tool'​ data-widget='​collapse'>"​
 +                 +"<​i class='​fa fa-minus'></​i>"​
 +                 +"</​button>"​
 +                 +"<​button type='​button'​ class='​btn btn-box-tool'​ data-widget='​remove'><​i class='​fa fa-times'></​i></​button>"​
 +               +"</​div></​div>"​
 + +"<​div class='​box-body table-responsive no-padding'>"​
 + +"<​table class='​table table-bordered table-hover'>"​
 + +"<​tbody>"​
 + +"<​tr>"​
 + +"<​th class='​text-center'>​并发数</​th>"​
 + +"<​th class='​text-center'>​平均耗时(毫秒)</​th>"​
 + +"<​th class='​text-center'>​tps(事务数/​秒)</​th>"​
 + +"</​tr>";​
 +
 + content += "<​tr>"​
 + +"<​td class='​text-center'>"​ + obj.totalCount + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj.avgUsedTime + "</​td>"​
 + +"<​td class='​text-center'>"​ + obj.tps + "</​td>"​
 + +"</​tr>";​
 +
 + content += "</​tbody>"​
 + +"</​table>"​
 + +"</​div>";​
 +
 + $("#​monitor_table"​).html(content);​
 + $("#​monitor_table"​).css("​display",​ "​block"​);​
 + }
 +</​script>​
 +
 +<style type="​text/​css">​
 +div.alert {
 + padding-top:​ 5px;
 + padding-bottom:​ 5px
 +}
 +</​style>​
 +
 +</​head>​
 +<!--
 +BODY TAG OPTIONS:
 +=================
 +Apply one or more of the following classes to get the
 +desired effect
 +|---------------------------------------------------------|
 +| SKINS         | skin-blue ​                              |
 +|               | skin-black ​                             |
 +|               | skin-purple ​                            |
 +|               | skin-yellow ​                            |
 +|               | skin-red ​                               |
 +|               | skin-green ​                             |
 +|---------------------------------------------------------|
 +|LAYOUT OPTIONS | fixed                                   |
 +|               | layout-boxed ​                           |
 +|               | layout-top-nav ​                         |
 +|               | sidebar-collapse ​                       |
 +|               | sidebar-mini ​                           |
 +|---------------------------------------------------------|
 +-->
 +<body class="​hold-transition skin-blue sidebar-mini">​
 + <div class="​wrapper">​
 +
 + <!-- Main Header -->
 + <​header class="​main-header">​
 +
 + <!-- Logo -->
 + <a href="​index2.html"​ class="​logo">​ <!-- mini logo for sidebar mini 50x50 pixels -->
 + <​span class="​logo-mini"><​b>​RA</​b></​span>​ <!-- logo for regular state and mobile devices -->
 + <​span class="​logo-lg"><​b>​Record App</​b></​span>​
 + </​a>​
 +
 + <!-- Header Navbar -->
 + <nav class="​navbar navbar-static-top"​ role="​navigation">​
 + <!-- Sidebar toggle button-->​
 + <a href="#"​ class="​sidebar-toggle"​ data-toggle="​offcanvas"​
 + role="​button">​ <span class="​sr-only">​Toggle navigation</​span>​
 + </​a>​
 + <!-- Navbar Right Menu -->
 + <div class="​navbar-custom-menu">​
 + <ul class="​nav navbar-nav">​
 + <​!-- User Account Menu -->
 + <​li class="​dropdown user user-menu">​
 + <​!-- Menu Toggle Button --> <a href="#"​ class="​dropdown-toggle"​
 + data-toggle="​dropdown">​ <!-- The user image in the navbar-->​
 + <​img src="​${rc.contextPath}/​dist/​img/​user2-160x160.jpg"​ class="​user-image"​
 + alt="​User Image">​ <!-- hidden-xs hides the username on small devices so only the image appears. -->
 + <​span class="​hidden-xs">​管理员</​span>​
 + </​a>​
 + <​ul class="​dropdown-menu">​
 + <​!-- The user image in the menu -->
 + <​li class="​user-header"><​img
 + src="​${rc.contextPath}/​dist/​img/​user2-160x160.jpg"​ class="​img-circle"​
 + alt="​User Image">​
 +
 + <​p>​
 + 管理员 <​small>​您已成功登录</​small>​
 + </​p></​li>​
 + <​!-- Menu Footer-->​
 + <​li class="​user-footer">​
 + <​div class="​pull-right">​
 + <​a href="​${rc.contextPath}/​logout.htm"​ class="​btn btn-default btn-flat">​退出</​a>​
 + </​div>​
 + </​li>​
 + </​ul>​
 + </​li>​
 + </​ul>​
 + </​div>​
 + </​nav>​
 + </​header>​
 + <!-- Left side column. contains the logo and sidebar -->
 + <aside class="​main-sidebar">​
 +
 + <!-- sidebar: style can be found in sidebar.less -->
 + <​section class="​sidebar">​
 +
 + <!-- Sidebar user panel (optional) -->
 + <div class="​user-panel">​
 + <​div class="​pull-left image">​
 + <​img src="​${rc.contextPath}/​dist/​img/​user2-160x160.jpg"​ class="​img-circle"​
 + alt="​User Image">​
 + </​div>​
 + <​div class="​pull-left info">​
 + <​p>​管理员</​p>​
 + <​!-- Status -->
 + <a href="#"><​i class="​glyphicon glyphicon-record text-success"></​i>​ 已登录</​a>​
 + </​div>​
 + </​div>​
 +
 + <!-- Sidebar Menu -->
 + <ul class="​sidebar-menu">​
 + <li class="​header">​配置</​li>​
 + <​!-- Optionally, you can add icons to the links -->
 + <​li>​
 + <a href="​${rc.contextPath}/​index.htm">​
 + <​i class="​glyphicon glyphicon-search"></​i>​
 + <​span>​查询配置</​span>​
 + </​a>​
 + </​li>​
 + <​li>​
 + <a href="​${rc.contextPath}/​config/​add.htm">​
 + <​i class="​glyphicon glyphicon-pencil"></​i>​
 + <​span>​新增配置</​span>​
 + </​a>​
 + </​li>​
 + <li class="​header">​交易监控</​li>​
 + <​!-- Optionally, you can add icons to the links -->
 + <li class="​active">​
 + <a href="​${rc.contextPath}/​monitor/​query.htm">​
 + <​i class="​glyphicon glyphicon-search"></​i>​
 + <​span>​监控查询</​span>​
 + </​a>​
 + </​li>​
 + <​li>​
 + <a href="​${rc.contextPath}/​monitor/​realtime.htm">​
 + <​i class="​glyphicon glyphicon-search"></​i>​
 + <​span>​实时监控</​span>​
 + </​a>​
 + </​li>​
 + </​ul>​
 + <!-- /​.sidebar-menu -->
 + </​section>​
 + <!-- /.sidebar -->
 + </​aside>​
 +
 + <!-- Content Wrapper. Contains page content -->
 + <div class="​content-wrapper">​
 + <!-- Main content -->
 + <​section class="​content">​
 +
 + <div id="​message_id"​ style="​display:​ none;"></​div>​
 +
 + <div class="​box box-primary">​
 + <​div class="​box-header with-border">​
 + <​h3 class="​box-title">​监控查询</​h3>​
 + <​div class="​box-tools pull-right">​
 +                 <button type="​button"​ class="​btn btn-box-tool"​ data-widget="​collapse">​
 +                 <i class="​fa fa-minus"></​i>​
 +                 </​button>​
 +                 <button type="​button"​ class="​btn btn-box-tool"​ data-widget="​remove"><​i class="​fa fa-times"></​i></​button>​
 +               </​div>​
 + </​div>​
 + <​!-- /​.box-header -->
 + <​div class="​box-body">​
 +
 + <​div class="​row">​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​方法路径</​label>​
 + <​select class="​form-control"​ id="​method_route">​
 + <​option value="">​全部</​option>​
 + <#​if Session.method_route_list?​exists>​
 + <#​list Session.method_route_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​方法类型</​label>​
 + <​select class="​form-control"​ id="​method_type">​
 + <​option value="">​全部</​option>​
 + <#​if Session.method_type_list?​exists>​
 + <#​list Session.method_type_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​外部系统</​label>​
 + <​select class="​form-control"​ id="​outer_system">​
 + <​option value="">​全部</​option>​
 + <#​if Session.outer_system_list?​exists>​
 + <#​list Session.outer_system_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​是否异常发生</​label>​
 + <​select class="​form-control"​ id="​is_exception">​
 + <​option value="">​全部</​option>​
 + <#​if Session.is_exception_list?​exists>​
 + <#​list Session.is_exception_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​开始时间</​label>​
 + <​div class="​input-group date">​
 + <​div class="​input-group-addon">​
 + <​i class="​glyphicon glyphicon-calendar"></​i>​
 + </​div>​
 + <​input type="​text"​ class="​form-control pull-right"​ id="​begin_time">​
 + </​div>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​结束时间</​label>​
 + <​div class="​input-group date">​
 + <​div class="​input-group-addon">​
 + <​i class="​glyphicon glyphicon-calendar"></​i>​
 + </​div>​
 + <​input type="​text"​ class="​form-control pull-right"​ id="​end_time">​
 + </​div>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​最小耗时(毫秒)(>​=)</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​begin_used_time">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​最大耗时(毫秒)(<​=)</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​end_used_time">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​机器ip</​label>​
 + <​select class="​form-control"​ id="​ip">​
 + <​option value="">​全部</​option>​
 + <#​if Session.ip_list?​exists>​
 + <#​list Session.ip_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​备注字段1</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​resv1">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​备注字段2</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​resv2">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​备注字段3</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​resv3">​
 + </​div>​
 + <​div class="​col-xs-6 col-sm-3 col-md-2">​
 + <​label>&​nbsp;</​label>​
 + <​button type="​button"​ class="​btn btn-block btn-primary"​
 + onclick="​activePage=1;​queryMonitor();">​查询</​button>​
 + </​div>​
 + <​div class="​col-xs-6 col-sm-3 col-md-2">​
 + <​label>&​nbsp;</​label>​
 + <​button type="​button"​ class="​btn btn-block btn-primary"​
 + onclick="​activePage=1;​countMonitor();">​统计</​button>​
 + </​div>​
 + </​div>​
 + </​div>​
 + </​div>​
 +
 + <div id="​monitor_table"​ class="​box box-primary"​
 + style="​display:​ none;">​
 + <​div class="​box-header with-border">​
 + <​h3 class="​box-title">​查询结果</​h3>​
 + </​div>​
 + <​!-- /​.box-header -->
 + <​div class="​box-body table-responsive no-padding">​
 + <​table class="​table table-hover">​
 + <​tbody>​
 + <​tr>​
 + <​th style="​width:​ 10px">​ID</​th>​
 + <​th>​环境</​th>​
 + <​th>​项目</​th>​
 + <​th>​监控名</​th>​
 + <​th>​监控值</​th>​
 + <​th>​描述</​th>​
 + <​th style="​width:​ 60px">​操作</​th>​
 + </​tr>​
 + <​tr>​
 + <​td>​1.</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​ware</​td>​
 + </​tr>​
 + <​tr>​
 + <​td>​2.</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​Update software</​td>​
 + <​td>​ware</​td>​
 + </​tr>​
 + </​tbody>​
 + </​table>​
 + </​div>​
 + <​!-- /.box-body -->
 + <​div class="​box-footer clearfix">​
 + <​ul class="​pagination pagination-sm no-margin pull-right">​
 + <​li><​a href="#">​«</​a></​li>​
 + <​li><​a href="#">​1</​a></​li>​
 + <​li><​a href="#">​2</​a></​li>​
 + <​li><​a href="#">​3</​a></​li>​
 + <​li><​a href="#">​»</​a></​li>​
 + </​ul>​
 + </​div>​
 + </​div>​
 + <!-- /.box -->
 +
 + </​section>​
 + <!-- /.content -->
 + </​div>​
 + <!-- /​.content-wrapper -->
 +
 + <!-- Main Footer -->
 + <​footer class="​main-footer">​
 + <!-- To the right -->
 + <div class="​pull-right hidden-xs">​Anything you want</​div>​
 + <!-- Default to the left -->
 + <​strong>​Copyright &copy; 2016 <a href="#">​Company</​a>​.
 + </​strong>​ All rights reserved.
 + </​footer>​
 +
 + <!-- Add the sidebar'​s background. This div must be placed
 +       ​immediately after the control sidebar -->
 + <div class="​control-sidebar-bg"></​div>​
 + </​div>​
 + <!-- ./wrapper -->
 +
 + <!-- REQUIRED JS SCRIPTS -->
 +
 + <!-- jQuery 2.2.3 -->
 + <script src="​${rc.contextPath}/​plugins/​jQuery/​jquery-2.2.3.min.js"></​script>​
 + <!-- Bootstrap 3.3.6 -->
 + <script src="​${rc.contextPath}/​bootstrap/​js/​bootstrap.min.js"></​script>​
 + <!-- AdminLTE App -->
 + <script src="​${rc.contextPath}/​dist/​js/​app.min.js"></​script>​
 + <!-- bootstrap datepicker -->
 + <script src="​${rc.contextPath}/​plugins/​datetimepicker/​bootstrap-datetimepicker.js"></​script>​
 +
 + <script type="​text/​javascript">​
 + //​DateTime picker
 + $('#​begin_time'​).datetimepicker({format:​ '​yyyy-mm-dd hh:​ii'​});​
 + //​DateTime picker
 + $('#​end_time'​).datetimepicker({format:​ '​yyyy-mm-dd hh:​ii'​});​
 + </​script>​
 +
 + <!-- Optionally, you can add Slimscroll and FastClick plugins.
 +     Both of these plugins are recommended to enhance the
 +     user experience. Slimscroll is required when using the
 +     fixed layout. -->
 +</​body>​
 +</​html>​
 +</​code>​
 +==== realtime.ftl ====
 +<code html realtime.ftl>​
 +<​!DOCTYPE html>
 +<!--
 +This is a starter template page. Use this page to start your new project from
 +scratch. This page gets rid of all links and provides the needed markup only.
 +-->
 +<​html>​
 +<​head>​
 +<meta charset="​utf-8">​
 +<meta http-equiv="​X-UA-Compatible"​ content="​IE=edge">​
 +<​title>​实时监控</​title>​
 +<!-- Tell the browser to be responsive to screen width -->
 +<meta
 + content="​width=device-width,​ initial-scale=1,​ maximum-scale=1,​ user-scalable=no"​
 + name="​viewport">​
 +<!-- Bootstrap 3.3.6 -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​bootstrap/​css/​bootstrap.min.css">​
 +<!-- Font Awesome -->
 +<link rel="​stylesheet"​
 + href="​https://​cdnjs.cloudflare.com/​ajax/​libs/​font-awesome/​4.5.0/​css/​font-awesome.min.css">​
 +<!-- Ionicons -->
 +<!-- <link rel="​stylesheet"​
 + href="​https://​cdnjs.cloudflare.com/​ajax/​libs/​ionicons/​2.0.1/​css/​ionicons.min.css">​ -->
 +<!-- Theme style -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​dist/​css/​AdminLTE.min.css">​
 +<!-- AdminLTE Skins. We have chosen the skin-blue for this starter
 +        page. However, you can choose any other skin. Make sure you
 +        apply the skin class to the body tag so the changes take effect.
 +  -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​dist/​css/​skins/​skin-blue.min.css">​
 +
 +<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
 +<!-- WARNING: Respond.js doesn'​t work if you view the page via file:// -->
 +<!--[if lt IE 9]>
 +  <script src="​https://​oss.maxcdn.com/​html5shiv/​3.7.3/​html5shiv.min.js"></​script>​
 +  <script src="​https://​oss.maxcdn.com/​respond/​1.4.2/​respond.min.js"></​script>​
 +  <​![endif]-->​
 +<!-- daterange picker -->
 +<link rel="​stylesheet"​
 + href="​${rc.contextPath}/​plugins/​daterangepicker/​daterangepicker.css">​
 +<!-- bootstrap datepicker -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​plugins/​datepicker/​datepicker3.css">​
 +<!-- bootstrap datetimepicker -->
 +<link rel="​stylesheet"​ href="​${rc.contextPath}/​plugins/​datetimepicker/​bootstrap-datetimepicker.css">​
 +
 +<​!--自动换行-->​
 +<​style>​
 +td {
 + word-wrap:​break-word;​
 + word-break:​break-all;​
 +}
 +</​style>​
 +
 +<script src="​${rc.contextPath}/​js/​base.js"></​script>​
 +
 +<script type="​text/​javascript">​
 + var contextPath = "​${rc.contextPath}/";​
 + var monitorArray = new Array();//​监控信息集合
 + var pageSize = 10;//​每页大小
 + var activePage = 1;//​当前页数
 + var totalPage = 0;//​总页数
 + var totalCount = 0;//总数
 + var isRequesting = false;//​是否正在与服务器端交互
 +
 + var avgUsedTime = 0;//​平均耗时
 + var tps = 0;//tps
 + var nowBeginTimeString = "";//​当前开始统计时间
 + var nowEndTimeString = "";//​当前开始统计时间
 +
 + //​历史统计
 + function queryHistory() {
 + var beginTime = $("#​begin_time"​).val();​
 + var endTime = $("#​end_time"​).val();​
 + if(""​ == beginTime || ""​ == endTime) {
 + showAttention("​请选择[历史开始时间]和[历史结束时间]!"​);​
 + return;
 + }
 + if(beginTime >= endTime) {
 + showAttention("​[历史开始时间]必须小于[历史结束时间]!"​);​
 + return;
 + }
 + var beginTimeObj = parseDate(beginTime,​ '​yyyy-MM-dd HH:​mm'​);​
 + var endTimeObj = parseDate(endTime,​ '​yyyy-MM-dd HH:​mm'​);​
 + var gap = parseInt($("#​gap"​).val()) * 1000;
 +
 + if((endTimeObj.getTime() - beginTimeObj.getTime())/​gap > 60) {
 + showAttention("​取点时间间隔太小,取点太多,服务器扛不住!"​);​
 + return;
 + }
 +
 + config.data.labels = new Array();
 + config.data.datasets[0].data = new Array();
 + config.data.datasets[1].data = new Array();
 + config.data.datasets[2].data = new Array();
 +
 + //​formatDate()
 + var nowBeginTime = beginTimeObj.getTime();​
 + var nowEndTime = nowBeginTime + gap;
 + nowBeginTimeString = formatDate(nowBeginTime);​
 + nowEndTimeString = formatDate(nowEndTime);​
 + countMonitor();//​统计监控信息
 +
 + nowBeginTime = nowEndTime;
 + nowEndTime = nowBeginTime + gap;
 + while(nowBeginTime <= endTimeObj.getTime()) {
 + nowBeginTimeString = formatDate(nowBeginTime);​
 + nowEndTimeString = formatDate(nowEndTime);​
 + countMonitor();//​统计监控信息
 + nowBeginTime = nowEndTime;
 + nowEndTime = nowBeginTime + gap;
 + }
 + }
 +
 + //​统计监控信息
 + function countMonitor(){
 + if(isRequesting){
 + showAttention("​正在与服务器端交互,请稍等!"​);​
 + return;
 + }
 + isRequesting = true;
 + $.ajax({
 + type: '​POST',​
 + async: false,
 + url: '​${rc.contextPath}/​monitor/​count.htm',​
 + data: '​methodRoute='​ + $("#​method_route"​).val() + '&​methodType='​ + $("#​method_type"​).val() + '&​outerSystem='​ + $("#​outer_system"​).val() + 
 + '&​isException='​ + $("#​is_exception"​).val() + '&​beginTime='​ + nowBeginTimeString + '&​endTime='​ + nowEndTimeString + 
 + '&​ip='​ + $("#​ip"​).val() + '&​resv1='​ + $("#​resv1"​).val() + '&​resv2='​ + $("#​resv2"​).val() + 
 + '&​resv3='​ + $("#​resv3"​).val() + '&​pageSize='​ + pageSize + '&​activePage='​ + activePage,
 + success: function(data) {
 + isRequesting = false;
 + totalCount = data.totalCount;​
 + avgUsedTime = data.avgUsedTime;​
 + tps = data.tps;
 +
 + config.data.labels.push(nowBeginTimeString);​
 + config.data.datasets[0].data.push(totalCount);​
 + config.data.datasets[1].data.push(avgUsedTime);​
 + config.data.datasets[2].data.push(tps);​
 +                window.myLine.update();​
 + }
 + });
 + }
 +
 + //​实时统计
 + function realtimeCount() {
 + //​待实现
 + }
 +</​script>​
 +
 +<style type="​text/​css">​
 +div.alert {
 + padding-top:​ 5px;
 + padding-bottom:​ 5px
 +}
 +</​style>​
 +
 +</​head>​
 +<!--
 +BODY TAG OPTIONS:
 +=================
 +Apply one or more of the following classes to get the
 +desired effect
 +|---------------------------------------------------------|
 +| SKINS         | skin-blue ​                              |
 +|               | skin-black ​                             |
 +|               | skin-purple ​                            |
 +|               | skin-yellow ​                            |
 +|               | skin-red ​                               |
 +|               | skin-green ​                             |
 +|---------------------------------------------------------|
 +|LAYOUT OPTIONS | fixed                                   |
 +|               | layout-boxed ​                           |
 +|               | layout-top-nav ​                         |
 +|               | sidebar-collapse ​                       |
 +|               | sidebar-mini ​                           |
 +|---------------------------------------------------------|
 +-->
 +<body class="​hold-transition skin-blue sidebar-mini">​
 + <div class="​wrapper">​
 +
 + <!-- Main Header -->
 + <​header class="​main-header">​
 +
 + <!-- Logo -->
 + <a href="​index2.html"​ class="​logo">​ <!-- mini logo for sidebar mini 50x50 pixels -->
 + <​span class="​logo-mini"><​b>​RA</​b></​span>​ <!-- logo for regular state and mobile devices -->
 + <​span class="​logo-lg"><​b>​Record App</​b></​span>​
 + </​a>​
 +
 + <!-- Header Navbar -->
 + <nav class="​navbar navbar-static-top"​ role="​navigation">​
 + <!-- Sidebar toggle button-->​
 + <a href="#"​ class="​sidebar-toggle"​ data-toggle="​offcanvas"​
 + role="​button">​ <span class="​sr-only">​Toggle navigation</​span>​
 + </​a>​
 + <!-- Navbar Right Menu -->
 + <div class="​navbar-custom-menu">​
 + <ul class="​nav navbar-nav">​
 + <​!-- User Account Menu -->
 + <​li class="​dropdown user user-menu">​
 + <​!-- Menu Toggle Button --> <a href="#"​ class="​dropdown-toggle"​
 + data-toggle="​dropdown">​ <!-- The user image in the navbar-->​
 + <​img src="​${rc.contextPath}/​dist/​img/​user2-160x160.jpg"​ class="​user-image"​
 + alt="​User Image">​ <!-- hidden-xs hides the username on small devices so only the image appears. -->
 + <​span class="​hidden-xs">​管理员</​span>​
 + </​a>​
 + <​ul class="​dropdown-menu">​
 + <​!-- The user image in the menu -->
 + <​li class="​user-header"><​img
 + src="​${rc.contextPath}/​dist/​img/​user2-160x160.jpg"​ class="​img-circle"​
 + alt="​User Image">​
 +
 + <​p>​
 + 管理员 <​small>​您已成功登录</​small>​
 + </​p></​li>​
 + <​!-- Menu Footer-->​
 + <​li class="​user-footer">​
 + <​div class="​pull-right">​
 + <​a href="​${rc.contextPath}/​logout.htm"​ class="​btn btn-default btn-flat">​退出</​a>​
 + </​div>​
 + </​li>​
 + </​ul>​
 + </​li>​
 + </​ul>​
 + </​div>​
 + </​nav>​
 + </​header>​
 + <!-- Left side column. contains the logo and sidebar -->
 + <aside class="​main-sidebar">​
 +
 + <!-- sidebar: style can be found in sidebar.less -->
 + <​section class="​sidebar">​
 +
 + <!-- Sidebar user panel (optional) -->
 + <div class="​user-panel">​
 + <​div class="​pull-left image">​
 + <​img src="​${rc.contextPath}/​dist/​img/​user2-160x160.jpg"​ class="​img-circle"​
 + alt="​User Image">​
 + </​div>​
 + <​div class="​pull-left info">​
 + <​p>​管理员</​p>​
 + <​!-- Status -->
 + <a href="#"><​i class="​glyphicon glyphicon-record text-success"></​i>​ 已登录</​a>​
 + </​div>​
 + </​div>​
 +
 + <!-- Sidebar Menu -->
 + <ul class="​sidebar-menu">​
 + <li class="​header">​配置</​li>​
 + <​!-- Optionally, you can add icons to the links -->
 + <​li>​
 + <a href="​${rc.contextPath}/​index.htm">​
 + <​i class="​glyphicon glyphicon-search"></​i>​
 + <​span>​查询配置</​span>​
 + </​a>​
 + </​li>​
 + <​li>​
 + <a href="​${rc.contextPath}/​config/​add.htm">​
 + <​i class="​glyphicon glyphicon-pencil"></​i>​
 + <​span>​新增配置</​span>​
 + </​a>​
 + </​li>​
 + <li class="​header">​交易监控</​li>​
 + <​!-- Optionally, you can add icons to the links -->
 + <​li>​
 + <a href="​${rc.contextPath}/​monitor/​query.htm">​
 + <​i class="​glyphicon glyphicon-search"></​i>​
 + <​span>​监控查询</​span>​
 + </​a>​
 + </​li>​
 + <li class="​active">​
 + <a href="​${rc.contextPath}/​monitor/​realtime.htm">​
 + <​i class="​glyphicon glyphicon-search"></​i>​
 + <​span>​实时监控</​span>​
 + </​a>​
 + </​li>​
 + </​ul>​
 + <!-- /​.sidebar-menu -->
 + </​section>​
 + <!-- /.sidebar -->
 + </​aside>​
 +
 + <!-- Content Wrapper. Contains page content -->
 + <div class="​content-wrapper">​
 + <!-- Main content -->
 + <​section class="​content">​
 +
 + <div id="​message_id"​ style="​display:​ none;"></​div>​
 +
 + <div class="​box box-primary">​
 + <​div class="​box-header with-border">​
 + <​h3 class="​box-title">​实时监控</​h3>​
 + <​div class="​box-tools pull-right">​
 +                 <button type="​button"​ class="​btn btn-box-tool"​ data-widget="​collapse">​
 +                 <i class="​fa fa-minus"></​i>​
 +                 </​button>​
 +                 <button type="​button"​ class="​btn btn-box-tool"​ data-widget="​remove"><​i class="​fa fa-times"></​i></​button>​
 +               </​div>​
 + </​div>​
 + <​!-- /​.box-header -->
 + <​div class="​box-body">​
 +
 + <​div class="​row">​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​方法路径</​label>​
 + <​select class="​form-control"​ id="​method_route">​
 + <​option value="">​全部</​option>​
 + <#​if Session.method_route_list?​exists>​
 + <#​list Session.method_route_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​方法类型</​label>​
 + <​select class="​form-control"​ id="​method_type">​
 + <​option value="">​全部</​option>​
 + <#​if Session.method_type_list?​exists>​
 + <#​list Session.method_type_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​外部系统</​label>​
 + <​select class="​form-control"​ id="​outer_system">​
 + <​option value="">​全部</​option>​
 + <#​if Session.outer_system_list?​exists>​
 + <#​list Session.outer_system_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​是否异常发生</​label>​
 + <​select class="​form-control"​ id="​is_exception">​
 + <​option value="">​全部</​option>​
 + <#​if Session.is_exception_list?​exists>​
 + <#​list Session.is_exception_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​机器ip</​label>​
 + <​select class="​form-control"​ id="​ip">​
 + <​option value="">​全部</​option>​
 + <#​if Session.ip_list?​exists>​
 + <#​list Session.ip_list as node>
 + <​option value="​${node}">​${node}</​option>​
 + </#​list>​
 + </#​if>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​备注字段1</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​resv1">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​备注字段2</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​resv2">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​备注字段3</​label>​
 + <​input type="​text"​ class="​form-control"​
 + placeholder="​Enter ..." id="​resv3">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​取点时间间隔</​label>​
 + <​select class="​form-control"​ id="​gap">​
 + <​option value="​60"​ selected>​1分钟</​option>​
 + <​option value="​600">​10分钟</​option>​
 + <​option value="​1800">​30分钟</​option>​
 + <​option value="​3600">​1小时</​option>​
 + <​option value="​43200">​12小时</​option>​
 + <​option value="​86400">​1天</​option>​
 + </​select>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>&​nbsp;</​label>​
 + <​button type="​button"​ class="​btn btn-block btn-primary"​
 + onclick="​activePage=1;​realtimeCount();">​实时统计</​button>​
 + </​div>​
 + </​div>​
 + <​div class="​row">​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​历史开始时间</​label>​
 + <​div class="​input-group date">​
 + <​div class="​input-group-addon">​
 + <​i class="​glyphicon glyphicon-calendar"></​i>​
 + </​div>​
 + <​input type="​text"​ class="​form-control pull-right"​ id="​begin_time">​
 + </​div>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>​历史结束时间</​label>​
 + <​div class="​input-group date">​
 + <​div class="​input-group-addon">​
 + <​i class="​glyphicon glyphicon-calendar"></​i>​
 + </​div>​
 + <​input type="​text"​ class="​form-control pull-right"​ id="​end_time">​
 + </​div>​
 + </​div>​
 + <​div class="​col-xs-12 col-sm-6 col-md-4">​
 + <​label>&​nbsp;</​label>​
 + <​button type="​button"​ class="​btn btn-block btn-primary"​
 + onclick="​activePage=1;​queryHistory();">​历史统计</​button>​
 + </​div>​
 + </​div>​
 + </​div>​
 + </​div>​
 +
 + <​canvas id="​canvas"></​canvas>​
 + <!-- /.box -->
 +
 + </​section>​
 + <!-- /.content -->
 + </​div>​
 + <!-- /​.content-wrapper -->
 +
 + <!-- Main Footer -->
 + <​footer class="​main-footer">​
 + <!-- To the right -->
 + <div class="​pull-right hidden-xs">​Anything you want</​div>​
 + <!-- Default to the left -->
 + <​strong>​Copyright &copy; 2016 <a href="#">​Company</​a>​.
 + </​strong>​ All rights reserved.
 + </​footer>​
 +
 + <!-- Add the sidebar'​s background. This div must be placed
 +       ​immediately after the control sidebar -->
 + <div class="​control-sidebar-bg"></​div>​
 + </​div>​
 + <!-- ./wrapper -->
 +
 + <!-- REQUIRED JS SCRIPTS -->
 +
 + <!-- jQuery 2.2.3 -->
 + <script src="​${rc.contextPath}/​plugins/​jQuery/​jquery-2.2.3.min.js"></​script>​
 + <!-- Bootstrap 3.3.6 -->
 + <script src="​${rc.contextPath}/​bootstrap/​js/​bootstrap.min.js"></​script>​
 + <!-- AdminLTE App -->
 + <script src="​${rc.contextPath}/​dist/​js/​app.min.js"></​script>​
 + <!-- bootstrap datepicker -->
 + <script src="​${rc.contextPath}/​plugins/​datetimepicker/​bootstrap-datetimepicker.js"></​script>​
 + <!-- http://​www.chartjs.org/​ -->
 + <script src="​http://​www.chartjs.org/​dist/​2.6.0/​Chart.bundle.js"></​script>​
 + <script src="​http://​www.chartjs.org/​samples/​latest/​utils.js"></​script>​
 +
 + <script type="​text/​javascript">​
 + //​DateTime picker
 + $('#​begin_time'​).datetimepicker({format:​ '​yyyy-mm-dd hh:​ii'​});​
 + //​DateTime picker
 + $('#​end_time'​).datetimepicker({format:​ '​yyyy-mm-dd hh:​ii'​});​
 +
 +        var config = {
 +            type: '​line',​
 +            data: {
 +                labels: [],
 +                datasets: [{
 +                    label: "​并发数",​
 +                    fill: false,
 +                    backgroundColor:​ window.chartColors.red,​
 +                    borderColor:​ window.chartColors.red,​
 +                    data: [
 +                    ],
 +                }, {
 +                    label: "​平均耗时(毫秒)",​
 +                    fill: false,
 +                    backgroundColor:​ window.chartColors.blue,​
 +                    borderColor:​ window.chartColors.blue,​
 +                    data: [
 +                    ],
 +                }, {
 +                    label: "​tps(事务数/​秒)",​
 +                    fill: false,
 +                    backgroundColor:​ window.chartColors.yellow,​
 +                    borderColor:​ window.chartColors.yellow,​
 +                    data: [
 +                    ],
 +                }]
 +            },
 +            options: {
 +                responsive: true,
 +                title:{
 +                    display:​true,​
 +                    text:'​记录点滴APP交易监控'​
 +                },
 +                tooltips: {
 +                    mode: '​index',​
 +                    intersect: false,
 +                },
 +                hover: {
 +                    mode: '​nearest',​
 +                    intersect: true
 +                },
 +                scales: {
 +                    xAxes: [{
 +                        display: true,
 +                        scaleLabel: {
 +                            display: true,
 +                            labelString:​ '​时段'​
 +                        }
 +                    }],
 +                    yAxes: [{
 +                        display: true,
 +                        scaleLabel: {
 +                            display: true,
 +                            labelString:​ '​值'​
 +                        }
 +                    }]
 +                }
 +            }
 +        };
 +
 +        window.onload = function() {
 +            var ctx = document.getElementById("​canvas"​).getContext("​2d"​);​
 +            window.myLine = new Chart(ctx, config);
 +        };
 +        ​
 + </​script>​
 +
 + <!-- Optionally, you can add Slimscroll and FastClick plugins.
 +     Both of these plugins are recommended to enhance the
 +     user experience. Slimscroll is required when using the
 +     fixed layout. -->
 +</​body>​
 +</​html>​
 +</​code>​
 +
 +==== MonitorController.java ====
 +config_center下的
 +<code java MonitorController.java>​
 +package com.gxx.config_center.web.monitor;​
 +
 +import java.util.HashMap;​
 +import java.util.Map;​
 +
 +import javax.servlet.http.HttpServletRequest;​
 +
 +import org.apache.commons.lang3.StringUtils;​
 +import org.apache.log4j.Logger;​
 +import org.springframework.stereotype.Controller;​
 +import org.springframework.web.bind.annotation.RequestMapping;​
 +import org.springframework.web.bind.annotation.RequestMethod;​
 +import org.springframework.web.bind.annotation.ResponseBody;​
 +
 +import com.alibaba.fastjson.JSONArray;​
 +import com.gxx.config_center.dto.MonitorDto;​
 +import com.gxx.config_center.interfaces.BaseInterface;​
 +import com.gxx.config_center.interfaces.MonitorInterface;​
 +import com.gxx.config_center.utils.HttpClientUtils;​
 +
 +/**
 + * <dl>
 + ​* ​   <​dt><​b>​Title:</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   none
 + ​* ​   </dd>
 + ​* ​   <​dt><​b>​Description:​监控控制器</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   <​p>​none
 + ​* ​   </dd>
 + * </dl>
 + *
 + * @author Administrator
 + * @version 1.0, 2017年06月21日
 + * @since config_center
 + */
 +@Controller
 +@RequestMapping("/​monitor/"​)
 +public class MonitorController {
 + /**
 + * 日志处理器
 + */
 + private final Logger logger = Logger.getLogger(MonitorController.class);​
 +
 + /**
 + * 访问交易监控查询页面
 + * @return
 + */
 + @RequestMapping(value = "/​query",​ method = RequestMethod.GET)
 + public String queryGet(HttpServletRequest request) {
 + if(null == request.getSession().getAttribute(BaseInterface.KEY_USER)){
 + logger.info("​访问account/​login"​);​
 + return "​account/​login";​
 + }
 +
 + /**
 + * 初始化session
 + */
 + initSession(request);​
 +
 + logger.info("​访问monitor/​query"​);​
 + return "​monitor/​query";​
 + }
 +
 + /**
 + * 交易监控查询
 + * @param request
 + * @param monitorDto
 + * @return
 + */
 + @RequestMapping(value = "/​query",​ method = RequestMethod.POST,​ produces="​application/​json"​)
 + public @ResponseBody String query(HttpServletRequest request, MonitorDto monitorDto) {
 + logger.info("​交易监控查询,​方法路径:​["​ + monitorDto.getMethodRoute() + "​],​方法类型:​["​ + monitorDto.getMethodType() + "​]"​
 + + ",​外部系统:​["​ + monitorDto.getOuterSystem() + "​],​是否异常发生:​["​ + monitorDto.getIsException() + "​]"​
 + + ",​开始时间:​["​ + monitorDto.getBeginTime() + "​],​结束时间:​["​ + monitorDto.getEndTime() + "​]"​
 + + ",​最小耗时(毫秒)(>​=):​["​ + monitorDto.getBeginUsedTime() + "​],​最大耗时(毫秒)(<​=):​["​ + monitorDto.getEndUsedTime() + "​]"​
 + + ",​机器ip:​["​ + monitorDto.getIp() + "​]"​
 + + ",​备注字段1:​["​ + monitorDto.getResv1() + "​],​备注字段2:​["​ + monitorDto.getResv2() + "​]"​
 + + ",​备注字段3:​["​ + monitorDto.getResv3() + "​],​每页个数:​["​ + monitorDto.getPageSize() + "​]"​
 + + ",​当前页数:​["​ + monitorDto.getActivePage() + "​]"​);​
 + /**
 + * 判登录
 + */
 + if(null == request.getSession().getAttribute(BaseInterface.KEY_USER)){
 + logger.info("​请先登录!"​);​
 + return "​{isSuccess:​false,​message:'​请先登录!'​}";​
 + }
 +
 + /**
 + * 调record_app查询
 + */
 + String url = "​http://​121.43.104.34:​8080/​record_app/​monitor/​query.htm";​
 + Map<​String,​ String> mapData = new HashMap<​String,​ String>​();​
 + mapData.put("​methodRoute",​ monitorDto.getMethodRoute());​
 + mapData.put("​methodType",​ processColon(monitorDto.getMethodType()));​
 + mapData.put("​outerSystem",​ processColon(monitorDto.getOuterSystem()));​
 + mapData.put("​isException",​ StringUtils.isBlank(monitorDto.getIsException())?"​-1":​processColon(monitorDto.getIsException()));​
 + mapData.put("​beginTime",​ monitorDto.getBeginTime());​
 + mapData.put("​endTime",​ monitorDto.getEndTime());​
 + mapData.put("​beginUsedTime",​ StringUtils.isBlank(monitorDto.getBeginUsedTime())?"​-1":​monitorDto.getBeginUsedTime());​
 + mapData.put("​endUsedTime",​ StringUtils.isBlank(monitorDto.getEndUsedTime())?"​-1":​monitorDto.getEndUsedTime());​
 + mapData.put("​ip",​ monitorDto.getIp());​
 + mapData.put("​resv1",​ monitorDto.getResv1());​
 + mapData.put("​resv2",​ monitorDto.getResv2());​
 + mapData.put("​resv3",​ monitorDto.getResv3());​
 + mapData.put("​pageSize",​ StringUtils.EMPTY + monitorDto.getPageSize());​
 + mapData.put("​activePage",​ StringUtils.EMPTY + monitorDto.getActivePage());​
 + return HttpClientUtils.getWebContentByPost(url,​ mapData, "​utf-8"​);​
 + }
 +
 + /**
 + * 交易监控统计
 + * @param request
 + * @param monitorDto
 + * @return
 + */
 + @RequestMapping(value = "/​count",​ method = RequestMethod.POST,​ produces="​application/​json"​)
 + public @ResponseBody String count(HttpServletRequest request, MonitorDto monitorDto) {
 + logger.info("​交易监控查询,​方法路径:​["​ + monitorDto.getMethodRoute() + "​],​方法类型:​["​ + monitorDto.getMethodType() + "​]"​
 + + ",​外部系统:​["​ + monitorDto.getOuterSystem() + "​],​是否异常发生:​["​ + monitorDto.getIsException() + "​]"​
 + + ",​开始时间:​["​ + monitorDto.getBeginTime() + "​],​结束时间:​["​ + monitorDto.getEndTime() + "​]"​
 + + ",​最小耗时(毫秒)(>​=):​["​ + monitorDto.getBeginUsedTime() + "​],​最大耗时(毫秒)(<​=):​["​ + monitorDto.getEndUsedTime() + "​]"​
 + + ",​机器ip:​["​ + monitorDto.getIp() + "​]"​
 + + ",​备注字段1:​["​ + monitorDto.getResv1() + "​],​备注字段2:​["​ + monitorDto.getResv2() + "​]"​
 + + ",​备注字段3:​["​ + monitorDto.getResv3() + "​]"​);​
 + /**
 + * 判登录
 + */
 + if(null == request.getSession().getAttribute(BaseInterface.KEY_USER)){
 + logger.info("​请先登录!"​);​
 + return "​{isSuccess:​false,​message:'​请先登录!'​}";​
 + }
 +
 + /**
 + * 调record_app查询
 + */
 + String url = "​http://​121.43.104.34:​8080/​record_app/​monitor/​count.htm";​
 + Map<​String,​ String> mapData = new HashMap<​String,​ String>​();​
 + mapData.put("​methodRoute",​ monitorDto.getMethodRoute());​
 + mapData.put("​methodType",​ processColon(monitorDto.getMethodType()));​
 + mapData.put("​outerSystem",​ processColon(monitorDto.getOuterSystem()));​
 + mapData.put("​isException",​ StringUtils.isBlank(monitorDto.getIsException())?"​-1":​processColon(monitorDto.getIsException()));​
 + mapData.put("​beginTime",​ monitorDto.getBeginTime());​
 + mapData.put("​endTime",​ monitorDto.getEndTime());​
 + mapData.put("​beginUsedTime",​ StringUtils.isBlank(monitorDto.getBeginUsedTime())?"​-1":​monitorDto.getBeginUsedTime());​
 + mapData.put("​endUsedTime",​ StringUtils.isBlank(monitorDto.getEndUsedTime())?"​-1":​monitorDto.getEndUsedTime());​
 + mapData.put("​ip",​ monitorDto.getIp());​
 + mapData.put("​resv1",​ monitorDto.getResv1());​
 + mapData.put("​resv2",​ monitorDto.getResv2());​
 + mapData.put("​resv3",​ monitorDto.getResv3());​
 + return HttpClientUtils.getWebContentByPost(url,​ mapData, "​utf-8"​);​
 + }
 +
 + /**
 + * 处理字符串,含有:​,则返回:​之前的字符
 + * @param string
 + * @return
 + */
 + private String processColon(String string) {
 + int index = StringUtils.indexOf(string,​ ":"​);​
 + if(index > -1) {
 + string = string.substring(0,​ index);
 + }
 + return string;
 + }
 +
 + /**
 + * 初始化session
 + * @param request
 + */
 + public void initSession(HttpServletRequest request) {
 + /**
 + * 调record_app查询
 + */
 + String url = "​http://​121.43.104.34:​8080/​record_app/​monitor/​queryAllMethodRoutes.htm";​
 + String methodRoutes = HttpClientUtils.getWebContentByGet(url,​ "​utf-8"​);​
 + JSONArray array = JSONArray.parseArray(methodRoutes);​
 + Object[] objArray = null;
 + if(null != array) {
 + objArray = array.toArray();​
 + }
 +
 + /**
 + * 方法路径
 + */
 + request.getSession().setAttribute(MonitorInterface.METHOD_ROUTE_LIST,​ objArray);
 + /**
 + * 方法类型
 + */
 + request.getSession().setAttribute(MonitorInterface.METHOD_TYPE_LIST,​ new String[]{"​PO:​提供对外服务方法","​IN:​内部服务方法","​IO:​调用外部方法","​SQL:​SQL"​});​
 + /**
 + * 外部系统
 + */
 + request.getSession().setAttribute(MonitorInterface.OUTER_SYSTEM_LIST,​ new String[]{"​record_app:​记录点滴"​});​
 + /**
 + * 是否异常发生
 + */
 + request.getSession().setAttribute(MonitorInterface.IS_EXCEPTION_LIST,​ new String[]{"​0:​无异常发生","​1:​异常发生"​});​
 + /**
 + * 机器ip
 + */
 + request.getSession().setAttribute(MonitorInterface.IP_LIST,​ new String[]{"​10.117.24.172"​});​
 + }
 +
 + /**
 + * 访问实时监控页面
 + * @return
 + */
 + @RequestMapping(value = "/​realtime",​ method = RequestMethod.GET)
 + public String realtimeGet(HttpServletRequest request) {
 + if(null == request.getSession().getAttribute(BaseInterface.KEY_USER)){
 + logger.info("​访问account/​login"​);​
 + return "​account/​login";​
 + }
 +
 + /**
 + * 初始化session
 + */
 + initSession(request);​
 +
 + logger.info("​访问monitor/​realtime"​);​
 + return "​monitor/​realtime";​
 + }
 +
 + /**
 + * 实时监控
 + * @param request
 + * @param monitorDto
 + * @return
 + */
 + @RequestMapping(value = "/​realtime",​ method = RequestMethod.POST,​ produces="​application/​json"​)
 + public @ResponseBody String realtime(HttpServletRequest request, MonitorDto monitorDto) {
 + logger.info("​交易监控查询,​方法路径:​["​ + monitorDto.getMethodRoute() + "​],​方法类型:​["​ + monitorDto.getMethodType() + "​]"​
 + + ",​外部系统:​["​ + monitorDto.getOuterSystem() + "​],​是否异常发生:​["​ + monitorDto.getIsException() + "​]"​
 + + ",​开始时间:​["​ + monitorDto.getBeginTime() + "​],​结束时间:​["​ + monitorDto.getEndTime() + "​]"​
 + + ",​机器ip:​["​ + monitorDto.getIp() + "​]"​
 + + ",​备注字段1:​["​ + monitorDto.getResv1() + "​],​备注字段2:​["​ + monitorDto.getResv2() + "​]"​
 + + ",​备注字段3:​["​ + monitorDto.getResv3() + "​]"​);​
 + /**
 + * 判登录
 + */
 + if(null == request.getSession().getAttribute(BaseInterface.KEY_USER)){
 + logger.info("​请先登录!"​);​
 + return "​{isSuccess:​false,​message:'​请先登录!'​}";​
 + }
 +
 + /**
 + * 调record_app查询
 + */
 + String url = "​http://​121.43.104.34:​8080/​record_app/​monitor/​count.htm";​
 + Map<​String,​ String> mapData = new HashMap<​String,​ String>​();​
 + mapData.put("​methodRoute",​ monitorDto.getMethodRoute());​
 + mapData.put("​methodType",​ processColon(monitorDto.getMethodType()));​
 + mapData.put("​outerSystem",​ processColon(monitorDto.getOuterSystem()));​
 + mapData.put("​isException",​ StringUtils.isBlank(monitorDto.getIsException())?"​-1":​processColon(monitorDto.getIsException()));​
 + mapData.put("​beginTime",​ monitorDto.getBeginTime());​
 + mapData.put("​endTime",​ monitorDto.getEndTime());​
 + mapData.put("​beginUsedTime",​ StringUtils.isBlank(monitorDto.getBeginUsedTime())?"​-1":​monitorDto.getBeginUsedTime());​
 + mapData.put("​endUsedTime",​ StringUtils.isBlank(monitorDto.getEndUsedTime())?"​-1":​monitorDto.getEndUsedTime());​
 + mapData.put("​ip",​ monitorDto.getIp());​
 + mapData.put("​resv1",​ monitorDto.getResv1());​
 + mapData.put("​resv2",​ monitorDto.getResv2());​
 + mapData.put("​resv3",​ monitorDto.getResv3());​
 + return HttpClientUtils.getWebContentByPost(url,​ mapData, "​utf-8"​);​
 + }
 +}
 +</​code>​
 +
 +==== MonitorController.java ====
 +record_app下的
 +<code java MonitorController.java>​
 +package com.gxx.record_app.web.monitor;​
 +
 +import java.util.List;​
 +
 +import javax.servlet.http.HttpServletRequest;​
 +
 +import org.apache.log4j.Logger;​
 +import org.springframework.beans.factory.annotation.Autowired;​
 +import org.springframework.stereotype.Controller;​
 +import org.springframework.web.bind.annotation.RequestMapping;​
 +import org.springframework.web.bind.annotation.ResponseBody;​
 +
 +import com.gxx.record_app.base.dao.TransMonitorMapper;​
 +import com.gxx.record_app.base.vo.TransMonitorWithBLOBs;​
 +import com.gxx.record_app.dto.MonitorDto;​
 +import com.gxx.record_app.interfaces.UserInterface;​
 +
 +/**
 + * <dl>
 + ​* ​   <​dt><​b>​Title:</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   none
 + ​* ​   </dd>
 + ​* ​   <​dt><​b>​Description:​监控控制器</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   <​p>​none
 + ​* ​   </dd>
 + * </dl>
 + *
 + * @author Gxx
 + * @version 1.0, 2017年06月22日
 + * @since record_app
 + */
 +@Controller
 +@RequestMapping("/​monitor/"​)
 +public class MonitorController implements UserInterface {
 + /**
 + * 日志处理器
 + */
 + private final Logger logger = Logger.getLogger(MonitorController.class);​
 +
 + @Autowired
 + private TransMonitorMapper transMonitorMapper;​
 +
 + /**
 + * 交易监控查询
 + * @param request
 + * @param monitorDto
 + * @return
 + */
 +    @RequestMapping(value = "/​query",​produces="​application/​json"​)
 + public @ResponseBody MonitorDto query(HttpServletRequest request, MonitorDto monitorDto) {
 + logger.info("​交易监控查询,​方法路径:​["​ + monitorDto.getMethodRoute() + "​],​方法类型:​["​ + monitorDto.getMethodType() + "​]"​
 + + ",​外部系统:​["​ + monitorDto.getOuterSystem() + "​],​是否异常发生:​["​ + monitorDto.getIsException() + "​]"​
 + + ",​开始时间:​["​ + monitorDto.getBeginTime() + "​],​结束时间:​["​ + monitorDto.getEndTime() + "​]"​
 + + ",​最小耗时(毫秒)(>​=):​["​ + monitorDto.getBeginUsedTime() + "​],​最大耗时(毫秒)(<​=):​["​ + monitorDto.getEndUsedTime() + "​]"​
 + + ",​机器ip:​["​ + monitorDto.getIp() + "​]"​
 + + ",​备注字段1:​["​ + monitorDto.getResv1() + "​],​备注字段2:​["​ + monitorDto.getResv2() + "​]"​
 + + ",​备注字段3:​["​ + monitorDto.getResv3() + "​],​每页个数:​["​ + monitorDto.getPageSize() + "​]"​
 + + ",​当前页数:​["​ + monitorDto.getActivePage() + "​]"​);​
 +
 + monitorDto.setIsSuccess(true);​
 + monitorDto.setMessage("​查询成功!"​);​
 +
 + List<​TransMonitorWithBLOBs>​ list = transMonitorMapper.queryTransMonitor(monitorDto);​
 + monitorDto.setList(list);​
 +
 + /**
 +      * 查询配置信息总数
 +      */
 +     long totalCount = transMonitorMapper.countTransMonitor(monitorDto);​
 +     long totalPage = 0;
 +     if(monitorDto.getPageSize() > 0 && totalCount > 0){
 +     totalPage = (totalCount-1)/​monitorDto.getPageSize()+1;​
 +     }
 +     monitorDto.setTotalCount(totalCount);​
 +     monitorDto.setTotalPage(totalPage);​
 + return monitorDto;
 + }
 +
 + /**
 + * 交易监控统计
 + * @param request
 + * @param monitorDto
 + * @return
 + */
 +    @RequestMapping(value = "/​count",​produces="​application/​json"​)
 + public @ResponseBody MonitorDto count(HttpServletRequest request, MonitorDto monitorDto) {
 + logger.info("​交易监控查询,​方法路径:​["​ + monitorDto.getMethodRoute() + "​],​方法类型:​["​ + monitorDto.getMethodType() + "​]"​
 + + ",​外部系统:​["​ + monitorDto.getOuterSystem() + "​],​是否异常发生:​["​ + monitorDto.getIsException() + "​]"​
 + + ",​开始时间:​["​ + monitorDto.getBeginTime() + "​],​结束时间:​["​ + monitorDto.getEndTime() + "​]"​
 + + ",​最小耗时(毫秒)(>​=):​["​ + monitorDto.getBeginUsedTime() + "​],​最大耗时(毫秒)(<​=):​["​ + monitorDto.getEndUsedTime() + "​]"​
 + + ",​机器ip:​["​ + monitorDto.getIp() + "​]"​
 + + ",​备注字段1:​["​ + monitorDto.getResv1() + "​],​备注字段2:​["​ + monitorDto.getResv2() + "​]"​
 + + ",​备注字段3:​["​ + monitorDto.getResv3() + "​],​每页个数:​["​ + monitorDto.getPageSize() + "​]"​
 + + ",​当前页数:​["​ + monitorDto.getActivePage() + "​]"​);​
 +
 + monitorDto.setIsSuccess(true);​
 + monitorDto.setMessage("​查询成功!"​);​
 +
 +     long totalCount = transMonitorMapper.countTransMonitor(monitorDto);//​并发数
 +     double avgUsedTime = 0;//​平均耗时
 +     long tps = 0;//​每秒钟支持并发数
 +     if(totalCount > 0) {
 +     avgUsedTime = transMonitorMapper.queryAvgUsedTime(monitorDto);//​平均耗时
 +     if(avgUsedTime > 0) {
 +     tps = (long)(totalCount *1000.0 / avgUsedTime);​
 +     }
 +     }
 +     ​
 +     monitorDto.setTotalCount(totalCount);​
 +     monitorDto.setAvgUsedTime(avgUsedTime);​
 +     monitorDto.setTps(tps);​
 + return monitorDto;
 + }
 +
 + /**
 + * 查询所有监控方法路径
 + * @param request
 + * @return
 + */
 +    @RequestMapping(value = "/​queryAllMethodRoutes",​produces="​application/​json"​)
 + public @ResponseBody List<​String>​ queryAllMethodRoutes(HttpServletRequest request) {
 +    return transMonitorMapper.queryAllMethodRoutes();​
 +    }
 +}
 +</​code>​
 +
 +==== TransMonitorMapper.java ====
 +<code java TransMonitorMapper.java>​
 +package com.gxx.record_app.base.dao;​
 +
 +import java.util.List;​
 +
 +import org.apache.ibatis.annotations.Select;​
 +import org.apache.ibatis.annotations.SelectProvider;​
 +import org.springframework.stereotype.Repository;​
 +
 +import com.gxx.record_app.base.vo.TransMonitor;​
 +import com.gxx.record_app.base.vo.TransMonitorWithBLOBs;​
 +import com.gxx.record_app.dto.MonitorDto;​
 +
 +@Repository
 +public interface TransMonitorMapper {
 +    int deleteByPrimaryKey(Integer id);
 +
 +    int insert(TransMonitorWithBLOBs record);
 +
 +    int insertSelective(TransMonitorWithBLOBs record);
 +
 +    TransMonitorWithBLOBs selectByPrimaryKey(Integer id);
 +
 +    int updateByPrimaryKeySelective(TransMonitorWithBLOBs record);
 +
 +    int updateByPrimaryKeyWithBLOBs(TransMonitorWithBLOBs record);
 +
 +    int updateByPrimaryKey(TransMonitor record);
 +    ​
 +    /**
 +     * 查询交易监控
 +     * @param monitorDto
 +     * @return
 +     */
 + @SelectProvider(type=TransMonitorSqlProvider.class,​method="​queryTransMonitor"​)
 +    public List<​TransMonitorWithBLOBs>​ queryTransMonitor(MonitorDto monitorDto);​
 +    ​
 +    /**
 +     * 查询交易监控总数
 +     * @param monitorDto
 +     * @return
 +     */
 + @SelectProvider(type=TransMonitorSqlProvider.class,​method="​countTransMonitor"​)
 +    public long countTransMonitor(MonitorDto monitorDto);​
 +    ​
 +    /**
 +     * 查询平均耗时
 +     * @param monitorDto
 +     * @return
 +     */
 + @SelectProvider(type=TransMonitorSqlProvider.class,​method="​queryAvgUsedTime"​)
 +    public double queryAvgUsedTime(MonitorDto monitorDto);​
 +
 + /**
 + * 查询所有监控方法路径
 + * @return
 + */
 + @Select("​SELECT DISTINCT METHOD_ROUTE FROM TRANS_MONITOR"​)
 + public List<​String>​ queryAllMethodRoutes();​
 +}
 +</​code>​
 +==== TransMonitorSqlProvider.java ====
 +<code java TransMonitorSqlProvider.java>​
 +package com.gxx.record_app.base.dao;​
 +
 +import org.apache.commons.lang3.StringUtils;​
 +
 +import com.gxx.record_app.dto.MonitorDto;​
 +
 +/**
 + * <dl>
 + ​* ​   <​dt><​b>​Title:</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   none
 + ​* ​   </dd>
 + ​* ​   <​dt><​b>​Description:​交易监控查询SQL提供类</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   <​p>​none
 + ​* ​   </dd>
 + * </dl>
 + *
 + * @author Gxx
 + * @version 1.0, 2017年06月22日
 + * @since record_app
 + *
 + */
 +public class TransMonitorSqlProvider {
 + /**
 + * 查询交易监控
 + * @param monitorDto
 + * @return
 + */
 + public String queryTransMonitor(MonitorDto monitorDto){
 + String sql = "​SELECT * FROM TRANS_MONITOR WHERE 1=1";
 + //​方法路径
 + if(StringUtils.isNotBlank(monitorDto.getMethodRoute())){
 + sql += " AND METHOD_ROUTE = '"​ + (monitorDto.getMethodRoute()) + "'";​
 + }
 + //​方法类型
 + if(StringUtils.isNotBlank(monitorDto.getMethodType())){
 + sql += " AND METHOD_TYPE = '"​ + (monitorDto.getMethodType()) + "'";​
 + }
 + //​外部系统
 + if(StringUtils.isNotBlank(monitorDto.getOuterSystem())){
 + sql += " AND OUTER_SYSTEM = '"​ + (monitorDto.getOuterSystem()) + "'";​
 + }
 + //​是否异常发生
 + if(monitorDto.getIsException() >= 0){
 + sql += " AND IS_EXCEPTION = " + (monitorDto.getIsException());​
 + }
 + //​开始时间
 + if(StringUtils.isNotBlank(monitorDto.getBeginTime())){
 + sql += " AND BEGIN_TIME >= '"​ + (monitorDto.getBeginTime()) + "'";​
 + }
 + //​结束时间
 + if(StringUtils.isNotBlank(monitorDto.getEndTime())){
 + sql += " AND END_TIME <= '"​ + (monitorDto.getEndTime()) + "'";​
 + }
 + //​最小耗时(毫秒)(>​=)
 + if(monitorDto.getBeginUsedTime() >= 0){
 + sql += " AND USED_TIME >= " + (monitorDto.getBeginUsedTime());​
 + }
 + //​最大耗时(毫秒)(<​=)
 + if(monitorDto.getEndUsedTime() >= 0){
 + sql += " AND USED_TIME <= " + (monitorDto.getEndUsedTime());​
 + }
 + //​机器ip
 + if(StringUtils.isNotBlank(monitorDto.getIp())){
 + sql += " AND IP = '"​ + (monitorDto.getIp()) + "'";​
 + }
 + //​备注字段1
 + if(StringUtils.isNotBlank(monitorDto.getResv1())){
 + sql += " AND RESV1 LIKE '​%"​ + (monitorDto.getResv1()) + "​%'";​
 + }
 + //​备注字段2
 + if(StringUtils.isNotBlank(monitorDto.getResv2())){
 + sql += " AND RESV2 LIKE '​%"​ + (monitorDto.getResv2()) + "​%'";​
 + }
 + //​备注字段3
 + if(StringUtils.isNotBlank(monitorDto.getResv3())){
 + sql += " AND RESV3 LIKE '​%"​ + (monitorDto.getResv3()) + "​%'";​
 + }
 + //​id倒序
 + sql += " ORDER BY ID DESC";
 + //分页
 + if(monitorDto.getActivePage() > 0 && monitorDto.getPageSize() > 0){
 + sql += " LIMIT " + (monitorDto.getActivePage()-1)*monitorDto.getPageSize() + ","​ + monitorDto.getPageSize();​
 + }
 + return sql;
 + }
 +
 + /**
 + * 查询交易监控总数
 + * @param monitorDto
 + * @return
 + */
 + public String countTransMonitor(MonitorDto monitorDto){
 + String sql = "​SELECT COUNT(1) FROM TRANS_MONITOR WHERE 1=1";
 + //​方法路径
 + if(StringUtils.isNotBlank(monitorDto.getMethodRoute())){
 + sql += " AND METHOD_ROUTE = '"​ + (monitorDto.getMethodRoute()) + "'";​
 + }
 + //​方法类型
 + if(StringUtils.isNotBlank(monitorDto.getMethodType())){
 + sql += " AND METHOD_TYPE = '"​ + (monitorDto.getMethodType()) + "'";​
 + }
 + //​外部系统
 + if(StringUtils.isNotBlank(monitorDto.getOuterSystem())){
 + sql += " AND OUTER_SYSTEM = '"​ + (monitorDto.getOuterSystem()) + "'";​
 + }
 + //​是否异常发生
 + if(monitorDto.getIsException() >= 0){
 + sql += " AND IS_EXCEPTION = " + (monitorDto.getIsException());​
 + }
 + //​开始时间
 + if(StringUtils.isNotBlank(monitorDto.getBeginTime())){
 + sql += " AND BEGIN_TIME >= '"​ + (monitorDto.getBeginTime()) + "'";​
 + }
 + //​结束时间
 + if(StringUtils.isNotBlank(monitorDto.getEndTime())){
 + sql += " AND END_TIME <= '"​ + (monitorDto.getEndTime()) + "'";​
 + }
 + //​最小耗时(毫秒)(>​=)
 + if(monitorDto.getBeginUsedTime() >= 0){
 + sql += " AND USED_TIME >= " + (monitorDto.getBeginUsedTime());​
 + }
 + //​最大耗时(毫秒)(<​=)
 + if(monitorDto.getEndUsedTime() >= 0){
 + sql += " AND USED_TIME <= " + (monitorDto.getEndUsedTime());​
 + }
 + //​机器ip
 + if(StringUtils.isNotBlank(monitorDto.getIp())){
 + sql += " AND IP = '"​ + (monitorDto.getIp()) + "'";​
 + }
 + //​备注字段1
 + if(StringUtils.isNotBlank(monitorDto.getResv1())){
 + sql += " AND RESV1 LIKE '​%"​ + (monitorDto.getResv1()) + "​%'";​
 + }
 + //​备注字段2
 + if(StringUtils.isNotBlank(monitorDto.getResv2())){
 + sql += " AND RESV2 LIKE '​%"​ + (monitorDto.getResv2()) + "​%'";​
 + }
 + //​备注字段3
 + if(StringUtils.isNotBlank(monitorDto.getResv3())){
 + sql += " AND RESV3 LIKE '​%"​ + (monitorDto.getResv3()) + "​%'";​
 + }
 + return sql;
 + }
 +
 + /**
 + * 查询平均耗时
 + * @param monitorDto
 + * @return
 + */
 + public String queryAvgUsedTime(MonitorDto monitorDto){
 + String sql = "​SELECT AVG(USED_TIME) FROM TRANS_MONITOR WHERE 1=1";
 + //​方法路径
 + if(StringUtils.isNotBlank(monitorDto.getMethodRoute())){
 + sql += " AND METHOD_ROUTE = '"​ + (monitorDto.getMethodRoute()) + "'";​
 + }
 + //​方法类型
 + if(StringUtils.isNotBlank(monitorDto.getMethodType())){
 + sql += " AND METHOD_TYPE = '"​ + (monitorDto.getMethodType()) + "'";​
 + }
 + //​外部系统
 + if(StringUtils.isNotBlank(monitorDto.getOuterSystem())){
 + sql += " AND OUTER_SYSTEM = '"​ + (monitorDto.getOuterSystem()) + "'";​
 + }
 + //​是否异常发生
 + if(monitorDto.getIsException() >= 0){
 + sql += " AND IS_EXCEPTION = " + (monitorDto.getIsException());​
 + }
 + //​开始时间
 + if(StringUtils.isNotBlank(monitorDto.getBeginTime())){
 + sql += " AND BEGIN_TIME >= '"​ + (monitorDto.getBeginTime()) + "'";​
 + }
 + //​结束时间
 + if(StringUtils.isNotBlank(monitorDto.getEndTime())){
 + sql += " AND END_TIME <= '"​ + (monitorDto.getEndTime()) + "'";​
 + }
 + //​最小耗时(毫秒)(>​=)
 + if(monitorDto.getBeginUsedTime() >= 0){
 + sql += " AND USED_TIME >= " + (monitorDto.getBeginUsedTime());​
 + }
 + //​最大耗时(毫秒)(<​=)
 + if(monitorDto.getEndUsedTime() >= 0){
 + sql += " AND USED_TIME <= " + (monitorDto.getEndUsedTime());​
 + }
 + //​机器ip
 + if(StringUtils.isNotBlank(monitorDto.getIp())){
 + sql += " AND IP = '"​ + (monitorDto.getIp()) + "'";​
 + }
 + //​备注字段1
 + if(StringUtils.isNotBlank(monitorDto.getResv1())){
 + sql += " AND RESV1 LIKE '​%"​ + (monitorDto.getResv1()) + "​%'";​
 + }
 + //​备注字段2
 + if(StringUtils.isNotBlank(monitorDto.getResv2())){
 + sql += " AND RESV2 LIKE '​%"​ + (monitorDto.getResv2()) + "​%'";​
 + }
 + //​备注字段3
 + if(StringUtils.isNotBlank(monitorDto.getResv3())){
 + sql += " AND RESV3 LIKE '​%"​ + (monitorDto.getResv3()) + "​%'";​
 + }
 + return sql;
 + }
 +}
 +</​code>​
 +==== MonitorDto.java ====
 +record_app下的
 +<code java MonitorDto.java>​
 +package com.gxx.record_app.dto;​
 +
 +import java.util.List;​
 +
 +import com.gxx.record_app.base.vo.TransMonitorWithBLOBs;​
 +
 +/**
 + * <dl>
 + ​* ​   <​dt><​b>​Title:</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   交易监控对象
 + ​* ​   </dd>
 + ​* ​   <​dt><​b>​Description:</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   <​p>​none
 + ​* ​   </dd>
 + * </dl>
 + *
 + * @author Gxx
 + * @version 1.0, 2017年6月22日
 + * @since config_center
 + */
 +public class MonitorDto extends BaseDto {
 +    private String methodRoute;//​方法路径
 +    private String methodType;//​方法类型
 +    private String outerSystem;//​外部系统
 +    private int isException;//​是否异常发生
 +    private String beginTime;//​开始时间
 +    private String endTime;//​结束时间
 +    private int beginUsedTime;//​最小耗时(毫秒)(>​=)
 +    private int endUsedTime;//​最大耗时(毫秒)(<​=)
 +    private String ip;//​机器ip
 +    private String resv1;//​备注字段1
 +    private String resv2;//​备注字段2
 +    private String resv3;//​备注字段3
 +    ​
 +    private int pageSize;//​每页个数
 +    private int activePage;//​当前页数
 +    ​
 +    private boolean isSuccess;//​是否成功
 +    private String message;//​返回信息
 +    ​
 +    private List<​TransMonitorWithBLOBs>​ list;//​数据集合
 +    private long totalCount;//​总条数
 +    private long totalPage;//​总页数
 +    ​
 +    private double avgUsedTime;//​平均耗时
 +    private long tps;//​每秒钟支持并发数
 +    ​
 + public String getMethodRoute() {
 + return methodRoute;​
 + }
 + public void setMethodRoute(String methodRoute) {
 + this.methodRoute = methodRoute;​
 + }
 + public String getMethodType() {
 + return methodType;
 + }
 + public void setMethodType(String methodType) {
 + this.methodType = methodType;
 + }
 + public String getOuterSystem() {
 + return outerSystem;​
 + }
 + public void setOuterSystem(String outerSystem) {
 + this.outerSystem = outerSystem;​
 + }
 + public int getIsException() {
 + return isException;​
 + }
 + public void setIsException(int isException) {
 + this.isException = isException;​
 + }
 + public String getBeginTime() {
 + return beginTime;
 + }
 + public void setBeginTime(String beginTime) {
 + this.beginTime = beginTime;
 + }
 + public String getEndTime() {
 + return endTime;
 + }
 + public void setEndTime(String endTime) {
 + this.endTime = endTime;
 + }
 + public int getBeginUsedTime() {
 + return beginUsedTime;​
 + }
 + public void setBeginUsedTime(int beginUsedTime) {
 + this.beginUsedTime = beginUsedTime;​
 + }
 + public int getEndUsedTime() {
 + return endUsedTime;​
 + }
 + public void setEndUsedTime(int endUsedTime) {
 + this.endUsedTime = endUsedTime;​
 + }
 + public String getIp() {
 + return ip;
 + }
 + public void setIp(String ip) {
 + this.ip = ip;
 + }
 + public String getResv1() {
 + return resv1;
 + }
 + public void setResv1(String resv1) {
 + this.resv1 = resv1;
 + }
 + public String getResv2() {
 + return resv2;
 + }
 + public void setResv2(String resv2) {
 + this.resv2 = resv2;
 + }
 + public String getResv3() {
 + return resv3;
 + }
 + public void setResv3(String resv3) {
 + this.resv3 = resv3;
 + }
 + public int getPageSize() {
 + return pageSize;
 + }
 + public void setPageSize(int pageSize) {
 + this.pageSize = pageSize;
 + }
 + public int getActivePage() {
 + return activePage;
 + }
 + public void setActivePage(int activePage) {
 + this.activePage = activePage;
 + }
 + public boolean isSuccess() {
 + return isSuccess;
 + }
 + public void setSuccess(boolean isSuccess) {
 + this.isSuccess = isSuccess;
 + }
 + public String getMessage() {
 + return message;
 + }
 + public void setMessage(String message) {
 + this.message = message;
 + }
 + public List<​TransMonitorWithBLOBs>​ getList() {
 + return list;
 + }
 + public void setList(List<​TransMonitorWithBLOBs>​ list) {
 + this.list = list;
 + }
 + public long getTotalCount() {
 + return totalCount;
 + }
 + public void setTotalCount(long totalCount) {
 + this.totalCount = totalCount;
 + }
 + public long getTotalPage() {
 + return totalPage;
 + }
 + public void setTotalPage(long totalPage) {
 + this.totalPage = totalPage;
 + }
 + public double getAvgUsedTime() {
 + return avgUsedTime;​
 + }
 + public void setAvgUsedTime(double avgUsedTime) {
 + this.avgUsedTime = avgUsedTime;​
 + }
 + public long getTps() {
 + return tps;
 + }
 + public void setTps(long tps) {
 + this.tps = tps;
 + }
 +}
 +</​code>​
 +==== MonitorDto.java ====
 +config_center下的
 +<code java MonitorDto.java>​
 +package com.gxx.config_center.dto;​
 +/**
 + * <dl>
 + ​* ​   <​dt><​b>​Title:</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   交易监控对象
 + ​* ​   </dd>
 + ​* ​   <​dt><​b>​Description:</​b></​dt>​
 + ​* ​   <dd>
 + ​* ​   <​p>​none
 + ​* ​   </dd>
 + * </dl>
 + *
 + * @author Gxx
 + * @version 1.0, 2017年6月22日
 + * @since config_center
 + */
 +public class MonitorDto extends BaseDto {
 +    private String methodRoute;//​方法路径
 +    private String methodType;//​方法类型
 +    private String outerSystem;//​外部系统
 +    private String isException;//​是否异常发生
 +    private String beginTime;//​开始时间
 +    private String endTime;//​结束时间
 +    private String beginUsedTime;//​最小耗时(毫秒)(>​=)
 +    private String endUsedTime;//​最大耗时(毫秒)(<​=)
 +    private String ip;//​机器ip
 +    private String resv1;//​备注字段1
 +    private String resv2;//​备注字段2
 +    private String resv3;//​备注字段3
 +    ​
 +    private int pageSize;//​每页个数
 +    private int activePage;//​当前页数
 +    ​
 + public String getMethodRoute() {
 + return methodRoute;​
 + }
 + public void setMethodRoute(String methodRoute) {
 + this.methodRoute = methodRoute;​
 + }
 + public String getMethodType() {
 + return methodType;
 + }
 + public void setMethodType(String methodType) {
 + this.methodType = methodType;
 + }
 + public String getOuterSystem() {
 + return outerSystem;​
 + }
 + public void setOuterSystem(String outerSystem) {
 + this.outerSystem = outerSystem;​
 + }
 + public String getIsException() {
 + return isException;​
 + }
 + public void setIsException(String isException) {
 + this.isException = isException;​
 + }
 + public String getBeginTime() {
 + return beginTime;
 + }
 + public void setBeginTime(String beginTime) {
 + this.beginTime = beginTime;
 + }
 + public String getEndTime() {
 + return endTime;
 + }
 + public void setEndTime(String endTime) {
 + this.endTime = endTime;
 + }
 + public String getBeginUsedTime() {
 + return beginUsedTime;​
 + }
 + public void setBeginUsedTime(String beginUsedTime) {
 + this.beginUsedTime = beginUsedTime;​
 + }
 + public String getEndUsedTime() {
 + return endUsedTime;​
 + }
 + public void setEndUsedTime(String endUsedTime) {
 + this.endUsedTime = endUsedTime;​
 + }
 + public String getIp() {
 + return ip;
 + }
 + public void setIp(String ip) {
 + this.ip = ip;
 + }
 + public String getResv1() {
 + return resv1;
 + }
 + public void setResv1(String resv1) {
 + this.resv1 = resv1;
 + }
 + public String getResv2() {
 + return resv2;
 + }
 + public void setResv2(String resv2) {
 + this.resv2 = resv2;
 + }
 + public String getResv3() {
 + return resv3;
 + }
 + public void setResv3(String resv3) {
 + this.resv3 = resv3;
 + }
 + public int getPageSize() {
 + return pageSize;
 + }
 + public void setPageSize(int pageSize) {
 + this.pageSize = pageSize;
 + }
 + public int getActivePage() {
 + return activePage;
 + }
 + public void setActivePage(int activePage) {
 + this.activePage = activePage;
 + }
 +}
 +</​code>​
分享/技术/交易监控/交易监控中间件_实现.1499007976.txt.gz · 最后更改: 2017/07/02 23:06 由 gxx