mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 20:15:06 +08:00
add 新增运营端小程序"我的钱包"界面接口
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.pile.dto.MerchantOrderReportDTO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessFinancialQueryResultVO;
|
||||
|
||||
public interface BusinessFinancialService {
|
||||
BusinessFinancialQueryResultVO getMyWallet(MerchantOrderReportDTO dto);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||
import com.jsowell.pile.dto.MerchantOrderReportDTO;
|
||||
import com.jsowell.pile.service.BusinessFinancialService;
|
||||
import com.jsowell.pile.service.ClearingWithdrawInfoService;
|
||||
import com.jsowell.pile.service.SettleOrderReportService;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessFinancialQueryResultVO;
|
||||
import com.jsowell.pile.vo.web.MerchantOrderReportVO;
|
||||
import com.jsowell.pile.vo.web.OrderReportDetail;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 运营端小程序财务相关Service
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BusinessFinancialServiceImpl implements BusinessFinancialService {
|
||||
|
||||
@Autowired
|
||||
private SettleOrderReportService settleOrderReportService;
|
||||
|
||||
@Autowired
|
||||
private AdapayService adapayService;
|
||||
|
||||
@Autowired
|
||||
private ClearingWithdrawInfoService clearingWithdrawInfoService;
|
||||
|
||||
/**
|
||||
* 我的钱包查询
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BusinessFinancialQueryResultVO getMyWallet(MerchantOrderReportDTO dto) {
|
||||
// 查询运营商订单报表
|
||||
MerchantOrderReportVO merchantOrderReportVO = settleOrderReportService.getMerchantOrderReportV2(dto);
|
||||
|
||||
// 构建返回结果
|
||||
BusinessFinancialQueryResultVO result = new BusinessFinancialQueryResultVO();
|
||||
|
||||
// 从订单报表中获取收入金额、交易金额、交易手续费
|
||||
if (merchantOrderReportVO != null && merchantOrderReportVO.getMerchantOrderReport() != null) {
|
||||
OrderReportDetail report = merchantOrderReportVO.getMerchantOrderReport();
|
||||
result.setTotalAmount(report.getTotalAmount() != null ? report.getTotalAmount() : BigDecimal.ZERO);
|
||||
result.setTradeAmount(report.getTradeAmount() != null ? report.getTradeAmount() : BigDecimal.ZERO);
|
||||
result.setTradeFee(report.getTradeFee() != null ? report.getTradeFee() : BigDecimal.ZERO);
|
||||
} else {
|
||||
result.setTotalAmount(BigDecimal.ZERO);
|
||||
result.setTradeAmount(BigDecimal.ZERO);
|
||||
result.setTradeFee(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 查询账户余额
|
||||
BigDecimal acctBalance = BigDecimal.ZERO;
|
||||
try {
|
||||
AdapayAccountBalanceVO accountBalanceVO = adapayService.queryAdapayAccountBalance(dto.getMerchantId());
|
||||
if (accountBalanceVO != null && accountBalanceVO.getAcctBalance() != null) {
|
||||
acctBalance = accountBalanceVO.getAcctBalance();
|
||||
}
|
||||
} catch (BaseAdaPayException e) {
|
||||
log.error("查询汇付账户余额异常 merchantId:{}", dto.getMerchantId(), e);
|
||||
}
|
||||
result.setAcctBalance(acctBalance);
|
||||
|
||||
// 查询累计提现金额
|
||||
BigDecimal totalWithdraw = BigDecimal.ZERO;
|
||||
try {
|
||||
BigDecimal withdraw = clearingWithdrawInfoService.queryTotalWithdraw(dto.getMerchantId());
|
||||
if (withdraw != null) {
|
||||
totalWithdraw = withdraw;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("查询累计提现金额异常 merchantId:{}", dto.getMerchantId(), e);
|
||||
}
|
||||
result.setTotalWithdraw(totalWithdraw);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.jsowell.pile.vo.uniapp.business;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
public class BusinessFinancialQueryResultVO {
|
||||
|
||||
/**
|
||||
* 账户总余额
|
||||
*/
|
||||
private BigDecimal acctBalance;
|
||||
|
||||
/**
|
||||
* 累计提现金额
|
||||
*/
|
||||
private BigDecimal totalWithdraw;
|
||||
|
||||
/**
|
||||
* 收入金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 交易金额
|
||||
*/
|
||||
private BigDecimal tradeAmount;
|
||||
|
||||
/**
|
||||
* 交易手续费
|
||||
*/
|
||||
private BigDecimal tradeFee;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
public static class BusinessFinancialQueryResultList{
|
||||
/**
|
||||
* 账单金额
|
||||
*/
|
||||
private BigDecimal billAmount;
|
||||
|
||||
/**
|
||||
* 账单状态
|
||||
* (0-未清分;1-清分在途;2-可提现;3-提现申请中;4-已提现;5等待处理;6-线下结算)
|
||||
*/
|
||||
private String billStatus;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
private String tradeDate;
|
||||
|
||||
/**
|
||||
* 提现申请时间
|
||||
*/
|
||||
private String applicationTime;
|
||||
|
||||
/**
|
||||
* 提现订单号
|
||||
*/
|
||||
private String withdrawCode;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user