Browse Source

修改统计页面导出接口

wyyay 2 years ago
parent
commit
d83f82f429

+ 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>

+ 6 - 0
business-service/pom.xml

@@ -35,6 +35,12 @@
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.ozs</groupId>
+            <artifactId>base-system</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 </project>

+ 72 - 0
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticDto.java

@@ -0,0 +1,72 @@
+package com.ozs.service.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ozs.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/15
+ */
+@Data
+public class AlarmStatisticDto {
+    /**
+     * 报警唯一标识
+     */
+    private String alarmId;
+    /**
+     * 线路名称
+     */
+    @Excel(name = "线路名称")
+    private String railwayName;
+
+    /**
+     * 报警时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "报警时间")
+    private Date alarmTime;
+
+    /**
+     * 行别编码
+     */
+    private String lineDir;
+
+    /**
+     * 行别
+     */
+    @Excel(name = "行别")
+    private String lineDirValue;
+
+    /**
+     * 报警类型编码
+     */
+    private String alarmType;
+
+    /**
+     * 报警类型
+     */
+    @Excel(name = "报警类型")
+    private String alarmTypeValue;
+
+    /**
+     * 报警里程位置
+     */
+    @Excel(name = "里程位置")
+    private String alarmMile;
+
+    /**
+     * 监控范围开始里程位置
+     */
+    @Excel(name = "里程起始范围km")
+    private Integer beginMile;
+
+    /**
+     * 监控范围结束里程位置
+     */
+    @Excel(name = "里程结束范围km")
+    private Integer endMile;
+}

+ 56 - 0
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticMonthDto.java

@@ -0,0 +1,56 @@
+package com.ozs.service.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ozs.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/15
+ */
+@Data
+public class AlarmStatisticMonthDto {
+    /**
+     * 报警唯一标识
+     */
+    private String alarmId;
+
+    /**
+     * 线路名称
+     */
+    @Excel(name = "线路名称")
+    private String railwayName;
+
+    /**
+     * 报警类型编码
+     */
+    private String alarmType;
+
+    /**
+     * 报警类型
+     */
+    @Excel(name = "报警类型")
+    private String alarmTypeValue;
+
+    /**
+     * 报警月份
+     */
+    @Excel(name = "报警月份")
+    private Integer monthsta;
+
+    /**
+     * 报警次数
+     */
+    @Excel(name = "报警次数")
+    private Integer frequency;
+
+    /**
+     * 报警时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "报警时间")
+    private Date alarmTime;
+}

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

@@ -2,6 +2,8 @@ package com.ozs.service.mapper;
 
 import com.ozs.service.entity.MsgAlarm;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ozs.service.entity.vo.AlarmStatisticDto;
+import com.ozs.service.entity.vo.AlarmStatisticMonthDto;
 import com.ozs.service.entity.vo.AlarmStatisticVo;
 
 import org.apache.ibatis.annotations.Mapper;
@@ -22,6 +24,12 @@ 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<AlarmStatisticDto> listDto(@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);
+
+    //报警月统计数据导出数据集合
+    List<AlarmStatisticMonthDto> listDtoMonth(@Param("railwayCode") String railwayCode, @Param("startMonth") Integer startMonth, @Param("endMonth") Integer endMonth, @Param("alarmType") String alarmType, @Param("userId") String userId);
 }

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

@@ -3,6 +3,8 @@ 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.AlarmStatisticDto;
+import com.ozs.service.entity.vo.AlarmStatisticMonthDto;
 import com.ozs.service.entity.vo.AlarmStatisticResVo;
 import com.ozs.service.entity.vo.AlarmStatisticVo;
 
@@ -24,9 +26,9 @@ public interface MsgAlarmService extends IService<MsgAlarm> {
     //web数据统计 报警月统计数据
     List<AlarmStatisticVo> getCount(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, String userId);
 
-    //web数据统计 报警数据详情导出
-    void exportExcel(HttpServletResponse response, AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception;
+    //报警数据详情导出数据集合
+    List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo, String userId);
 
     //web数据统计 报警月统计数据导出
-    void exportExcelMonth(HttpServletResponse response, AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception;
+    List<AlarmStatisticMonthDto> exportExcelMonth(AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception;
 }

+ 26 - 160
business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java

@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.service.entity.MsgAlarm;
+import com.ozs.service.entity.vo.AlarmStatisticDto;
+import com.ozs.service.entity.vo.AlarmStatisticMonthDto;
 import com.ozs.service.entity.vo.AlarmStatisticResVo;
 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 com.ozs.system.mapper.SysDictDataMapper;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.BeanUtils;
@@ -33,6 +37,8 @@ import java.util.*;
 public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> implements MsgAlarmService {
     @Autowired
     MsgAlarmMapper msgAlarmMapper;
+    @Autowired
+    SysDictDataMapper sysDictDataMapper;
 
     public static IPage listToPage(List list, int pageNum, int pageSize) {
         List pageList = new ArrayList<>();
@@ -61,171 +67,31 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
     }
 
     @Override
-    public void exportExcel(HttpServletResponse response, AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception {
-        // 第一步,创建一个webbook,对应一个Excel文件
-        HSSFWorkbook wb = new HSSFWorkbook();
-        // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
-        HSSFSheet sheet = wb.createSheet("报警数据详情");
-        // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
-        HSSFRow row = sheet.createRow(0);
-        // 第四步,创建单元格,并设置值表头 设置表头居中
-        HSSFCellStyle style = wb.createCellStyle();
-        //单元格边框
-        //style.setAlignment(BorderStyle.THIN); // 创建一个居中格式
-        style.setBorderBottom(BorderStyle.THIN); //下边框
-        style.setBorderLeft(BorderStyle.THIN);//左边框
-        style.setBorderTop(BorderStyle.THIN);//上边框
-        style.setBorderRight(BorderStyle.THIN);//右边框
-        //设置单元格字体大小
-        HSSFFont font = wb.createFont();
-        font.setFontName("宋体");
-        font.setFontHeightInPoints((short) 11);//设置字体大小
-        //font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示
-        style.setFont(font);//选择需要用到的字体格式
-
-        HSSFCell cell = row.createCell(0);
-        cell.setCellValue("线路");
-        cell.setCellStyle(style);
-        cell = row.createCell(1);
-        cell.setCellValue("时间");
-        cell.setCellStyle(style);
-        cell = row.createCell(2);
-        cell.setCellValue("行别");
-        cell.setCellStyle(style);
-        cell = row.createCell(3);
-        cell.setCellValue("报警类型");
-        cell.setCellStyle(style);
-        cell = row.createCell(4);
-        cell.setCellValue("里程位置");
-        cell.setCellStyle(style);
-        cell = row.createCell(5);
-        cell.setCellValue("里程起始范围km");
-        cell.setCellStyle(style);
-        cell = row.createCell(6);
-        cell.setCellValue("里程结束范围km");
-        cell.setCellStyle(style);
-
-        //调取数据
-        List<AlarmStatisticVo> list = msgAlarmMapper.list(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
+    public List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo, String userId) {
+        List<AlarmStatisticDto> listDto = msgAlarmMapper.listDto(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());
-            }
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            if (vo.getAlarmTime() != null) {
-                String dateStr = sdf.format(vo.getAlarmTime());
-                row.createCell(1).setCellValue(dateStr);
-            }
-            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());
-            }
-        }
-        //第六步,输出Excel文件
-        OutputStream output = response.getOutputStream();
-        response.reset();
-        response.setContentType("application/vnd.ms-excel");
+        listDto.forEach(l -> {
+            String alarmType = l.getAlarmType();
+            String alarmTypeValue = sysDictDataMapper.selectDictLabel("sys_alarm_type", alarmType);
+            l.setAlarmTypeValue(alarmTypeValue);
 
-        //设置文件头:最后一个参数是设置下载文件名
-        long filename = System.currentTimeMillis();
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
-        String fileName = "报警数据详情";
-        response.addHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
-        wb.write(output);
-        output.close();
+            String lineDir = l.getLineDir();
+            String lineDirValue = sysDictDataMapper.selectDictLabel("sys_line_dir", lineDir);
+            l.setLineDirValue(lineDirValue);
+        });
+        return listDto;
     }
 
     @Override
-    public void exportExcelMonth(HttpServletResponse response, AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception {
-        // 第一步,创建一个webbook,对应一个Excel文件
-        HSSFWorkbook wb = new HSSFWorkbook();
-        // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
-        HSSFSheet sheet = wb.createSheet("报警月统计数据");
-        // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
-        HSSFRow row = sheet.createRow(0);
-        // 第四步,创建单元格,并设置值表头 设置表头居中
-        HSSFCellStyle style = wb.createCellStyle();
-        //单元格边框
-        //style.setAlignment(BorderStyle.THIN); // 创建一个居中格式
-        style.setBorderBottom(BorderStyle.THIN); //下边框
-        style.setBorderLeft(BorderStyle.THIN);//左边框
-        style.setBorderTop(BorderStyle.THIN);//上边框
-        style.setBorderRight(BorderStyle.THIN);//右边框
-        //设置单元格字体大小
-        HSSFFont font = wb.createFont();
-        font.setFontName("宋体");
-        font.setFontHeightInPoints((short) 11);//设置字体大小
-        //font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示
-        style.setFont(font);//选择需要用到的字体格式
-
-        HSSFCell cell = row.createCell(0);
-        cell.setCellValue("线路");
-        cell.setCellStyle(style);
-        cell = row.createCell(1);
-        cell.setCellValue("报警类型");
-        cell.setCellStyle(style);
-        cell = row.createCell(2);
-        cell.setCellValue("报警月份");
-        cell.setCellStyle(style);
-        cell = row.createCell(3);
-        cell.setCellValue("报警次数");
-        cell.setCellStyle(style);
-        cell = row.createCell(4);
-        cell.setCellValue("报警时间");
-        cell.setCellStyle(style);
-
-        //调取数据
-        List<AlarmStatisticVo> list = msgAlarmMapper.listMonth(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
+    public List<AlarmStatisticMonthDto> exportExcelMonth(AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception {
+        List<AlarmStatisticMonthDto> listDto = msgAlarmMapper.listDtoMonth(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.getAlarmType() != null) {
-                row.createCell(1).setCellValue(vo.getAlarmType());
-            }
-            if (vo.getMonthsta() != null) {
-                row.createCell(2).setCellValue(vo.getMonthsta());
-            }
-            if (vo.getFrequency() != null) {
-                row.createCell(3).setCellValue(vo.getFrequency());
-            }
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            if (vo.getAlarmTime() != null) {
-                String dateStr = sdf.format(vo.getAlarmTime());
-                row.createCell(4).setCellValue(dateStr);
-            }
-        }
-        //第六步,输出Excel文件
-        OutputStream output = response.getOutputStream();
-        response.reset();
-        response.setContentType("application/vnd.ms-excel");
-        //设置文件头:最后一个参数是设置下载文件名
-        long filename = System.currentTimeMillis();
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
-        String fileName = "报警月统计数据";
-        response.addHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
-        wb.write(output);
-        output.close();
+        listDto.forEach(l -> {
+            String alarmType = l.getAlarmType();
+            String alarmTypeValue = sysDictDataMapper.selectDictLabel("sys_alarm_type", alarmType);
+            l.setAlarmTypeValue(alarmTypeValue);
+        });
+        return listDto;
     }
+
 }

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

@@ -126,4 +126,96 @@
         group by a.alarm_id,MONTH(a.alarm_time)
 
     </select>
+
+    <resultMap id="AlarmStatisticDtoResult" type="com.ozs.service.entity.vo.AlarmStatisticDto">
+        <id column="id" property="id"/>
+        <result column="alarmId" property="alarmId"/>
+        <result column="railwayName" property="railwayName"/>
+        <result column="alarmTime" property="alarmTime"/>
+        <result column="lineDir" property="lineDir"/>
+        <result column="lineDirValue" property="lineDirValue"/>
+        <result column="alarmType" property="alarmType"/>
+        <result column="alarmTypeValue" property="alarmTypeValue"/>
+        <result column="alarmMile" property="alarmMile"/>
+        <result column="beginMile" property="beginMile"/>
+        <result column="endMile" property="endMile"/>
+    </resultMap>
+    <select id="listDto" resultMap="AlarmStatisticDtoResult">
+        SELECT
+        a.alarm_id AS alarmId,
+        a.alarm_time AS alarmTime,
+        a.alarm_mile AS alarmMile,
+        a.line_dir AS lineDir,
+        a.alarm_type AS alarmType,
+        c.railway_name AS railwayName,
+        b.begin_mile AS beginMile,
+        b.end_mile AS endMile
+        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 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="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>
+    <resultMap id="AlarmStatisticMonthDtoResult" type="com.ozs.service.entity.vo.AlarmStatisticMonthDto">
+        <id column="id" property="id"/>
+        <result column="alarmId" property="alarmId"/>
+        <result column="railwayName" property="railwayName"/>
+        <result column="alarmType" property="alarmType"/>
+        <result column="alarmTime" property="alarmTime"/>
+        <result column="monthsta" property="monthsta"/>
+        <result column="frequency" property="frequency"/>
+    </resultMap>
+    <select id="listDtoMonth" resultMap="AlarmStatisticMonthDtoResult">
+        SELECT
+        a.alarm_id AS alarmId,
+        MONTH(a.alarm_time) as monthsta,
+        count(DISTINCT a.alarm_id) as frequency,
+        a.alarm_type AS alarmType,
+        a.alarm_time AS alarmTime,
+        c.railway_name AS railwayName
+        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 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="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>

+ 8 - 3
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -10,6 +10,7 @@ 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.common.utils.poi.ExcelUtil;
 import com.ozs.service.entity.BaseCameraManagement;
 import com.ozs.service.entity.BaseRailwayManagement;
 import com.ozs.service.entity.MsgAlarm;
@@ -324,7 +325,9 @@ public class MsgAlarmController extends BaseController {
             userId = "";
         }
         try {
-            msgAlarmService.exportExcel(response, alarmStatisticResVo, userId);
+            List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
+            ExcelUtil<AlarmStatisticDto> util = new ExcelUtil<>(AlarmStatisticDto.class);
+            util.exportExcel(response, list, "报警数据详情");
         } catch (Exception e) {
             e.printStackTrace();
             log.info(e.getMessage());
@@ -332,7 +335,7 @@ public class MsgAlarmController extends BaseController {
     }
 
     /**
-     * web数据统计 数据导出
+     * web数据统计 报警月统计数据导出
      *
      * @param
      * @return
@@ -351,7 +354,9 @@ public class MsgAlarmController extends BaseController {
             userId = "";
         }
         try {
-            msgAlarmService.exportExcelMonth(response, alarmStatisticResVo, userId);
+            List<AlarmStatisticMonthDto> list = msgAlarmService.exportExcelMonth(alarmStatisticResVo, userId);
+            ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
+            util.exportExcel(response, list, "-报警月统计数据");
         } catch (Exception e) {
             e.printStackTrace();
             log.info(e.getMessage());

+ 48 - 12
hazard-admin/src/main/java/com/ozs/web/controller/monitor/SysLoginInfoController.java

@@ -2,14 +2,16 @@ package com.ozs.web.controller.monitor;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ozs.common.core.domain.vo.SysLoginInfoVo;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.*;
 import com.ozs.common.annotation.Log;
 import com.ozs.common.core.controller.BaseController;
 import com.ozs.common.core.domain.AjaxResult;
@@ -34,12 +36,46 @@ public class SysLoginInfoController extends BaseController {
     @Autowired
     private SysPasswordService passwordService;
 
-    @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(SysLoginInfo logininfor) {
-        startPage();
-        List<SysLoginInfo> list = logininforService.selectLogininforList(logininfor);
-        return getDataTable(list);
+//    @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
+//    @GetMapping("/list")
+//    public TableDataInfo list(SysLoginInfo logininfor) {
+//        startPage();
+//        List<SysLoginInfo> list = logininforService.selectLogininforList(logininfor);
+//        return getDataTable(list);
+//    }
+
+    /**
+     * 获取登录日志分页列表
+     *
+     * @param sysLoginInfoVo
+     * @return
+     */
+    @ApiOperation(value = "获取登录日志分页列表")
+    @PostMapping("/list")
+    public AjaxResult list(@RequestBody SysLoginInfoVo sysLoginInfoVo) {
+        LambdaQueryWrapper<SysLoginInfo> wrapper = new LambdaQueryWrapper<SysLoginInfo>();
+        if (!ObjectUtils.isEmpty(sysLoginInfoVo.getIpaddr())) {
+            wrapper.like(SysLoginInfo::getIpaddr, sysLoginInfoVo.getIpaddr());
+        }
+        if (!ObjectUtils.isEmpty(sysLoginInfoVo.getUserName())) {
+            wrapper.like(SysLoginInfo::getUserName, sysLoginInfoVo.getUserName());
+        }
+        if (!ObjectUtils.isEmpty(sysLoginInfoVo.getStatus())) {
+            wrapper.like(SysLoginInfo::getStatus, sysLoginInfoVo.getStatus());
+        }
+        if (!ObjectUtils.isEmpty(sysLoginInfoVo.getLoginTime())) {
+            wrapper.like(SysLoginInfo::getLoginTime, sysLoginInfoVo.getLoginTime());
+        }
+        IPage<SysLoginInfo> page = logininforService.page(new Page<>(sysLoginInfoVo.getPageNum(), sysLoginInfoVo.getPageSize()), wrapper);
+        return AjaxResult.success(page);
+    }
+
+    @ApiOperation(value = "获取登录日志详细")
+    @PreAuthorize("@ss.hasPermi('monitor:logininfor:detail')")
+    @PostMapping("/detail")
+    public AjaxResult remove(Long infoId) {
+        SysLoginInfo info = logininforService.selectLoginLogById(infoId);
+        return AjaxResult.success(info);
     }
 
     @Log(title = "登录日志", businessType = BusinessType.EXPORT)

+ 53 - 16
hazard-admin/src/main/java/com/ozs/web/controller/monitor/SysOperlogController.java

@@ -2,14 +2,18 @@ package com.ozs.web.controller.monitor;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ozs.common.core.domain.vo.SysLoginInfoVo;
+import com.ozs.common.core.domain.vo.SysOperlogVo;
+import com.ozs.system.domain.SysLoginInfo;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.*;
 import com.ozs.common.annotation.Log;
 import com.ozs.common.core.controller.BaseController;
 import com.ozs.common.core.domain.AjaxResult;
@@ -26,25 +30,58 @@ import com.ozs.system.service.ISysOperLogService;
  */
 @RestController
 @RequestMapping("/monitor/operlog")
-public class SysOperlogController extends BaseController
-{
+public class SysOperlogController extends BaseController {
     @Autowired
     private ISysOperLogService operLogService;
 
+//    @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
+//    @GetMapping("/list")
+//    public TableDataInfo list(SysOperLog operLog)
+//    {
+//        startPage();
+//        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
+//        return getDataTable(list);
+//    }
+
+    /**
+     * 获取操作日志分页列表
+     *
+     * @param sysOperlogVo
+     * @return
+     */
     @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(SysOperLog operLog)
-    {
-        startPage();
-        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
-        return getDataTable(list);
+    @ApiOperation(value = "获取操作日志分页列表")
+    @PostMapping("/list")
+    public AjaxResult list(@RequestBody SysOperlogVo sysOperlogVo) {
+        LambdaQueryWrapper<SysOperLog> wrapper = new LambdaQueryWrapper<SysOperLog>();
+        if (!ObjectUtils.isEmpty(sysOperlogVo.getOperId())) {
+            wrapper.like(SysOperLog::getOperId, sysOperlogVo.getOperId());
+        }
+        if (!ObjectUtils.isEmpty(sysOperlogVo.getUserId())) {
+            wrapper.like(SysOperLog::getUserId, sysOperlogVo.getUserId());
+        }
+        if (!ObjectUtils.isEmpty(sysOperlogVo.getOperatorType())) {
+            wrapper.like(SysOperLog::getOperatorType, sysOperlogVo.getOperatorType());
+        }
+        if (!ObjectUtils.isEmpty(sysOperlogVo.getOperTime())) {
+            wrapper.like(SysOperLog::getOperTime, sysOperlogVo.getOperTime());
+        }
+        IPage<SysOperLog> page = operLogService.page(new Page<>(sysOperlogVo.getPageNum(), sysOperlogVo.getPageSize()), wrapper);
+        return AjaxResult.success(page);
+    }
+
+    @ApiOperation(value = "获取操作日志详细")
+    @PostMapping("/detail")
+    @PreAuthorize("@ss.hasPermi('monitor:operlog:detail')")
+    public AjaxResult detail(Long operId) {
+        SysOperLog sysOperLog = operLogService.selectOperLogById(operId);
+        return AjaxResult.success(sysOperLog);
     }
 
     @Log(title = "操作日志", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysOperLog operLog)
-    {
+    public void export(HttpServletResponse response, SysOperLog operLog) {
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
         ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
         util.exportExcel(response, list, "操作日志");