|
|
@@ -52,6 +52,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
+import java.util.concurrent.Executor;
|
|
|
|
|
|
/**
|
|
|
* 钱包支付信息
|
|
|
@@ -219,7 +221,6 @@ public class WalletMainService extends SuperPayService {
|
|
|
.walletType(WalletType.Shop)
|
|
|
.userId(rechargeRecord.getUserId())
|
|
|
.shopId(rechargeRecord.getShopId()).build();
|
|
|
-
|
|
|
Wallet shopWallet = findWallet(shopQuery);
|
|
|
shopWallet.setAmount(shopWallet.getAmount().add(total));
|
|
|
shopWallet.setTotalAmount(shopWallet.getTotalAmount().add(total));
|
|
|
@@ -253,17 +254,20 @@ public class WalletMainService extends SuperPayService {
|
|
|
|
|
|
//----------------------------渠道的方法 start-----------------------
|
|
|
|
|
|
- private WalletFlow createWalletFlow(String walletId, BigDecimal total, String outTradeNo, TradeType type, Object attach, String schoolId) {
|
|
|
- WalletFlow walletFlow = new WalletFlow();
|
|
|
- Wallet wallet = new Wallet();
|
|
|
- wallet.setId(walletId);
|
|
|
- walletFlow.setWallet(wallet);
|
|
|
- walletFlow.setTotal(total);
|
|
|
- walletFlow.setOutTradeNo(outTradeNo);
|
|
|
- walletFlow.setTradeType(type);
|
|
|
- walletFlow.setAttach(attach);
|
|
|
- walletFlow.setSchoolId(schoolId);
|
|
|
- return walletFlowDao.save(walletFlow);
|
|
|
+ // 记录流水
|
|
|
+ private void createWalletFlow(String walletId, BigDecimal total, String outTradeNo, TradeType type, Object attach, String schoolId) {
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ WalletFlow walletFlow = new WalletFlow();
|
|
|
+ Wallet wallet = new Wallet();
|
|
|
+ wallet.setId(walletId);
|
|
|
+ walletFlow.setWallet(wallet);
|
|
|
+ walletFlow.setTotal(total);
|
|
|
+ walletFlow.setOutTradeNo(outTradeNo);
|
|
|
+ walletFlow.setTradeType(type);
|
|
|
+ walletFlow.setAttach(attach);
|
|
|
+ walletFlow.setSchoolId(schoolId);
|
|
|
+ walletFlowDao.save(walletFlow);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@NotNull
|