提交代码

dev-discount
胡锐 2 years ago
parent 633f4e7ad2
commit 1a9b3e311b
  1. 11
      hai-order/src/main/java/com/web/rocketmq/consumer/OrderRefundSuccessConsumer.java
  2. 7
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -47,8 +47,17 @@ public class OrderRefundSuccessConsumer implements RocketMQListener<HighOrderRef
// 交易订单
HighOrder order = orderService.getOrderDetailByNo(orderRefund.getOrderNo());
if (order != null && order.getMemDiscountId() != null) {
// 初始化金额 避免null值
order.setSurplusRefundPrice(order.getSurplusRefundPrice()!=null?order.getSurplusRefundPrice():new BigDecimal("0"));
order.setSurplusRefundIntegral(order.getSurplusRefundIntegral()!=null?order.getSurplusRefundIntegral():0);
// 剩余退款的积分
int surplusRefundIntegral = order.getSurplusRefundIntegral() - orderRefund.getRefundIntegral();
// 剩余退款的金额
BigDecimal surplusRefundPrice = order.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice());
// 交易订单可退金额为0,才会退还优惠券
if (order.getSurplusRefundIntegral() == 0 && order.getSurplusRefundPrice().compareTo(new BigDecimal("0")) == 0) {
if (surplusRefundIntegral == 0 && surplusRefundPrice.compareTo(new BigDecimal("0")) == 0) {
HighDiscountUserRel rel = discountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用

@ -561,7 +561,7 @@ public class OrderServiceImpl implements OrderService {
order.setRefundTime(new Date());
order.setOrderStatus(OrderStatus.STATUS4.getNumber());
// 退回金额,原路返回
/*// 退回金额,原路返回
RefundPriceModel refundPrice = orderRefundService.refundPrice(refundOrderNo
, order
, OrderPayType.getDataByType(order.getPayType())
@ -569,18 +569,17 @@ public class OrderServiceImpl implements OrderService {
, order.getPayGold());
if (!refundPrice.getRefundSuccess()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试");
}
}*/
List<HighOrderRefund> refundList = orderRefundService.getRefundByRefundNo(refundOrderNo);
for (HighOrderRefund orderRefund : refundList) {
orderRefund.setRefundStatus(OrderRefundStatus.STATUS2.getNumber());
orderRefund.setRefundTime(new Date());
orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo());
//orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo());
orderRefundService.update(orderRefund);
rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_REFUND_SUCCESS.getTopic(), orderRefund);
}
return updateOrderData(order);
}

Loading…
Cancel
Save