Browse Source

Merge branch 'master' of http://124.70.58.209:3000/ytrd-project-management/GeoHazardMonitor

gao.qiang 2 years ago
parent
commit
56753860a2
27 changed files with 724 additions and 140 deletions
  1. 2 2
      .idea/compiler.xml
  2. 12 12
      .idea/jarRepositories.xml
  3. 0 5
      .idea/misc.xml
  4. 21 7
      business-service/src/main/java/com/ozs/service/entity/BaseUser.java
  5. 1 1
      business-service/src/main/java/com/ozs/service/entity/MsgAppPush.java
  6. 0 16
      business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatistic.java
  7. 36 0
      business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticResVo.java
  8. 105 0
      business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticVo.java
  9. 1 8
      business-service/src/main/java/com/ozs/service/entity/vo/MsgAlarmVo.java
  10. 1 1
      business-service/src/main/java/com/ozs/service/entity/vo/MsgAppPushVo.java
  11. 9 0
      business-service/src/main/java/com/ozs/service/mapper/MsgAlarmMapper.java
  12. 21 0
      business-service/src/main/java/com/ozs/service/mapper/MsgAppPushMapper.java
  13. 1 0
      business-service/src/main/java/com/ozs/service/service/BaseCameraManagementService.java
  14. 1 0
      business-service/src/main/java/com/ozs/service/service/BaseRailwayManagementService.java
  15. 8 0
      business-service/src/main/java/com/ozs/service/service/MsgAlarmService.java
  16. 17 3
      business-service/src/main/java/com/ozs/service/service/MsgAppPushService.java
  17. 3 2
      business-service/src/main/java/com/ozs/service/service/impl/BaseCameraManagementServiceImpl.java
  18. 37 0
      business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java
  19. 17 0
      business-service/src/main/java/com/ozs/service/service/impl/MsgAppPushServiceImpl.java
  20. 1 1
      business-service/src/main/resources/mapper/service/BaseUserMapper.xml
  21. 122 0
      business-service/src/main/resources/mapper/service/MsgAlarmMapper.xml
  22. 41 0
      business-service/src/main/resources/mapper/service/MsgAppPushMapper.xml
  23. 1 1
      hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseRailwayManagementController.java
  24. 227 55
      hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java
  25. 14 3
      hazard-admin/src/main/java/com/ozs/web/controller/app/GeoHazardMineController.java
  26. 2 2
      hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConfig.java
  27. 23 21
      hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketServer.java

+ 2 - 2
.idea/compiler.xml

@@ -7,10 +7,10 @@
         <sourceOutputDir name="target/generated-sources/annotations" />
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
-        <module name="hazard-sdk" />
-        <module name="business-service" />
         <module name="hazard-admin" />
+        <module name="hazard-sdk" />
         <module name="base-admin" />
+        <module name="business-service" />
       </profile>
     </annotationProcessing>
     <bytecodeTargetLevel>

+ 12 - 12
.idea/jarRepositories.xml

@@ -2,8 +2,8 @@
 <project version="4">
   <component name="RemoteRepositoriesConfiguration">
     <remote-repository>
-      <option name="id" value="public" />
-      <option name="name" value="aliyun nexus" />
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
       <option name="url" value="https://maven.aliyun.com/repository/public" />
     </remote-repository>
     <remote-repository>
@@ -11,6 +11,16 @@
       <option name="name" value="Central Repository" />
       <option name="url" value="https://repo.maven.apache.org/maven2" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="public" />
+      <option name="name" value="aliyun nexus" />
+      <option name="url" value="https://maven.aliyun.com/repository/public" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
     <remote-repository>
       <option name="id" value="central" />
       <option name="name" value="Central Repository" />
@@ -26,11 +36,6 @@
       <option name="name" value="Central Repository" />
       <option name="url" value="http://maven.aliyun.com/nexus/content/repositories/central/" />
     </remote-repository>
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Maven Central repository" />
-      <option name="url" value="https://repo1.maven.org/maven2" />
-    </remote-repository>
     <remote-repository>
       <option name="id" value="custom_group" />
       <option name="name" value="Nexus Repository" />
@@ -41,10 +46,5 @@
       <option name="name" value="JBoss Community repository" />
       <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
     </remote-repository>
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Central Repository" />
-      <option name="url" value="https://maven.aliyun.com/repository/public" />
-    </remote-repository>
   </component>
 </project>

+ 0 - 5
.idea/misc.xml

@@ -7,11 +7,6 @@
         <option value="$PROJECT_DIR$/pom.xml" />
       </list>
     </option>
-    <option name="ignoredFiles">
-      <set>
-        <option value="$PROJECT_DIR$/admin/pom.xml" />
-      </set>
-    </option>
   </component>
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
 </project>

+ 21 - 7
business-service/src/main/java/com/ozs/service/entity/BaseUser.java

@@ -43,24 +43,38 @@ public class BaseUser implements Serializable {
     /** 用户邮箱 */
     private String email;
 
-    /** 手机号码 */
+    /**
+     * 手机号码
+     */
     private String phoneNum;
 
-    /** 用户性别 */
+    /**
+     * 用户性别
+     */
     private Integer sex;
 
-    /** 用户头像 */
+    /**
+     * 用户头像
+     */
     private String avatar;
 
-    /** 密码 */
+    /**
+     * 密码
+     */
     private String password;
 
-    /** 帐号状态(0正常 1停用) */
+    /**
+     * 帐号状态(0正常 1停用)
+     */
     private Integer status;
 
-    /** 删除标志(0代表存在 2代表删除) */
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
     private Integer delFlag;
 
-    /** 数据权限 1:本人;2:本部门;3:本部门及下级部门;4:本人及本级部门;5:本人及本部门及下级部门;6:全部 */
+    /**
+     * 数据权限 1:本人;2:本部门;3:本部门及下级部门;4:本人及本级部门;5:本人及本部门及下级部门;6:全部
+     */
     private Integer dataPermission;
 }

+ 1 - 1
business-service/src/main/java/com/ozs/service/entity/MsgAppPush.java

@@ -39,7 +39,7 @@ public class MsgAppPush extends BaseEntity implements Serializable {
     /**
      * 接收人
      */
-    private Long recipient;
+    private String receiveBy;
 
     /**
      * 状态:0未读;1已读

+ 0 - 16
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatistic.java

@@ -1,16 +0,0 @@
-package com.ozs.service.entity.vo;
-
-import lombok.Data;
-
-/**统计管理页面强求参数
- * @author wyy
- * @subject
- * @creat 2023/3/6
- */
-@Data
-public class AlarmStatistic {
-    /**
-     * 报警线路
-     */
-    private String alarmLine;
-}

+ 36 - 0
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticResVo.java

@@ -0,0 +1,36 @@
+package com.ozs.service.entity.vo;
+
+import com.ozs.common.vo.PageVo;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 统计管理页面强求参数
+ *
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@Data
+public class AlarmStatisticResVo extends PageVo implements Serializable {
+    /**
+     * 线路
+     */
+    private String railwayCode;
+
+    /**
+     * 起始月份
+     */
+    private Integer startMonth;
+
+    /**
+     * 结束月份
+     */
+    private Integer endMonth;
+
+    /**
+     * 灾害类型
+     */
+    private String alarmType;
+}

+ 105 - 0
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticVo.java

@@ -0,0 +1,105 @@
+package com.ozs.service.entity.vo;
+
+import com.ozs.service.entity.BaseCameraManagement;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 统计管理页面实体类
+ *
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@Data
+public class AlarmStatisticVo {
+
+    /**
+     * 报警唯一标识
+     */
+    private String alarmId;
+
+    /**
+     * 相机编码
+     */
+    private String cameraCode;
+
+    /**
+     * 报警时间
+     */
+    private Date alarmTime;
+
+    /**
+     * 报警里程位置
+     */
+    private String alarmMile;
+
+    /**
+     * 报警内容
+     */
+    private String content;
+
+    /**
+     * 报警置信度(百分比)
+     */
+    private Integer alarmConfidence;
+
+    /**
+     * 报警行别(1上行2下行)
+     */
+    private Integer lineDir;
+
+    /**
+     * 报警病害类型(目前只有1泥石流,后续可扩展使用)
+     */
+    private Integer alarmType;
+
+    /**
+     * 报警病害属性(可以给出泥石流的框定范围)
+     */
+    private String alarmAttr;
+
+    /**
+     * 报警图片地址
+     */
+    private String imageUrl;
+
+    /**
+     * 解除人
+     */
+    private String releasedBy;
+
+    /**
+     * 解除时间
+     */
+    private Date releasedTime;
+
+    /**
+     * 报警是否解除 1已解除2未解除
+     */
+    private Integer isLock;
+
+    /**
+     * 月份
+     */
+    private Integer monthsta;
+
+    /**
+     * 次数
+     */
+    private Integer frequency;
+
+    /**
+     * 报警是否解除 1已解除2未解除
+     */
+    private BaseCameraManagement baseCameraManagement;
+
+    public BaseCameraManagement getBaseCameraManagement() {
+        return baseCameraManagement;
+    }
+
+    public void setBaseCameraManagement(BaseCameraManagement baseCameraManagement) {
+        this.baseCameraManagement = baseCameraManagement;
+    }
+}

+ 1 - 8
business-service/src/main/java/com/ozs/service/entity/vo/MsgAlarmVo.java

@@ -1,15 +1,8 @@
 package com.ozs.service.entity.vo;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.ozs.common.annotation.Excel;
-import com.ozs.common.core.domain.BaseEntity;
+
 import com.ozs.common.vo.PageVo;
-import io.swagger.annotations.ApiModel;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
 import lombok.Data;
-import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 import java.util.Date;

+ 1 - 1
business-service/src/main/java/com/ozs/service/entity/vo/MsgAppPushVo.java

@@ -23,7 +23,7 @@ public class MsgAppPushVo extends PageVo implements Serializable {
     /**
      * 接收人
      */
-    private Long recipient;
+    private String receiveBy;
 
     /**
      * 状态:0未读;1已读

+ 9 - 0
business-service/src/main/java/com/ozs/service/mapper/MsgAlarmMapper.java

@@ -2,7 +2,12 @@ package com.ozs.service.mapper;
 
 import com.ozs.service.entity.MsgAlarm;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ozs.service.entity.vo.AlarmStatisticVo;
+
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -14,5 +19,9 @@ import org.apache.ibatis.annotations.Mapper;
  */
 @Mapper
 public interface MsgAlarmMapper extends BaseMapper<MsgAlarm> {
+    //报警数据详情
+    List<AlarmStatisticVo> list(@Param("railwayCode") String railwayCode, @Param("startMonth") Integer startMonth, @Param("endMonth") Integer endMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
 
+    //报警月统计数据
+    List<AlarmStatisticVo> listMonth(@Param("railwayCode") String railwayCode, @Param("startMonth") Integer startMonth, @Param("endMonth") Integer endMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
 }

+ 21 - 0
business-service/src/main/java/com/ozs/service/mapper/MsgAppPushMapper.java

@@ -2,7 +2,11 @@ package com.ozs.service.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ozs.service.entity.MsgAppPush;
+import com.ozs.service.entity.vo.MsgAppPushVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @author wyy
@@ -11,5 +15,22 @@ import org.apache.ibatis.annotations.Mapper;
  */
 @Mapper
 public interface MsgAppPushMapper extends BaseMapper<MsgAppPush> {
+    /**
+     * app推送报警信息记录
+     *
+     * @param status
+     * @param
+     * @return
+     */
+    List<MsgAppPushVo> alarmPushMsg(Integer status);
 
+    /**
+     * app推送报警信息记录修改状态
+     *
+     * @param status
+     * @param id
+     * @param updateBy
+     * @return
+     */
+    public int update(@Param("id") Long id, @Param("status") Integer status, @Param("updateBy") String updateBy);
 }

+ 1 - 0
business-service/src/main/java/com/ozs/service/service/BaseCameraManagementService.java

@@ -17,6 +17,7 @@ import java.util.List;
 public interface BaseCameraManagementService extends IService<BaseCameraManagement> {
     /**
      * 相机台账管理表导入
+     *
      * @param accountManageList
      * @param updateSupport
      * @return

+ 1 - 0
business-service/src/main/java/com/ozs/service/service/BaseRailwayManagementService.java

@@ -17,6 +17,7 @@ import java.util.List;
 public interface BaseRailwayManagementService extends IService<BaseRailwayManagement> {
     /**
      * 线路管理表导入
+     *
      * @param accountManageList
      * @param updateSupport
      * @return

+ 8 - 0
business-service/src/main/java/com/ozs/service/service/MsgAlarmService.java

@@ -1,7 +1,11 @@
 package com.ozs.service.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ozs.service.entity.MsgAlarm;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ozs.service.entity.vo.AlarmStatisticVo;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +16,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2023-02-22
  */
 public interface MsgAlarmService extends IService<MsgAlarm> {
+    //web数据统计 报警数据详情
+    IPage<AlarmStatisticVo> list(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, Integer pageNum, Integer pageSize, String userId);
 
+    //web数据统计 报警月统计数据
+    List<AlarmStatisticVo> getCount(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, String userId);
 }

+ 17 - 3
business-service/src/main/java/com/ozs/service/service/MsgAppPushService.java

@@ -2,6 +2,10 @@ package com.ozs.service.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ozs.service.entity.MsgAppPush;
+import com.ozs.service.entity.vo.MsgAppPushVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @author wyy
@@ -10,11 +14,21 @@ import com.ozs.service.entity.MsgAppPush;
  */
 public interface MsgAppPushService extends IService<MsgAppPush> {
     /**
-     * 修改app推送报警信息记录为已读
-     * @param id
+     * app推送报警信息记录
+     *
+     * @param status
      * @param
      * @return
      */
-    //MsgAppPush updateStatus(Long id);
+    List<MsgAppPushVo> alarmPushMsg(Integer status);
 
+    /**
+     * app推送报警信息记录修改状态
+     *
+     * @param status
+     * @param id
+     * @param updateBy
+     * @return
+     */
+    int update(Long id, Integer status, String updateBy);
 }

+ 3 - 2
business-service/src/main/java/com/ozs/service/service/impl/BaseCameraManagementServiceImpl.java

@@ -38,11 +38,11 @@ import java.util.Set;
 public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManagementMapper, BaseCameraManagement> implements BaseCameraManagementService {
     @Autowired
     protected Validator validator;
-    @Resource
-    private BaseCameraManagementMapper baseCameraManagementMapper;
     @Autowired
     BaseDeviceDynamicManagementMapper baseDeviceDynamicManagementMapper;
     @Resource
+    private BaseCameraManagementMapper baseCameraManagementMapper;
+    @Resource
     private BaseUserService baseUserService;
     @Resource
     private BaseUserMapper baseUserMapper;
@@ -113,6 +113,7 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
 
     /**
      * 获取相机列表+数据权限
+     *
      * @return
      */
     @Override

+ 37 - 0
business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java

@@ -1,11 +1,21 @@
 package com.ozs.service.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ozs.service.entity.MsgAlarm;
+import com.ozs.service.entity.vo.AlarmStatisticVo;
 import com.ozs.service.mapper.MsgAlarmMapper;
 import com.ozs.service.service.MsgAlarmService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 报警信息表 服务实现类
@@ -16,5 +26,32 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> implements MsgAlarmService {
+    @Autowired
+    MsgAlarmMapper msgAlarmMapper;
+
+    public static IPage listToPage(List list, int pageNum, int pageSize) {
+        List pageList = new ArrayList<>();
+        int curIdx = pageNum > 1 ? (pageNum - 1) * pageSize : 0;
+        for (int i = 0; i < pageSize && curIdx + i < list.size(); i++) {
+            pageList.add(list.get(curIdx + i));
+        }
+        IPage page = new Page<>(pageNum, pageSize);
+        page.setRecords(pageList);
+        page.setTotal(list.size());
+        return page;
+    }
+
+    //web数据统计 报警数据详情
+    @Override
+    public IPage<AlarmStatisticVo> list(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, Integer pageNum, Integer pageSize, String userId) {
+        List<AlarmStatisticVo> list = msgAlarmMapper.list(railwayCode, startMonth, endMonth, alarmType, userId);
+        IPage listPage = listToPage(list, pageNum, pageSize);
+        return listPage;
+    }
 
+    @Override
+    public List<AlarmStatisticVo> getCount(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, String userId) {
+        List<AlarmStatisticVo> list = msgAlarmMapper.listMonth(railwayCode, startMonth, endMonth, alarmType, userId);
+        return list;
+    }
 }

+ 17 - 0
business-service/src/main/java/com/ozs/service/service/impl/MsgAppPushServiceImpl.java

@@ -2,10 +2,14 @@ package com.ozs.service.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ozs.service.entity.MsgAppPush;
+import com.ozs.service.entity.vo.MsgAppPushVo;
 import com.ozs.service.mapper.MsgAppPushMapper;
 import com.ozs.service.service.MsgAppPushService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @author wyy
  * @subject
@@ -13,5 +17,18 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class MsgAppPushServiceImpl extends ServiceImpl<MsgAppPushMapper, MsgAppPush> implements MsgAppPushService {
+    @Autowired
+    MsgAppPushMapper msgAppPushMapper;
+
+    @Override
+    public List<MsgAppPushVo> alarmPushMsg(Integer status) {
+        List<MsgAppPushVo> list = msgAppPushMapper.alarmPushMsg(status);
+        return list;
+    }
 
+    @Override
+    public int update(Long id, Integer status, String updateBy) {
+        int num = msgAppPushMapper.update(id, status, updateBy);
+        return num;
+    }
 }

+ 1 - 1
business-service/src/main/resources/mapper/service/BaseUserMapper.xml

@@ -52,7 +52,7 @@
         <foreach item="item" collection="deptList" separator="," open="(" close=")" index="">
             #{item}
         </foreach>
-          and data_permission = 5
+        and data_permission = 5
     </select>
 
     <select id="getUserIdList6" resultType="java.lang.String">

+ 122 - 0
business-service/src/main/resources/mapper/service/MsgAlarmMapper.xml

@@ -1,5 +1,127 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ozs.service.mapper.MsgAlarmMapper">
+    <resultMap id="AlarmStatisticVoResult" type="com.ozs.service.entity.vo.AlarmStatisticVo">
+        <id column="id" property="id"/>
+        <result column="alarm_id" property="alarmId"/>
+        <result column="camera_code" property="cameraCode"/>
+        <result column="alarm_time" property="alarmTime"/>
+        <result column="alarm_mile" property="alarmMile"/>
+        <result column="content" property="content"/>
+        <result column="alarm_confidence" property="alarmConfidence"/>
+        <result column="line_dir" property="lineDir"/>
+        <result column="alarm_type" property="alarmType"/>
+        <result column="alarm_attr" property="alarmAttr"/>
+        <result column="image_url" property="imageUrl"/>
+        <result column="released_by" property="releasedBy"/>
+        <result column="released_time" property="releasedTime"/>
+        <result column="is_lock" property="isLock"/>
+        <association property="baseCameraManagement" javaType="com.ozs.service.entity.BaseCameraManagement">
+            <id column="id" property="id"/>
+            <result column="railway_code" property="railwayCode"/>
+            <result column="channel" property="channel"/>
+            <result column="install_mile" property="installMile"/>
+            <result column="begin_mile" property="beginMile"/>
+            <result column="end_mile" property="endMile"/>
+            <result column="install_longitude" property="installLongitude"/>
+            <result column="install_latitude" property="installLatitude"/>
+        </association>
+    </resultMap>
 
+    <select id="list" resultMap="AlarmStatisticVoResult">
+        SELECT
+        a.alarm_id ,
+        a.camera_code ,
+        a.alarm_time ,
+        a.alarm_mile ,
+        a.content ,
+        a.alarm_confidence,
+        a.line_dir ,
+        a.alarm_type ,
+        a.alarm_attr ,
+        a.image_url ,
+        a.released_by ,
+        a.released_time,
+        a.is_lock ,
+        b.railway_code AS railway_code,
+        b.channel AS channel,
+        b.install_mile AS install_mile,
+        b.begin_mile AS begin_mile,
+        b.end_mile AS end_mile,
+        b.install_longitude AS install_longitude,
+        b.install_latitude AS install_latitude
+        FROM
+        msg_alarm AS a left join
+        base_camera_management AS b on a.camera_code=b.camera_code left join
+        msg_web_push m on a.alarm_id = m.alarm_id
+
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
+            </if>
+            <if test="startMonth != null and startMonth != 0">
+                <![CDATA[and MONTH(a.alarm_time) >=#{startMonth}]]>
+            </if>
+            <if test="endMonth != null and endMonth != 0">
+                <![CDATA[and MONTH(a.alarm_time) <=#{endMonth}]]>
+            </if>
+            <if test="alarmType != null and alarmType != ''">
+                and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
+            </if>
+            <if test="userId != null and userId != ''">
+                and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
+            </if>
+        </where>
+        group by a.alarm_id
+    </select>
+
+    <select id="listMonth" resultMap="AlarmStatisticVoResult">
+        SELECT
+        a.alarm_id ,
+        MONTH(a.alarm_time) as monthsta,
+        count(DISTINCT a.alarm_id) as frequency,
+        a.camera_code ,
+        a.alarm_time ,
+        a.alarm_mile ,
+        a.content ,
+        a.alarm_confidence,
+        a.line_dir ,
+        a.alarm_type ,
+        a.alarm_attr ,
+        a.image_url ,
+        a.released_by ,
+        a.released_time,
+        a.is_lock ,
+        b.railway_code AS railway_code,
+        b.channel AS channel,
+        b.install_mile AS install_mile,
+        b.begin_mile AS begin_mile,
+        b.end_mile AS end_mile,
+        b.install_longitude AS install_longitude,
+        b.install_latitude AS install_latitude
+        FROM
+        msg_alarm AS a left join
+        base_camera_management AS b on a.camera_code=b.camera_code left join
+        msg_web_push m on a.alarm_id = m.alarm_id
+
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
+            </if>
+            <if test="startMonth != null and startMonth != 0">
+                <![CDATA[and MONTH(a.alarm_time) >=#{startMonth}]]>
+            </if>
+            <if test="endMonth != null and endMonth != 0">
+                <![CDATA[and MONTH(a.alarm_time) <=#{endMonth}]]>
+            </if>
+            <if test="alarmType != null and alarmType != ''">
+                and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
+            </if>
+            <if test="userId != null and userId != ''">
+                and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
+            </if>
+        </where>
+        group by a.alarm_id,MONTH(a.alarm_time)
+
+    </select>
 </mapper>

+ 41 - 0
business-service/src/main/resources/mapper/service/MsgAppPushMapper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ozs.service.mapper.MsgAppPushMapper">
+    <resultMap id="MsgAppPushVoResult" type="com.ozs.service.entity.vo.MsgAppPushVo">
+        <id column="id" property="id"/>
+        <result column="alarm_id" property="alarmId"/>
+        <result column="receive_by" property="receiveBy"/>
+        <result column="status" property="status"/>
+        <result column="create_by" property="createBy"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_by" property="updateBy"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="remark" property="remark"/>
+    </resultMap>
+    <select id="alarmPushMsg" resultMap="MsgAppPushVoResult">
+        select
+        alarm_id,
+        receive_by,
+        status,
+        create_by,
+        create_time,
+        update_by,
+        update_time,
+        remark
+        from msg_app_push
+        <where>
+            <if test="status != null and status != 0">
+                and UPPER(status) like UPPER(CONCAT('%',#{status},'%'))
+            </if>
+        </where>
+    </select>
+    <update id="update" parameterType="com.ozs.service.entity.MsgAppPush">
+        update msg_app_push
+        <set>
+            <if test="status != null and status != 0">status = #{status},</if>
+            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            update_time = sysdate()
+        </set>
+        where id = #{id}
+    </update>
+</mapper>

+ 1 - 1
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseRailwayManagementController.java

@@ -76,7 +76,7 @@ public class BaseRailwayManagementController extends BaseController {
         if (!StringUtils.isBlank(baseRailwayManagementVo.getRailwayCode())) {
             lw.like(BaseRailwayManagement::getRailwayCode, "%" + baseRailwayManagementVo.getRailwayCode() + "%");
         }
-        if (!ObjectUtils.isEmpty(baseRailwayManagementVo.getRailwayType())&& baseRailwayManagementVo.getRailwayType() != 0) {
+        if (!ObjectUtils.isEmpty(baseRailwayManagementVo.getRailwayType()) && baseRailwayManagementVo.getRailwayType() != 0) {
             lw.eq(BaseRailwayManagement::getRailwayType, baseRailwayManagementVo.getRailwayType());
         }
         IPage<BaseRailwayManagement> page = baseRailwayManagementService.page(new Page<BaseRailwayManagement>(baseRailwayManagementVo.getPageNum(), baseRailwayManagementVo.getPageSize()), lw);

+ 227 - 55
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -1,26 +1,37 @@
 package com.ozs.web.controller.accountmanagment;
 
 
-import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ozs.common.core.controller.BaseController;
 import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.utils.AppendUtils;
+import com.ozs.common.utils.StringUtils;
 import com.ozs.service.entity.BaseCameraManagement;
 import com.ozs.service.entity.BaseRailwayManagement;
 import com.ozs.service.entity.MsgAlarm;
 import com.ozs.service.entity.MsgAlarmFrequency;
-import com.ozs.service.entity.vo.MsgAlarmResp;
-import com.ozs.service.entity.vo.MsgAlarmVo;
-import com.ozs.service.service.*;
-import com.ozs.web.controller.websocket.WebSocketServer;
+import com.ozs.service.entity.vo.*;
+import com.ozs.service.mapper.MsgAlarmMapper;
+import com.ozs.service.service.BaseCameraManagementService;
+import com.ozs.service.service.BaseRailwayManagementService;
+import com.ozs.service.service.MsgAlarmFrequencyService;
+import com.ozs.service.service.MsgAlarmService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -31,7 +42,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.util.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 import java.util.stream.Collectors;
 
 /**
@@ -48,49 +64,33 @@ public class MsgAlarmController extends BaseController {
     @Resource
     MsgAlarmService msgAlarmService;
     @Resource
+    MsgAlarmMapper msgAlarmMapper;
+    @Resource
     MsgAlarmFrequencyService msgAlarmFrequencyService;
     @Autowired
     BaseCameraManagementService baseCameraManagementService;
     @Autowired
     BaseRailwayManagementService baseRailwayManagementService;
-    @Value("${base.imgUrl:http://124.71.171.71:18801/picbucket}")
-    private String imgUrl;
-    @Autowired
-    private BaseUserService baseUserService;
-    @Autowired
-    private WebSocketServer webSocketServer;
 
     /**
      * 测试消息推送
      */
     @PostMapping("/push")
     @ApiOperation(value = "预报警信息分页")
-    public AjaxResult insertDate(String args) {
-        String userId = getUserId();
-        // 初始化 -> 运行中 -> 成功或失败
-        try {
-            // 1、初始化
-            webSocketServer.sendOneMessage(userId, objStr(args, 1));
-            Thread.sleep(3 * 1000);
-            // 2、运行中
-            webSocketServer.sendOneMessage(userId, objStr(args, 2));
-            Thread.sleep(5 * 1000);
-            // 3、成功或失败
-            webSocketServer.sendOneMessage(userId, Math.random() * 10 > 5 ? objStr(args, 6) : objStr(args, 7));
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            throw new RuntimeException("构建失败");
-        }
+    public AjaxResult insertDate(String[] args) {
+        // 模拟需要推送的用户群
+        ArrayList<String> ids = new ArrayList<>();
+        ids.add("001");
+        ids.add("002");
+        ids.add("003");
+        ids.add("004");
+        ids.add("005");
+//
+//        WebSocketService webSocketService = new WebSocketService();
+//        webSocketService.sendMsgToUsers(ids);
         return AjaxResult.success("推送成功");
     }
 
-    private String objStr(String str, int status) {
-        JSONObject obj = new JSONObject();
-        obj.put("pipelineId", str); //流水线ID
-        obj.put("status", status);
-        return obj.toJSONString();
-    }
-
     /**
      * 报警信息分页
      *
@@ -100,7 +100,7 @@ public class MsgAlarmController extends BaseController {
     @ApiOperation(value = "报警信息分页")
     @PostMapping("/list")
     public AjaxResult selectMsgAlarm(@RequestBody MsgAlarmVo msgAlarmVo) {
-        List<BaseCameraManagement> baseCameraManagementList = new ArrayList<>();
+        List<BaseCameraManagement> baseCameraManagementList=new ArrayList<>();
         LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<BaseCameraManagement>();
         if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode())) {
             wrapper.eq(BaseCameraManagement::getRailwayCode, msgAlarmVo.getRailwayCode());
@@ -111,25 +111,21 @@ public class MsgAlarmController extends BaseController {
         if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
             wrapper.le(BaseCameraManagement::getEndMile, msgAlarmVo.getEndMile());
         }
-        if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode()) || !ObjectUtils.isEmpty(msgAlarmVo.getBeginMile()) || !ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
+        if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode())||!ObjectUtils.isEmpty(msgAlarmVo.getBeginMile())||!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
             baseCameraManagementList = baseCameraManagementService.list(wrapper);
         }
-        List<String> userIds = baseCameraManagementService.getUserIds(getUserId());
         LambdaQueryWrapper<MsgAlarm> lw = new LambdaQueryWrapper<MsgAlarm>();
-        if (!ObjectUtils.isEmpty(userIds)) {
-            lw.in(MsgAlarm::getCreateBy, userIds);
-        }
         if (!ObjectUtils.isEmpty(msgAlarmVo.getLineDir())) {
             lw.eq(MsgAlarm::getLineDir, msgAlarmVo.getLineDir());
         }
-        if (baseCameraManagementList.size() > 0) {
+        if (baseCameraManagementList.size()>0) {
             List<String> collect = baseCameraManagementList.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
             lw.in(MsgAlarm::getCameraCode, collect);
         }
         if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmType())) {
             lw.eq(MsgAlarm::getAlarmType, msgAlarmVo.getAlarmType());
         }
-        if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile()) && msgAlarmVo.getAlarmMile() != 0) {
+        if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile())) {
             lw.eq(MsgAlarm::getAlarmMile, msgAlarmVo.getAlarmMile());
         }
         if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginAlarmTime())) {
@@ -142,15 +138,8 @@ public class MsgAlarmController extends BaseController {
             lw.eq(MsgAlarm::getIsLock, msgAlarmVo.getIsLock());
         }
         IPage<MsgAlarm> page = msgAlarmService.page(new Page<>(msgAlarmVo.getPageNum(), msgAlarmVo.getPageSize()), lw);
-        if (!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())) {
+        if(!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())){
             List<MsgAlarm> dto1 = page.getRecords().stream().map(o -> {
-                ArrayList<String> objects = new ArrayList<>();
-                String[] split = o.getImageUrl().split(";");
-                for (String s : split) {
-                    s = imgUrl + s;
-                    objects.add(s);
-                }
-                o.setImageUrls(objects);
                 LambdaQueryWrapper<BaseCameraManagement> cameraManagementLambdaQueryWrapper = new LambdaQueryWrapper<BaseCameraManagement>();
                 if (!ObjectUtils.isEmpty(o.getCameraCode())) {
                     cameraManagementLambdaQueryWrapper.eq(BaseCameraManagement::getCameraCode, o.getCameraCode());
@@ -169,7 +158,7 @@ public class MsgAlarmController extends BaseController {
                 o.setEndMile(end);
                 String begin = AppendUtils.stringAppend(cameraManagement.getBeginMile());
                 o.setBeginMile(begin);
-                o.setAlarmCount((int) msgAlarmFrequencyService.count() + 1);
+                o.setAlarmCount((int) msgAlarmFrequencyService.count()+1);
                 return o;
             }).collect(Collectors.toList());
             page.setRecords(dto1);
@@ -197,11 +186,11 @@ public class MsgAlarmController extends BaseController {
         msgAlarmResp.setDeptId(baseCameraManagement.getDeptId());
         String begin = AppendUtils.stringAppend(baseCameraManagement.getBeginMile());
         String end = AppendUtils.stringAppend(baseCameraManagement.getEndMile());
-        String endMile = begin + "-" + end;
+        String endMile=begin+"-"+end;
         msgAlarmResp.setBeginMile(endMile);
         String mile = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
         msgAlarmResp.setAlarmMile(mile);
-        msgAlarmResp.setInstallLongitude(baseCameraManagement.getInstallLongitude() + "," + baseCameraManagement.getInstallLatitude());
+        msgAlarmResp.setInstallLongitude(baseCameraManagement.getInstallLongitude()+","+baseCameraManagement.getInstallLatitude());
         return AjaxResult.success(msgAlarmResp);
     }
 
@@ -236,5 +225,188 @@ public class MsgAlarmController extends BaseController {
         List<MsgAlarm> list = msgAlarmService.list(wrapper);
         return AjaxResult.success(list);
     }
+
+    /**
+     * web数据统计
+     *
+     * @param alarmStatisticResVo
+     * @return
+     */
+    @PostMapping("/dataStatistic")
+    @ApiOperation(value = "web数据统计 报警数据详情")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
+            @ApiImplicitParam(paramType = "query", name = "startMonth", value = "起始月份"),
+            @ApiImplicitParam(paramType = "query", name = "endMonth", value = "结束月份"),
+            @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
+    })
+    public AjaxResult dataStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
+        Integer pageNum = alarmStatisticResVo.getPageNum().intValue();
+        Integer pageSize = alarmStatisticResVo.getPageSize().intValue();
+        String userId = getUserId();
+        if ("1".equals(userId)) {
+            userId = "";
+        }
+        IPage<AlarmStatisticVo> page = msgAlarmService.list(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
+                alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), pageNum, pageSize, userId);
+        return AjaxResult.success(page);
+    }
+
+    /**
+     * web数据统计
+     *
+     * @param
+     * @return
+     */
+    @PostMapping("/alarmMonthStatistic")
+    @ApiOperation(value = "web数据统计 报警月统计数据")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
+            @ApiImplicitParam(paramType = "query", name = "startMonth", value = "起始月份"),
+            @ApiImplicitParam(paramType = "query", name = "endMonth", value = "结束月份"),
+            @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
+    })
+    public AjaxResult alarmMonthStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
+        String userId = getUserId();
+        if ("1".equals(userId)) {
+            userId = "";
+        }
+        List<AlarmStatisticVo> list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
+                alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), userId);
+        return AjaxResult.success(list);
+    }
+
+
+    /**
+     * web数据统计 数据导出
+     *
+     * @param
+     * @return
+     */
+    @PostMapping("/exportDataStatistic")
+    @ApiOperation(value = "web数据统计")
+    public void exportDataStatistic(HttpServletRequest request, HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
+        //创建Excel文件
+        Workbook wb = new HSSFWorkbook();
+        //生成sheet
+        Sheet sheet = wb.createSheet("报警数据详情");
+        //创建行
+        Row row = null;
+        //创建列
+        Cell cell = null;
+        //创建表头单元格样式
+        CellStyle cs_header = wb.createCellStyle();
+        //设置字体样式
+        Font boldFont = wb.createFont();
+        //设置文字类型
+        boldFont.setFontName("宋体");
+        //设置加粗
+        boldFont.setBold(true);
+        //设置文字大小
+        boldFont.setFontHeightInPoints((short) 16);
+        //应用设置的字体
+        cs_header.setFont(boldFont);
+        //设置边框下、左、右、上
+        cs_header.setBorderBottom(BorderStyle.THIN);
+        cs_header.setBorderLeft(BorderStyle.THIN);
+        cs_header.setBorderRight(BorderStyle.THIN);
+        cs_header.setBorderTop(BorderStyle.THIN);
+        //水平居中
+        cs_header.setAlignment(HorizontalAlignment.CENTER);
+        //垂直居中
+        cs_header.setVerticalAlignment(VerticalAlignment.CENTER);
+        //前景填充色
+        cs_header.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
+        //设置前景填充样式
+        cs_header.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        //设置标题
+        row = sheet.createRow(0);
+        //设置单元格行高
+        row.setHeightInPoints(24);
+        //设置标题
+        String[] headers = new String[]{
+                "线路", "时间", "行别", "报警类型", "里程位置", "里程起始范围km", "里程结束范围km"
+        };
+        //逐个设置标题样式
+        for (int i = 0; i < headers.length; i++) {
+            //创建单元格
+            cell = row.createCell(i);
+            //设置单元格内容
+            cell.setCellValue(headers[i]);
+            //设置单元格样式
+            cell.setCellStyle(cs_header);
+        }
+        //创建文本单元格样式
+        CellStyle cs_text = wb.createCellStyle();
+        //创建文字设置
+        Font textFont = wb.createFont();
+        //设置文字类型
+        textFont.setFontName("Consolas");
+        //设置文字大小
+        textFont.setFontHeightInPoints((short) 10);
+        //应用设置
+        cs_text.setFont(textFont);
+        //设置边框
+        cs_text.setBorderBottom(BorderStyle.THIN);
+        cs_text.setBorderLeft(BorderStyle.THIN);
+        cs_text.setBorderRight(BorderStyle.THIN);
+        cs_text.setBorderTop(BorderStyle.THIN);
+        //水平居中
+        cs_text.setAlignment(HorizontalAlignment.CENTER);
+        //垂直居中
+        cs_text.setVerticalAlignment(VerticalAlignment.CENTER);
+        String userId = "1";//getUserId();
+        if ("1".equals(userId)) {
+            userId = "";
+        }
+        //调取数据
+        List<AlarmStatisticVo> list = msgAlarmMapper.list(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
+                alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), userId);
+        //将数据写入表格
+        for (int i = 0; i < list.size(); i++) {
+            row = sheet.createRow(i + 1);
+            AlarmStatisticVo vo = list.get(i);
+            // 第四步,创建单元格,并设置值
+            if (StringUtils.isNotEmpty(vo.getBaseCameraManagement().getRailwayCode())) {
+                row.createCell(0).setCellValue(vo.getBaseCameraManagement().getRailwayCode());
+            }
+            if (vo.getAlarmTime() != null) {
+                row.createCell(1).setCellValue(vo.getAlarmTime());
+            }
+            if (vo.getLineDir() != null) {
+                row.createCell(2).setCellValue(vo.getLineDir());
+            }
+            if (vo.getAlarmType() != null) {
+                row.createCell(3).setCellValue(vo.getAlarmType());
+            }
+            if (vo.getBaseCameraManagement().getInstallMile() != null) {
+                row.createCell(4).setCellValue(vo.getBaseCameraManagement().getInstallMile());
+            }
+            if (vo.getBaseCameraManagement().getBeginMile() != null) {
+                row.createCell(5).setCellValue(vo.getBaseCameraManagement().getBeginMile());
+            }
+            if (vo.getBaseCameraManagement().getEndMile() != null) {
+                row.createCell(6).setCellValue(vo.getBaseCameraManagement().getEndMile());
+            }
+        }
+        //设置中文文件名称
+        String fileName = "报警数据详情";//URLEncoder.encode("POIExcel下载测试","UTF-8");
+        //浏览器默认服务器传过去的是html,不是excel文件
+        //设置响应类型:传输内容是流,并支持中文
+        response.setContentType("application/octet-stream;charset=UTF-8");
+        //设置响应头信息header,下载时以文件附件下载
+        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
+        //输出流对象
+        OutputStream os;
+        try {
+            os = response.getOutputStream();
+            //强制刷新
+            os.flush();
+            os.close();
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }
 

+ 14 - 3
hazard-admin/src/main/java/com/ozs/web/controller/app/GeoHazardMineController.java

@@ -24,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.util.List;
 import java.util.UUID;
 
 /**
@@ -98,9 +99,19 @@ public class GeoHazardMineController extends BaseController {
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     @ApiOperation("app推送报警信息记录分页显示(全部信息)")
     public AjaxResult list(@RequestBody MsgAppPushVo msgAppPushVo) {
-        QueryWrapper<MsgAppPush> queryWrapper = new QueryWrapper<MsgAppPush>();
-        IPage<MsgAppPush> page = msgAppPushService.page(new Page<>(msgAppPushVo.getPageNum(), msgAppPushVo.getPageSize()), queryWrapper);
-        return AjaxResult.success(page);
+        List<MsgAppPushVo> list = msgAppPushService.alarmPushMsg(msgAppPushVo.getStatus());
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * app推送报警信息记录修改状态
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ApiOperation("app推送报警信息记录分页显示(全部信息)")
+    public AjaxResult update(@RequestBody MsgAppPush msgAppPush) {
+        String userName = getUsername();
+        msgAppPushService.update(msgAppPush.getId(), msgAppPush.getStatus(), userName);
+        return AjaxResult.success();
     }
 }
 

+ 2 - 2
hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConfig.java

@@ -11,8 +11,8 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 @Configuration
 public class WebSocketConfig {
     /**
-     * 	注入ServerEndpointExporter,
-     * 	这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint
+     * 注入ServerEndpointExporter,
+     * 这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint
      */
     @Bean
     public ServerEndpointExporter serverEndpointExporter() {

+ 23 - 21
hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketServer.java

@@ -21,6 +21,12 @@ import java.util.concurrent.CopyOnWriteArraySet;
 @ServerEndpoint("/websocket/{userId}")  // 接口路径 ws://localhost:8087/webSocket/userId;
 public class WebSocketServer {
 
+    //concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
+    //虽然@Component默认是单例模式的,但springboot还是会为每个websocket连接初始化一个bean,所以可以用一个静态set保存起来。
+    //  注:底下WebSocket是当前类名
+    private static CopyOnWriteArraySet<WebSocketServer> webSockets = new CopyOnWriteArraySet<>();
+    // 用来存在线连接用户信息
+    private static ConcurrentHashMap<String, Session> sessionPool = new ConcurrentHashMap<String, Session>();
     //与某个客户端的连接会话,需要通过它来给客户端发送数据
     private Session session;
     /**
@@ -28,24 +34,17 @@ public class WebSocketServer {
      */
     private String userId;
 
-    //concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
-    //虽然@Component默认是单例模式的,但springboot还是会为每个websocket连接初始化一个bean,所以可以用一个静态set保存起来。
-    //  注:底下WebSocket是当前类名
-    private static CopyOnWriteArraySet<WebSocketServer> webSockets =new CopyOnWriteArraySet<>();
-    // 用来存在线连接用户信息
-    private static ConcurrentHashMap<String,Session> sessionPool = new ConcurrentHashMap<String,Session>();
-
     /**
      * 链接成功调用的方法
      */
     @OnOpen
-    public void onOpen(Session session, @PathParam(value="userId")String userId) {
+    public void onOpen(Session session, @PathParam(value = "userId") String userId) {
         try {
             this.session = session;
             this.userId = userId;
             webSockets.add(this);
             sessionPool.put(userId, session);
-            log.info("【websocket消息】有新的连接,总数为:"+webSockets.size());
+            log.info("【websocket消息】有新的连接,总数为:" + webSockets.size());
         } catch (Exception e) {
         }
     }
@@ -58,10 +57,11 @@ public class WebSocketServer {
         try {
             webSockets.remove(this);
             sessionPool.remove(this.userId);
-            log.info("【websocket消息】连接断开,总数为:"+webSockets.size());
+            log.info("【websocket消息】连接断开,总数为:" + webSockets.size());
         } catch (Exception e) {
         }
     }
+
     /**
      * 收到客户端消息后调用的方法
      *
@@ -69,27 +69,29 @@ public class WebSocketServer {
      */
     @OnMessage
     public void onMessage(String message) {
-        log.info("【websocket消息】收到客户端消息:"+message);
+        log.info("【websocket消息】收到客户端消息:" + message);
     }
 
-    /** 发送错误时的处理
+    /**
+     * 发送错误时的处理
+     *
      * @param session
      * @param error
      */
     @OnError
     public void onError(Session session, Throwable error) {
 
-        log.error("用户错误,原因:"+error.getMessage());
+        log.error("用户错误,原因:" + error.getMessage());
         error.printStackTrace();
     }
 
 
     // 此为广播消息
     public void sendAllMessage(String message) {
-        log.info("【websocket消息】广播消息:"+message);
-        for(WebSocketServer webSocket : webSockets) {
+        log.info("【websocket消息】广播消息:" + message);
+        for (WebSocketServer webSocket : webSockets) {
             try {
-                if(webSocket.session.isOpen()) {
+                if (webSocket.session.isOpen()) {
                     webSocket.session.getAsyncRemote().sendText(message);
                 }
             } catch (Exception e) {
@@ -101,9 +103,9 @@ public class WebSocketServer {
     // 此为单点消息
     public void sendOneMessage(String userId, String message) {
         Session session = sessionPool.get(userId);
-        if (session != null&&session.isOpen()) {
+        if (session != null && session.isOpen()) {
             try {
-                log.info("【websocket消息】 单点消息:"+message);
+                log.info("【websocket消息】 单点消息:" + message);
                 session.getAsyncRemote().sendText(message);
             } catch (Exception e) {
                 e.printStackTrace();
@@ -113,11 +115,11 @@ public class WebSocketServer {
 
     // 此为单点消息(多人)
     public void sendMoreMessage(String[] userIds, String message) {
-        for(String userId:userIds) {
+        for (String userId : userIds) {
             Session session = sessionPool.get(userId);
-            if (session != null&&session.isOpen()) {
+            if (session != null && session.isOpen()) {
                 try {
-                    log.info("【websocket消息】 单点消息:"+message);
+                    log.info("【websocket消息】 单点消息:" + message);
                     session.getAsyncRemote().sendText(message);
                 } catch (Exception e) {
                     e.printStackTrace();