Administrator
2020-02-23 388be9f734f5b80c348bcc956726c206002e832a
fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java
@@ -40,6 +40,7 @@
import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
import com.yeshi.fanli.service.inter.redpack.RedPackForbidService;
import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService;
@@ -91,7 +92,10 @@
   @Resource
   private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
   @Transactional
   @Resource
   private RedPackForbidService redPackForbidService;
   @Transactional(rollbackFor = Exception.class)
   @Override
   public void addOrder(BanLiShopOrder order) throws BanLiShopOrderException {
      // 查询必要的参数是否添加
@@ -219,7 +223,7 @@
      banLiShopOrderMapper.updateByPrimaryKeySelective(order);
   }
   @Transactional
   @Transactional(rollbackFor = Exception.class)
   @Override
   public void payOrderByHongBao(Long orderId) throws BanLiShopOrderException, RedPackBalanceException {
      BanLiShopOrder order = banLiShopOrderMapper.selectByPrimaryKeyForUpdate(orderId);
@@ -324,6 +328,7 @@
      return banLiShopOrderMapper.selectByPrimaryKeyForUpdate(id);
   }
   @Transactional(rollbackFor = Exception.class)
   @Override
   public void invalidOrderByOrderId(Long id, String desc) {
      // 判断订单是否存在
@@ -342,8 +347,8 @@
               if (isS)// 支付成功,重新发送支付成功消息
               {
                  BanLiShopOrderMQMsg msg = new BanLiShopOrderMQMsg(order.getId(), order.getUid());
                  Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
                        OrderTopicTagEnum.banLiShopOrderPaid,msg);
                  Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
                        OrderTopicTagEnum.banLiShopOrderPaid, msg);
                  producer.send(message);
                  return;
               }
@@ -374,8 +379,8 @@
      if (order.getState() != BanLiShopOrder.STATE_PAID)
         throw new BanLiShopOrderException(1, "订单未处于待审核状态");
      Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.banLiShopOrderRefund,
         new BanLiShopOrderMQMsg(order.getId(), order.getUid()));
      Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.banLiShopOrderRefund,
            new BanLiShopOrderMQMsg(order.getId(), order.getUid()));
      try {
         orderTransactionProducer.send(message, new LocalTransactionExecuter() {
            @Override
@@ -435,13 +440,11 @@
         throw new BanLiShopOrderException(22, "商品已下线");
      }
      if (redPackForbidService.verifyForbid(uid))
         throw new BanLiShopOrderException(25, "红包功能已被封禁");
      if (pay.getHongBaoPrice() != null && pay.getHongBaoPrice().compareTo(new BigDecimal(0)) > 0) {
         BigDecimal money = null;
         try {
            money = redPackBalanceService.getBalance(uid);
         } catch (RedPackBalanceException e) {
            throw new BanLiShopOrderException(25, "红包功能异常");
         }
         BigDecimal money = redPackBalanceService.getBalance(uid);
         if (money.compareTo(pay.getHongBaoPrice()) < 0) {
            throw new BanLiShopOrderException(24, "红包余额不足");
         }