Search in sources :

Example 1 with OrderItemDTO

use of com.whoiszxl.dto.OrderItemDTO in project shopzz by whoiszxl.

the class PayOrderStockUpdaterFactory method createCommand.

@Override
protected StockUpdater createCommand(T parameter) {
    OrderInfoDTO orderInfoDTO = (OrderInfoDTO) parameter;
    Map<Long, OrderItemDTO> orderItemDTOMap = new HashMap<>(100);
    for (OrderItemDTO orderItemDTO : orderInfoDTO.getOrderItemDTOList()) {
        orderItemDTOMap.put(orderItemDTO.getSkuId(), orderItemDTO);
    }
    return new PayOrderStockUpdater(productStockService, orderItemDTOMap);
}
Also used : OrderItemDTO(com.whoiszxl.dto.OrderItemDTO) HashMap(java.util.HashMap) OrderInfoDTO(com.whoiszxl.dto.OrderInfoDTO)

Example 2 with OrderItemDTO

use of com.whoiszxl.dto.OrderItemDTO in project shopzz by whoiszxl.

the class SubmitOrderStockUpdaterFactory method createCommand.

@Override
public StockUpdater createCommand(T parameter) {
    OrderCreateInfoDTO orderCreateInfoDTO = (OrderCreateInfoDTO) parameter;
    Map<Long, OrderItemDTO> orderItemDTOMap = new HashMap<>();
    for (OrderItemDTO item : orderCreateInfoDTO.getOrderItemList()) {
        orderItemDTOMap.put(item.getSkuId(), item);
    }
    return new SubmitOrderStockUpdater(productStockService, orderItemDTOMap);
}
Also used : OrderCreateInfoDTO(com.whoiszxl.dto.OrderCreateInfoDTO) OrderItemDTO(com.whoiszxl.dto.OrderItemDTO) HashMap(java.util.HashMap)

Example 3 with OrderItemDTO

use of com.whoiszxl.dto.OrderItemDTO in project shopzz by whoiszxl.

the class SubmitOrderStockUpdaterFactory method getProductSkuIds.

@Override
protected List<Long> getProductSkuIds(T parameter) {
    OrderCreateInfoDTO orderCreateInfoDTO = (OrderCreateInfoDTO) parameter;
    List<Long> productSkuIds = new ArrayList<>();
    for (OrderItemDTO item : orderCreateInfoDTO.getOrderItemList()) {
        productSkuIds.add(item.getSkuId());
    }
    return productSkuIds;
}
Also used : OrderCreateInfoDTO(com.whoiszxl.dto.OrderCreateInfoDTO) OrderItemDTO(com.whoiszxl.dto.OrderItemDTO) ArrayList(java.util.ArrayList)

Example 4 with OrderItemDTO

use of com.whoiszxl.dto.OrderItemDTO in project shopzz by whoiszxl.

the class WmsFeignClientImpl method notifyPayOrderSuccess.

@Override
public ResponseResult<Boolean> notifyPayOrderSuccess(OrderInfoDTO orderInfo) {
    // 更新WMS中心库存
    for (OrderItemDTO orderItemDTO : orderInfo.getOrderItemDTOList()) {
        SaleDeliveryScheduleResult scheduleResult = saleDeliveryScheduler.getScheduleResult(orderItemDTO);
        WmsStockUpdater stockUpdater = wmsStockUpdaterFactory.create(WmsStockUpdateEventConstants.PAY_ORDER, scheduleResult);
        stockUpdater.update();
    }
    return ResponseResult.buildSuccess();
}
Also used : WmsStockUpdater(com.whoiszxl.stock.WmsStockUpdater) OrderItemDTO(com.whoiszxl.dto.OrderItemDTO) SaleDeliveryScheduleResult(com.whoiszxl.entity.schedule.SaleDeliveryScheduleResult)

Example 5 with OrderItemDTO

use of com.whoiszxl.dto.OrderItemDTO in project shopzz by whoiszxl.

the class SubmitOrderWmsStockUpdater method updateProductStock.

@Override
protected void updateProductStock() {
    // 更新商品库存
    OrderItemDTO orderItem = scheduleResult.getOrderItem();
    // 提交订单,减去可用,增加锁定
    warehouseProductStockService.subAvailableStockAndAddLockedStock(orderItem.getQuantity(), orderItem.getSkuId());
}
Also used : OrderItemDTO(com.whoiszxl.dto.OrderItemDTO)

Aggregations

OrderItemDTO (com.whoiszxl.dto.OrderItemDTO)10 OrderCreateInfoDTO (com.whoiszxl.dto.OrderCreateInfoDTO)3 WmsStockUpdater (com.whoiszxl.stock.WmsStockUpdater)3 OrderInfoDTO (com.whoiszxl.dto.OrderInfoDTO)2 SaleDeliveryScheduleResult (com.whoiszxl.entity.schedule.SaleDeliveryScheduleResult)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 SaleDeliveryOrderPickingItem (com.whoiszxl.entity.SaleDeliveryOrderPickingItem)1 KafkaListener (org.springframework.kafka.annotation.KafkaListener)1