From e4860db370ded4db181e33946775e72fb5357580 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期六, 08 二月 2025 11:55:38 +0800 Subject: [PATCH] 修改门店首页统计bug --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index e16060f..0cc3986 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -209,7 +209,7 @@ @ApiOperation(value = "门店详情", tags = {"管理后台-门店管理"}) public R<Shop> getDetailById(@RequestParam("id") Integer id){ Shop shop = shopService.getById(id); - if (shop.getPid()==0){ + if (null != shop.getPid() && shop.getPid()==0){ shop.setPid(null); } return R.ok(shop); @@ -823,16 +823,23 @@ @GetMapping("/getShopStatistics") - public R<Map<String, BigDecimal> > getShopStatistics(){ - List<Shop> shopList = shopService.list(); + public R<Map<String, BigDecimal> > getShopStatistics(@RequestParam("shopId") Integer shopId){ + LambdaQueryWrapper<Shop> queryWrapper = new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1); + if(null != shopId){ + queryWrapper.eq(Shop::getId, shopId); + } + List<Shop> shopList = shopService.list(queryWrapper); BigDecimal serverGiveawayMoney = BigDecimal.ZERO; + BigDecimal giveawayMoney = BigDecimal.ZERO; BigDecimal lowerLevelGiveawayMoney = BigDecimal.ZERO; for (Shop shop : shopList) { serverGiveawayMoney = serverGiveawayMoney.add(shop.getServerGiveawayMoney()); + giveawayMoney = giveawayMoney.add(shop.getGiveawayMoney()); lowerLevelGiveawayMoney = lowerLevelGiveawayMoney.add(shop.getLowerLevelGiveawayMoney()); } Map<String, BigDecimal> map = new HashMap<>(); map.put("serverGiveawayMoney", serverGiveawayMoney); + map.put("giveawayMoney", giveawayMoney); map.put("lowerLevelGiveawayMoney", lowerLevelGiveawayMoney); return R.ok(map); } -- Gitblit v1.7.1