From 6b3aba3c9000a7bd77f10b3007702347f8c1d401 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 15 一月 2025 09:29:06 +0800
Subject: [PATCH] 修改bug
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
index 883a4c3..d0ebce5 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
@@ -1,13 +1,16 @@
package com.ruoyi.other.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopPoint;
import com.ruoyi.other.api.enums.PointChangeType;
import com.ruoyi.other.mapper.ShopPointMapper;
import com.ruoyi.other.service.ShopPointService;
+import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.vo.ShopPointStatistics;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
@@ -37,6 +40,8 @@
private TokenService tokenService;
@Resource
private SysUserClient sysUserClient;
+ @Resource
+ private ShopService shopService;
@@ -45,17 +50,19 @@
public ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint) {
Long userid = tokenService.getLoginUser().getUserid();
SysUser sysUser = sysUserClient.getSysUser(userid).getData();
- List<ShopPoint> shopPoints = this.baseMapper.selectShopPointList(shopPoint);
- Map<Integer, Integer> shopPointMap = shopPoints.stream()
- .collect(Collectors.groupingBy(
- ShopPoint::getType,
- Collectors.summingInt(ShopPoint::getVariablePoint)
- ));
+
+ List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>()
+ .eq(Shop::getAppUserId,sysUser.getObjectId()));
+ Integer sPoint = 0;
+ Integer shopCommissionPoint = 0;
+ Integer subShopCommissionPoint = 0;
+ for (Shop shop : shopList) {
+ sPoint += shop.getServerPoint();
+ shopCommissionPoint += shop.getSharePoint();
+ subShopCommissionPoint += shop.getLowerLevelSharePoint();
+ }
ShopPointStatistics shopPointStatistics = new ShopPointStatistics();
- int sPoint = shopPointMap.getOrDefault(PointChangeType.SHOP_ACHIEVEMENT.getCode(), 0);
- int shopCommissionPoint = shopPointMap.getOrDefault(PointChangeType.SHOP_REBATE.getCode(), 0);
- int subShopCommissionPoint = shopPointMap.getOrDefault(PointChangeType.JUNIOR_SHOP_REBATE.getCode(), 0);
shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint);
shopPointStatistics.setShopPoint(sPoint);
shopPointStatistics.setShopCommissionPoint(shopCommissionPoint);
--
Gitblit v1.7.1