From 866f686c3c4ae1bd47affe146a26db5dd1ceb032 Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期三, 18 十二月 2024 14:57:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java |   40 ++++++++++------------------------------
 1 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
index c4da661..9b7ded5 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -2,6 +2,8 @@
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.account.api.model.UserPoint;
@@ -16,6 +18,7 @@
 import com.ruoyi.account.vo.UserPointVO;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.PhoneNumberValidator;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.other.api.domain.PointSetting;
 import com.ruoyi.other.api.domain.VipSetting;
@@ -23,14 +26,12 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -162,33 +163,12 @@
 
     @Override
     public UserPointStatistics getStatistics(UserPoint userPoint) {
-        LoginUser loginUser = tokenService.getLoginUser();
-        userPoint.setAppUserId(loginUser.getUserid());
-        List<UserPoint> userPointList =  userPointMapper.findLatestChangeByType(userPoint);
-        Map<Integer, Integer> userBalanceMap = userPointList.stream()
-                .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance));
-
-        Integer consumePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.CONSUME.getCode())).orElse(0);
-        Integer sharePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.COMMISSION_RETURN.getCode())).orElse(0);
-        Integer pullNewPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.NEW_USER_REFERRAL.getCode())).orElse(0);
-        Integer registerPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.REGISTRATION.getCode())).orElse(0);
-        Integer workPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.WORK_PERFORMANCE.getCode())).orElse(0);
-        Integer shopAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TECHNICIAN_PERFORMANCE.getCode())).orElse(0);
-        Integer exchangeGoodsPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.EXCHANGE_GOODS.getCode())).orElse(0);
-        Integer storeAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_PERFORMANCE.getCode())).orElse(0);
-        Integer storeCommissionPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_COMMISSION_RETURN.getCode())).orElse(0);
-        Integer transferPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TRANSFER_POINTS.getCode())).orElse(0);
-        Integer totalPoint = consumePoint + sharePoint + pullNewPoint + registerPoint + workPoint + shopAchievementPoint + exchangeGoodsPoint + storeAchievementPoint + storeCommissionPoint + transferPoint;
+        return null;
+    }
 
 
-        UserPointStatistics userPointStatistics = new UserPointStatistics();
-        userPointStatistics.setTotalPoint(totalPoint);
-        userPointStatistics.setConsumePoint(consumePoint);
-        userPointStatistics.setSharePoint(sharePoint);
-        userPointStatistics.setPullNewPoint(pullNewPoint);
-        userPointStatistics.setRegisterPoint(registerPoint);
-        userPointStatistics.setWorkPoint(workPoint);
-        userPointStatistics.setShopAchievementPoint(shopAchievementPoint);
-        return userPointStatistics;
+    @Override
+    public IPage<UserPoint> getUserPointPage(Page<UserPoint> page, UserPoint userPoint) {
+        return this.baseMapper.queryUserPointPage(page, userPoint);
     }
 }

--
Gitblit v1.7.1