update 可提现金额,减去当天申请金额

This commit is contained in:
Guoqs
2025-11-18 13:33:26 +08:00
parent 277fad8918
commit e778d34941
13 changed files with 2077 additions and 36 deletions

View File

@@ -678,8 +678,8 @@ public class AdapayService {
// if (CollectionUtils.isNotEmpty(withdrawInfoVOS)) {
// totalWithdraw = withdrawInfoVOS.stream().map(WithdrawInfoVO::getCashAmt).reduce(BigDecimal.ZERO, BigDecimal::add);
// }
BigDecimal totalWithdraw = clearingWithdrawInfoService.queryTotalWithdraw(merchantId);
vo.setTotalWithdraw(totalWithdraw);
// BigDecimal totalWithdraw = clearingWithdrawInfoService.queryTotalWithdraw(merchantId);
vo.setTotalWithdraw(clearingWithdrawInfoService.queryTotalWithdraw(merchantId));
// 在途金额
BigDecimal pendingAmount = BigDecimal.ZERO;
@@ -692,6 +692,13 @@ public class AdapayService {
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
vo.setPendingAmount(pendingAmount);
// 查询今天的提现金额
BigDecimal todayWithdrawalAmount = clearingWithdrawInfoService.queryTodayWithdrawalAmount(merchantId);
// 如果大于0则重新更新LastAvlBalance
if (todayWithdrawalAmount.compareTo(BigDecimal.ZERO) > 0) {
vo.setLastAvlBalance(BigDecimal.ZERO.max(vo.getLastAvlBalance().subtract(todayWithdrawalAmount)));
}
return vo;
}

View File

@@ -22,7 +22,7 @@ public class AdapayAccountBalanceVO {
// 冻结余额,当配置了自动结算功能,在每日发起结算时会将可用余额转为冻结金额。该部分金额不允许取现。
private BigDecimal frzBalance;
// 昨日日终余额。
// 昨日日终余额。(页面显示为可提现金额)
private BigDecimal lastAvlBalance;
// 汇付会员id

View File

@@ -1,6 +1,7 @@
package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.AdapayUnsplitRecord;
import com.jsowell.pile.vo.AdapayUnsplitRecordVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -29,4 +30,6 @@ public interface AdapayUnsplitRecordMapper {
int batchInsert(@Param("list") List<AdapayUnsplitRecord> list);
List<AdapayUnsplitRecord> queryUnsplitOrders(@Param("startTime") String startTime, @Param("endTime") String endTime);
List<AdapayUnsplitRecordVO> queryList();
}

View File

@@ -1,6 +1,8 @@
package com.jsowell.pile.service;
import com.jsowell.pile.domain.AdapayUnsplitRecord;
import com.jsowell.pile.vo.AdapayUnsplitRecordVO;
import java.util.List;
public interface AdapayUnsplitRecordService{
@@ -27,4 +29,6 @@ public interface AdapayUnsplitRecordService{
int batchInsert(List<AdapayUnsplitRecord> list);
List<AdapayUnsplitRecord> queryUnsplitOrders(String startTime, String endTime);
List<AdapayUnsplitRecordVO> queryList();
}

View File

@@ -43,4 +43,7 @@ public interface ClearingWithdrawInfoService{
PageResponse queryWithdrawList(QueryWithdrawListDTO dto) throws BaseAdaPayException;
BigDecimal queryTotalWithdraw(String merchantId);
// 获取今日提现总额
BigDecimal queryTodayWithdrawalAmount(String merchantId);
}

View File

@@ -5,7 +5,6 @@ import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.jsowell.adapay.dto.QueryWithdrawListDTO;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.util.DateUtils;
@@ -13,11 +12,9 @@ import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ClearingWithdrawInfo;
import com.jsowell.pile.mapper.ClearingWithdrawInfoMapper;
import com.jsowell.pile.service.ClearingWithdrawInfoService;
import com.jsowell.pile.service.PileMerchantInfoService;
import com.jsowell.pile.vo.web.ClearingBillVO;
import com.jsowell.pile.vo.web.WithdrawInfoVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -164,4 +161,36 @@ public class ClearingWithdrawInfoServiceImpl implements ClearingWithdrawInfoServ
return clearingWithdrawInfoMapper.queryTotalWithdraw(merchantId);
}
/**
* 查询今日提现总额
* @param merchantId
* @return
*/
@Override
public BigDecimal queryTodayWithdrawalAmount(String merchantId) {
BigDecimal todayWithdrawalAmount = BigDecimal.ZERO;
QueryWithdrawListDTO dto = QueryWithdrawListDTO.builder()
.merchantId(merchantId)
.pageNum(1)
.pageSize(10)
.build();
PageResponse pageResponse = null;
try {
pageResponse = queryWithdrawList(dto);
} catch (BaseAdaPayException e) {
throw new RuntimeException(e);
}
if (pageResponse != null && pageResponse.getList() != null && !pageResponse.getList().isEmpty()) {
List<WithdrawInfoVO> list = (List<WithdrawInfoVO>) pageResponse.getList();
for (WithdrawInfoVO vo : list) {
// 如果applicationTime在当天则加到todayWithdrawalAmount中
if (DateUtils.isToday(vo.getApplicationTime())) {
todayWithdrawalAmount = todayWithdrawalAmount.add(vo.getCashAmt());
}
}
}
return todayWithdrawalAmount;
}
}

View File

@@ -0,0 +1,30 @@
package com.jsowell.pile.vo;
import lombok.Data;
@Data
public class AdapayUnsplitRecordVO {
// 订单号
private String orderCode;
// 支付金额
private String payAmount;
// 结算金额
private String settleAmount;
// 确认分账金额
private String confirmedSplitAmount;
// 待分账金额
private String waitSplitAmount;
// 应退款金额
private String refundAmount;
// 已退款金额
private String paidAmount;
// 待退款金额
private String refundPayAmount;
}

View File

@@ -3,6 +3,7 @@ package com.jsowell.web.controller.pile;
import com.jsowell.pile.domain.AdapayUnsplitRecord;
import com.jsowell.pile.mapper.AdapayUnsplitRecordMapper;
import com.jsowell.pile.service.AdapayUnsplitRecordService;
import com.jsowell.pile.vo.AdapayUnsplitRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -73,4 +74,9 @@ public class AdapayUnsplitRecordServiceImpl implements AdapayUnsplitRecordServic
return adapayUnsplitRecordMapper.queryUnsplitOrders(startTime, endTime);
}
@Override
public List<AdapayUnsplitRecordVO> queryList() {
return adapayUnsplitRecordMapper.queryList();
}
}