use of com.whoiszxl.dto.OrderInfoDTO 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);
}
use of com.whoiszxl.dto.OrderInfoDTO in project shopzz by whoiszxl.
the class OrderFeignClientImpl method notifyDcPaySuccess.
@Override
public ResponseResult<Boolean> notifyDcPaySuccess(List<Long> orderIds) {
// 1. 更新订单到发货状态
List<Order> orderList = orderIds.stream().map(orderId -> {
Order order = new Order();
order.setId(orderId);
order.setOrderStatus(OrderStatusConstants.WAIT_FOR_DELIVERY);
order.setUpdatedBy("system");
return order;
}).collect(Collectors.toList());
boolean updateFlag = orderService.updateBatchById(orderList);
for (Long orderId : orderIds) {
OrderInfoDTO orderInfo = orderService.getOrderInfo(orderId);
// 通知商品中心更新库存
ResponseResult result = productFeignClient.paySuccessUpdateStock(orderInfo);
if (!result.isOk()) {
log.info("库存更新失败");
}
// TODO 通知WMS订单支付成功,更新WMS中心库存,WMS新增出库单
// TODO 更新会员中心等级与积分
}
return ResponseResult.buildByFlag(updateFlag);
}
use of com.whoiszxl.dto.OrderInfoDTO in project shopzz by whoiszxl.
the class PayOrderStockUpdaterFactory method getProductSkuIds.
@Override
protected List<Long> getProductSkuIds(T parameter) {
OrderInfoDTO orderInfoDTO = (OrderInfoDTO) parameter;
List<Long> productSkuIds = new ArrayList<>();
for (OrderItemDTO orderItemDTO : orderInfoDTO.getOrderItemDTOList()) {
productSkuIds.add(orderItemDTO.getSkuId());
}
return productSkuIds;
}
use of com.whoiszxl.dto.OrderInfoDTO in project shopzz by whoiszxl.
the class OrderFeignClientImpl method notifyDcPaySuccess.
@Override
public ResponseResult<Boolean> notifyDcPaySuccess(List<Long> orderIds) {
// 1. 更新订单到发货状态
List<Order> orderList = orderIds.stream().map(orderId -> {
Order order = new Order();
order.setId(orderId);
order.setOrderStatus(OrderStatusConstants.WAIT_FOR_DELIVERY);
order.setUpdatedBy("admin");
return order;
}).collect(Collectors.toList());
boolean updateFlag = orderService.updateBatchById(orderList);
for (Long orderId : orderIds) {
OrderInfoDTO orderInfo = orderService.getOrderInfo(orderId);
// 2. 清空购物车
ResponseResult<Boolean> clearCartResult = cartFeignClient.clearCheckedCartByMemberId(orderInfo.getMemberId());
if (!clearCartResult.getData()) {
log.error("下单成功,但是清空购物车失败了");
}
// 3. 通知库存中心更新库存
inventoryFeignClient.notifyPayOrderEvent(orderInfo);
// 4. 通知WMS订单支付成功,更新WMS中心库存,WMS新增出库单
wmsFeignClient.notifyPayOrderSuccess(orderInfo);
// 5. 更新会员中心等级与积分
memberFeignClient.notifyPayOrderSuccess(orderInfo.getMemberId(), orderInfo.getTotalAmount());
}
return ResponseResult.buildByFlag(updateFlag);
}
Aggregations