From 744594ef1a2f530fc3e86ea9dc48b62247f79420 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 19 五月 2020 17:13:23 +0800 Subject: [PATCH] 饿了么绘图,添加口碑 --- fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java index 614fb40..f4ba043 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java +++ b/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, "绾㈠寘浣欓涓嶈冻"); } -- Gitblit v1.8.0