From e2da11b0a91d989cb7fb5d1be55a563907237cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E4=B8=8B?= <484014559@qq.com> Date: Thu, 29 Aug 2024 14:14:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=8E=A5=E5=8F=A3=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E9=80=9F=E7=8E=87=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/dataobject/checkticket/CheckTicket.java | 4 ++-- .../dal/mongodb/checkticket/CheckTicketRepository.java | 6 +++--- .../service/checkticket/CheckTicketServiceImpl.java | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java index 5ed2ca101..45b94eb3e 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.datacenter.dal.dataobject.checkticket; import lombok.Data; import org.springframework.data.mongodb.core.mapping.Document; -//@Document("checkticket") -@Document("check_ticket_today") +@Document("checkticket") +//@Document("check_ticket_today") //@Document("checktickettest") @Data public class CheckTicket { diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java index 08b94120d..c9af61478 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java @@ -20,8 +20,8 @@ public interface CheckTicketRepository extends MongoRepository findByTimestampBetweenAndCheckticketdate(String startTime, String endTime,String day); - List findByCheckticketdateAndChecktickettimeBetween(String day,String startTime, String endTime); + Long countByCheckticketdateAndChecktickettimeBetween(String day,String startTime, String endTime); - @Query("{'checkticketdate':{'$gte': ?0, '$lt': ?1} , 'checktickettime':{'$gte': ?2, '$lt': ?3}}") - List findByCheckticketdateBetweenAndChecktickettimeBetween(String startTime, String endTime,String beingTime, String resultTime); +// @Query("{'checkticketdate':{'$gte': ?0, '$lt': ?1} , 'checktickettime':{'$gte': ?2, '$lt': ?3}}") + Long countByCheckticketdateBetweenAndChecktickettimeBetween(String startTime, String endTime,String beingTime, String resultTime); } diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java index 4edb574d2..82695d4a1 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java @@ -41,14 +41,14 @@ public class CheckTicketServiceImpl implements CheckTicketService { LocalDateTime hourEndTime = hourStartTime.plusHours(1); String begintime = formatter.format(hourStartTime); String resulttime = formatter.format(hourEndTime); - List checkTickets; + Long checkTickets; if (starTime != null && endTime != null && starTime.equals(endTime)){ - checkTickets = checkTicketRepository.findByCheckticketdateAndChecktickettimeBetween(starTime,begintime,resulttime); + checkTickets = checkTicketRepository.countByCheckticketdateAndChecktickettimeBetween(starTime,begintime,resulttime); }else { - checkTickets = checkTicketRepository.findByCheckticketdateBetweenAndChecktickettimeBetween(starTime,endTime,begintime,resulttime); + checkTickets = checkTicketRepository.countByCheckticketdateBetweenAndChecktickettimeBetween(starTime,endTime,begintime,resulttime); } map.put("date",begintime+"-"+resulttime); - map.put("count", String.valueOf(checkTickets.stream().count())); + map.put("count", String.valueOf(checkTickets)); mapList.add(map); }