Преглед на файлове

对接数据监控接口

tengmingxue преди 2 години
родител
ревизия
87fe048103

+ 1 - 1
.env.development

@@ -51,6 +51,6 @@ VITE_GLOB_CONTENT_SECURITY_POLICY = false
 # Alarm Notify Polling Interval Time
 VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME = 500000
 #二三维一体化
-VITE_GLOB_LIGONG_ADMIN = http://localhost:8085/#/
+VITE_GLOB_LIGONG_ADMIN = http://localhost:8084/#/
 # Alarm Notify Auto Close Time Unit is Second
 VITE_GLOB_ALARM_NOTIFY_DURATION = 5

+ 1 - 1
.env.production

@@ -62,6 +62,6 @@ VITE_GLOB_CONTENT_SECURITY_POLICY = false
 # Alarm Notify Polling Interval Time
 VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME = 60000
 #二三维一体化
-VITE_GLOB_LIGONG_ADMIN = http://localhost:8085/#/
+VITE_GLOB_LIGONG_ADMIN = http://192.168.119.100:12002/spatialDataMng/#/
 # Alarm Notify Auto Close Time Unit is Second
 VITE_GLOB_ALARM_NOTIFY_DURATION = 5

+ 152 - 3
src/api/interface/interface.ts

@@ -2,16 +2,38 @@
 import { defHttp } from '/@/utils/http/axios';
 import { session } from "/@/utils/Memory.js";
 import type { ErrorMessageMode } from '/#/axios';
+const interfaceType = { apiUrl2: true };
+
 
 enum Api {
+    callProvider = "/callProvider",
     List = '/base-center/system/selectSystemPowerInterface',
     GetGroup = '/interface-center/interface/getGroup',
     GetGroupId = '/interface-center/interface/getInterfacesAndPowerByUserId',
     GetInterfaceDetail = '/interface-center/interface/getInterfaceDetail',
-    GetInterfaces = '/interface-center/interface/getInterfaces'
-}
+    GetInterfaces = '/interface-center/interface/getInterfaces',
+    //数据监控接口
+    //(1)大数据平台告警信息
+    BigDataMonitor = '/interface-center/monitor/bigData/events',
+    //(2) 大数据平台hdfs容量信息
+    HdfsCapacity = '/interface-center/monitor/bigData/hdfsCapacity',
+    //(3) 获取接口api总数,当月调用次数,总调用次数
+    GetApiData = '/interface-center/monitor/getApiData',
+    //(4) 获取接口近三十天每日的调用次数
+    GetApiUseCountDays = '/interface-center/monitor/getApiUseCountDays',
+    //(5) 获取接口近半年每月的调用次数
+    GetApiUseCountMouths = '/interface-center/monitor/getApiUseCountMouths',
+    //(6) 各分析统计
+    BusinessStatistics = '/xldanalysis-center/xldanalyst/BusinessStatistics',
 
-const interfaceType = { apiUrl2: true };
+    //(7) 分类统计
+    GetInterfacesTotalNum = '/interface-center/interface/getInterfacesTotalNum',
+    //(8) 获取地图服务,文件数据,数据库数据,工具数据个数
+    GetSpaceData = '/interface-center/monitor/getSpaceData',
+    //(9) 统计文件个数和总文件大小
+    GetDataStoreGroupByStatistics = '/interface-center/monitor/getDataStoreGroupByStatistics'
+
+}
 
 /**
  * @description:获取应用列表
@@ -116,3 +138,130 @@ export function getAllInterface(e) {
             })
     })
 }
+
+
+/**
+ * @description:各分析统计
+ *  @param:
+ *     startTime  开始时间     2022-01-29
+ *     endTime    结束时间     2022-09-29
+*/
+export function queryBusinessStatistics(params) {
+    return new Promise<void>((resolve) => {
+        defHttp.post({ url: Api.BusinessStatistics, params })
+            .then((r) => {
+                if (r.resp_code == 0 && r.datas && r.datas.length) {
+                    resolve(r.datas);
+                } else {
+                    resolve();
+                }
+            })
+    })
+}
+
+
+/**
+ * @description:获取接口近三十天每日的调用次数
+*/
+export function queryApiUseCountDays(params) {
+    return new Promise<void>((resolve) => {
+        defHttp.get({ url: Api.GetApiUseCountDays, params })
+            .then((r) => {
+                if (r.resp_code == 0 && r.datas && r.datas) {
+                    resolve(r.datas);
+                } else {
+                    resolve();
+                }
+            })
+    })
+}
+
+/**
+ * @description:获取接口近半年每月的调用次数
+*/
+export function queryApiUseCountMouths(params) {
+    return new Promise<void>((resolve) => {
+        defHttp.get({ url: Api.GetApiUseCountMouths, params })
+            .then((r) => {
+                if (r.resp_code == 0 && r.datas && r.datas) {
+                    resolve(r.datas);
+                } else {
+                    resolve();
+                }
+            })
+    })
+}
+
+
+
+/**
+ * @description:数据资源分类统计
+ */
+ export function StatisticDataResource() {
+    const formData = new FormData();
+    formData.append("interfaceName", "antu.space.provider.sservicebase.ServiceBaseMetaDataViewProvider");
+    formData.append("methodName", "getStatistics");
+    formData.append("args[]", session.getItem('tokenV2'));
+    formData.append("args[]", 'false');
+    return new Promise<void>((resolve, reject) => {
+        defHttp.post({ url: Api.callProvider, params: formData, ...interfaceType })
+            .then((r) => {
+                let result = r.result === '' ? {} : JSON.parse(r.result)
+                resolve(result);
+            })
+    })
+}
+
+
+/**
+ * @description:查询接口总数
+ *  @param:
+*/
+export function queryInterfacesTotalNum(params) {
+    return new Promise<void>((resolve) => {
+        defHttp.get({ url: Api.GetInterfacesTotalNum, params })
+            .then((r) => {
+                if (r.resp_code === 0 && r.datas) {
+                    resolve(r.datas);
+                } else {
+                    resolve(0);
+                }
+            })
+    })
+}
+
+/**
+ * @description:获取地图服务,文件数据,数据库数据,工具数据个数
+ *  @param:
+*/
+export function querySpaceData(params) {
+    return new Promise<void>((resolve) => {
+        defHttp.get({ url: Api.GetSpaceData, params })
+            .then((r) => {
+                if (r.resp_code == 0 && r.datas && r.datas.length) {
+                    resolve(r.datas);
+                } else {
+                    resolve();
+                }
+            })
+    })
+}
+
+/**
+ * @description:统计文件个数和总文件大小
+ *  @param:
+*/
+export function DataStoreGroupByStatistics(params) {
+    return new Promise<void>((resolve) => {
+        defHttp.get({ url: Api.GetDataStoreGroupByStatistics, params })
+            .then((r) => {
+                if (r.resp_code == 0 && r.datas && r.datas.length) {
+                    resolve(r.datas);
+                } else {
+                    resolve();
+                }
+            })
+    })
+}
+
+

+ 34 - 24
src/views/dashboard/workbench/component/InterfaceEveryday.vue

@@ -16,9 +16,10 @@ import {
   watch,
   getCurrentInstance,
   shallowRef,
+  onUnmounted,
 } from 'vue';
 import moment from 'moment';
-
+import { queryApiUseCountDays } from '/@/api/interface/interface'
 const props = {
   type: {
     type: Object,
@@ -32,46 +33,47 @@ export default defineComponent({
   setup(props) {
     const data = reactive({
       title: '每日接口调用次数',
+      interval:null,
     });
     const domRef = ref(null);
     const { proxy } = getCurrentInstance();
     const echarts = proxy.$echarts;
     const mychart = shallowRef(null);
-
     /**
      * 查询统计数据
      */
     const queryData = async () => {
-      setEcharts();
+      const res = await queryApiUseCountDays()
+      let xAxisData = [],seriesData=[]
+      
+      if(res.dateArr){
+        res.dateArr.map(item=>{
+          const Arr = item.split('-')
+          xAxisData.push(`${Arr[1]}/${Arr[2]}`)
+        })
+        res.list.map(item=>{
+          seriesData.push(parseInt(item))
+        })
+      }
+      if(seriesData.length < 1 || xAxisData.length < 1) return;
+      const option = getOption(seriesData,xAxisData);
+      setEcharts(option);
     };
 
-    const setEcharts = () => {
+    const setEcharts = (option) => {
       if (mychart.value) mychart.value.clear();
       mychart.value = echarts.init(domRef.value);
-      const option = getOption();
-      mychart.value.setOption(option);
+      //const option = getOption(seriesData,xAxisData);
+      mychart.value.setOption(option,true);
       window.onresize = () => {
         mychart.value.resize();
       };
     };
 
-    const getOption = () => {
-      const seriesData = [60, 52, 200, 334, 390, 330, 220, 200, 334, 390, 330, 220];
+    const getOption = (seriesData,xAxisData) => {
+      //const seriesData = [60, 52, 200, 334, 390, 330, 220, 200, 334, 390, 330, 220];
       const maxValue = Math.max.apply(null, seriesData);
-      const xAxisData = [
-        '09/01',
-        '09/02',
-        '09/03',
-        '09/04',
-        '09/05',
-        '09/06',
-        '09/07',
-        '09/08',
-        '09/09',
-        '09/10',
-        '09/11',
-        '09/12',
-      ];
+      //const xAxisData = ['09/01','09/02','09/03','09/04', '09/05','09/06','09/07','09/08','09/09','09/10','09/11','09/12'];
       const colorList = [
         {
           type: 'linear',
@@ -164,7 +166,7 @@ export default defineComponent({
             name: '调用次数',
             type: 'bar',
             barWidth: '60%',
-            data: [60, 52, 200, 334, 390, 330, 220, 200, 334, 390, 330, 220],
+            data: seriesData,//[60, 52, 200, 334, 390, 330, 220, 200, 334, 390, 330, 220],
             itemStyle: {
               // 柱形图圆角,鼠标移上去效果,如果只是一个数字则说明四个参数全部设置为那么多
               normal: {
@@ -180,13 +182,21 @@ export default defineComponent({
             barGap: '0%',
           },
         ],
+        animationDuration: 0,//这里两个动画设置可以让图表更顺滑
+        animationEasing: 'cubicInOut'//这里两个动画设置可以让图表更顺滑
       };
     };
 
     onMounted(() => {
-      queryData();
+      if (data.interval) return;
+      data.interval = setInterval(() => {
+        queryData();
+      }, 3000);
     });
 
+    onUnmounted(() => {
+      if (data.interval) clearInterval(data.interval);
+    });
     return {
       domRef,
       mychart,

+ 41 - 27
src/views/dashboard/workbench/component/InterfaceMonth.vue

@@ -16,9 +16,12 @@ import {
   watch,
   getCurrentInstance,
   shallowRef,
+  onUnmounted,
 } from 'vue';
 import moment from 'moment';
 
+import { queryApiUseCountMouths } from '/@/api/interface/interface';
+
 const props = {
   type: {
     type: Object,
@@ -32,6 +35,7 @@ export default defineComponent({
   setup(props) {
     const data = reactive({
       title: '月度接口访问次数',
+      interval: null,
     });
     const domRef = ref(null);
     const { proxy } = getCurrentInstance();
@@ -42,36 +46,39 @@ export default defineComponent({
      * 查询统计数据
      */
     const queryData = async () => {
-      setEcharts();
+      const res = await queryApiUseCountMouths();
+
+      let xAxisData = [],
+        seriesData = [];
+
+      if (res) {
+        res.mouths.map((item) => {
+          xAxisData.push(item);
+        });
+
+        res.nums.map((item) => {
+          seriesData.push(parseInt(item));
+        });
+      }
+      if (seriesData.length < 1 || xAxisData.length < 1) return;
+      const option = getOption(seriesData, xAxisData);
+      setEcharts(option);
     };
 
-    const setEcharts = () => {
+    const setEcharts = (option) => {
       if (mychart.value) mychart.value.clear();
       mychart.value = echarts.init(domRef.value);
-      const option = getOption();
-      mychart.value.setOption(option);
+      //const option = getOption();
+      mychart.value.setOption(option,true);
       window.onresize = () => {
         mychart.value.resize();
       };
     };
 
-    const getOption = () => {
-      const seriesData = [123, 60, 25, 28, 42, 39, 20, 40, 123, 60, 25, 28];
+    const getOption = (seriesData, xAxisData) => {
+      //const seriesData = [123, 60, 25, 28, 42, 39, 20, 40, 123, 60, 25, 28];
       const maxValue = Math.max.apply(null, seriesData);
-      const xAxisData = [
-        '01月',
-        '02月',
-        '03月',
-        '04月',
-        '05月',
-        '06月',
-        '07月',
-        '08月',
-        '09月',
-        '10月',
-        '11月',
-        '12月',
-      ];
+      //const xAxisData = ['01月','02月','03月','04月','05月','06月','07月','08月','09月','10月','11月','12月',];
       const colorList = [
         {
           type: 'linear',
@@ -124,8 +131,8 @@ export default defineComponent({
           value: item,
           symbol: 'rect',
           symbolSize: ['100%', 4],
-          itemStyle:{
-            color:item < maxValue ? 'rgba(6,113,221,1)' :  'rgba(237,172,75,1)',
+          itemStyle: {
+            color: item < maxValue ? 'rgba(6,113,221,1)' : 'rgba(237,172,75,1)',
           },
         });
       });
@@ -149,7 +156,7 @@ export default defineComponent({
           axisLine: {
             show: true,
             lineStyle: {
-              color: 'rgba(222, 222, 222, 1)'
+              color: 'rgba(222, 222, 222, 1)',
             },
           },
         },
@@ -167,12 +174,12 @@ export default defineComponent({
           bottom: '1%',
           containLabel: true,
         },
-       
+
         series: [
           {
             name: 'hill',
             type: 'pictorialBar',
-            barCategoryGap: '60%',
+            barCategoryGap: '80%',
             // symbol: 'path://M0,10 L10,10 L5,0 L0,10 z',
             symbol: 'rect',
             itemStyle: {
@@ -201,13 +208,20 @@ export default defineComponent({
             data: seriesSymboleData,
           },
         ],
+        animationDuration: 0,//这里两个动画设置可以让图表更顺滑
+        animationEasing: 'cubicInOut'//这里两个动画设置可以让图表更顺滑
       };
     };
 
     onMounted(() => {
-      queryData();
+      if (data.interval) return;
+      data.interval = setInterval(() => {
+        queryData();
+      }, 3000);
+    });
+    onUnmounted(() => {
+      if (data.interval) clearInterval(data.interval);
     });
-
     return {
       domRef,
       mychart,

+ 49 - 16
src/views/dashboard/workbench/component/ResTypeStatistic.vue

@@ -18,7 +18,7 @@ import {
   shallowRef,
 } from 'vue';
 import moment from 'moment';
-
+import { StatisticDataResource,queryInterfacesTotalNum,querySpaceData } from '/@/api/interface/interface';
 const props = {
   type: {
     type: Object,
@@ -42,31 +42,64 @@ export default defineComponent({
      * 查询统计数据
      */
     const queryData = async () => {
-      setEcharts();
+      let seriesData = [
+        { value: 0, name: '地图资源' },
+        { value: 0, name: '文件资源' },
+        { value: 0, name: '数据库资源' },
+        { value: 0, name: '工具资源' },
+        { value: 0, name: '接口资源' },
+      ];
+      // const res = await StatisticDataResource();
+      // if(res){
+      //   //更新地图资源
+      //   seriesData[0].value = parseInt(res?.MR_COUNT ? res?.MR_COUNT : 0)
+      //   seriesData[1].value = parseInt(res?.DR_COUNT ? res?.DR_COUNT : 0)
+      //   seriesData[2].value = parseInt(res?.BR_COUNT ? res?.BR_COUNT : 6)
+      //   seriesData[3].value = parseInt(res?.TR_COUNT ? res?.TR_COUNT : 0)
+      //   seriesData[4].value = parseInt(res?.SR_COUNT ? res?.SR_COUNT : 0)
+      // }
+
+      const res = await queryInterfacesTotalNum()
+      if(res){
+        seriesData[4].value = parseInt(res ? res : 0)
+      }
+      const res2 = await querySpaceData()
+      if(res2 && res2.length > 0){
+        res2.map(item=>{
+          if(item.type === 'mr') seriesData[0].value = parseInt(item?.NUM ? item?.NUM : 0)
+          if(item.type === 'dr') seriesData[1].value = parseInt(item?.NUM ? item?.NUM : 0)
+          if(item.type === 'sr') seriesData[2].value = parseInt(item?.NUM ? item?.NUM : 0)
+          if(item.type === 'dt') seriesData[3].value = parseInt(item?.NUM ? item?.NUM : 0)
+        })
+      }
+
+      const option = getOption(seriesData);
+      //更新数据
+      setEcharts(option);
     };
 
-    const setEcharts = () => {
+    const setEcharts = (option) => {
       if (mychart.value) mychart.value.clear();
       mychart.value = echarts.init(domRef.value);
-      const option = getOption();
+      //const option = getOption();
       mychart.value.setOption(option);
       window.onresize = () => {
         mychart.value.resize();
       };
     };
 
-    const getOption = () => {
-      const seriesData = [
-        { value: 1048, name: '地图资源' },
-        { value: 735, name: '文件资源' },
-        { value: 580, name: '数据库资源' },
-        { value: 484, name: '工具资源' },
-        { value: 300, name: '接口资源' },
-      ];
-      let sumValue = 0
-      seriesData.map(item=>{
-        sumValue += item.value 
-      })
+    const getOption = (seriesData) => {
+      // const seriesData = [
+      //   { value: 1048, name: '地图资源' },
+      //   { value: 735, name: '文件资源' },
+      //   { value: 580, name: '数据库资源' },
+      //   { value: 484, name: '工具资源' },
+      //   { value: 300, name: '接口资源' },
+      // ];
+      let sumValue = 0;
+      seriesData.map((item) => {
+        sumValue += item.value;
+      });
       return {
         tooltip: {
           trigger: 'item',

Файловите разлики са ограничени, защото са твърде много
+ 2 - 9
src/views/dashboard/workbench/component/SpatialAnnlysis.vue


+ 31 - 13
src/views/dashboard/workbench/component/TopCardStatistic.vue

@@ -2,7 +2,7 @@
  * @Author: tengmingxue 1473375109@qq.com
  * @Date: 2023-09-13 10:06:22
  * @LastEditors: tengmingxue 1473375109@qq.com
- * @LastEditTime: 2023-09-13 17:03:44
+ * @LastEditTime: 2023-09-15 17:27:10
  * @FilePath: \xld-gis-admin\src\views\dashboard\workbench\component\TopCardStatistic.vue
  * @Description: 统计卡片
 -->
@@ -11,13 +11,13 @@
     <div class="card card1">
       <div class="data">
         <span class="label">数据容量</span>
-        <span class="value">{{dataSize}}TB</span>
+        <span class="value">{{ dataSize }}TB</span>
       </div>
     </div>
     <div class="card card2">
       <div class="data">
         <span class="label">数据种类</span>
-        <span class="value">{{dataType}}类</span>
+        <span class="value">{{ dataType }}类</span>
       </div>
     </div>
     <div class="card card3">
@@ -29,13 +29,15 @@
     <div class="card card4">
       <div class="data">
         <span class="label">支持数据</span>
-        <span class="value">{{ supportNum}}次</span>
+        <span class="value">{{ supportNum }}次</span>
       </div>
     </div>
   </div>
 </template>
   <script lang="ts">
 import { defineComponent, onMounted, toRefs, onUnmounted, nextTick, reactive } from 'vue';
+import { queryApiUseCountMouths } from '/@/api/interface/interface';
+
 export default defineComponent({
   name: 'TopCardStatistic',
   components: {},
@@ -48,23 +50,39 @@ export default defineComponent({
 
   setup(props) {
     const data = reactive({
+      interval:null,
       statisticData: props.statisticData,
-      dataSize:10000,
-      dataType:6,
-      analysisProject:12,
-      supportNum:1092,
+      dataSize: 10000,
+      dataType: 5,
+      analysisProject: 12,
+      supportNum: 1092,
     });
 
     nextTick(() => {});
     /**
      * 查数据
-    */
-    const queryData = () => {} 
+     */
+    const queryData = async () => {
+      let supportNum = 0;
+      const res = await queryApiUseCountMouths({});
+      if (res) {
+        res.nums.map((item) => {
+          supportNum += parseInt(item);
+        });
+      }
+      data.supportNum = supportNum;
+    };
+
     onMounted(() => {
-        queryData()
+      if (data.interval) return;
+      data.interval = setInterval(() => {
+        queryData();
+      }, 3000);
     });
 
-    onUnmounted(() => {});
+    onUnmounted(() => {
+      if (data.interval) clearInterval(data.interval);
+    });
 
     return {
       ...toRefs(data),
@@ -84,7 +102,7 @@ export default defineComponent({
     height: 100%;
     width: calc(100% - 3rem);
     margin: 0 3rem;
-    justify-content: end;
+    justify-content: flex-end;
     align-items: center;
     background-size: 100% 100%;
     .data {

+ 18 - 4
src/views/dashboard/workbench/component/UnstructuredStatistic.vue

@@ -2,7 +2,7 @@
  * @Author: tengmingxue 1473375109@qq.com
  * @Date: 2023-09-13 10:06:22
  * @LastEditors: tengmingxue 1473375109@qq.com
- * @LastEditTime: 2023-09-13 22:59:32
+ * @LastEditTime: 2023-09-15 21:46:43
  * @FilePath: \xld-gis-admin\src\views\dashboard\workbench\component\TopCardStatistic.vue
  * @Description: 统计卡片
 -->
@@ -99,11 +99,11 @@
           <div class="contenter">
             <div class="res-title">文件数据</div>
             <div class="res-file">
-              <div class="num">160</div>
+              <div class="num">{{ file.num }}</div>
               <div class="name">文件个数</div>
             </div>
             <div class="res-file">
-              <div class="num">200GB</div>
+              <div class="num">{{ file.size }}GB</div>
               <div class="name">文件总大小</div>
             </div>
           </div>
@@ -132,6 +132,8 @@
 </template>
     <script lang="ts">
 import { defineComponent, onMounted, toRefs, onUnmounted, nextTick, reactive } from 'vue';
+import { DataStoreGroupByStatistics } from '/@/api/interface/interface';
+
 export default defineComponent({
   name: 'UnstructuredStatistic',
   components: {},
@@ -146,13 +148,25 @@ export default defineComponent({
     const data = reactive({
       statisticData: props.statisticData,
       title: '非结构化统计',
+      file:{
+        num:'0',
+        size:'0',
+      }
     });
 
     nextTick(() => {});
     /**
      * 查数据
      */
-    const queryData = () => {};
+    const queryData = async() => {
+      const param = {}
+      const res = await DataStoreGroupByStatistics(param)
+      if(res && res.length > 0){
+        data.file.num = res[0]['num']
+        data.file.size = parseFloat(parseInt(res[0]['size'])/(1024*1024*1024)).toFixed(2)
+      }
+      console.log('文件数据统计',res,data.file)
+    };
     onMounted(() => {
       queryData();
     });