cloudroam
2024-10-24 d19b094bde681e2a261ff28a088dd969b68ac65c
src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
@@ -23,6 +23,7 @@
import com.mzl.flower.mapper.supplier.SupplierMapper;
import com.mzl.flower.mapper.system.UserWechatMapper;
import com.mzl.flower.mapper.wallet.WalletBillRecordMapper;
import com.mzl.flower.mapper.wallet.WalletMapper;
import com.mzl.flower.mapper.wallet.WalletWithdrawRecordMapper;
import com.mzl.flower.service.payment.UserPaymentV3Service;
import com.mzl.flower.service.supplier.SupplierService;
@@ -38,6 +39,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
@@ -72,6 +74,8 @@
    private final WalletBillRecordMapper walletBillRecordMapper;
    private final WalletBillRecordService walletBillRecordService;
    private final WalletMapper walletMapper;
    @Autowired
@@ -246,6 +250,19 @@
            walletBillRecordMapper.insert(walletBillRecordDO);
            //不需要更新结算单了,此时提现的金额和计算单上的金额不一致
        }
        if (Constants.WALLET_APPROVE_STATE.REJECT.name().equals(walletWithdrawRecordDTO.getApproveState())) {
            //更新钱包
            Supplier s = supplierMapper.selectById(withdrawRecordDO.getSupplierId());
            WalletDO walletDO = walletService.getBySupplierId(s.getId());
            if(!ObjectUtils.isEmpty(walletDO)){
                //提现中金额:审核失败体现中金额扣减
                walletDO.setWithdrawingAmount(walletDO.getWithdrawingAmount().subtract(withdrawRecordDO.getAmount()));
                //可提现金额:审核失败可提现金额增加
                walletDO.setWithdrawableAmount(walletDO.getWithdrawableAmount().add(withdrawRecordDO.getAmount()));
                walletMapper.updateById(walletDO);
            }
        }
    }
    public String format(LocalDateTime dateTime, String format) {
        if (dateTime == null || format == null) {