Pārlūkot izejas kodu

中台-可视化子页

limeng 2 gadi atpakaļ
vecāks
revīzija
c7644e519d

+ 29 - 7
mybusiness/src/main/java/com/business/controller/VisualizationController.java

@@ -5,15 +5,17 @@ import com.business.domain.ImputationData;
 import com.business.service.ImputationDataService;
 import com.sooka.common.core.controller.BaseController;
 import com.sooka.common.core.domain.AjaxResult;
+import com.sooka.framework.util.ShiroUtils;
+import com.sooka.system.domain.SysDept;
 import com.sooka.system.domain.TUInterfaceinfo;
+import com.sooka.system.service.ISysDeptService;
 import com.sooka.system.service.ITUInterfaceinfoService;
 import com.util.StaticScheduleTask;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+import sun.plugin2.util.SystemUtil;
 
 import java.util.List;
 
@@ -30,13 +32,33 @@ public class VisualizationController extends BaseController {
     @Autowired
     private ImputationDataService imputationDataService;
 
+    @Autowired
+    private ISysDeptService sysDeptService;
+
     @GetMapping("index")
-    public String index(){
+    public String index(ModelMap mmap){
+        SysDept dept = new SysDept();
+        dept.setParentId(214L);
+        List<SysDept> depts = sysDeptService.selectDeptList(dept);
+        mmap.put("depts",depts);
         return "/visualization/index";
     }
 
-    @GetMapping("tk_iframe")
-    public String tk_iframe(){
+    @GetMapping("tk_iframe/{id}")
+    public String tk_iframe(@PathVariable("id") Long id, ModelMap mmap){
+        /**查询部门信息**/
+        SysDept sysDept = sysDeptService.selectDeptById(id);
+        /**查询接口列表**/
+        TUInterfaceinfo interfaceinfo = new TUInterfaceinfo();
+        interfaceinfo.setDeptId(id.toString());
+        List<TUInterfaceinfo> interfaceList = interfaceinfoService.selectTUInterfaceinfoList(interfaceinfo);
+        /**查询接口数量**/
+        TUInterfaceinfo shareCount = interfaceinfoService.getShareCountByDeptId(id.toString());
+
+        mmap.put("deptId",sysDept.getDeptId());
+        mmap.put("deptName",sysDept.getDeptName());
+        mmap.put("interfaceList",interfaceList);
+        mmap.put("shareCount",shareCount);
         return "/visualization/tk_iframe";
     }
 

+ 37 - 0
mybusiness/src/main/java/com/sooka/system/domain/TUInterfaceinfo.java

@@ -88,6 +88,43 @@ public class TUInterfaceinfo extends BaseEntity
     /** 所属部门NAME **/
     private String deptName;
 
+    private String shareType1;
+    private String shareType2;
+    private String shareType3;
+    private String shareType4;
+
+    public String getShareType1() {
+        return shareType1;
+    }
+
+    public void setShareType1(String shareType1) {
+        this.shareType1 = shareType1;
+    }
+
+    public String getShareType2() {
+        return shareType2;
+    }
+
+    public void setShareType2(String shareType2) {
+        this.shareType2 = shareType2;
+    }
+
+    public String getShareType3() {
+        return shareType3;
+    }
+
+    public void setShareType3(String shareType3) {
+        this.shareType3 = shareType3;
+    }
+
+    public String getShareType4() {
+        return shareType4;
+    }
+
+    public void setShareType4(String shareType4) {
+        this.shareType4 = shareType4;
+    }
+
     public String getDeptId() {
         return deptId;
     }

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

@@ -121,4 +121,10 @@ public interface TUInterfaceinfoMapper
      * @return 结果
      * */
     public Integer getFaultInterfaceCount();
+
+    /**
+     * 根据部门ID查询分类数量
+     * @return 结果
+     * */
+    public TUInterfaceinfo getShareCountByDeptId(@Param("deptId") String deptId);
 }

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

@@ -2,6 +2,7 @@ package com.sooka.system.service;
 
 import java.util.List;
 import com.sooka.system.domain.TUInterfaceinfo;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 【请填写功能名称】Service接口
@@ -118,4 +119,10 @@ public interface ITUInterfaceinfoService
      * */
     public Integer getFaultInterfaceCount();
 
+    /**
+     * 根据部门ID查询分类数量
+     * @return 结果
+     * */
+    public TUInterfaceinfo getShareCountByDeptId(String deptId);
+
 }

+ 10 - 6
mybusiness/src/main/java/com/sooka/system/service/impl/TUInterfaceinfoServiceImpl.java

@@ -5,6 +5,7 @@ import java.util.List;
 import com.sooka.common.core.text.Convert;
 import com.sooka.common.utils.DateUtils;
 import com.sooka.common.utils.uuid.UUID;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.sooka.system.mapper.TUInterfaceinfoMapper;
@@ -96,12 +97,6 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
         return  0;
     }
 
-    public static void main(String[] args){
-        System.out.println(getW(10000));
-//        System.out.println(1/(int)Math.pow(10,1));
-    }
-
-
     /**
      * 修改【请填写功能名称】
      *
@@ -217,4 +212,13 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
     public Integer getFaultInterfaceCount(){
         return tUInterfaceinfoMapper.getFaultInterfaceCount();
     }
+
+    /**
+     * 根据部门ID查询分类数量
+     * @return 结果
+     * */
+    @Override
+    public TUInterfaceinfo getShareCountByDeptId(String deptId){
+        return tUInterfaceinfoMapper.getShareCountByDeptId(deptId);
+    }
 }

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

@@ -30,6 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptName"    column="dept_name"    />
         <result property="count"    column="count"    />
         <result property="percent"    column="percent"    />
+        <result property="shareType1"    column="shareType1"    />
+        <result property="shareType2"    column="shareType2"    />
+        <result property="shareType3"    column="shareType3"    />
+        <result property="shareType4"    column="shareType4"    />
     </resultMap>
 
     <sql id="selectTUInterfaceinfoVo">
@@ -169,6 +173,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT max(CONVERT(code, UNSIGNED INTEGER)) from t_u_interfaceinfo
     </select>
 
+    <select id="getShareCountByDeptId" resultMap="TUInterfaceinfoResult">
+        SELECT
+            COUNT(id) count,
+            IFNULL(
+                SUM(
+                    CASE share_type
+                    WHEN 'share_type_1' THEN
+                        1
+                    ELSE
+                        0
+                    END
+                ),
+                0
+            ) AS shareType1,
+            IFNULL(
+                SUM(
+                    CASE share_type
+                    WHEN 'share_type_2' THEN
+                        1
+                    ELSE
+                        0
+                    END
+                ),
+                0
+            ) AS shareType2,
+            IFNULL(
+                SUM(
+                    CASE share_type
+                    WHEN 'share_type_3' THEN
+                        1
+                    ELSE
+                        0
+                    END
+                ),
+                0
+            ) AS shareType3,
+            IFNULL(
+                SUM(
+                    CASE share_type
+                    WHEN 'share_type_4' THEN
+                        1
+                    ELSE
+                        0
+                    END
+                ),
+                0
+            ) AS shareType4
+        FROM
+            t_u_interfaceinfo
+        <where>
+            <if test="deptId != null  and deptId != ''"> and dept_id = #{deptId}</if>
+        </where>
+    </select>
+
     <select id="getCount" resultMap="TUInterfaceinfoResult">
         SELECT
             COUNT(id) count,

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

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
     <title>通化市接口中台可视化中心</title>
@@ -24,11 +24,7 @@
         <div class="nav_a nav_la">
             <span>接入部门</span>
             <div class="nav_div">
-                <a onclick="openFrame()">血站</a>
-                <a>体检中心</a>
-                <a>图书馆</a>
-                <a>自来水公司</a>
-                <a>不动产登记中心</a>
+                <a th:each="dept:${depts}" th:id="${dept.deptId}">[[${dept.deptName}]]</a>
             </div>
           </div>
         <a class="nav_a">接口故障<i>(<span id="faultInterfaceCount">0</span>)</i></a>
@@ -370,7 +366,7 @@
 </div>
 
 <!-- 弹框 开始-->
-<iframe id="tk_iframe" style="display:none" th:src="@{/visualization/tk_iframe}"></iframe>
+<iframe id="tk_iframe" style="display:none"></iframe>
 <!-- 弹框 结束-->
 <script>
     //宇宙特效
@@ -487,6 +483,13 @@
         imputationDataList($("#line").val());
     }
 
+    let iframe_prefix = "/visualization/tk_iframe/";
+    $(".nav_div > a").on("click",function(_this){
+        let id = _this.currentTarget.id;
+        $("#tk_iframe").attr("src",iframe_prefix + id);
+        openFrame();
+    });
+
     //iframe 显示方法
     function openFrame(){
         $("#tk_iframe").show();

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

@@ -15,7 +15,8 @@
 	</head>
 	<body>
 		<div class="tk_tit">
-			<span>XXXX部门</span>
+		<input id="deptId" type="hidden" th:value="${deptId}">
+			<span>[[${deptName}]]</span>
 			<u class="tk_close" onclick="parent.closeFrame()">X</u>
 		</div>
 		<div class="tk_con clearfix">
@@ -23,51 +24,10 @@
 				<i class="tk_x"><img th:src="@{/visualization/images/thqzj_tk2.png}"></i>
 				<h1>接口列表</h1>
 				<div id="FontScroll">
-				<ul class="jk_list line" >
-					<li class="list_div">
+				<ul class="jk_list line">
+					<li class="list_div" th:each="info:${interfaceList}">
 						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
-					</li>
-					<li class="list_div">
-						<i><img th:src="@{/visualization/images/thqzj_tk4.png}"/></i>
-						<span>基本纳税人接口1</span>
-						<b>66</b>
+						<span>[[${#strings.abbreviate(info.interfaceName,16)}]]</span>
 					</li>
 				</ul>
 				</div>
@@ -77,27 +37,27 @@
 				<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="s_txt">
-					<h5>1442175</h5>
+					<h5>[[${shareCount.count}]]</h5>
 					<p>前置机共享总数</p>
 				</div>
 				<div class="gjjks qzj_txt">
 					<i><img th:src="@{/visualization/images/thqzj_tk11.png}"/></i>
-					<span>归集接口数</span>
-					<u>88306<b>个</b></u>
+					<span>市直共享接口数</span>
+					<u>[[${shareCount.shareType1}]]<b>个</b></u>
 				</div>
 				<div class="gxjks qzj_txt">
 					<i><img th:src="@{/visualization/images/thqzj_tk12.png}"/></i>
-					<span>共享接口数</span>
-					<u>9652<b>个</b></u>
+					<span>市直归集接口数</span>
+					<u>[[${shareCount.shareType2}]]<b>个</b></u>
 				</div>
 				<div class="ssbjks qzj_txt">
 					<i><img th:src="@{/visualization/images/thqzj_tk13.png}"/></i>
-					<u>3652<b>个</b></u>
+					<u>[[${shareCount.shareType3}]]<b>个</b></u>
 					<span>省上报接口数</span>
 				</div>
 				<div class="sgxjks qzj_txt">
 					<i><img th:src="@{/visualization/images/thqzj_tk14.png}"/></i>
-					<u>31256<b>个</b></u>
+					<u>[[${shareCount.shareType4}]]<b>个</b></u>
 					<span>省共享接口数</span>
 				</div>
 			</div>