xin
2025-09-22 6681b64ff05626c6f10ad69e49a87c3969b72bb8
订单增加库存、减少库存
2 files modified
8 ■■■■■ changed files
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java 3 ●●●●● patch | view | raw | blame | history
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;
@@ -221,6 +223,9 @@
                    default:
                        throw new BadRequestException("暂未开通其余支付模式");
                }
                for (OrderReturnProductSnapshot snapshot : orderReturn.getProductSnapshots()) {
                    productInventoryService.increaseStock(snapshot.getProductId(), snapshot.getDetailCount());
                }
                break;
            default:
                throw new BadRequestException("审核状态错误");
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java
@@ -6,6 +6,7 @@
import com.oying.modules.hwc.service.SwiftPassService;
import com.oying.modules.pc.product.domain.Product;
import com.oying.modules.pc.product.domain.enums.ProductStatusEnum;
import com.oying.modules.pc.product.service.ProductInventoryService;
import com.oying.modules.pc.product.service.ProductService;
import com.oying.modules.pc.store.domain.Store;
import com.oying.modules.pc.store.domain.enums.StoreStatusEnum;
@@ -54,6 +55,7 @@
    private final RedisUtils redisUtils;
    private final StoreService storeService;
    private final OrderOperationLogService operationLogService;
    private final ProductInventoryService productInventoryService;
    private static final String DESCRIBE = "哦应:";
    private static final String ORDER_KEY = "oying:order";
    private static final String ORDER_STORE_KEY = "oying:order:store";
@@ -100,6 +102,7 @@
        List<OrderProductSnapshot> snapshots = new ArrayList<>();
        for (ProductInfo productInfo : info.getProducts()) {
            Product product = productInfo.getProduct();
            productInventoryService.decreaseStock(product.getProductId(), productInfo.getCount());
            OrderProductSnapshot snapshot = new OrderProductSnapshot();
            snapshot.setOrderNum(orderNum);
            snapshot.setStoreId(submit.getStoreId());