diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java b/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java index c75521f..a798373 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java @@ -4,8 +4,6 @@ package com.ruoyi.database.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.utils.StringKit; import com.ruoyi.database.domain.MetaAlarmInfo; -import com.ruoyi.database.domain.PeopleVehicleFlow; -import com.ruoyi.database.domain.TransitVehicleRecord; import com.ruoyi.database.service.MetaAlarmInfoService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -22,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; @@ -71,16 +70,20 @@ public class MetaAlarmInfoController extends BaseController { for (int i = 1; i <= 7; i++) { LocalDate date = currentDate.minusDays(i); LocalDateTime startDateTime = date.atStartOfDay(); - LocalDateTime endDateTime = date.plusDays(1).atStartOfDay(); + LocalDateTime endDateTime = date.atTime(LocalTime.MAX); + // 构造查询条件 + String startDateString = startDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); + String endDateString = endDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); + QueryWrapper vehicleQueryWrapper = new QueryWrapper<>(metaAlarmInfo); - vehicleQueryWrapper.between("alarm_response_unit", startDateTime, endDateTime); + vehicleQueryWrapper.between("alarm_response_time", startDateString, endDateString); + // 查询当前日期的记录数据总数 long vehicleCount = metaAlarmInfoService.count(vehicleQueryWrapper); // 存储结果到 TreeMap 中 dailyCountsMap.put(date, vehicleCount); } - return AjaxResult.success(dailyCountsMap); } catch (Exception e) { logger.info(StringKit.toString(e));