mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-16 13:19:57 +08:00
update
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.dto;
|
package com.jsowell.pile.dto;
|
||||||
|
|
||||||
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -69,4 +70,9 @@ public class AfterSettleOrderDTO {
|
|||||||
* 订单退款金额
|
* 订单退款金额
|
||||||
*/
|
*/
|
||||||
private BigDecimal orderRefundAmount;
|
private BigDecimal orderRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息, 查询后放入DTO方便后面使用
|
||||||
|
*/
|
||||||
|
private OrderBasicInfo orderBasicInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -853,6 +853,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
* 返回更新后的OrderBasicInfo对象
|
* 返回更新后的OrderBasicInfo对象
|
||||||
* 专用方法,其他地方如果要用请仔细检查
|
* 专用方法,其他地方如果要用请仔细检查
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void returnUpdateOrderBasicInfo(OrderBasicInfo orderBasicInfo, TransactionRecordsData data) {
|
public void returnUpdateOrderBasicInfo(OrderBasicInfo orderBasicInfo, TransactionRecordsData data) {
|
||||||
// 订单编号
|
// 订单编号
|
||||||
String orderCode = orderBasicInfo.getOrderCode();
|
String orderCode = orderBasicInfo.getOrderCode();
|
||||||
@@ -893,6 +894,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
*
|
*
|
||||||
* @return 查询并更新过数据的orderDetail
|
* @return 查询并更新过数据的orderDetail
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public OrderDetail returnUpdateOrderDetail(OrderBasicInfo orderBasicInfo, TransactionRecordsData data) {
|
public OrderDetail returnUpdateOrderDetail(OrderBasicInfo orderBasicInfo, TransactionRecordsData data) {
|
||||||
String orderCode = orderBasicInfo.getOrderCode();
|
String orderCode = orderBasicInfo.getOrderCode();
|
||||||
BigDecimal orderAmount = orderBasicInfo.getOrderAmount();
|
BigDecimal orderAmount = orderBasicInfo.getOrderAmount();
|
||||||
@@ -1512,63 +1514,36 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
BigDecimal orderPayAmount = afterSettleOrderDTO.getOrderPayAmount(); // 支付金额
|
BigDecimal orderPayAmount = afterSettleOrderDTO.getOrderPayAmount(); // 支付金额
|
||||||
BigDecimal orderConsumeAmount = afterSettleOrderDTO.getOrderConsumeAmount(); // 消费金额
|
BigDecimal orderConsumeAmount = afterSettleOrderDTO.getOrderConsumeAmount(); // 消费金额
|
||||||
BigDecimal orderRefundAmount = afterSettleOrderDTO.getOrderRefundAmount(); // 退款金额
|
BigDecimal orderRefundAmount = afterSettleOrderDTO.getOrderRefundAmount(); // 退款金额
|
||||||
BigDecimal orderSettleAmount = afterSettleOrderDTO.getOrderSettleAmount(); // 结算金额
|
|
||||||
|
|
||||||
if (orderConsumeAmount.add(orderRefundAmount).compareTo(orderPayAmount) != 0) {
|
if (orderConsumeAmount.add(orderRefundAmount).compareTo(orderPayAmount) != 0) {
|
||||||
logger.info("订单支付金额与消费金额+退款金额不相等");
|
logger.info("订单支付金额与消费金额+退款金额不相等");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OrderBasicInfo orderBasicInfo = this.getOrderInfoByOrderCode(afterSettleOrderDTO.getOrderCode());
|
||||||
|
afterSettleOrderDTO.setOrderBasicInfo(orderBasicInfo);
|
||||||
|
|
||||||
// 订单结算金额,汇付分账
|
// 订单结算金额,汇付分账
|
||||||
splittingMethod(orderSettleAmount, afterSettleOrderDTO);
|
splittingMethod(afterSettleOrderDTO);
|
||||||
|
|
||||||
// 订单退款,汇付退款
|
// 订单退款,汇付退款
|
||||||
|
refundMethod(afterSettleOrderDTO);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分账方法
|
* 分账方法
|
||||||
* @param orderSettleAmount
|
|
||||||
* @param afterSettleOrderDTO
|
* @param afterSettleOrderDTO
|
||||||
*/
|
*/
|
||||||
private void splittingMethod(BigDecimal orderSettleAmount, AfterSettleOrderDTO afterSettleOrderDTO) {
|
private void splittingMethod(AfterSettleOrderDTO afterSettleOrderDTO) {
|
||||||
|
BigDecimal orderSettleAmount = afterSettleOrderDTO.getOrderSettleAmount(); // 结算金额
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行订单退款
|
* 执行订单退款
|
||||||
* @param orderBasicInfo
|
|
||||||
*/
|
*/
|
||||||
private void refundOrder(OrderBasicInfo orderBasicInfo) {
|
private void refundMethod(AfterSettleOrderDTO afterSettleOrderDTO) {
|
||||||
BigDecimal refundAmount = orderBasicInfo.getRefundAmount();
|
OrderBasicInfo orderBasicInfo = afterSettleOrderDTO.getOrderBasicInfo();
|
||||||
// 查询该笔订单的退款记录
|
|
||||||
List<OrderDetailInfoVO.OrderRefundInfo> orderRefundInfoList = this.getOrderRefundInfoList(orderBasicInfo);
|
|
||||||
if (CollectionUtils.isNotEmpty(orderRefundInfoList)) {
|
|
||||||
// 已退款金额
|
|
||||||
BigDecimal refunded = orderRefundInfoList.stream()
|
|
||||||
.map(x -> Objects.nonNull(x.getReverseAmt()) ? new BigDecimal(x.getReverseAmt()) : BigDecimal.ZERO)
|
|
||||||
.reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
||||||
if (refunded.compareTo(refundAmount) >= 0) {
|
|
||||||
logger.info("执行订单退款-校验已退款金额,orderCode:{}, 应退款金额:{}, 已经退款金额:{}, 不再执行退款", orderBasicInfo.getOrderCode(), refundAmount, refunded);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String payMode = orderBasicInfo.getPayMode();
|
|
||||||
if (StringUtils.equals(payMode, OrderPayModeEnum.PAYMENT_OF_PRINCIPAL_BALANCE.getValue())) {
|
|
||||||
// 余额支付
|
|
||||||
balancePaymentOrderRefund(orderBasicInfo);
|
|
||||||
} else if (StringUtils.equals(payMode, OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())
|
|
||||||
|| StringUtils.equals(payMode, OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) {
|
|
||||||
// 在线支付
|
|
||||||
onlinePaymentOrderRefund(orderBasicInfo);
|
|
||||||
} else {
|
|
||||||
// 白名单支付或者ETC支付
|
|
||||||
logger.info("订单:{}使用:{},不进行退款处理", orderBasicInfo.getOrderCode(), OrderPayModeEnum.getPayModeDescription(payMode));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("【{}】-订单退款逻辑异常orderCode:{}", this.getClass().getSimpleName(), orderBasicInfo.getOrderCode(), e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3995,6 +3970,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
* @param stationId
|
* @param stationId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<SupStationStatsVO> queryOrderListByStationId(String stationId) {
|
public List<SupStationStatsVO> queryOrderListByStationId(String stationId) {
|
||||||
List<SupStationStatsVO> orderVOS = orderBasicInfoMapper.queryOrderListByStationId(stationId);
|
List<SupStationStatsVO> orderVOS = orderBasicInfoMapper.queryOrderListByStationId(stationId);
|
||||||
for (SupStationStatsVO orderVO : orderVOS) {
|
for (SupStationStatsVO orderVO : orderVOS) {
|
||||||
|
|||||||
Reference in New Issue
Block a user