瀏覽代碼

可视化-接口故障

limeng 2 年之前
父節點
當前提交
81723870a1

+ 20 - 13
mybusiness/src/main/java/com/business/controller/VisualizationController.java

@@ -111,21 +111,28 @@ public class VisualizationController extends BaseController {
         ImputationData id = new ImputationData();
         id.setYear(year);
         ImputationData data = imputationDataService.selectImputationData(id);
-        arr[0] = data.getJan();
-        arr[1] = data.getFeb();
-        arr[2] = data.getMar();
-        arr[3] = data.getApr();
-        arr[4] = data.getMay();
-        arr[5] = data.getJun();
-        arr[6] = data.getJul();
-        arr[7] = data.getAug();
-        arr[8] = data.getSep();
-        arr[9] = data.getOct();
-        arr[10] = data.getNov();
-        arr[11] = data.getDecb();
+            arr[0] = data.getJan();
+            arr[1] = data.getFeb();
+            arr[2] = data.getMar();
+            arr[3] = data.getApr();
+            arr[4] = data.getMay();
+            arr[5] = data.getJun();
+            arr[6] = data.getJul();
+            arr[7] = data.getAug();
+            arr[8] = data.getSep();
+            arr[9] = data.getOct();
+            arr[10] = data.getNov();
+            arr[11] = data.getDecb();
         return arr;
     }
 
-
+    /**
+     * 查询故障接口数量
+     * */
+    @PostMapping("getFaultInterfaceCount")
+    @ResponseBody
+    public Integer getFaultInterfaceCount(){
+        return interfaceinfoService.getFaultInterfaceCount();
+    }
 
 }

+ 6 - 0
mybusiness/src/main/java/com/sooka/system/mapper/TUInterfaceinfoMapper.java

@@ -110,4 +110,10 @@ public interface TUInterfaceinfoMapper
      * @return 结果
      */
     public List<TUInterfaceinfo> getImputationDataRanking();
+
+    /**
+     * 查询故障接口数量
+     * @return 结果
+     * */
+    public Integer getFaultInterfaceCount();
 }

+ 6 - 0
mybusiness/src/main/java/com/sooka/system/service/ITUInterfaceinfoService.java

@@ -107,4 +107,10 @@ public interface ITUInterfaceinfoService
      */
     public List<TUInterfaceinfo> getImputationDataRanking();
 
+    /**
+     * 查询故障接口数量
+     * @return 结果
+     * */
+    public Integer getFaultInterfaceCount();
+
 }

+ 9 - 0
mybusiness/src/main/java/com/sooka/system/service/impl/TUInterfaceinfoServiceImpl.java

@@ -200,4 +200,13 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
     public List<TUInterfaceinfo> getImputationDataRanking(){
         return tUInterfaceinfoMapper.getImputationDataRanking();
     }
+
+    /**
+     * 查询故障接口数量
+     * @return 结果
+     * */
+    @Override
+    public Integer getFaultInterfaceCount(){
+        return tUInterfaceinfoMapper.getFaultInterfaceCount();
+    }
 }

+ 9 - 0
mybusiness/src/main/resources/mapper/system/TUInterfaceinfoMapper.xml

@@ -314,4 +314,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         10
     </select>
 
+    <select id="getFaultInterfaceCount" resultType="Integer">
+        SELECT
+            count(id) count
+        FROM
+            t_u_interfaceinfo
+        WHERE
+            status = 1
+    </select>
+
 </mapper>

+ 6 - 0
mybusiness/src/main/resources/static/visualization/js/echarts_div.js

@@ -73,6 +73,12 @@ function imputationDataList(year) {
 	});
 }
 
+function getFaultInterfaceCount() {
+	$.post("/visualization/getFaultInterfaceCount",function (res) {
+		$("#faultInterfaceCount").text(res);
+	});
+}
+
 // 接口占比
 function jkzb(percent) {
 	let trafficWay = [];

+ 3 - 6
mybusiness/src/main/resources/static/visualization/js/th_jk.js

@@ -10,6 +10,9 @@
         setInterval(function () {
             CurrentTime()
         }, 1000);
+
+        /** 查询故障接口数量 **/
+        getFaultInterfaceCount();
         /** 接口数量和占比 **/
         countAndPercent();
         /** 归集数据/接口排名 **/
@@ -27,12 +30,6 @@
             $('.tab_div1 .jkgj_tab').attr('v', i);
             $('.tab_div1 .jkgj_tab').hide();
             $('.tab_div1 .jkgj_tab').eq(i).show();
-            //
-            // if ($('.tab_div1 .jkgj_tab').eq(1).is(':hidden')) {
-            //     jkgj();
-            // } else if ($('.tab_div1 .jkgj_tab').eq(0).is(':hidden')) {
-            //     jkgj2();
-            // }
         });
 
         $(".tab_div1").mouseenter(function () {//只要用户鼠标在这个tab1区域内,就不自动跳转

+ 2 - 1
mybusiness/src/main/resources/templates/visualization/index.html

@@ -22,7 +22,7 @@
     <div class="header_nav fr">
         <a class="on">大数据</a>
         <a>接入部门</a>
-        <a>接口故障<i>(0)</i></a>
+        <a>接口故障<i>(<span id="faultInterfaceCount">0</span>)</i></a>
     </div>
 </div>
 <div class="content clearfix">
@@ -331,6 +331,7 @@
         imputationDataList($("#line").val());
     }
 
+
 </script>
 <script type="text/javascript" th:src="@{/visualization/js/echarts_div.js}"></script>
 <script type="text/javascript" th:src="@{/visualization/js/echarts-tooltip-carousel.js}"></script>