update 查询提现记录

This commit is contained in:
2024-01-05 15:26:22 +08:00
parent 65332f1ed4
commit 29adce0d00
8 changed files with 376 additions and 120 deletions

View File

@@ -0,0 +1,16 @@
package com.jsowell.adapay.dto;
import lombok.*;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class QueryWithdrawListDTO {
private String merchantId;
private Integer pageNum;
private Integer pageSize;
}

View File

@@ -39,7 +39,6 @@ import com.jsowell.pile.domain.ClearingWithdrawInfo;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.dto.PayOrderDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.web.WithdrawInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -551,11 +550,12 @@ public class AdapayService {
vo.setYesterdayRevenue(yesterdayRevenue);
// 累计提现金额
BigDecimal totalWithdraw = BigDecimal.ZERO;
List<WithdrawInfoVO> withdrawInfoVOS = clearingWithdrawInfoService.selectByMerchantId(merchantId);
if (CollectionUtils.isNotEmpty(withdrawInfoVOS)) {
totalWithdraw = withdrawInfoVOS.stream().map(WithdrawInfoVO::getCashAmt).reduce(BigDecimal.ZERO, BigDecimal::add);
}
// BigDecimal totalWithdraw = BigDecimal.ZERO;
// List<WithdrawInfoVO> withdrawInfoVOS = clearingWithdrawInfoService.selectByMerchantId(merchantId);
// if (CollectionUtils.isNotEmpty(withdrawInfoVOS)) {
// totalWithdraw = withdrawInfoVOS.stream().map(WithdrawInfoVO::getCashAmt).reduce(BigDecimal.ZERO, BigDecimal::add);
// }
BigDecimal totalWithdraw = clearingWithdrawInfoService.queryTotalWithdraw(merchantId);
vo.setTotalWithdraw(totalWithdraw);
return vo;
}

View File

@@ -4,6 +4,7 @@ import com.jsowell.pile.domain.ClearingWithdrawInfo;
import com.jsowell.pile.vo.web.ClearingBillVO;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
public interface ClearingWithdrawInfoMapper {
@@ -70,4 +71,6 @@ public interface ClearingWithdrawInfoMapper {
List<ClearingBillVO> selectWithdrawInfoByOrderCodeList(@Param("orderCodeList") List<String> orderCodeList);
List<ClearingWithdrawInfo> selectByMerchantId(@Param("merchantId") String merchantId);
BigDecimal queryTotalWithdraw(String merchantId);
}

View File

@@ -1,11 +1,15 @@
package com.jsowell.pile.service;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.jsowell.adapay.dto.QueryWithdrawListDTO;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.pile.domain.ClearingWithdrawInfo;
import com.jsowell.pile.vo.web.ClearingBillVO;
import com.jsowell.pile.vo.web.WithdrawInfoVO;
import java.math.BigDecimal;
import java.util.List;
public interface ClearingWithdrawInfoService{
int deleteByPrimaryKey(Integer id);
@@ -35,4 +39,8 @@ public interface ClearingWithdrawInfoService{
List<ClearingBillVO> selectWithdrawInfoByOrderCodeList(List<String> orderCodeList);
List<WithdrawInfoVO> selectByMerchantId(String merchantId) throws BaseAdaPayException;
PageResponse queryWithdrawList(QueryWithdrawListDTO dto) throws BaseAdaPayException;
BigDecimal queryTotalWithdraw(String merchantId);
}

View File

@@ -1,10 +1,13 @@
package com.jsowell.pile.service.impl;
import com.github.pagehelper.PageHelper;
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.core.page.PageResponse;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ClearingWithdrawInfo;
import com.jsowell.pile.mapper.ClearingWithdrawInfoMapper;
import com.jsowell.pile.service.ClearingWithdrawInfoService;
@@ -16,7 +19,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
@Service
public class ClearingWithdrawInfoServiceImpl implements ClearingWithdrawInfoService{
@@ -107,10 +112,10 @@ public class ClearingWithdrawInfoServiceImpl implements ClearingWithdrawInfoServ
if (CollectionUtils.isEmpty(infoList)) {
return resultList;
}
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(merchantId);
if (StringUtils.isBlank(wechatAppId)) {
return resultList;
}
// String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(merchantId);
// if (StringUtils.isBlank(wechatAppId)) {
// return resultList;
// }
for (ClearingWithdrawInfo clearingWithdrawInfo : infoList) {
String withdrawCode = clearingWithdrawInfo.getWithdrawCode();
WithdrawInfoVO vo = new WithdrawInfoVO();
@@ -124,4 +129,35 @@ public class ClearingWithdrawInfoServiceImpl implements ClearingWithdrawInfoServ
return resultList;
}
@Override
public PageResponse queryWithdrawList(QueryWithdrawListDTO dto) throws BaseAdaPayException {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<ClearingWithdrawInfo> infoList = clearingWithdrawInfoMapper.selectByMerchantId(dto.getMerchantId());
PageInfo<ClearingWithdrawInfo> pageInfo = new PageInfo<>(infoList);
List<WithdrawInfoVO> resultList = Lists.newArrayList();
for (ClearingWithdrawInfo clearingWithdrawInfo : pageInfo.getList()) {
WithdrawInfoVO vo = new WithdrawInfoVO();
vo.setMerchantId(clearingWithdrawInfo.getMerchantId());
vo.setWithdrawCode(clearingWithdrawInfo.getWithdrawCode());
vo.setApplicationTime(DateUtils.formatDateTime(clearingWithdrawInfo.getApplicationTime()));
vo.setStatusDesc(clearingWithdrawInfo.getWithdrawStatus());
vo.setCashAmt(clearingWithdrawInfo.getCreditedAmt());
resultList.add(vo);
}
PageResponse pageResponse = PageResponse.builder()
.pageSize(pageInfo.getPageSize())
.pageNum(pageInfo.getPageNum())
.list(resultList)
.pages(pageInfo.getPages())
.total(pageInfo.getTotal())
.build();
return pageResponse;
}
@Override
public BigDecimal queryTotalWithdraw(String merchantId) {
return clearingWithdrawInfoMapper.queryTotalWithdraw(merchantId);
}
}