update 修改校验分账的方法

This commit is contained in:
2023-10-11 17:01:23 +08:00
parent 37f8ba43af
commit aef44dcce9
2 changed files with 289 additions and 35 deletions

View File

@@ -1483,7 +1483,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
*/
private OrderSettleResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) {
// 分账金额
BigDecimal confirmAmt = BigDecimal.ZERO;
BigDecimal totalConfirmAmt = BigDecimal.ZERO;
// 手续费
BigDecimal feeAmt = BigDecimal.ZERO;
// 通过支付id查询分账情况
@@ -1499,8 +1499,12 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
if (StringUtils.equals(jsonObject.getString("orderCode"), orderCode)) {
// 订单号对的上,累计分账金额
BigDecimal amount = new BigDecimal(confirm.getConfirmAmt());
confirmAmt = confirmAmt.add(amount);
BigDecimal confirmAmt = new BigDecimal(confirm.getConfirmAmt());
BigDecimal confirmedAmt = new BigDecimal(confirm.getConfirmedAmt());
BigDecimal orderConfirmedAmt = confirmedAmt.compareTo(BigDecimal.ZERO) == 0
? confirmedAmt
: confirmAmt;
totalConfirmAmt = totalConfirmAmt.add(orderConfirmedAmt);
feeAmt = feeAmt.add(new BigDecimal(confirm.getFeeAmt()));
}
}
@@ -1511,11 +1515,11 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
OrderSettleResult result = new OrderSettleResult();
result.setOrderCode(orderCode);
result.setSettleAmt(settleAmount.toString());
result.setConfirmAmt(confirmAmt.toString());
result.setConfirmAmt(totalConfirmAmt.toString());
result.setFeeAmt(feeAmt.toString());
String status;
// 如果确认金额和结算金额相等返回succeeded其他情况返回PENDING
if (settleAmount.compareTo(confirmAmt) == 0) {
if (settleAmount.compareTo(totalConfirmAmt) == 0) {
// 返回succeeded 标识该笔订单已经完成了分账,不要再次执行分账
status = AdapayStatusEnum.SUCCEEDED.getValue();
} else {