From bf20aa59fb83ce6bd855c791e65f115854234800 Mon Sep 17 00:00:00 2001 From: hanrenchun Date: Mon, 29 Jan 2024 15:22:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/business/controller/BigScreenController.java | 7 +++++-- .../database/controller/TransitUserRecordController.java | 7 +++---- .../controller/TransitVehicleRecordController.java | 7 +++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java b/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java index 08b1c56..95a2e6d 100644 --- a/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java +++ b/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java @@ -315,9 +315,12 @@ public class BigScreenController extends BaseController { metaAlarmInfoAndHandleAlarmVo.setJjxxAlarmResponseTime(dateFormat.format(jjxxAlarmResponse)); } alarmVos.add(metaAlarmInfoAndHandleAlarmVo); - Collections.sort(alarmVos,Collections.reverseOrder()); + } - return AjaxResult.success(alarmVos); + List sortedList = alarmVos.stream() + .sorted(Comparator.comparing(MetaAlarmInfoAndHandleAlarmVo::getJjxxInformantTime)) + .collect(Collectors.toList()); + return AjaxResult.success(sortedList); } catch (Exception e) { logger.info(StringKit.toString(e)); return AjaxResult.error("请求失败,请联系管理员"); diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java b/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java index 2f06be7..916388b 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/TransitUserRecordController.java @@ -57,10 +57,9 @@ public class TransitUserRecordController extends BaseController { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd"); QueryWrapper queryWrapper = new QueryWrapper<>(transitUserRecord); - LocalDate date = LocalDate.parse(transitUserRecord.getFirstTime(), formatter1); - LocalDate nextDay = date.plusDays(1); - String nextDayString = nextDay.format(formatter1); - queryWrapper.between("partition_field", transitUserRecord.getFirstTime(), nextDayString); + LocalDateTime now = LocalDateTime.now(); + LocalDateTime minusDay = now.minusDays(1); + queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now)); queryWrapper.orderByDesc("partition_field"); List list = transitUserRecordService.list(queryWrapper); return getDataTable(list); diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java b/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java index 4e2df38..c1f8fc4 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java @@ -55,10 +55,9 @@ public class TransitVehicleRecordController extends BaseController { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd"); QueryWrapper queryWrapper = new QueryWrapper<>(transitVehicleRecord); - LocalDate date = LocalDate.parse(transitVehicleRecord.getFirstTime(), formatter1); - LocalDate nextDay = date.plusDays(1); - String nextDayString = nextDay.format(formatter1); - queryWrapper.between("partition_field", transitVehicleRecord.getFirstTime(), nextDayString); + LocalDateTime now = LocalDateTime.now(); + LocalDateTime minusDay = now.minusDays(1); + queryWrapper.between("partition_field", formatter.format(minusDay), formatter.format(now)); queryWrapper.orderByDesc("partition_field"); List list = transitVehicleRecordService.list(queryWrapper); return getDataTable(list);