Authored by Lixiaodi

防止多次加帐

@@ -273,6 +273,10 @@ public class PaymentServiceImpl implements IPaymentService { @@ -273,6 +273,10 @@ public class PaymentServiceImpl implements IPaymentService {
273 273
274 // 更新订单状态[已支付] 274 // 更新订单状态[已支付]
275 int num = abstractOrderService.updateOrderStatusPaid(orderInfo); 275 int num = abstractOrderService.updateOrderStatusPaid(orderInfo);
  276 + if (num == 0) {
  277 + logger.warn("paySuccess finished. status has paid, orderCode is {}", orderCode);
  278 + return;
  279 + }
276 280
277 // 记录支付成功记录 281 // 记录支付成功记录
278 OrdersPay ordersPay = new OrdersPay(); 282 OrdersPay ordersPay = new OrdersPay();
@@ -313,10 +317,8 @@ public class PaymentServiceImpl implements IPaymentService { @@ -313,10 +317,8 @@ public class PaymentServiceImpl implements IPaymentService {
313 addPayEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, recordPayment, 317 addPayEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, recordPayment,
314 ordersPay.getAmount()); 318 ordersPay.getAmount());
315 } else if (codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()) { 319 } else if (codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()) {
316 - if (num > 0) { // 防止并发回调和 主动查询结果。做幂等  
317 - addPayEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, recordPayment,  
318 - ordersPay.getAmount());  
319 - } 320 + addPayEnsureRecord(orderInfo.getUid(), orderInfo.getSkup(), orderCode, recordPayment,
  321 + ordersPay.getAmount());
320 } 322 }
321 logger.info("paySuccess finished. orderCode is {}", orderCode); 323 logger.info("paySuccess finished. orderCode is {}", orderCode);
322 abstractOrderService.processAfterPay(orderInfo); 324 abstractOrderService.processAfterPay(orderInfo);