From 0f9d91bacff24cb14d5d86ec3de0598a13f4152c Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 27 十二月 2024 11:50:37 +0800 Subject: [PATCH] 修改会员等级变更 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java | 43 +------------------------------------------ 1 files changed, 1 insertions(+), 42 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 71267e7..edacfef 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 @@ -21,7 +21,6 @@ import com.ruoyi.other.api.domain.PointSetting; import com.ruoyi.other.api.domain.VipSetting; import com.ruoyi.other.api.enums.PointChangeType; -import com.ruoyi.other.api.feignClient.ShopClient; import com.ruoyi.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -54,8 +53,6 @@ private VipSettingService vipSettingService; @Resource private PointSettingService pointSettingService; - @Resource - private ShopClient shopClient; @Override public UserPointVO getUserPoint(Long userId) { @@ -121,7 +118,7 @@ throw new ServiceException("积分设置未找到"); } // 可转赠积分总数 - long adjustedPoint = getAdjustedPoint(pointSetting, appUser); + long adjustedPoint = appUser.getAvailablePoint(); if (point.compareTo(new BigDecimal(adjustedPoint)) > 0) { throw new ServiceException("转赠积分不足"); @@ -144,44 +141,6 @@ appUserService.updateById(appUser); log.info("积分转赠完成,用户ID: {}, 新积分: {}", appUserForPhoe.getId(), appUserForPhoe.getLavePoint()); } - - /** - * 获取可转赠积分 - * @param pointSetting 积分设置 - * @param appUser 用户 - * @return - */ - private long getAdjustedPoint(PointSetting pointSetting, AppUser appUser) { - if (pointSetting == null || appUser == null) { - throw new ServiceException("pointSetting和appUser不能为空"); - } - - long transferPoint = 0; - - transferPoint += calculatePoint(pointSetting.getBuyPointGift(), appUser.getShopPoint(), pointSetting.getBuyPoint()); - transferPoint += calculatePoint(pointSetting.getSharePointGift(), appUser.getSharePoint(), pointSetting.getSharePoint()); - transferPoint += calculatePoint(pointSetting.getShopSharePointGift(), appUser.getShopSharePoint(), pointSetting.getShopSharePoint()); - transferPoint += calculatePoint(pointSetting.getShopPointGift(), appUser.getShopAchievementPoint(), pointSetting.getShopPoint()); - transferPoint += calculatePoint(pointSetting.getPersonPointGift(), appUser.getTotalPerformancePoint(), pointSetting.getPersonPoint()); - transferPoint += calculatePoint(pointSetting.getGetNewPointGift(), appUser.getTotalInvitePoint(), pointSetting.getGetNewPoint()); - transferPoint += calculatePoint(pointSetting.getGetRegisPointGift(), appUser.getTotalRegisterPoint(), pointSetting.getRegisPoint()); - transferPoint += calculatePoint(pointSetting.getWorkPointGift(), appUser.getTotalSharePoint() + appUser.getTotalSignPoint() + appUser.getTotalHourPoint(), pointSetting.getWorkPoint()); - - return transferPoint; - } - - private long calculatePoint(Integer settingValue, double userValue, double pointValue) { - if (settingValue == 1) { - try { - double result = userValue * (pointValue / 100.0); - return Math.round(result); - } catch (ArithmeticException e) { - return 0; - } - } - return 0; - } - @Override -- Gitblit v1.7.1