From 6681b64ff05626c6f10ad69e49a87c3969b72bb8 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Mon, 22 Sep 2025 12:57:34 +0800
Subject: [PATCH] 订单增加库存、减少库存

---
 oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
index 337325d..e564b02 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.oying.exception.BadRequestException;
 import com.oying.modules.hwc.service.SwiftPassService;
+import com.oying.modules.pc.product.service.ProductInventoryService;
 import com.oying.modules.sh.domain.Order;
 import com.oying.modules.sh.domain.OrderProductSnapshot;
 import com.oying.modules.sh.domain.OrderReturn;
@@ -46,6 +47,7 @@
     private final RedisUtils redisUtils;
     private final SwiftPassService swiftPassService;
     private final OrderAddressSnapshotService addressSnapshotService;
+    private final ProductInventoryService productInventoryService;
     private static final String ORDER_RETURN_KEY = "oying:order:refund";
     private static final String ORDER_CODE = "REFUND";
     public static final Integer DAY = 30;
@@ -103,8 +105,8 @@
         // 退款订单号
         String returnNum = redisUtils.generateSn(ORDER_RETURN_KEY, GenerateEnum.ORDER_RETURN.getKey());
         returnOrder.setReturnNum(returnNum);
-        returnOrder.setReturnStatus(ReturnAuditEnum.ZERO.getKey());
-        returnOrder.setReturnStatusDescribe(ReturnAuditEnum.ZERO.getValue());
+        returnOrder.setReturnStatus(OrderStatusEnum.TEN.getKey());
+        returnOrder.setReturnStatusDescribe(OrderStatusEnum.TEN.getValue());
         returnOrder.setOrderNum(resources.getOrderNum());
         returnOrder.setOrderTime(order.getOrderTime());
         returnOrder.setOrderStoreNum(order.getOrderStoreNum());
@@ -138,7 +140,7 @@
             }
         }
         productSnapshotService.saveBatch(productSnapshots);
-        operationLogService.create(response, OrderStatusEnum.FIFTEEN, null);
+        operationLogService.create(response, OrderStatusEnum.TEN, null);
     }
 
     private static OrderReturnProductSnapshot getSnapshot(OrderProductSnapshot snapshot, String returnNum) {
@@ -221,6 +223,9 @@
                     default:
                         throw new BadRequestException("暂未开通其余支付模式");
                 }
+                for (OrderReturnProductSnapshot snapshot : orderReturn.getProductSnapshots()) {
+                    productInventoryService.increaseStock(snapshot.getProductId(), snapshot.getDetailCount());
+                }
                 break;
             default:
                 throw new BadRequestException("审核状态错误");

--
Gitblit v1.9.3