From ea1a62ba6484d6c6cb1ca67dcea938a95ba18fc6 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 26 五月 2025 18:26:26 +0800 Subject: [PATCH] 新增加用户端接口 --- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java index 2d4ade6..bba0315 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java @@ -17,7 +17,6 @@ import com.google.common.collect.Lists; import com.google.gson.Gson; import com.ruoyi.common.core.constant.CacheConstants; -import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.enums.UserStatus; import com.ruoyi.common.core.exception.ServiceException; @@ -29,6 +28,8 @@ import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.utils.CodeFactoryUtil; import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.goods.api.domain.LotteryEvent; +import com.ruoyi.goods.api.service.LotteryEventClient; import com.ruoyi.order.config.WxPayConfiguration; import com.ruoyi.order.domain.dto.*; import com.ruoyi.order.domain.pojo.account.OrderPayment; @@ -72,7 +73,6 @@ import lombok.extern.log4j.Log4j2; import org.redisson.api.RLock; import org.redisson.api.RedissonClient; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -80,7 +80,6 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; -import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -154,18 +153,20 @@ @Resource private OrderPaymentService orderPaymentService; - + @Resource private ProfitSharingService profitSharingService; - + @Resource private OrderRefundService orderRefundService; - + @Value("${wx.pay.callbackPath}") private String callbackPath; - - + @Resource + private LotteryEventClient lotteryEventClient; + + /** * @description: buyGoods * @param: appSureOrderDto @@ -1544,6 +1545,13 @@ appPlaceOrderVo.setPaySign(payArr[5]); appPlaceOrderVo.setPrepayId(orderPayment.getPrepayId()); // 返回AppPlaceOrderVo对象 + List<LotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData(); + if (data.size() > 0) { + long count = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) >= 0).count(); + appPlaceOrderVo.setLotteryDraw(count > 0); + } else { + appPlaceOrderVo.setLotteryDraw(false); + } return appPlaceOrderVo; } @@ -2670,8 +2678,12 @@ goodsRealPrice = goodsTotalPrice; //优惠券计算 if (memberCouponId != null) { - appMemberCouponVo = appMemberCouponVoMap.get(memberCouponId); + log.info("使用优惠券:{}", memberCouponId); + appMemberCouponVo = appMemberCouponVoMap.get(memberCouponId.toString()); + log.info("匹配的优惠券:{}", JSON.toJSONString(appMemberCouponVo)); if (null != appMemberCouponVo && (StringUtils.isBlank(appMemberCouponVo.getRelGoodsIds()) || appMemberCouponVo.getRelGoodsIds().contains(goodsId))) { + log.info("可以使用优惠券:{}", JSON.toJSONString(appMemberCouponVo)); + couponType = appMemberCouponVo.getCouponType(); couponType = appMemberCouponVo.getCouponType(); if (couponType == 1 && appMemberCouponVo.getMoneyThreshold() != null && appMemberCouponVo.getDiscountMoney() != null) { moneyThreshold = appMemberCouponVo.getMoneyThreshold(); @@ -2841,6 +2853,7 @@ consumerGoodsService.saveBatchConsumerGoods(consumerGoodsList); //减去优惠券 if (StringUtils.isNotBlank(memberCouponSJ.toString())) { + log.info("修改优惠券使用状态:{}", JSON.toJSONString(memberCouponSJ)); remoteCouponService.useMemberCoupon(memberCouponSJ.toString()); } //更新会员消费记录 -- Gitblit v1.7.1