Bläddra i källkod

可视化优化

limeng 2 år sedan
förälder
incheckning
77681bc6bd

+ 44 - 1
mybusiness/src/main/java/com/business/controller/VisualizationController.java

@@ -1,5 +1,6 @@
 package com.business.controller;
 package com.business.controller;
 
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.business.domain.ImputationData;
 import com.business.domain.ImputationData;
 import com.business.service.ImputationDataService;
 import com.business.service.ImputationDataService;
@@ -43,12 +44,15 @@ public class VisualizationController extends BaseController {
     @Autowired
     @Autowired
     private ISysDeptService sysDeptService;
     private ISysDeptService sysDeptService;
 
 
+    private static final String FORMAT_STRING = "0000000000";
+
     @GetMapping("index")
     @GetMapping("index")
     public String index(ModelMap mmap){
     public String index(ModelMap mmap){
         SysDept dept = new SysDept();
         SysDept dept = new SysDept();
         dept.setParentId(214L);
         dept.setParentId(214L);
         List<SysDept> depts = sysDeptService.selectDeptList(dept);
         List<SysDept> depts = sysDeptService.selectDeptList(dept);
         mmap.put("depts",depts);
         mmap.put("depts",depts);
+        mmap.put("deptCount",depts.size());
         return "/visualization/index";
         return "/visualization/index";
     }
     }
 
 
@@ -62,14 +66,34 @@ public class VisualizationController extends BaseController {
         List<TUInterfaceinfo> interfaceList = interfaceinfoService.selectTUInterfaceinfoList(interfaceinfo);
         List<TUInterfaceinfo> interfaceList = interfaceinfoService.selectTUInterfaceinfoList(interfaceinfo);
         /**查询接口数量**/
         /**查询接口数量**/
         TUInterfaceinfo shareCount = interfaceinfoService.getShareCountByDeptId(id.toString());
         TUInterfaceinfo shareCount = interfaceinfoService.getShareCountByDeptId(id.toString());
-
+        /**部门归集数据量**/
+        Integer guijiCount = interfaceinfoService.getGuijiCountByDeptId(id.toString());
         mmap.put("deptId",sysDept.getDeptId());
         mmap.put("deptId",sysDept.getDeptId());
         mmap.put("deptName",sysDept.getDeptName());
         mmap.put("deptName",sysDept.getDeptName());
         mmap.put("interfaceList",interfaceList);
         mmap.put("interfaceList",interfaceList);
         mmap.put("shareCount",shareCount);
         mmap.put("shareCount",shareCount);
+        mmap.put("guijiCount",formatWithMakingUp(guijiCount.toString()));
         return "/visualization/tk_iframe";
         return "/visualization/tk_iframe";
     }
     }
 
 
+
+    /**
+     * 字符串前用零补齐
+     *
+     * @param src 原始字符串
+     * @return 补齐后的字符串
+     */
+    public static String formatWithMakingUp(String src) {
+        if (null == src) {
+            return null;
+        }
+        int delta = FORMAT_STRING.length() - src.length();
+        if (delta <= 0) {
+            return src;
+        }
+        return FORMAT_STRING.substring(0, delta) + src;
+    }
+
     /**
     /**
      * 查询 接口接口占比-子页
      * 查询 接口接口占比-子页
      * */
      * */
@@ -226,4 +250,23 @@ public class VisualizationController extends BaseController {
         return iIntRecordService.applyCount(year,deptId);
         return iIntRecordService.applyCount(year,deptId);
     }
     }
 
 
+
+    /**
+     * 查询归集和接口排名TOP10
+     * */
+    @PostMapping("getCallNumByDept/{deptId}")
+    @ResponseBody
+    public JSONArray getCallNumByDept(@PathVariable("deptId") Long deptId){
+        JSONArray jsonArray = new JSONArray();
+        //数据
+        List<TUInterfaceinfo> list_data = interfaceinfoService.getCallNumByDept(deptId);
+        for(TUInterfaceinfo info:list_data){
+            JSONObject object = new JSONObject();
+            object.put("name",info.getDeptName());
+            object.put("value",info.getCount());
+            jsonArray.add(object);
+        }
+        return jsonArray;
+    }
+
 }
 }

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

@@ -141,6 +141,8 @@ public interface TUInterfaceinfoMapper
      * */
      * */
     public TUInterfaceinfo getShareCountByDeptId(@Param("deptId") String deptId);
     public TUInterfaceinfo getShareCountByDeptId(@Param("deptId") String deptId);
 
 
+    public Integer getGuijiCountByDeptId(@Param("deptId") String deptId);
+
     /**
     /**
      * 接口调用频次
      * 接口调用频次
      * @return 结果
      * @return 结果
@@ -164,4 +166,10 @@ public interface TUInterfaceinfoMapper
      * @return 结果
      * @return 结果
      */
      */
     public List<TUInterfaceinfo> interfaceLogList(TUInterfaceinfo interfaceinfo);
     public List<TUInterfaceinfo> interfaceLogList(TUInterfaceinfo interfaceinfo);
+
+    /**
+     * 查询共享应用分析
+     * @return 结果
+     */
+    public List<TUInterfaceinfo> getCallNumByDept(@Param("deptId") Long deptId);
 }
 }

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

@@ -137,6 +137,8 @@ public interface ITUInterfaceinfoService
      * */
      * */
     public TUInterfaceinfo getShareCountByDeptId(String deptId);
     public TUInterfaceinfo getShareCountByDeptId(String deptId);
 
 
+    public Integer getGuijiCountByDeptId(String deptId);
+
     /**
     /**
      * 接口调用频次
      * 接口调用频次
      * @return 结果
      * @return 结果
@@ -161,4 +163,10 @@ public interface ITUInterfaceinfoService
      */
      */
     public List<TUInterfaceinfo> interfaceLogList(TUInterfaceinfo interfaceinfo);
     public List<TUInterfaceinfo> interfaceLogList(TUInterfaceinfo interfaceinfo);
 
 
+    /**
+     * 查询共享应用分析
+     * @return 结果
+     */
+    public List<TUInterfaceinfo> getCallNumByDept(Long deptId);
+
 }
 }

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

@@ -247,6 +247,11 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
         return tUInterfaceinfoMapper.getShareCountByDeptId(deptId);
         return tUInterfaceinfoMapper.getShareCountByDeptId(deptId);
     }
     }
 
 
+    @Override
+    public Integer getGuijiCountByDeptId(String deptId){
+        return tUInterfaceinfoMapper.getGuijiCountByDeptId(deptId);
+    }
+
     /**
     /**
      * 接口调用频次
      * 接口调用频次
      * @return 结果
      * @return 结果
@@ -282,4 +287,13 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
     public List<TUInterfaceinfo> interfaceLogList(TUInterfaceinfo interfaceinfo){
     public List<TUInterfaceinfo> interfaceLogList(TUInterfaceinfo interfaceinfo){
         return tUInterfaceinfoMapper.interfaceLogList(interfaceinfo);
         return tUInterfaceinfoMapper.interfaceLogList(interfaceinfo);
     }
     }
+
+    /**
+     * 查询共享应用分析
+     * @return 结果
+     */
+    @Override
+    public List<TUInterfaceinfo> getCallNumByDept(Long deptId){
+        return tUInterfaceinfoMapper.getCallNumByDept(deptId);
+    }
 }
 }

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

@@ -412,6 +412,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         10
         10
     </select>
     </select>
 
 
+
+    <select id="getGuijiCountByDeptId" resultType="Integer">
+        SELECT
+            SUM(callsuccnum) count
+        FROM
+            t_u_interfaceinfo
+        WHERE
+            dept_id = #{deptId}
+    </select>
+
     <select id="getInterfaceCount" parameterType="String" resultType="Integer">
     <select id="getInterfaceCount" parameterType="String" resultType="Integer">
         SELECT
         SELECT
             count(id) count
             count(id) count
@@ -527,4 +537,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by count desc
         order by count desc
     </select>
     </select>
 
 
+
+    <select id="getCallNumByDept" resultMap="TUInterfaceinfoResult">
+        SELECT
+            count(info.id) count,
+            log.dept_name
+        FROM
+            t_u_log log
+        LEFT JOIN t_u_interfaceinfo info ON log.interfaceinfo_id = info.id
+        WHERE
+            log.dept_name != ""
+        AND info.dept_id = #{deptId}
+        GROUP BY
+            log.dept_name
+    </select>
+
 </mapper>
 </mapper>

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

@@ -22,7 +22,7 @@
     <div class="header_nav fr">
     <div class="header_nav fr">
         <a class="nav_a on">大数据</a>
         <a class="nav_a on">大数据</a>
         <div class="nav_a nav_la">
         <div class="nav_a nav_la">
-            <span>接入部门<i>(<span>33</span>)</i></span>
+            <span>接入部门<i>(<span>[[${deptCount}]]</span>)</i></span>
             <div class="nav_div">
             <div class="nav_div">
                 <a th:each="dept:${depts}" th:id="${dept.deptId}">[[${dept.deptName}]]</a>
                 <a th:each="dept:${depts}" th:id="${dept.deptId}">[[${dept.deptName}]]</a>
             </div>
             </div>

+ 17 - 17
mybusiness/src/main/resources/templates/visualization/tk_iframe.html

@@ -36,7 +36,7 @@
         </div>
         </div>
     </div>
     </div>
     <div class="tk_zs">
     <div class="tk_zs">
-        <div class="tk_zs_tit"><span>归集数据总量</span><u>0000000000</u></div>
+        <div class="tk_zs_tit"><span>归集数据总量</span><u>[[${guijiCount}]]</u></div>
         <div class="d_bg"><img th:src="@{/visualization/images/thqzj_tk5.png}"/></div>
         <div class="d_bg"><img th:src="@{/visualization/images/thqzj_tk5.png}"/></div>
         <div class="s_bg"><img th:src="@{/visualization/images/thqzj_tk6.png}"/></div>
         <div class="s_bg"><img th:src="@{/visualization/images/thqzj_tk6.png}"/></div>
         <div class="b_yp"><img th:src="@{/visualization/images/thqzj_tk15.png}"/></div>
         <div class="b_yp"><img th:src="@{/visualization/images/thqzj_tk15.png}"/></div>
@@ -108,6 +108,7 @@
                 </select>
                 </select>
             </div>
             </div>
         </div>
         </div>
+        <!--共享应用分析 饼图-->
         <div id="gjsj_bt"></div>
         <div id="gjsj_bt"></div>
         <div id="gjsj2"></div>
         <div id="gjsj2"></div>
     </div>
     </div>
@@ -126,10 +127,17 @@
         getJkspfx();
         getJkspfx();
         //月度申请数量分析
         //月度申请数量分析
         getYdsqsl();
         getYdsqsl();
-        //接口申请数量月度统计-饼图
+        //共享应用分析-饼图
         ydsqsl_bt();
         ydsqsl_bt();
     })
     })
 
 
+    /**共享应用分析  饼图**/
+    function ydsqsl_bt() {
+        $.post("/visualization/getCallNumByDept/"+$("#deptId").val(), function (res) {
+            bingtu(res);
+        });
+    }
+
     /**接口占比**/
     /**接口占比**/
     function percent(year) {
     function percent(year) {
         if (year == null) {
         if (year == null) {
@@ -666,8 +674,9 @@
             myChart.setOption(option);
             myChart.setOption(option);
         }
         }
     }
     }
-    /**月度申请数量统计  饼图**/
-    function ydsqsl_bt() {
+
+    /**共享应用分析  饼图 实例化方法**/
+    function bingtu(data_) {
         var chartPie1 = echarts.init(document.getElementById('gjsj_bt'));
         var chartPie1 = echarts.init(document.getElementById('gjsj_bt'));
         function getEhartsOption(data) {
         function getEhartsOption(data) {
             var option;
             var option;
@@ -702,10 +711,9 @@
                             emphasis: {
                             emphasis: {
                                 show: true,
                                 show: true,
                                 formatter:function(params, ticket, callback) {
                                 formatter:function(params, ticket, callback) {
-                                    var name = params.data.name;
-                                    var arr = name.split(":");
-                                    var percent = params.percent;
-                                    var str = percent+'%'+'\n'+ arr[0];
+                                    let name = params.data.name;
+                                    let value = params.data.value;
+                                    let str = name +'\n'+ value + '次';
                                     return str;
                                     return str;
                                 },
                                 },
                                 textStyle: {
                                 textStyle: {
@@ -725,15 +733,7 @@
                 ]}
                 ]}
         }
         }
         var parame1 ={
         var parame1 ={
-            title:"家庭活跃人数",
-            subtext:"303100人",
-            data: [
-                { value: 38, name: '61岁以上' },
-                { value: 7, name: '30岁以下' },
-                { value: 20, name: '30-40岁' },
-                { value: 16, name: '51-60岁' },
-                { value: 19, name: '41-50岁' }
-            ]
+            data: data_
         }
         }
         chartPie1.setOption(getEhartsOption(parame1));
         chartPie1.setOption(getEhartsOption(parame1));
         var i=0;
         var i=0;