bug fix
This commit is contained in:
@@ -163,7 +163,6 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
// 交易失败 9
|
||||
BuyOrderEntity orderEntity = this.getOne(new QueryWrapper<BuyOrderEntity>().eq("user_id", userId)
|
||||
.eq("order_sn", orderSn));
|
||||
|
||||
if (type.equals("0")) {
|
||||
orderEntity.setOrderStatus("1");
|
||||
} else if (type.equals("9")) {
|
||||
|
||||
@@ -188,16 +188,9 @@ public class WeChatPayController {
|
||||
String orderNo = resourceMap.get("out_trade_no").toString();
|
||||
// 根据订单号,做幂等处理,并且在对业务数据进行状态检查和处理之前,要采用数据锁进行并发控制,以避免函数重入造成的数据混乱
|
||||
BuyOrderEntity order = this.buyOrderService.getOne(new QueryWrapper<BuyOrderEntity>().eq("order_sn", orderNo));
|
||||
PayWechatOrderEntity wechatEntity;
|
||||
if (!ObjectUtils.isEmpty(order)) {
|
||||
wechatEntity = this.payWechatOrderService.getOne(new QueryWrapper<PayWechatOrderEntity>().eq("order_sn", order.getOrderSn()));
|
||||
} else {
|
||||
log.error("无效订单!");
|
||||
return R.error(500, "无效订单!");
|
||||
}
|
||||
// 1.根据订单id获取订单信息
|
||||
if ("order".equals(order.getOrderType())) {
|
||||
BuyOrderEntity orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>().eq("order_sn", wechatEntity.getOrderSn()));
|
||||
BuyOrderEntity orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>().eq("order_sn", orderNo));
|
||||
BigDecimal realMoney = orderEntity.getRealMoney();
|
||||
// 查询订单的所有 book_id
|
||||
List<Integer> orderBookIdList = shopProudictBookService.getOrderBookId(order.getOrderSn());
|
||||
@@ -217,10 +210,8 @@ public class WeChatPayController {
|
||||
entity.setBookId(bookId);
|
||||
userEbookBuyEntities.add(entity);
|
||||
}
|
||||
boolean b = userEbookBuyService.saveBatch(userEbookBuyEntities);
|
||||
if (wechatEntity.getTotalAmount().compareTo(realMoney) == 0) {
|
||||
buyOrderService.updateOrderStatus(order.getUserId(), order.getOrderSn(), "0");
|
||||
}
|
||||
userEbookBuyService.saveBatch(userEbookBuyEntities);
|
||||
buyOrderService.updateOrderStatus(order.getUserId(), order.getOrderSn(), "0");
|
||||
}
|
||||
if ("point".equals(order.getOrderType())) {
|
||||
PayWechatOrderEntity buy_order_id = payWechatOrderService.getBaseMapper().selectOne(new QueryWrapper<PayWechatOrderEntity>().eq("order_sn", order.getOrderSn()));
|
||||
|
||||
Reference in New Issue
Block a user