suntianwu 3 лет назад
Родитель
Сommit
9f2b122ae8

+ 62 - 15
src/main/java/com/care/bigscreen/controller/BigScreenController.java

@@ -4,6 +4,9 @@ package com.care.bigscreen.controller;
 import com.care.bigscreen.service.BigScreenService;
 import com.care.bigscreen.vo.*;
 
+import com.care.common.vo.PageResVO;
+import com.care.util.PageResult;
+import com.care.util.PageUtil;
 import com.care.util.Result;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -53,7 +56,7 @@ public class BigScreenController {
     @GetMapping("/selectBigScreenStatisticsByOrg")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class,required = true)
             }
     )
     public Result<BigScreenStatisticsVO> selectBigScreenStatisticsByOrg(Long orgId) {
@@ -73,7 +76,7 @@ public class BigScreenController {
     @GetMapping("/selectBigScreenStatisticsByStation")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class,required = true)
             }
     )
     public Result<BigScreenStatisticsVO> selectBigScreenStatisticsByStation(Long stationId) {
@@ -93,11 +96,11 @@ public class BigScreenController {
     @GetMapping("/selectBigScreenStatisticsByLongitudeLatitude")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "longitudeLeftUp", value = "左上经度", dataTypeClass = String.class),
-                    @ApiImplicitParam(name = "latitudeLeftUp", value = "左上维度", dataTypeClass = String.class),
-                    @ApiImplicitParam(name = "longitudeRightDown", value = "右下经度", dataTypeClass = String.class),
-                    @ApiImplicitParam(name = "latitudeRightDown", value = "右下维度", dataTypeClass = String.class),
-                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "longitudeLeftUp", value = "左上经度", dataTypeClass = String.class,required = true),
+                    @ApiImplicitParam(name = "latitudeLeftUp", value = "左上维度", dataTypeClass = String.class,required = true),
+                    @ApiImplicitParam(name = "longitudeRightDown", value = "右下经度", dataTypeClass = String.class,required = true),
+                    @ApiImplicitParam(name = "latitudeRightDown", value = "右下维度", dataTypeClass = String.class,required = true),
+                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class,required = false)
             }
     )
     public Result<BigScreenStatisticsVO> selectBigScreenStatisticsByLongitudeLatitude(String longitudeLeftUp, String latitudeLeftUp,String longitudeRightDown,String latitudeRightDown,Long orgId) {
@@ -117,7 +120,7 @@ public class BigScreenController {
     @GetMapping("/selectBigScreenStationList")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class,required = false)
             }
     )
     public Result<List<BigScreenStationVO>> selectBigScreenStationList(Long orgId) {
@@ -137,7 +140,7 @@ public class BigScreenController {
     @GetMapping("/selectBigScreenStationListOlderTop5")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class,required = true)
             }
     )
     public Result<List<BigScreenStationVO>> selectBigScreenStationListOlderTop5(Long orgId) {
@@ -157,7 +160,7 @@ public class BigScreenController {
     @GetMapping("/selectBigScreenStationListEventTop5")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "orgId", value = "机构ID", dataTypeClass = Long.class,required = true)
             }
     )
     public Result<List<BigScreenStationVO>> selectBigScreenStationListEventTop5(Long orgId) {
@@ -177,7 +180,7 @@ public class BigScreenController {
     @GetMapping("/selectStationBigScreenStatisticsByStation")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class,required = true)
             }
     )
     public Result<BigScreenStationStatisticsVO> selectStationBigScreenStatisticsByStation(Long stationId) {
@@ -198,12 +201,13 @@ public class BigScreenController {
     @GetMapping("/selectBigScreenAlarmOlderList")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class,required = true),
+                    @ApiImplicitParam(name = "olderName", value = "被监护人姓名", dataTypeClass = String.class,required = false)
             }
     )
-    public Result<List<BigScreenAlarmOlderVO>> selectBigScreenAlarmOlderList(Long stationId) {
+    public Result<List<BigScreenAlarmOlderVO>> selectBigScreenAlarmOlderList(Long stationId,String olderName) {
         try {
-            List<BigScreenAlarmOlderVO> bigScreenAlarmOlderVOList =  bigScreenService.selectBigScreenAlarmOlderList(stationId);
+            List<BigScreenAlarmOlderVO> bigScreenAlarmOlderVOList =  bigScreenService.selectBigScreenAlarmOlderList(stationId,olderName);
             return Result.success(bigScreenAlarmOlderVOList);
         } catch (Exception e) {
             log.error("告警用户列表查询出现异常",e);
@@ -219,7 +223,7 @@ public class BigScreenController {
     @GetMapping("/selectStationBigScreenOlderDetail")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "olderId", value = "监护人ID", dataTypeClass = Long.class)
+                    @ApiImplicitParam(name = "olderId", value = "监护人ID", dataTypeClass = Long.class,required = true)
             }
     )
     public Result<BigScreenOlderDetailVO> selectStationBigScreenOlderDetail(Long olderId) {
@@ -232,4 +236,47 @@ public class BigScreenController {
         }
     }
 
+    /**
+     * 服务站大屏的实时安全事件列表查询
+     */
+    @ApiOperation(value = "服务站大屏的实时安全事件列表查询", notes = "服务站大屏的实时安全事件列表查询")
+    @GetMapping("/selectBigScreenRtEventList")
+    @ApiImplicitParams(
+            {
+                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class,required = true)
+            }
+    )
+    public Result<List<BigScreenEventVO>> selectBigScreenRtEventList(Long stationId) {
+        try {
+            List<BigScreenEventVO> bigScreenEventVOList =  bigScreenService.selectBigScreenRtEventList(stationId);
+            return Result.success(bigScreenEventVOList);
+        } catch (Exception e) {
+            log.error("告警用户列表查询出现异常",e);
+            return Result.error("系统错误,告警用户列表查询失败");
+        }
+    }
+
+    /**
+     * 服务站大屏的已完成安全事件列表分页查询
+     */
+    @ApiOperation(value = "服务站大屏的已完成安全事件列表分页查询", notes = "服务站大屏的已完成安全事件列表分页查询")
+    @GetMapping("/selectBigScreenHisEventListByPage")
+    @ApiImplicitParams(
+            {
+                    @ApiImplicitParam(name = "stationId", value = "站点ID", dataTypeClass = Long.class,required = true)
+            }
+    )
+    public PageResult<List<BigScreenEventVO>> selectBigScreenHisEventListByPage(Long stationId, PageResVO page) {
+        try {
+            PageUtil<BigScreenEventVO> bigScreenEventVOListByPage =  bigScreenService.selectBigScreenHisEventListByPage(stationId,page);
+            return  PageResult.success(
+                    "查询成功",bigScreenEventVOListByPage.getListT(),
+                    bigScreenEventVOListByPage.getCurrent(),
+                    bigScreenEventVOListByPage.getPageSize(),
+                    bigScreenEventVOListByPage.getTotal());
+        } catch (Exception e) {
+            log.error("服务站大屏的已完成安全事件列表分页查询出现异常",e);
+            return PageResult.error("系统错误,服务站大屏的已完成安全事件列表分页查询失败");
+        }
+    }
 }

+ 20 - 1
src/main/java/com/care/bigscreen/mapper/BigSreenMapper.java

@@ -3,6 +3,8 @@ package com.care.bigscreen.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.care.bigscreen.entity.StStation;
 import com.care.bigscreen.vo.*;
+import com.care.demo.entity.RimsDictionaries;
+import com.care.util.PageUtil;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -53,8 +55,25 @@ public interface BigSreenMapper extends BaseMapper<StStation> {
     /**
      * 告警用户列表查询
      */
-    List<BigScreenAlarmOlderVO> selectBigScreenAlarmOlderList(@Param("stationId") Long stationId);
+    List<BigScreenAlarmOlderVO> selectBigScreenAlarmOlderList(@Param("stationId") Long stationId,@Param("olderName") String olderName);
 
+    /**
+     * 服务站大屏的被监控人详细查询
+     */
     BigScreenOlderDetailVO selectStationBigScreenOlderDetail(@Param("olderId") Long olderId);
 
+    /**
+     * 服务站大屏的实时安全事件列表查询
+     */
+    List<BigScreenEventVO> selectBigScreenRtEventList(@Param("stationId") Long stationId);
+
+    /**
+     * 服务站大屏的已完成安全事件总记录数
+     */
+    Integer selectBigScreenHisEventListByCount(@Param("stationId") Long stationId);
+    /**
+     * 服务站大屏的已完成安全事件列表分页查询
+     */
+    List<BigScreenEventVO> selectBigScreenHisEventListByPage(@Param("stationId") Long stationId, @Param("pageUtil") PageUtil<BigScreenEventVO> pageUtil);
+
 }

+ 14 - 1
src/main/java/com/care/bigscreen/service/BigScreenService.java

@@ -1,6 +1,8 @@
 package com.care.bigscreen.service;
 
 import com.care.bigscreen.vo.*;
+import com.care.common.vo.PageResVO;
+import com.care.util.PageUtil;
 
 import java.util.List;
 
@@ -49,10 +51,21 @@ public interface BigScreenService {
     /**
      * 告警用户列表查询
      */
-    List<BigScreenAlarmOlderVO> selectBigScreenAlarmOlderList(Long stationId);
+    List<BigScreenAlarmOlderVO> selectBigScreenAlarmOlderList(Long stationId,String olderName);
 
     /**
      * 服务站大屏的被监控人详细查询
      */
     BigScreenOlderDetailVO selectStationBigScreenOlderDetail(Long olderId);
+
+    /**
+     * 服务站大屏的实时安全事件列表查询
+     */
+    List<BigScreenEventVO> selectBigScreenRtEventList(Long stationId);
+
+    /**
+     * 服务站大屏的已完成安全事件列表分页查询
+     */
+    PageUtil<BigScreenEventVO> selectBigScreenHisEventListByPage(Long stationId, PageResVO page);
+
 }

+ 32 - 2
src/main/java/com/care/bigscreen/service/impl/BigScreenServiceImpl.java

@@ -4,6 +4,8 @@ package com.care.bigscreen.service.impl;
 import com.care.bigscreen.mapper.BigSreenMapper;
 import com.care.bigscreen.service.BigScreenService;
 import com.care.bigscreen.vo.*;
+import com.care.common.vo.PageResVO;
+import com.care.util.PageUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -77,8 +79,8 @@ public class BigScreenServiceImpl implements BigScreenService {
      * 告警用户列表查询
      */
     @Override
-    public List<BigScreenAlarmOlderVO> selectBigScreenAlarmOlderList(Long stationId){
-        return bigSreenMapper.selectBigScreenAlarmOlderList(stationId);
+    public List<BigScreenAlarmOlderVO> selectBigScreenAlarmOlderList(Long stationId, String olderName){
+        return bigSreenMapper.selectBigScreenAlarmOlderList(stationId, olderName);
     }
 
     /**
@@ -88,4 +90,32 @@ public class BigScreenServiceImpl implements BigScreenService {
     public BigScreenOlderDetailVO selectStationBigScreenOlderDetail(Long olderId) {
         return bigSreenMapper.selectStationBigScreenOlderDetail(olderId);
     }
+
+    /**
+     * 服务站大屏的实时安全事件列表查询
+     */
+    @Override
+    public List<BigScreenEventVO> selectBigScreenRtEventList(Long stationId) {
+        return bigSreenMapper.selectBigScreenRtEventList(stationId);
+    }
+
+    /**
+     * 服务站大屏的已完成安全事件列表分页查询
+     */
+    @Override
+    public PageUtil<BigScreenEventVO> selectBigScreenHisEventListByPage(Long stationId, PageResVO page) {
+
+        //1、创建一个分页工具对象(然后对分页数据进行整理)
+        PageUtil<BigScreenEventVO> pageUtil = new PageUtil<>();
+        //2、更新当前页面大小
+        pageUtil.setPageSize(page.getPageSize());
+        //3、获取多条件查询总记录数
+        pageUtil.setTotal(bigSreenMapper.selectBigScreenHisEventListByCount(stationId));
+        //4、更新当前页码(此时页码将不会再发生越界问题)
+        pageUtil.setCurrent(page.getCurrent());
+        List<BigScreenEventVO> bigScreenEventVOList = bigSreenMapper.selectBigScreenHisEventListByPage(stationId, pageUtil);
+        pageUtil.setListT(bigScreenEventVOList);
+        return pageUtil;
+
+    }
 }

+ 31 - 0
src/main/java/com/care/bigscreen/vo/BigScreenEventVO.java

@@ -0,0 +1,31 @@
+package com.care.bigscreen.vo;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 站点大屏安全事件响应类
+ *
+ * @author stw
+ * @since 2021-05-20
+ */
+@Data
+@ApiModel(value = "站点大屏安全事件响应类", description = "站点大屏安全事件响应类")
+public class BigScreenEventVO {
+
+
+    @ApiModelProperty("安全事件名称")
+    private String title;
+
+    @ApiModelProperty("时间")
+    private String createTime;
+
+    @ApiModelProperty("处理状态")
+    private String status;
+
+    @ApiModelProperty("事件类型")
+    private String eventType;
+}

+ 2 - 2
src/main/java/com/care/common/vo/PageResVO.java

@@ -9,11 +9,11 @@ public class PageResVO {
     /**
      * 当前页
      */
-    private Long current;
+    private Long current = 1L;
     /**
      * 每页记录数
      */
-    private Long pageSize;
+    private Long pageSize = 10L;
     /**
      * 记录总数
      */

+ 34 - 1
src/main/resources/mybatis/BigSreenMapper.xml

@@ -147,7 +147,11 @@
          a.status,
         (select sdc.name from sys_dim_code sdc where sdc.dim_code = a.status and sdc.type_code='event_order_status') statusName
          FROM care_event_order a
-        where a.station_id = #{stationId} and a.modify_time  in (
+        where a.station_id = #{stationId} and a.status in ('0','1')
+        <if test="olderName != null and olderName != ''">
+            AND (select b.name from care_older b where b.id = a.older_id) like CONCAT('%',#{olderName},'%')
+        </if>
+        and a.modify_time  in (
             SELECT modify_time from (SELECT MAX(modify_time) modify_time FROM care_event_order GROUP BY older_id) a
         )
         order by a.modify_time desc
@@ -200,4 +204,33 @@
         order by a.id,d.contact_level
     </select>
 
+    <select id="selectBigScreenRtEventList" resultType="com.care.bigscreen.vo.BigScreenEventVO">
+        SELECT
+        a.title,
+        a.create_time createTime,
+        (select sdc.name from sys_dim_code sdc where sdc.dim_code = a.status and sdc.type_code='event_order_status') status,
+        '告警' eventType
+        FROM care_event_order a
+        where a.station_id = #{stationId} and a.status in ('0','1')
+        order by a.status,a.create_time
+    </select>
+
+    <select id="selectBigScreenHisEventListByCount" resultType="int" >
+        SELECT
+         count(1)
+        FROM care_event_order a
+        where a.station_id = #{stationId} and a.status not in ('0','1')
+    </select>
+
+    <select id="selectBigScreenHisEventListByPage" resultType="com.care.bigscreen.vo.BigScreenEventVO">
+        SELECT
+        a.title,
+        a.create_time createTime,
+        (select sdc.name from sys_dim_code sdc where sdc.dim_code = a.status and sdc.type_code='event_order_status') status,
+        '告警' eventType
+        FROM care_event_order a
+        where a.station_id = #{stationId} and a.status not in ('0','1')
+        order by a.create_time desc
+        LIMIT #{pageUtil.start}, #{pageUtil.pageSize}
+    </select>
 </mapper>