Browse Source

bug:订单退款金额取值错误

LuoDLeo 3 weeks ago
parent
commit
11dc7c73aa

+ 1 - 1
src/main/java/org/springblade/modules/finance/service/IOrderService.java

@@ -88,7 +88,7 @@ public interface IOrderService extends IService<Order> {
 	 */
 	void commonRefund(Order order, Long afterSalesId);
 
-	void commonRefund(String orderNo, Long orderId, BigDecimal refundAmount, BigDecimal totalAmount, Long afterSalesId);
+	void commonRefund(String orderNo, Long orderId, BigDecimal refundAmount, BigDecimal paymentAmount, Long afterSalesId);
 
 	/**
 	 * 查询订单物流

+ 1 - 1
src/main/java/org/springblade/modules/finance/service/impl/AfterSalesServiceImpl.java

@@ -387,7 +387,7 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
 		}
 
 		BigDecimal refundPrice = orderGoods.getGoodsPrice().multiply(BigDecimal.valueOf(orderGoods.getGoodsNum()));
-		orderService.commonRefund(order.getOrderNo(), order.getId(), refundPrice, order.getTotalAmount(), afterSalesId);
+		orderService.commonRefund(order.getOrderNo(), order.getId(), refundPrice, order.getPaymentAmount(), afterSalesId);
 
 		afterSales.setIsArrived(YesOrNoEnum.YES.getValue());
 		this.updateById(afterSales);

+ 1 - 0
src/main/java/org/springblade/modules/finance/service/impl/IWxPayServiceImpl.java

@@ -280,6 +280,7 @@ public class IWxPayServiceImpl implements IWxPayService {
 
 	@Override
 	public Boolean orderRefund(String orderNo, Long orderId, BigDecimal refundAmount, BigDecimal totalAmount,  Long afterSalesId) {
+		log.info("订单编号:{},订单id:{},退款金额:{},总金额:{},售后id:{}",orderNo,orderId,refundAmount,totalAmount,afterSalesId);
 		try {
 			OrderRefund orderRefund = OrderRefund.build(orderId);
 			orderRefund.setAfterSalesId(afterSalesId);

+ 5 - 6
src/main/java/org/springblade/modules/finance/service/impl/OrderServiceImpl.java

@@ -2,9 +2,10 @@ package org.springblade.modules.finance.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
-import org.springblade.common.base.BaseEntity;
 import org.springblade.common.cache.ParamCache;
 import org.springblade.common.constant.CacheBizConstant;
 import org.springblade.common.constant.CommonConstant;
@@ -21,16 +22,14 @@ import org.springblade.modules.api.vo.LogisticVO;
 import org.springblade.modules.distribution.service.ICommissionService;
 import org.springblade.modules.distribution.service.IDistributionConfigService;
 import org.springblade.modules.finance.entity.*;
+import org.springblade.modules.finance.mapper.OrderMapper;
 import org.springblade.modules.finance.service.*;
 import org.springblade.modules.finance.vo.OrderVO;
-import org.springblade.modules.finance.mapper.OrderMapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.modules.mall.service.IStoreService;
 import org.springblade.modules.platform.service.IMessageService;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 
@@ -337,13 +336,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	@Override
-	public void commonRefund(String orderNo, Long orderId, BigDecimal refundAmount, BigDecimal totalAmount, Long afterSalesId) {
+	public void commonRefund(String orderNo, Long orderId, BigDecimal refundAmount, BigDecimal paymentAmount, Long afterSalesId) {
 		OrderRefund orderRefund = orderRefundService.lambdaQuery().eq(OrderRefund::getAfterSalesId, afterSalesId)
 				.eq(OrderRefund::getRefundState, RefundStateEnum.ONLY_REFUND.getValue()).one();
 		if (orderRefund != null) {
 			throw new ServiceException("申请中,请勿重复操作");
 		}
-		wxPayService.orderRefund(orderNo, orderId, refundAmount, totalAmount, afterSalesId);
+		wxPayService.orderRefund(orderNo, orderId, refundAmount, paymentAmount, afterSalesId);
 	}
 
 	/**