Ver código fonte

大屏统计

suntianwu 3 anos atrás
pai
commit
1fe2d81e76

+ 43 - 3
src/main/java/com/care/bigscreen/controller/StStationController.java

@@ -2,6 +2,7 @@ package com.care.bigscreen.controller;
 
 
 import com.care.bigscreen.service.StStationService;
+import com.care.bigscreen.vo.BigScreenStationVO;
 import com.care.bigscreen.vo.BigScreenStatisticsVO;
 
 import com.care.util.Result;
@@ -120,14 +121,53 @@ public class StStationController {
                     @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
             }
     )
-    public Result<List<BigScreenStatisticsVO>> selectBigScreenStationList(Long orgId) {
+    public Result<List<BigScreenStationVO>> selectBigScreenStationList(Long orgId) {
         try {
-            List<BigScreenStatisticsVO> bigScreenStatisticsVOList =  stStationService.selectBigScreenStationList(orgId);
-            return Result.success(bigScreenStatisticsVOList);
+            List<BigScreenStationVO> bigScreenStationVOList =  stStationService.selectBigScreenStationList(orgId);
+            return Result.success(bigScreenStationVOList);
         } catch (Exception e) {
             log.error("站点列表查询出现异常",e);
             return Result.error("系统错误,站点列表查询失败");
         }
     }
 
+    /**
+     * 站点列表用户数TOP5查询
+     */
+    @ApiOperation(value = "站点列表用户数TOP5查询", notes = "站点列表用户数TOP5查询")
+    @GetMapping("/selectBigScreenStationListOlderTop5")
+    @ApiImplicitParams(
+            {
+                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
+            }
+    )
+    public Result<List<BigScreenStationVO>> selectBigScreenStationListOlderTop5(Long orgId) {
+        try {
+            List<BigScreenStationVO> bigScreenStationVOList =  stStationService.selectBigScreenStationListOlderTop5(orgId);
+            return Result.success(bigScreenStationVOList);
+        } catch (Exception e) {
+            log.error("站点列表查询出现异常",e);
+            return Result.error("系统错误,站点列表查询失败");
+        }
+    }
+
+    /**
+     * 站点列表安全事件TOP5查询
+     */
+    @ApiOperation(value = "站点列表安全事件TOP5查询", notes = "站点列表安全事件TOP5查询")
+    @GetMapping("/selectBigScreenStationListEventTop5")
+    @ApiImplicitParams(
+            {
+                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
+            }
+    )
+    public Result<List<BigScreenStationVO>> selectBigScreenStationListEventTop5(Long orgId) {
+        try {
+            List<BigScreenStationVO> bigScreenStationVOList =  stStationService.selectBigScreenStationListEventTop5(orgId);
+            return Result.success(bigScreenStationVOList);
+        } catch (Exception e) {
+            log.error("站点列表查询出现异常",e);
+            return Result.error("系统错误,站点列表查询失败");
+        }
+    }
 }

+ 13 - 1
src/main/java/com/care/bigscreen/mapper/StStationMapper.java

@@ -2,6 +2,7 @@ package com.care.bigscreen.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.care.bigscreen.entity.StStation;
+import com.care.bigscreen.vo.BigScreenStationVO;
 import com.care.bigscreen.vo.BigScreenStatisticsVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -32,5 +33,16 @@ public interface StStationMapper extends BaseMapper<StStation> {
     /**
      * 站点列表查询
      */
-    List<BigScreenStatisticsVO> selectBigScreenStationList(@Param("orgId") Long orgId);
+    List<BigScreenStationVO> selectBigScreenStationList(@Param("orgId") Long orgId);
+
+    /**
+     * 站点列表用户数TOP5查询
+     */
+    List<BigScreenStationVO> selectBigScreenStationListOlderTop5(@Param("orgId") Long orgId);
+
+    /**
+     * 站点列表安全事件数TOP5查询
+     */
+    List<BigScreenStationVO> selectBigScreenStationListEventTop5(@Param("orgId") Long orgId);
+
 }

+ 13 - 1
src/main/java/com/care/bigscreen/service/StStationService.java

@@ -1,5 +1,6 @@
 package com.care.bigscreen.service;
 
+import com.care.bigscreen.vo.BigScreenStationVO;
 import com.care.bigscreen.vo.BigScreenStatisticsVO;
 
 import java.util.List;
@@ -27,5 +28,16 @@ public interface StStationService {
     /**
      * 站点列表查询
      */
-    List<BigScreenStatisticsVO> selectBigScreenStationList(Long orgId);
+    List<BigScreenStationVO> selectBigScreenStationList(Long orgId);
+
+    /**
+     * 站点列表用户数TOP5查询
+     */
+    List<BigScreenStationVO> selectBigScreenStationListOlderTop5(Long orgId);
+
+    /**
+     * 站点列表安全事件数TOP5查询
+     */
+    List<BigScreenStationVO> selectBigScreenStationListEventTop5(Long orgId);
+
 }

+ 19 - 1
src/main/java/com/care/bigscreen/service/impl/StStationServiceImpl.java

@@ -3,6 +3,7 @@ package com.care.bigscreen.service.impl;
 
 import com.care.bigscreen.mapper.StStationMapper;
 import com.care.bigscreen.service.StStationService;
+import com.care.bigscreen.vo.BigScreenStationVO;
 import com.care.bigscreen.vo.BigScreenStatisticsVO;
 import org.springframework.stereotype.Service;
 
@@ -44,7 +45,24 @@ public class StStationServiceImpl implements StStationService {
      * 站点列表查询
      */
     @Override
-    public List<BigScreenStatisticsVO> selectBigScreenStationList(Long orgId) {
+    public List<BigScreenStationVO> selectBigScreenStationList(Long orgId) {
         return stStationMapper.selectBigScreenStationList(orgId);
     }
+
+    /**
+     * 站点列表用户数TOP5查询
+     */
+    @Override
+    public List<BigScreenStationVO> selectBigScreenStationListOlderTop5(Long orgId){
+        return stStationMapper.selectBigScreenStationListOlderTop5(orgId);
+    }
+
+    /**
+     * 站点列表安全事件数TOP5查询
+     */
+    @Override
+    public List<BigScreenStationVO> selectBigScreenStationListEventTop5(Long orgId){
+        return stStationMapper.selectBigScreenStationListEventTop5(orgId);
+    }
+
 }

+ 13 - 0
src/main/java/com/care/bigscreen/vo/BigScreenStationVO.java

@@ -33,5 +33,18 @@ public class BigScreenStationVO {
     @ApiModelProperty(value = "纬度")
     private BigDecimal latitude;
 
+    @ApiModelProperty(value = "负责人")
+    private String director;
 
+    @ApiModelProperty(value = "联系电话")
+    private String phone;
+
+    @ApiModelProperty(value = "地址")
+    private String addr;
+
+    @ApiModelProperty(value = "用户数")
+    private Long olderAmount;
+
+    @ApiModelProperty(value = "安全事件数")
+    private Long eventAmount;
 }

+ 42 - 7
src/main/resources/mybatis/StStationMapper.xml

@@ -77,17 +77,52 @@
 
     <select id="selectBigScreenStationList" resultType="com.care.bigscreen.vo.BigScreenStationVO">
         SELECT
-        station_id stationId,
-        station_name stationName,
-        org_id orgId,
-        longitude,
-        latitude
-        FROM st_station t
+        a.station_id stationId,
+        a.station_name stationName,
+        a.org_id orgId,
+        a.longitude,
+        a.latitude,
+        b.director,
+        b.phone,
+        b.addr
+        FROM st_station a INNER JOIN care_station b ON a.station_id = b.id
         <where>
            1 = 1
             <if test="orgId != null and orgId != ''">
-                AND t.org_id = #{orgId}
+                AND a.org_id = #{orgId}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectBigScreenStationListOlderTop5" resultType="com.care.bigscreen.vo.BigScreenStationVO">
+        SELECT
+        a.station_id stationId,
+        a.station_name stationName,
+        a.older_amount olderAmount
+        FROM st_station a
+        <where>
+            1 = 1
+            <if test="orgId != null and orgId != ''">
+                AND a.org_id = #{orgId}
+            </if>
+        </where>
+        order by a.older_amount DESC
+        limit 5
+    </select>
+
+    <select id="selectBigScreenStationListEventTop5" resultType="com.care.bigscreen.vo.BigScreenStationVO">
+        SELECT
+        a.station_id stationId,
+        a.station_name stationName,
+        (a.rt_event_amount + a.his_event_amount) eventAmount
+        FROM st_station a
+        <where>
+            1 = 1
+            <if test="orgId != null and orgId != ''">
+                AND a.org_id = #{orgId}
             </if>
         </where>
+        order by (a.rt_event_amount + a.his_event_amount) DESC
+        limit 5
     </select>
 </mapper>