luodangjia
2024-12-16 a8d2cb07f6440dc54dc4005b0b06d5a47cb1517d
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -55,23 +55,20 @@
    @Override
    public UserPointVO getUserPoint(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        List<UserPoint> userPointList = list(new LambdaQueryWrapper<UserPoint>()
                .eq(UserPoint::getAppUserId, userId));
        List<UserPoint> userPointList = this.baseMapper.findLatestUserPointByTypeForUser(userId);
        Map<Integer, Integer> userBalanceMap = userPointList.stream()
                .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance));
        VipSetting vipSetting = vipSettingService.getVipSettingByUserId(userId);
        Integer lavePoint = appUser.getLavePoint();
        UserPointVO userPointVO = new UserPointVO();
        userPointVO.setTotalPoint(lavePoint);
//        userPointVO.setConsumePoint(lavePoint);
        userPointVO.setShopPoint(userBalanceMap.get(PointChangeType.CONSUME.getCode()));
        userPointVO.setSharePoint(userBalanceMap.get(PointChangeType.COMMISSION_RETURN.getCode()));
        userPointVO.setTotalPoint(appUser.getTotalPoint());
        userPointVO.setConsumePoint(appUser.getLavePoint());
        userPointVO.setShopPoint(appUser.getShopPoint());
        userPointVO.setSharePoint(appUser.getSharePoint());
        userPointVO.setPullNewPoint(userBalanceMap.get(PointChangeType.NEW_USER_REFERRAL.getCode()));
        userPointVO.setShopAchievementPoint(userBalanceMap.get(PointChangeType.STORE_PERFORMANCE.getCode()));
        userPointVO.setShopSharePoint(userBalanceMap.get(PointChangeType.STORE_COMMISSION_RETURN.getCode()));
        userPointVO.setGiftPoint(vipSetting.getVipGiftRole());
        userPointVO.setGiftPoint(vipSetting.getVipGiftRole() == 1 && vipSetting.getId() == 1 ? 1 : 0);
        return userPointVO;
    }
@@ -108,7 +105,7 @@
        if (vipSetting == null) {
            throw new ServiceException("VIP 设置未找到");
        }
        if (vipSetting.getVipGiftRole() == 0) {
        if (vipSetting.getId() == 0 && vipSetting.getVipGiftRole() == 0) {
            throw new ServiceException("转赠积分权限未开启");
        }
@@ -149,6 +146,7 @@
        }
        appUserForPhoe.setLavePoint(appUserForPhoe.getLavePoint() + point.intValue());
        appUserForPhoe.setTotalPoint(appUserForPhoe.getTotalPoint() + point.intValue());
        appUserService.updateById(appUserForPhoe);
        log.info("积分转赠完成,用户ID: {}, 新积分: {}", appUserForPhoe.getId(), appUserForPhoe.getLavePoint());