| | |
| | | public UserPointVO getUserPoint(Long userId) { |
| | | AppUser appUser = appUserService.getById(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; |
| | | } |
| | | |
| | |
| | | if (vipSetting == null) { |
| | | throw new ServiceException("VIP 设置未找到"); |
| | | } |
| | | if (vipSetting.getVipGiftRole() == 0) { |
| | | if (vipSetting.getId() == 0 && vipSetting.getVipGiftRole() == 0) { |
| | | throw new ServiceException("转赠积分权限未开启"); |
| | | } |
| | | |