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<>();