|
@@ -8,6 +8,7 @@ import com.github.microservice.pay.client.ret.ResultState;
|
|
|
import com.github.microservice.pay.client.service.ledger.GeneralLedgerService;
|
|
import com.github.microservice.pay.client.service.ledger.GeneralLedgerService;
|
|
|
import com.github.microservice.pay.client.service.ledger.TransactionLogService;
|
|
import com.github.microservice.pay.client.service.ledger.TransactionLogService;
|
|
|
import com.github.microservice.types.payment.PaymentChannelType;
|
|
import com.github.microservice.types.payment.PaymentChannelType;
|
|
|
|
|
+import com.github.microservice.types.payment.PaymentType;
|
|
|
import com.zhongshu.card.server.core.domain.pay.PayAccount;
|
|
import com.zhongshu.card.server.core.domain.pay.PayAccount;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -52,27 +53,35 @@ public class WithdrawService extends SuperService {
|
|
|
/**
|
|
/**
|
|
|
* 查询当前支付渠道可提现余额
|
|
* 查询当前支付渠道可提现余额
|
|
|
*/
|
|
*/
|
|
|
- public Object queryWithdrawAmountByPaymentType(String projectOid, String oid, String paymentType){
|
|
|
|
|
|
|
+ public com.github.microservice.net.ResultContent queryWithdrawAmount(String projectOid, String oid, PaymentType paymentType){
|
|
|
//todo 统计当前支付渠道的收入与支出
|
|
//todo 统计当前支付渠道的收入与支出
|
|
|
|
|
+ Long amount = queryWithdrawAmountByPaymentType(projectOid, oid, paymentType);
|
|
|
|
|
+ if (null == amount){
|
|
|
|
|
+ return com.github.microservice.net.ResultContent.buildFail("查询余额失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ //todo 收入-支出 等于当前可提现余额
|
|
|
|
|
+ return com.github.microservice.net.ResultContent.buildContent(amount);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Long queryWithdrawAmountByPaymentType(String projectOid, String oid, PaymentType paymentType) {
|
|
|
PayAccount settleAccount = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.Settle);
|
|
PayAccount settleAccount = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.Settle);
|
|
|
GeneralLedgerQueryTransactionLogModel queryTransactionLogModel = new GeneralLedgerQueryTransactionLogModel();
|
|
GeneralLedgerQueryTransactionLogModel queryTransactionLogModel = new GeneralLedgerQueryTransactionLogModel();
|
|
|
queryTransactionLogModel.setFilter(Map.of("meta.paymentType", paymentType));
|
|
queryTransactionLogModel.setFilter(Map.of("meta.paymentType", paymentType));
|
|
|
queryTransactionLogModel.setGeneralLedgerId(new String[]{settleAccount.getLedgerId()});
|
|
queryTransactionLogModel.setGeneralLedgerId(new String[]{settleAccount.getLedgerId()});
|
|
|
ResultContent<TransactionLogAggregateRetModel> aggregateRetModelResultContent = transactionLogService.aggregateAmount(queryTransactionLogModel);
|
|
ResultContent<TransactionLogAggregateRetModel> aggregateRetModelResultContent = transactionLogService.aggregateAmount(queryTransactionLogModel);
|
|
|
if (!aggregateRetModelResultContent.getState().equals(ResultState.Success)){
|
|
if (!aggregateRetModelResultContent.getState().equals(ResultState.Success)){
|
|
|
- return aggregateRetModelResultContent;
|
|
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
long amount = aggregateRetModelResultContent.getContent().getStatistics().getCreditCount() - aggregateRetModelResultContent.getContent().getStatistics().getDebitCount();
|
|
long amount = aggregateRetModelResultContent.getContent().getStatistics().getCreditCount() - aggregateRetModelResultContent.getContent().getStatistics().getDebitCount();
|
|
|
- //todo 收入-支出 等于当前可提现余额
|
|
|
|
|
- return ResultContent.buildContent(amount);
|
|
|
|
|
|
|
+ return amount;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 发起提现
|
|
* 发起提现
|
|
|
*/
|
|
*/
|
|
|
- public Object withdrawApply(String projectOid, String oid, String paymentType, BigDecimal amount){
|
|
|
|
|
|
|
+ public Object withdrawApply(String projectOid, String oid, PaymentType paymentType, BigDecimal amount){
|
|
|
//TODO 校验提现金额是否大约可以提现金额
|
|
//TODO 校验提现金额是否大约可以提现金额
|
|
|
-
|
|
|
|
|
|
|
+ Long waitAmount = queryWithdrawAmountByPaymentType(projectOid, oid, paymentType);
|
|
|
//TODO 获取支付配置 为线上或者线下
|
|
//TODO 获取支付配置 为线上或者线下
|
|
|
|
|
|
|
|
//TODO 创建流程
|
|
//TODO 创建流程
|