mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 订单分账逻辑
This commit is contained in:
@@ -55,7 +55,6 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -92,12 +91,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Value("${adapay.jsowell.appId}")
|
||||
private String ADAPAY_APP_ID;
|
||||
|
||||
@Value("${adapay.callback}")
|
||||
private String ADAPAY_CALLBACK_URL;
|
||||
|
||||
@Autowired
|
||||
private WxAppletRemoteService wxAppletRemoteService;
|
||||
|
||||
@@ -701,7 +694,10 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
dto.setOrderDetail(orderDetail);
|
||||
transactionService.doUpdateOrder(dto);
|
||||
|
||||
// 需要退款的情况
|
||||
// 订单支付结算
|
||||
orderPaymentSettlement(orderBasicInfo);
|
||||
|
||||
// 退款逻辑/需要退款的情况
|
||||
BigDecimal residue = orderBasicInfo.getRefundAmount();
|
||||
if (residue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// 执行退款逻辑
|
||||
@@ -733,6 +729,29 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
logger.info("结算订单end:{} OrderTransactionDTO:{}", orderBasicInfo.getOrderCode(), JSONObject.toJSONString(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单分账逻辑
|
||||
* 订单结算完成,就执行分账
|
||||
* 清分账单生成逻辑改为当天第一笔结算后就新建,后面的产生的订单,追加更新
|
||||
*/
|
||||
private OrderSettleResult orderPaymentSettlement(OrderBasicInfo orderBasicInfo) {
|
||||
String appId = "";
|
||||
AdapayMemberAccount adapayMemberAccount = null;
|
||||
OrderSettleResult orderSettleResult = null;
|
||||
try {
|
||||
if (OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue().equals(orderBasicInfo.getPayMode())) {
|
||||
// 余额支付的订单
|
||||
orderSettleResult = doBalancePayment(orderBasicInfo, adapayMemberAccount, appId);
|
||||
} else {
|
||||
// 在线支付,进行支付确认分账
|
||||
orderSettleResult = doPaymentConfirm(orderBasicInfo, adapayMemberAccount, appId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("订单交易确认失败:{}", orderBasicInfo.getOrderCode(), e);
|
||||
}
|
||||
return orderSettleResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回更新后的OrderBasicInfo对象
|
||||
* 专用方法,其他地方如果要用请仔细检查
|
||||
|
||||
Reference in New Issue
Block a user