lin 3 gadi atpakaļ
vecāks
revīzija
1e580b3f97

+ 7 - 2
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/alarm/AlarmTypeDetailsDto.java

@@ -4,6 +4,9 @@ import com.zcxk.rmcp.api.dto.BasePageDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * @description
@@ -20,11 +23,13 @@ public class AlarmTypeDetailsDto {
     @ApiModelProperty("告警分类")
     private Integer alarmCategory;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @ApiModelProperty("开始时间")
-    private String startTime;
+    private Date startTime;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @ApiModelProperty("结束时间")
-    private String endTime;
+    private Date endTime;
 
     @ApiModelProperty("0 : 历史报警 1:实时报警")
     private int state;

+ 3 - 3
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/AlarmTypeDetailMapper.xml

@@ -68,11 +68,11 @@
             <if test="dto.alarmCategory != null and dto.alarmCategory!=''" >
                 and sat.alarm_category like concat('%', #{dto.alarmCategory}, '%')
             </if>
-            <if test="dto.startTime != null and dto.startTime!=''">
+            <if test="dto.startTime != null">
                 and sad.alarm_start_time >=#{dto.startTime}
             </if>
-            <if test="dto.endTime != null and dto.endTime!=''">
-                and sad.alarm_end_time &lt;= #{dto.endTime}
+            <if test="dto.endTime != null">
+                and sad.alarm_start_time &lt;= #{dto.endTime}
             </if>
             <if test="dto.state != null">
                 and sad.state = #{dto.state}

+ 2 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/AlarmTypeDetailsServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zcxk.rmcp.web.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.bz.zoneiot.core.common.enums.StatusEnum;
 import com.bz.zoneiot.core.common.pojo.Message;
@@ -78,6 +79,7 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService {
     public Pagination<AlarmTypeDetailsEntityVo> selectPage(AlarmTypeDetailsDto dto, BasePageDto page) {
         dto.setState(AlarmStateEnum.REALTIME_ALARM.getCode());
         PageHelper.startPage(page.getPageNum(),page.getPageSize());
+        dto.setEndTime(DateUtil.endOfDay(dto.getEndTime()).toJdkDate());
         return new Pagination<>(alarmTypeDetailMapper.selectList(dto, UserUtil.getCurrentUser().getUserCondition()));
     }