From 57d1f80bd3b1de02811fba3de591ce172ad7c641 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 14 一月 2025 16:00:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java | 25 ++++++++++++++++---------
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml | 2 +-
2 files changed, 17 insertions(+), 10 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..9ff2204 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.getAppUserId()));
+ 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);
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
index 9c18ce8..a2f2ff8 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
@@ -48,7 +48,7 @@
tsp.type,
tsp.create_time,
tsp.variable_point,
- tsp.order_num
+ tsp.order_num as orderNum
FROM
t_shop_point tsp
LEFT JOIN t_shop ts ON tsp.shop_id = ts.id
--
Gitblit v1.7.1