From 660682627325b09fa9c1032e1a14c56c066fe0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E4=B8=8B?= <484014559@qq.com> Date: Wed, 28 Aug 2024 11:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=8E=A5=E5=8F=A3=E6=94=B9?= =?UTF-8?q?=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacenter/controller/app/saledata/SaleDataApi.java | 9 +++++++++ .../controller/app/saledata/vo/SaleDataItemTypeVo.java | 2 +- .../dal/mongodb/saledata/SaleDataRepository.java | 2 +- .../datacenter/service/saledata/SaleDataServiceImpl.java | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/SaleDataApi.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/SaleDataApi.java index 1c1a0da7b..a92c8362e 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/SaleDataApi.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/SaleDataApi.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.datacenter.controller.app.saledata; import cn.iocoder.yudao.module.datacenter.service.saledata.SaleDataService; +import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.validation.annotation.Validated; @@ -26,6 +27,8 @@ import java.util.regex.Pattern; public class SaleDataApi { @Resource private SaleDataService saleDataService; +// @Resource +// private WebSocketSenderApi webSocketSenderApi; @GetMapping() @Operation(summary = "获得输入日期的当天总售票数") @@ -138,4 +141,10 @@ public class SaleDataApi { return saleDataService.findyearJun(saleDataService.findEventsLastYear()); } +// @GetMapping("/test") +// public void testMethod(){ +// +// webSocketSenderApi.sendObject("1","1","666"); +// } + } diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/vo/SaleDataItemTypeVo.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/vo/SaleDataItemTypeVo.java index aa1e904b5..b62c1de75 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/vo/SaleDataItemTypeVo.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/saledata/vo/SaleDataItemTypeVo.java @@ -5,5 +5,5 @@ import lombok.Data; @Data public class SaleDataItemTypeVo { // private String itemtype; - private String itemtypename; + private String itemname; } diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java index fdbb93904..0c5abd27b 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java @@ -58,7 +58,7 @@ public interface SaleDataRepository extends MongoRepository { @Query(value = "{}", fields = "{ 'itemtypename': 1 }") List findAllByItemtypename(); - @Query(value = "{'sddate': { $gte: ?0, $lt: ?1 }}", fields = "{ 'itemtypename': 1 }") + @Query(value = "{'sddate': { $gte: ?0, $lt: ?1 }}", fields = "{ 'itemname': 1 }") List findAllByItemtypenameTime(String starTime, String endTime); @Query(value = "{'sddate': { $gte: ?0, $lt: ?1 }}", fields = "{ 'transactiontypeno': 1 }") diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java index 2c3796e55..bb0dfdd87 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java @@ -256,7 +256,7 @@ public class SaleDataServiceImpl implements SaleDataService { public List> findByDoItemType(String starTime, String endTime) { List list = saleDataRepository.findAllByItemtypenameTime(starTime, this.publicMethod(endTime)); Map countMap = list.stream() - .collect(Collectors.groupingBy(SaleDataItemTypeVo::getItemtypename, Collectors.counting())); + .collect(Collectors.groupingBy(SaleDataItemTypeVo::getItemname, Collectors.counting())); List> mapArrayList = new ArrayList<>(); for (String s : countMap.keySet()) { Map map = new HashMap<>();