Browse Source

修改数据统计

wyyay 2 years ago
parent
commit
5755136d57

+ 13 - 7
business-service/src/main/java/com/ozs/entity/TerminalIgnoreAlarm.java

@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import java.io.Serializable;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
+import java.util.Date;
+
+import com.ozs.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import lombok.*;
 
 /**
  * <p>
@@ -16,8 +19,11 @@ import lombok.EqualsAndHashCode;
  * @since 2023-04-11
  */
 @Data
-@EqualsAndHashCode(callSuper = false)
-public class TerminalIgnoreAlarm implements Serializable {
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("终端忽略报警信息记录表")
+public class TerminalIgnoreAlarm extends BaseEntity implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -40,7 +46,7 @@ public class TerminalIgnoreAlarm implements Serializable {
     /**
      * 忽略时间
      */
-    private LocalDateTime ignoreTime;
+    private Date ignoreTime;
 
     /**
      * 创建者
@@ -50,7 +56,7 @@ public class TerminalIgnoreAlarm implements Serializable {
     /**
      * 创建时间
      */
-    private LocalDateTime createTime;
+    private Date createTime;
 
     /**
      * 更新者
@@ -60,7 +66,7 @@ public class TerminalIgnoreAlarm implements Serializable {
     /**
      * 更新时间
      */
-    private LocalDateTime updateTime;
+    private Date updateTime;
 
     /**
      * 备注

+ 44 - 49
business-service/src/main/java/com/ozs/entity/vo/AlarmStatisticDto.java

@@ -20,12 +20,6 @@ public class AlarmStatisticDto {
     @Excel(name = "报警唯一标识")
     private String alarmId;
 
-    /**
-     * 相机编码
-     */
-    @Excel(name = "相机编码")
-    private String cameraCode;
-
     /**
      * 报警时间
      */
@@ -33,6 +27,18 @@ public class AlarmStatisticDto {
     @Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date alarmTime;
 
+    /**
+     * 线路名称
+     */
+    @TableField(exist = false)
+    @Excel(name = "报警线路")
+    private String railwayName;
+
+    /**
+     * 行别编码
+     */
+    private Integer lineDir;
+
     /**
      * 报警里程位置
      */
@@ -45,20 +51,16 @@ public class AlarmStatisticDto {
     private String content;
 
     /**
-     * 报警置信度(百分比)
-     */
-    private Integer alarmConfidence;
-
-    /**
-     * 行别编码
+     * 报警级别
      */
-    private String lineDir;
+    @Excel(name = "报警级别")
+    private Integer alarmLevel;
 
     /**
-     * 行别
+     * 报警置信度(百分比)
      */
-    @Excel(name = "行别")
-    private String lineDirValue;
+    @Excel(name = "报警置信度(百分比)")
+    private Integer alarmConfidence;
 
     /**
      * 报警类型编码
@@ -66,30 +68,21 @@ public class AlarmStatisticDto {
     private String alarmType;
 
     /**
-     * 报警类型
+     * 框定范围
      */
-    @Excel(name = "报警类型")
-    private String alarmTypeValue;
-
-    
+    @Excel(name = "框定范围")
+    private String alarmAttr;
 
     /**
-     * 报警图片地址
+     * 报警是否解除 1已解除2未解除
      */
-    @Excel(name = "报警图片地址")
-    private String imageUrl;
+    private Integer isRelease;
 
     /**
      * 解除人
      */
     private String releasedBy;
 
-    /**
-     * 解除人真实姓名
-     */
-    @Excel(name = "解除人")
-    private String releasedByName;
-
     /**
      * 解除时间
      */
@@ -98,23 +91,34 @@ public class AlarmStatisticDto {
     private Date releasedTime;
 
     /**
-     * 线路名称
+     * 解除内容
      */
-    @TableField(exist = false)
-    @Excel(name = "报警线路")
-    private String railwayName;
+    @Excel(name = "解除内容")
+    private String releaseContent;
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    private String remark;
+
+    /**
+     * 行别
+     */
+    @Excel(name = "行别")
+    private String lineDirName;
 
     /**
      * 报警里程位置字符串形式
      */
-    @TableField(exist = false)
     @Excel(name = "报警里程位置")
     private String alarmMiles;
 
     /**
-     * 报警是否解除 1已解除2未解除
+     * 报警类型
      */
-    private Integer isRelease;
+    @Excel(name = "报警类型")
+    private String alarmTypeName;
 
     /**
      * 报警是否解除 1已解除2未解除
@@ -123,17 +127,8 @@ public class AlarmStatisticDto {
     private String isReleaseName;
 
     /**
-     * 备注
-     */
-    @Excel(name = "备注")
-    private String remark;
-
-    /**
-     * 报警级别
-     */
-    private Integer alarmLevel;
-    /**
-     * 解除内容
+     * 解除人真实姓名
      */
-    private String releaseContent;
+    @Excel(name = "解除人")
+    private String releasedByName;
 }

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

@@ -28,9 +28,4 @@ public class AlarmStatisticResVo extends PageVo implements Serializable {
      * 当前月份
      */
     private Integer currentMonth;
-
-    /**
-     * 灾害类型
-     */
-    private String alarmType;
 }

+ 37 - 42
business-service/src/main/java/com/ozs/entity/vo/AlarmStatisticVo.java

@@ -21,16 +21,6 @@ public class AlarmStatisticVo {
      */
     private String alarmId;
 
-    /**
-     * 线路名称
-     */
-    private String railwayName;
-
-    /**
-     * 相机编码
-     */
-    private String cameraCode;
-
     /**
      * 报警时间
      */
@@ -40,13 +30,14 @@ public class AlarmStatisticVo {
     private Date alarmTime;
 
     /**
-     * 备注
+     * 线路名称
      */
-    private String remark;
-    
+    private String railwayName;
 
-  
-   
+    /**
+     * 报警行别(1上行2下行)
+     */
+    private Integer lineDir;
 
     /**
      * 报警里程位置
@@ -59,35 +50,29 @@ public class AlarmStatisticVo {
     private String content;
 
     /**
-     * 报警置信度(百分比)
-     */
-    private Integer alarmConfidence;
-
-    /**
-     * 报警行别(1上行2下行)
+     * 报警级别
      */
-    private Integer lineDir;
+    private String alarmLevel;
 
     /**
-     * 报警行别字符串(1上行2下行)
+     * 报警置信度(百分比)
      */
-    private String lineDirName;
+    private Integer alarmConfidence;
 
     /**
      * 报警病害类型(目前只有1泥石流,后续可扩展使用)
      */
     private Integer alarmType;
+
     /**
-     * 报警病害类型(目前只有1泥石流,后续可扩展使用)
+     * 框定范围
      */
-    private String alarmTypeName;
-
-    
+    private Integer alarmAttr;
 
     /**
-     * 报警图片地址
+     * 报警是否解除 1已解除2未解除
      */
-    private String imageUrl;
+    private Integer isRelease;
 
     /**
      * 解除人
@@ -95,31 +80,41 @@ public class AlarmStatisticVo {
     private String releasedBy;
 
     /**
-     * 解除
+     * 解除时间
      */
-    private String releasedByName;
+    @JsonFormat(
+            pattern = "yyyy-MM-dd HH:mm:ss"
+    )
+    private Date releasedTime;
 
     /**
-     * 解除时间
+     * 解除内容
      */
-    private Date releasedTime;
+    private String releaseContent;
 
     /**
-     * 报警是否解除 1已解除2未解除
+     * 备注
      */
-    private Integer isRelease;
+    private String remark;
 
     /**
-     * 报警是否解除 1已解除2未解除
+     * 报警行别字符串(1上行2下行)
      */
-    private String isReleaseName;
+    private String lineDirName;
+
+
     /**
-     * 报警级别
+     * 报警病害类型(目前只有1泥石流,后续可扩展使用)
      */
-    private Integer alarmLevel;
+    private String alarmTypeName;
 
     /**
-     * 解除内容
+     * 解除
      */
-    private String releaseContent;
+    private String releasedByName;
+
+    /**
+     * 报警是否解除 1已解除2未解除
+     */
+    private String isReleaseName;
 }

+ 3 - 10
business-service/src/main/java/com/ozs/mapper/MsgAlarmMapper.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ozs.entity.MsgAlarm;
 import com.ozs.entity.vo.AlarmStatisticDto;
 import com.ozs.entity.vo.AlarmStatisticMonthDto;
-import com.ozs.entity.vo.AlarmStatisticVo;
 import com.ozs.entity.vo.MsgAlarmVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -22,19 +21,13 @@ import java.util.List;
 @Mapper
 public interface MsgAlarmMapper extends BaseMapper<MsgAlarm> {
     //报警数据详情
-    List<AlarmStatisticVo> list(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
-
-    //报警数据详情导出数据集合
-    List<AlarmStatisticDto> listDto(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
-
-    //报警月统计数据
-    List<AlarmStatisticVo> listMonth(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
+    List<AlarmStatisticDto> list(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth);
 
     //报警月统计数据导出数据集合
-    List<AlarmStatisticMonthDto> listDtoMonth(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
+    List<AlarmStatisticMonthDto> listDtoMonth(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth);
 
     //报警月统计数据导出数据集合(天)
-    List<AlarmStatisticMonthDto> listDtoDay(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
+    List<AlarmStatisticMonthDto> listDtoDay(@Param("railwayCode") String railwayCode, @Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth);
 
     Integer selectCameraCode(@Param("cameraCode") String cameraCode);
 

+ 5 - 11
business-service/src/main/java/com/ozs/service/MsgAlarmService.java

@@ -17,25 +17,19 @@ import java.util.Map;
  * @since 2023-02-22
  */
 public interface MsgAlarmService extends IService<MsgAlarm> {
-    //web数据统计 报警数据详情
-    List<AlarmStatisticVo> list(String railwayCode, Integer currentYear, Integer currentMonth, String alarmType, Integer pageNum, Integer pageSize, String userId);
+    //web数据统计 报警数据详情 导出数据集合
+    List<AlarmStatisticDto> list(String railwayCode, Integer currentYear, Integer currentMonth, Integer pageNum, Integer pageSize);
 
     IPage listToPage(List list, int pageNum, int pageSize);
 
     //web数据统计 报警月统计数据
-    List<AlarmStatisticMonthDto> getCount(String railwayCode, Integer currentYear, Integer currentMonth, String alarmType, String userId);
+    List<AlarmStatisticMonthDto> getCount(String railwayCode, Integer currentYear, Integer currentMonth);
 
     //web数据统计 报警月统计数据(天)
-    List<AlarmStatisticMonthDto> getDayCount(String railwayCode, Integer currentYear, Integer currentMonth, String alarmType, String userId);
+    List<AlarmStatisticMonthDto> getDayCount(String railwayCode, Integer currentYear, Integer currentMonth);
 
     //报警数据详情导出数据集合
-    List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo, String userId);
-
-    //报警数据详情导出数据集合(天)
-    List<AlarmStatisticMonthDto> exportDayExcel(AlarmStatisticResVo alarmStatisticResVo, String userId);
-
-    //web数据统计 报警月统计数据导出
-    List<AlarmStatisticMonthDto> exportExcelMonth(AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception;
+    List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo);
 
     /**
      * 通过相机编码查询未解除预警信息

+ 9 - 23
business-service/src/main/java/com/ozs/service/impl/MsgAlarmServiceImpl.java

@@ -46,41 +46,27 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
 
     //web数据统计 报警数据详情
     @Override
-    public List<AlarmStatisticVo> list(String railwayCode, Integer currentYear, Integer currentMonth, String alarmType, Integer pageNum, Integer pageSize, String userId) {
-        List<AlarmStatisticVo> list = msgAlarmMapper.list(railwayCode, currentYear, currentMonth, alarmType, userId);
+    public List<AlarmStatisticDto> list(String railwayCode, Integer currentYear, Integer currentMonth, Integer pageNum, Integer pageSize) {
+        List<AlarmStatisticDto> list = msgAlarmMapper.list(railwayCode, currentYear, currentMonth);
         return list;
     }
 
     @Override
-    public List<AlarmStatisticMonthDto> getCount(String railwayCode, Integer currentYear, Integer currentMonth, String alarmType, String userId) {
-        List<AlarmStatisticMonthDto> list = msgAlarmMapper.listDtoMonth(railwayCode, currentYear, currentMonth, alarmType, userId);
+    public List<AlarmStatisticMonthDto> getCount(String railwayCode, Integer currentYear, Integer currentMonth) {
+        List<AlarmStatisticMonthDto> list = msgAlarmMapper.listDtoMonth(railwayCode, currentYear, currentMonth);
         return list;
     }
 
     @Override
-    public List<AlarmStatisticMonthDto> getDayCount(String railwayCode, Integer currentYear, Integer currentMonth, String alarmType, String userId) {
-        List<AlarmStatisticMonthDto> list = msgAlarmMapper.listDtoDay(railwayCode, currentYear, currentMonth, alarmType, userId);
+    public List<AlarmStatisticMonthDto> getDayCount(String railwayCode, Integer currentYear, Integer currentMonth) {
+        List<AlarmStatisticMonthDto> list = msgAlarmMapper.listDtoDay(railwayCode, currentYear, currentMonth);
         return list;
     }
 
     @Override
-    public List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo, String userId) {
-        List<AlarmStatisticDto> listDto = msgAlarmMapper.listDto(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
-        return listDto;
-    }
-
-    @Override
-    public List<AlarmStatisticMonthDto> exportDayExcel(AlarmStatisticResVo alarmStatisticResVo, String userId) {
-        List<AlarmStatisticMonthDto> listDto = msgAlarmMapper.listDtoDay(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
-        return listDto;
-    }
-
-    @Override
-    public List<AlarmStatisticMonthDto> exportExcelMonth(AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception {
-        List<AlarmStatisticMonthDto> listDto = msgAlarmMapper.listDtoMonth(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
+    public List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo) {
+        List<AlarmStatisticDto> listDto = msgAlarmMapper.list(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
+                alarmStatisticResVo.getCurrentMonth());
         return listDto;
     }
 

+ 16 - 110
business-service/src/main/resources/mapper/MsgAlarmMapper.xml

@@ -1,52 +1,45 @@
 <?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.mapper.MsgAlarmMapper">
-    <resultMap id="AlarmStatisticVoResult" type="com.ozs.entity.vo.AlarmStatisticVo">
+    <resultMap id="AlarmStatisticDtoResult" type="com.ozs.entity.vo.AlarmStatisticDto">
         <id column="id" property="id"/>
         <result column="alarm_id" property="alarmId"/>
         <result column="railway_name" property="railwayName"/>
-        <result column="camera_code" property="cameraCode"/>
         <result column="alarm_time" property="alarmTime"/>
-        <result column="remark" property="remark"/>
+        <result column="line_dir" property="lineDir"/>
         <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_level" property="alarmLevel"/>
+        <result column="alarm_confidence" property="alarmConfidence"/>
         <result column="alarm_type" property="alarmType"/>
-        <result column="image_url" property="imageUrl"/>
+        <result column="alarm_attr" property="alarmAttr"/>
+        <result column="is_release" property="isRelease"/>
         <result column="released_by" property="releasedBy"/>
         <result column="released_time" property="releasedTime"/>
-        <result column="is_release" property="isRelease"/>
         <result column="release_content" property="releaseContent"/>
+        <result column="remark" property="remark"/>
     </resultMap>
 
-    <select id="list" resultMap="AlarmStatisticVoResult">
+    <select id="list" resultMap="AlarmStatisticDtoResult">
         SELECT
         a.alarm_id ,
-        a.camera_code ,
+        b.railway_name,
         a.alarm_time ,
+        a.line_dir,
         a.alarm_mile,
+        a.alarm_level,
         a.content ,
         a.alarm_confidence ,
-        a.line_dir,
         a.alarm_type,
         a.alarm_attr,
-        a.image_url,
+        a.is_release,
         a.released_by ,
         a.released_time,
-        a.released_reason,
-        a.released_type,
-        c.railway_name,
-        a.remark,
-        a.alarm_level,
         a.release_content,
-        a.is_lock
+        a.remark
         FROM
         msg_alarm AS a inner 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 left join
-        base_railway_management c on b.railway_code=c.railway_code
+        base_railway_management AS b on a.railway_code=b.railway_code
 
         <where>
             <if test="railwayCode != null and railwayCode != ''">
@@ -61,81 +54,10 @@
             <if test="currentMonth != null and currentMonth != 0">
                 and MONTH(a.alarm_time) =#{currentMonth}
             </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
+        group by a.alarm_id order by a.alarm_time desc
     </select>
 
-    <resultMap id="AlarmStatisticDtoResult" type="com.ozs.entity.vo.AlarmStatisticDto">
-        <id column="id" property="id"/>
-        <result column="alarmId" property="alarmId"/>
-        <result column="cameraCode" property="cameraCode"/>
-        <result column="alarmTime" property="alarmTime"/>
-        <result column="alarmMile" property="alarmMile"/>
-        <result column="content" property="content"/>
-        <result column="alarmConfidence" property="alarmConfidence"/>
-        <result column="lineDir" property="lineDir"/>
-        <result column="alarmType" property="alarmType"/>
-        <result column="imageUrl" property="imageUrl"/>
-        <result column="releasedBy" property="releasedBy"/>
-        <result column="releasedTime" property="releasedTime"/>
-        <result column="railwayName" property="railwayName"/>
-        <result column="remark" property="remark"/>
-        <result column="isRelease" property="isRelease"/>
-        <result column="alarm_level" property="alarmLevel"/>
-        <result column="release_content" property="releaseContent"/>
-    </resultMap>
-    <select id="listDto" resultMap="AlarmStatisticDtoResult">
-        SELECT
-        a.alarm_id AS alarmId,
-        a.camera_code AS cameraCode,
-        a.alarm_time AS alarmTime,
-        a.alarm_mile AS alarmMile,
-        a.content AS content,
-        a.alarm_confidence AS alarmConfidence,
-        a.line_dir AS lineDir,
-        a.alarm_type AS alarmType,
-        a.image_url AS imageUrl,
-        a.released_by AS releasedBy,
-        a.released_time AS releasedTime,
-        c.railway_name AS railwayName,
-        a.alarm_level AS alarmLevel,
-        a.remark AS remark,
-        a.is_release AS isRelease,
-        a.release_content AS releaseContent
-        FROM
-        msg_alarm AS a inner 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 left join
-        base_railway_management c on b.railway_code=c.railway_code
-
-        <where>
-            <if test="railwayCode != null and railwayCode != ''">
-                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
-            </if>
-            <if test="currentYear != null and currentYear != 0">
-                and YEAR(a.alarm_time) like UPPER(CONCAT('%',#{currentYear},'%'))
-            </if>
-            <if test="currentYear == null or currentYear == ''">
-                and YEAR(a.alarm_time) = YEAR(SYSDATE())
-            </if>
-            <if test="currentMonth != null and currentMonth != 0">
-                and MONTH(a.alarm_time) =#{currentMonth}
-            </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>
     <resultMap id="AlarmStatisticMonthDtoResult" type="com.ozs.entity.vo.AlarmStatisticMonthDto">
         <id column="id" property="id"/>
         <result column="monthsta" property="monthsta"/>
@@ -152,9 +74,7 @@
         count(DISTINCT a.alarm_id) as fre
         FROM
         msg_alarm AS a inner 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 left join
-        base_railway_management c on b.railway_code=c.railway_code
+        base_railway_management AS b on a.railway_code=b.railway_code
 
         <where>
             <if test="railwayCode != null and railwayCode != ''">
@@ -169,12 +89,6 @@
             <if test="currentMonth != null and currentMonth != 0">
                 and MONTH(a.alarm_time) =#{currentMonth}
             </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) AS p group by p.monthsta order by p.monthsta
     </select>
@@ -188,9 +102,7 @@
         count(DISTINCT a.alarm_id) as fre
         FROM
         msg_alarm AS a inner 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 left join
-        base_railway_management c on b.railway_code=c.railway_code
+        base_railway_management AS b on a.railway_code=b.railway_code
 
         <where>
             <if test="railwayCode != null and railwayCode != ''">
@@ -205,12 +117,6 @@
             <if test="currentMonth != null and currentMonth != 0">
                 and MONTH(a.alarm_time) =#{currentMonth}
             </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) AS p group by p.daysta order by p.daysta
     </select>

+ 0 - 213
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -372,218 +372,5 @@ public class MsgAlarmController extends BaseController {
         List<MsgAlarm> list = msgAlarmService.list(wrapper);
         return AjaxResult.success(list);
     }
-
-    /**
-     * web数据统计
-     *
-     * @param alarmStatisticResVo
-     * @return
-     */
-    @Log(title = "报警信息管理", businessType = BusinessType.OTHER)
-    @PostMapping("/dataStatistic")
-    @ApiOperation(value = "web数据统计 报警数据详情")
-    @ApiImplicitParams(value = {
-            @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
-            @ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
-            @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
-            @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
-    })
-    public AjaxResult dataStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
-        Integer pageNum = alarmStatisticResVo.getPageNum().intValue();
-        Integer pageSize = alarmStatisticResVo.getPageSize().intValue();
-        SysUser user = getLoginUser().getUser();
-        String userId = getUserId();
-        if (user.isAdmin(user.getId())) {
-            userId = "";
-        }
-        List<AlarmStatisticVo> list = msgAlarmService.list(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), pageNum, pageSize, userId);
-        if (!ObjectUtils.isEmpty(list)) {
-            list.forEach(l -> {
-                if (!ObjectUtils.isEmpty(l.getAlarmMile())) {
-                    l.setAlarmMile(AppendUtils.stringAppend(Integer.valueOf(l.getAlarmMile())));
-                }
-                if (StringUtils.isNotEmpty(l.getReleasedBy())) {
-                    BaseUser buser = baseUserService.getUser(l.getReleasedBy());
-                    l.setReleasedByName(buser.getNickName());
-                }
-
-                if (!ObjectUtils.isEmpty(l.getLineDir())) {
-                    l.setLineDirName(l.getLineDir() == 1 ? "上行" : "下行");
-                }
-                if (!ObjectUtils.isEmpty(l.getAlarmType())) {
-                    l.setAlarmTypeName(dictDataService.selectDictLabel("sys_alarm_type", String.valueOf(l.getAlarmType())));
-                }
-                if (!ObjectUtils.isEmpty(l.getIsRelease())) {
-                    l.setIsReleaseName(l.getIsRelease() == 1 ? "已解除" : "未解除");
-                }
-            });
-        }
-        IPage page = msgAlarmService.listToPage(list, pageNum, pageSize);
-        return AjaxResult.success(page);
-    }
-
-    /**
-     * web数据统计
-     *
-     * @param
-     * @return
-     */
-    @Log(title = "报警信息管理", businessType = BusinessType.OTHER)
-    @PostMapping("/alarmMonthStatistic")
-    @ApiOperation(value = "web数据统计 报警月统计数据")
-    @ApiImplicitParams(value = {
-            @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
-            @ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
-            @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
-            @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
-    })
-    public AjaxResult alarmMonthStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
-        SysUser user = getLoginUser().getUser();
-        String userId = getUserId();
-        ;
-        if (user.isAdmin(user.getId())) {
-            userId = "";
-        }
-        List<Integer> numbs = new ArrayList<>();
-        Integer listSize;
-        List<AlarmStatisticMonthDto> list = null;
-        if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {
-            list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                    alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
-            listSize = 12;
-        } else {
-            if (alarmStatisticResVo.getCurrentMonth().equals(2)) {//2
-                listSize = 28;
-            } else if (alarmStatisticResVo.getCurrentMonth().equals(4) || alarmStatisticResVo.getCurrentMonth().equals(6) ||
-                    alarmStatisticResVo.getCurrentMonth().equals(9) || alarmStatisticResVo.getCurrentMonth().equals(11)) {//4,6,9,11
-                listSize = 30;
-            } else {//1,3,5,7,8,10,12
-                listSize = 31;
-            }
-            list = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                    alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
-        }
-        for (int i = 1; i <= listSize; i++) {
-            numbs.add(i);
-        }
-
-        List<Integer> list1 = new ArrayList<>();
-        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
-            list.forEach(l -> {
-                list1.add(l.getMonthsta());
-            });
-        }
-        AlarmStatisticMonthDto dto;
-        for (int i = 0; i < numbs.size(); i++) {
-            if (!list1.contains(numbs.get(i))) {
-                dto = new AlarmStatisticMonthDto();
-                dto.setMonthsta(numbs.get(i));
-                dto.setFrequency(0);
-                list.add(dto);
-            }
-        }
-        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
-            Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
-                @Override
-                public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
-
-                    return o1.getMonthsta().compareTo(o2.getMonthsta());
-                }
-            });
-        }
-        return AjaxResult.success(list);
-    }
-
-
-    /**
-     * web数据统计 数据导出
-     *
-     * @param
-     * @return
-     */
-    @Log(title = "报警信息管理", businessType = BusinessType.EXPORT)
-    @PostMapping("/exportDataStatistic")
-    @ApiOperation(value = "web数据统计-数据导出")
-    @ApiImplicitParams(value = {
-            @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
-            @ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
-            @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
-            @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
-    })
-    public void exportDataStatistic(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
-        SysUser user = getLoginUser().getUser();
-        String userId = getUserId();
-        if (user.isAdmin(user.getId())) {
-            userId = "";
-        }
-        try {
-            List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
-            if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
-                list.forEach(l -> {
-                    if (!ObjectUtils.isEmpty(l.getAlarmMile())) {
-                        l.setAlarmMiles(AppendUtils.stringAppend(Integer.valueOf(l.getAlarmMile())));
-                    }
-                    if (StringUtils.isNotEmpty(l.getReleasedBy())) {
-                        BaseUser buser = baseUserService.getUser(l.getReleasedBy());
-                        l.setReleasedByName(buser.getNickName());
-                    }
-                    if (!ObjectUtils.isEmpty(l.getAlarmType())) {
-                        String alarmType = l.getAlarmType();
-                        String alarmTypeValue = dictDataService.selectDictLabel("sys_alarm_type", alarmType);
-                        l.setAlarmTypeValue(alarmTypeValue);
-                    }
-                    if (!ObjectUtils.isEmpty(l.getLineDir())) {
-                        String lineDir = l.getLineDir();
-                        String lineDirValue = dictDataService.selectDictLabel("sys_line_dir", lineDir);
-                        l.setLineDirValue(lineDirValue);
-                    }
-                    if (!ObjectUtils.isEmpty(l.getIsRelease())) {
-                        l.setIsReleaseName(l.getIsRelease() == 1 ? "已解除" : "未解除");
-                    }
-                });
-            }
-
-            ExcelUtil<AlarmStatisticDto> util = new ExcelUtil<>(AlarmStatisticDto.class);
-            util.exportExcel(response, list, "报警数据详情");
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.info(e.getMessage());
-        }
-    }
-
-    /**
-     * web数据统计 报警月统计数据导出
-     *
-     * @param
-     * @return
-     */
-    @Log(title = "报警信息管理", businessType = BusinessType.EXPORT)
-    @PostMapping("/exportDataStatisticMonth")
-    @ApiOperation(value = "报警月统计数据导出")
-    @ApiImplicitParams(value = {
-            @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
-            @ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
-            @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
-            @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
-    })
-    public void exportDataStatisticMonth(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
-        SysUser user = getLoginUser().getUser();
-        String userId = getUserId();
-        if (user.isAdmin(user.getId())) {
-            userId = "";
-        }
-
-        List<AlarmStatisticMonthDto> list = null;
-        if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {
-            list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                    alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
-        } else {
-            list = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
-                    alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
-        }
-        ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
-        util.exportExcel(response, list, "报警月统计数据");
-    }
 }