From a738f7d328e037abe189c14c94d7ef835bf8296c Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 12 九月 2024 09:27:46 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 027dfc6..aec8295 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -190,6 +190,7 @@ //检查当前用户积分是否够 Long userId = tokenService.getLoginUserApplet().getUserId(); Integer point = 0; + TAppUser user = appUserClient.getUserById(userId).getData(); if (exchangeDto.getGoodType()==1) { //查询当前商品信息 @@ -200,7 +201,6 @@ if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) { return AjaxResult.error("当前用户已兑换"+count+"张"); } - TAppUser user = appUserClient.getUserById(userId).getData(); if (user.getPoints()<good.getRedeemPoints()){ return AjaxResult.error("当前用户积分不足"); } @@ -211,6 +211,9 @@ Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); + } + if (user.getPoints()<point){ + return AjaxResult.error("当前用户积分不足"); } } exchangeDto.setPoint(point); @@ -224,6 +227,7 @@ grantCouponDto.setCouponId(exchangeDto.getGoodId()); grantCouponDto.setWaysToObtain(1); grantCouponDto.setEndTime(LocalDateTime.now()); + grantCouponDto.setType(3); appCouponClient.grantCoupon(grantCouponDto); } //生成消耗积分的记录 -- Gitblit v1.7.1