| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @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 |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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(); |
| | |
| | | consumerGoodsService.saveBatchConsumerGoods(consumerGoodsList); |
| | | //减去优惠券 |
| | | if (StringUtils.isNotBlank(memberCouponSJ.toString())) { |
| | | log.info("修改优惠券使用状态:{}", JSON.toJSONString(memberCouponSJ)); |
| | | remoteCouponService.useMemberCoupon(memberCouponSJ.toString()); |
| | | } |
| | | //更新会员消费记录 |