From 25c40344055ff5f688df2f5b566ef3eb8bf73709 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期六, 09 十一月 2024 20:56:49 +0800
Subject: [PATCH] 1.我的订单-打印:修改成支付时间查询
---
src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java
index 45291a2..161cc3e 100644
--- a/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java
@@ -5,6 +5,7 @@
import com.mzl.flower.constant.LockConstants;
import com.mzl.flower.dto.request.wallet.QueryWalletAmountDTO;
import com.mzl.flower.dto.response.supplier.SupplierDTO;
+import com.mzl.flower.entity.supplier.Supplier;
import com.mzl.flower.entity.wallet.WalletDO;
import com.mzl.flower.enums.TrueOrFalseEnum;
import com.mzl.flower.mapper.wallet.WalletMapper;
@@ -17,6 +18,7 @@
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
@@ -76,6 +78,8 @@
@Override
public WalletDO getOrCreateBySupplierId(Long supplierId) {
+
+
WalletDO walletDO=getBySupplierId(supplierId);
if(null==walletDO){
RLock lock = redissonClient.getLock(String.format(LockConstants.WALLET_SUPPLIER_ID_KEY, supplierId));
@@ -84,9 +88,12 @@
try {
walletDO=getBySupplierId(supplierId);
if(null!=walletDO) return walletDO;
+
+ final Supplier supplier = supplierService.getSupplierById(supplierId);
+
// 创建一个钱包
walletDO =new WalletDO();
- walletDO.setUserId(SecurityUtils.getUserId());
+ walletDO.setUserId(supplier.getUserId());
walletDO.setSupplierId(supplierId);
walletDO.setTotalAmount(BigDecimal.ZERO);
walletDO.setWithdrawableAmount(BigDecimal.ZERO);
@@ -96,7 +103,7 @@
walletDO.setSettlingAmount(BigDecimal.ZERO);
walletDO.setTotalDeduction(BigDecimal.ZERO);
walletDO.setTotalTransactionAmount(BigDecimal.ZERO);
- walletDO.setSettlingAmount(BigDecimal.ZERO);
+ walletDO.setSettledAmount(BigDecimal.ZERO);
walletDO.create(SecurityUtils.getUserId());
baseMapper.insert(walletDO);
// 将再次查询的结果返回
@@ -130,7 +137,10 @@
@Override
public BigDecimal getWaittingSettlementAmount(WalletDO walletDO) {
-
+ if(null!=walletDO && !StringUtils.isEmpty(walletDO.getSupplierId()) && StringUtils.isEmpty(walletDO.getUserId())){
+ final Supplier supplier = supplierService.getSupplierById(walletDO.getSupplierId());
+ walletDO.setUserId(supplier.getUserId());
+ }
return baseMapper.getWaittingSettlementAmount(walletDO);
}
@@ -161,8 +171,12 @@
BigDecimal saleDeduceAmount = walletReduceService.getSaleReduceAmount(queryWalletAmountDTO);
saleDeduceAmount = saleDeduceAmount != null ? saleDeduceAmount : BigDecimal.ZERO;
+ // 集货站运费
+ BigDecimal stationFeeAmount = walletReduceService.getStationFeeAmount(queryWalletAmountDTO);
+ stationFeeAmount = stationFeeAmount != null ? stationFeeAmount : BigDecimal.ZERO;
+
// 总扣款
- BigDecimal deduceAmount = checkDeduceAmount.add(saleDeduceAmount);
+ BigDecimal deduceAmount = checkDeduceAmount.add(saleDeduceAmount).add(stationFeeAmount);
return deduceAmount;
}
--
Gitblit v1.9.3