| | |
| | | import com.ruoyi.study.api.domain.TUser; |
| | | import com.ruoyi.study.api.feignClient.StudyClient; |
| | | import com.ruoyi.study.api.vo.UserPersonalCenterVO; |
| | | import com.ruoyi.system.api.model.LoginUserParent; |
| | | import org.redisson.api.RSemaphore; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | if (null == good) { |
| | | return R.exchangeError("商品不存在,请稍后重试!"); |
| | | } |
| | | LoginUserParent loginUser1 = tokenService.getLoginUser1(); |
| | | if (null == loginUser1){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | // 校验用户积分是否足够兑换 |
| | | UserPersonalCenterVO userPersonalCenter = studyClient.userInfo().getData(); |
| | | if (null == userPersonalCenter) { |
| | | TUser user = studyClient.userInfoParent().getData(); |
| | | if (null == user) { |
| | | throw new GlobalException("用户信息获取失败!"); |
| | | } |
| | | TUser user = userPersonalCenter.getUser(); |
| | | int needIntegral = good.getIntegral() * number; |
| | | if (user.getIntegral() < needIntegral) { |
| | | return R.exchangeError("兑换失败,当前剩余积分不足!"); |