| | |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | public class UserPointServiceImpl extends ServiceImpl<UserPointMapper, UserPoint> implements UserPointService { |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private RemoteVipSettingClient remoteVipSettingClient; |
| | | |
| | | @Override |
| | | public UserPointVO getUserPoint(Long userId) { |
| | |
| | | Map<Integer, Integer> userBalanceMap = userPointList.stream() |
| | | .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance)); |
| | | |
| | | R<VipSetting> r = remoteVipSettingClient.getVipSettingById(appUser.getVipId()); |
| | | if (!R.isSuccess(r)){ |
| | | throw new RuntimeException("会员等级获取失败"); |
| | | } |
| | | |
| | | Integer lavePoint = appUser.getLavePoint(); |
| | | UserPointVO userPointVO = new UserPointVO(); |
| | | userPointVO.setTotalPoint(lavePoint); |
| | |
| | | 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(r.getData().getVipGiftRole()); |
| | | return userPointVO; |
| | | } |
| | | |