mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
adapayService添加批量查询分账信息方法
This commit is contained in:
@@ -1567,4 +1567,94 @@ public class AdapayService {
|
||||
// 删除数据库中的记录
|
||||
adapayMemberAccountService.deleteAccountByMerchantId(dto.getMerchantId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据paymentIdList查询分账信息
|
||||
* @param paymentIdList
|
||||
* @return 未分帐paymentIdList
|
||||
*/
|
||||
public List<String> getSplitInfoByPaymentIdList(List<String> paymentIdList) throws BaseAdaPayException {
|
||||
List<String> unSplitList = Lists.newArrayList(); // 未分帐
|
||||
List<String> splitList = Lists.newArrayList(); // 已分帐
|
||||
|
||||
BigDecimal total = BigDecimal.ZERO; // 总分账金额
|
||||
BigDecimal totalWithdrawalAmt = BigDecimal.ZERO; // 实际到账金额汇总
|
||||
BigDecimal totalFeeAmt = BigDecimal.ZERO; // 手续费金额汇总
|
||||
|
||||
List<String> selfList = Lists.newArrayList();
|
||||
|
||||
Map<String, BigDecimal> map = Maps.newHashMap();
|
||||
for (String paymentId : paymentIdList) {
|
||||
if (StringUtils.isBlank(paymentId)) {
|
||||
continue;
|
||||
}
|
||||
// 查询支付确认id
|
||||
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||||
dto.setPaymentId(paymentId);
|
||||
dto.setWechatAppId(wechatAppId1);
|
||||
// 查询分账信息
|
||||
QueryPaymentConfirmDetailResponse response = this.queryPaymentConfirmList(dto);
|
||||
if (response != null) {
|
||||
List<PaymentConfirmInfo> confirms = response.getPaymentConfirms();
|
||||
if (CollectionUtils.isEmpty(confirms)) {
|
||||
unSplitList.add(paymentId);
|
||||
} else {
|
||||
splitList.add(paymentId);
|
||||
for (PaymentConfirmInfo confirm : confirms) {
|
||||
if (this.queryConfirmReverseStatus(confirm)) {
|
||||
log.info("支付确认id:" + confirm.getId() + "撤销了。。。");
|
||||
continue;
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
|
||||
String adapayMemberId = jsonObject.getString("adapayMemberId");
|
||||
if (StringUtils.isBlank(adapayMemberId)) {
|
||||
adapayMemberId = jsonObject.getString("adapayMemberIds");
|
||||
}
|
||||
|
||||
BigDecimal confirmAmt = new BigDecimal(confirm.getConfirmAmt()); // 本次确认金额
|
||||
BigDecimal confirmedAmt = new BigDecimal(confirm.getConfirmedAmt()); // 已确认金额
|
||||
BigDecimal feeAmt = new BigDecimal(confirm.getFeeAmt()); // 手续费
|
||||
|
||||
// 汇总已确认金额
|
||||
total = total.add(confirmedAmt);
|
||||
|
||||
// 汇总手续费金额
|
||||
totalFeeAmt = totalFeeAmt.add(feeAmt);
|
||||
|
||||
// 汇总可提现金额
|
||||
totalWithdrawalAmt = totalWithdrawalAmt.add(confirmAmt).subtract(feeAmt);
|
||||
|
||||
// confirm
|
||||
List<DivMember> divMembers = confirm.getDivMembers();
|
||||
// System.out.println("confirm:" + JSON.toJSONString(divMembers));
|
||||
for (DivMember divMember : divMembers) {
|
||||
// 放map
|
||||
map.merge(divMember.getMemberId(), new BigDecimal(divMember.getAmount()), BigDecimal::add);
|
||||
}
|
||||
|
||||
if (StringUtils.equals(adapayMemberId, "0")
|
||||
|| StringUtils.equals(adapayMemberId, "AM29102732")) {
|
||||
// 0为默认平台id, AM29102732为罗总账户
|
||||
selfList.add(paymentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unSplitList.add(paymentId);
|
||||
}
|
||||
}
|
||||
// System.out.println("=================未分账:" + JSON.toJSONString(unSplitList) + ", 数量:" + unSplitList.size());
|
||||
// System.out.println("=================已分账:" + JSON.toJSONString(map) + ", 总分账:" + total + ", 数量:" + splitList.size());
|
||||
// System.out.println("===============金额明细:" + "总到账金额:" + totalWithdrawalAmt + ", 总手续费:" + totalFeeAmt);
|
||||
// System.out.println("===================自己:" + JSON.toJSONString(selfList) + ", 数量:" + selfList.size());
|
||||
log.info("\n入参paymentId数量:{}, 已分帐数量:{}, 未分帐数量:{}, 未分帐id:{} " +
|
||||
"\n已分帐:{}, 总分账:{}, 数量:{}" +
|
||||
"\n金额明细:[总到账金额:{}, 总手续费:{}] " +
|
||||
"\n自己:{}, 数量:{}",
|
||||
paymentIdList.size(), splitList.size(), unSplitList.size(), unSplitList,
|
||||
JSON.toJSONString(map), total, splitList.size(),
|
||||
totalWithdrawalAmt, totalFeeAmt,
|
||||
selfList, selfList.size());
|
||||
return unSplitList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user