mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-18 00:38:33 +08:00
获取订单待分账信息
This commit is contained in:
@@ -1957,9 +1957,9 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验分账金额方法
|
* 获取订单待分账信息
|
||||||
*/
|
*/
|
||||||
private boolean verifyOrderAllAmount(AfterSettleOrderDTO afterSettleOrderDTO) {
|
private List<PaymentInfo> getOrderPaymentInfoList(AfterSettleOrderDTO afterSettleOrderDTO) {
|
||||||
String orderCode = afterSettleOrderDTO.getOrderCode();
|
String orderCode = afterSettleOrderDTO.getOrderCode();
|
||||||
// 查询订单支付记录
|
// 查询订单支付记录
|
||||||
List<OrderPayRecord> orderPayRecordList = orderPayRecordService.getOrderPayRecordList(orderCode);
|
List<OrderPayRecord> orderPayRecordList = orderPayRecordService.getOrderPayRecordList(orderCode);
|
||||||
@@ -1977,7 +1977,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("根据订单号:{}, 查询出{}笔支付信息, 需要分账的支付信息为:{}", orderCode, paymentInfos.size(), JSON.toJSONString(paymentInfos));
|
logger.info("根据订单号:{}, 查询出{}笔支付信息, 需要分账的支付信息为:{}", orderCode, paymentInfos.size(), JSON.toJSONString(paymentInfos));
|
||||||
return true;
|
return paymentInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2001,34 +2001,23 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验分账
|
// 获取订单待分账信息
|
||||||
verifyOrderAllAmount(afterSettleOrderDTO);
|
List<PaymentInfo> paymentInfos = getOrderPaymentInfoList(afterSettleOrderDTO);
|
||||||
|
|
||||||
// 根据站点id查询分账配置(如果未配置则初始化)
|
// 根据站点id查询分账配置(如果未配置则初始化)
|
||||||
List<StationSplitConfig> stationSplitConfigList = stationSplitConfigService.queryByStationIdWithInit(stationId);
|
List<StationSplitConfig> stationSplitConfigList = stationSplitConfigService.queryByStationIdWithInit(stationId);
|
||||||
|
|
||||||
// 计算每个参与分账的用户, 应分多少钱
|
// 计算每个参与分账的用户, 应分多少钱
|
||||||
List<SplitData> splitDataList = calculationSplitDataList(stationSplitConfigList, afterSettleOrderDTO);
|
List<SplitData> splitDataList = calculationSplitDataList(stationSplitConfigList, afterSettleOrderDTO);
|
||||||
List<DivMember> divMemberList = transformDivMemberList(splitDataList);
|
List<DivMember> divMemberList = transformDivMemberList(splitDataList);
|
||||||
// List<DivMember> divMemberList = calculationOfSplitAmount(stationSplitConfigList, afterSettleOrderDTO);
|
|
||||||
logger.info("realTimeOrderSplit-订单:{}, 分账信息:{}", orderCode, JSON.toJSONString(splitDataList));
|
logger.info("realTimeOrderSplit-订单:{}, 分账信息:{}", orderCode, JSON.toJSONString(splitDataList));
|
||||||
|
|
||||||
// 执行分账
|
// 执行分账
|
||||||
if (CollectionUtils.isEmpty(divMemberList)) {
|
if (CollectionUtils.isEmpty(divMemberList)) {
|
||||||
logger.info("realTimeOrderSplit-订单[{}]分账信息为空", orderCode);
|
logger.info("realTimeOrderSplit-订单[{}]分账信息为空", orderCode);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询订单支付记录
|
|
||||||
List<OrderPayRecord> orderPayRecordList = orderPayRecordService.getOrderPayRecordList(orderCode);
|
|
||||||
// 选出需要分账的支付id
|
|
||||||
List<PaymentInfo> paymentInfos = Lists.newArrayList();
|
|
||||||
for (OrderPayRecord orderPayRecord : orderPayRecordList) {
|
|
||||||
BigDecimal payAmount = orderPayRecord.getPayAmount();
|
|
||||||
BigDecimal refundAmount = orderPayRecord.getRefundAmount() == null ? BigDecimal.ZERO : orderPayRecord.getRefundAmount();
|
|
||||||
// 如果相减等于0,说明这笔支付单退完了,就不用分账了
|
|
||||||
BigDecimal subtract = payAmount.subtract(refundAmount);
|
|
||||||
if (subtract.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
paymentInfos.addAll(orderPayRecordService.parseDeductionRecord(orderPayRecord.getDeductionRecord()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String paymentId = paymentInfos.get(0).getPaymentId(); // 支付id
|
String paymentId = paymentInfos.get(0).getPaymentId(); // 支付id
|
||||||
String merchantId = afterSettleOrderDTO.getMerchantId(); // 运营商id
|
String merchantId = afterSettleOrderDTO.getMerchantId(); // 运营商id
|
||||||
// 根据运营商id 查询appId
|
// 根据运营商id 查询appId
|
||||||
|
|||||||
Reference in New Issue
Block a user