use of com.whoiszxl.entity.Order in project shopzz by whoiszxl.
the class OrderServiceImpl method buildOrder.
private Order buildOrder(Long orderId, String orderNo, OrderSubmitCommand orderSubmitCommand) {
Order order = new Order();
order.setId(orderId);
order.setOrderNo(orderNo);
order.setMemberId(AuthUtils.getMemberId());
order.setUsername("not set");
order.setOrderStatus(OrderStatusConstants.UNKNOWN);
// 收货地址配置
ResponseResult<MemberAddressFeignDTO> memberAddressResult = memberFeignClient.getMemberAddress(orderSubmitCommand.getAddressId());
if (!memberAddressResult.isOk()) {
ExceptionCatcher.catchValidateEx(ResponseResult.buildError("地址无效"));
}
AssertUtils.isNotNull(memberAddressResult.getData(), "地址无效");
String addressJson = JsonUtil.toJson(memberAddressResult.getData());
order.setSnapshotAddress(addressJson);
order.setPayType(OrderPayTypeConstants.NOT_SET);
order.setOrderComment(orderSubmitCommand.getOrderComment());
return order;
}
use of com.whoiszxl.entity.Order in project shopzz by whoiszxl.
the class OrderServiceImpl method getOrderInfo.
@Override
public OrderInfoDTO getOrderInfo(Long orderId) {
// 获取订单信息
Order order = this.getById(orderId);
// 获取订单条目信息
List<OrderItem> orderItemList = orderItemService.list(new LambdaQueryWrapper<OrderItem>().eq(OrderItem::getOrderId, orderId));
List<OrderItemDTO> orderItemDTOList = dozerUtils.mapList(orderItemList, OrderItemDTO.class);
OrderInfoDTO orderInfoDTO = new OrderInfoDTO();
orderInfoDTO.setOrderId(order.getId());
orderInfoDTO.setMemberId(order.getMemberId());
orderInfoDTO.setTotalAmount(order.getTotalAmount());
orderInfoDTO.setOrderItemDTOList(orderItemDTOList);
return orderInfoDTO;
}
use of com.whoiszxl.entity.Order 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.entity.Order in project shopzz by whoiszxl.
the class OrderServiceImpl method createOrderInfo.
/**
* 创建订单和订单条目信息
* @param memberDetailDTO 用户信息
* @param orderSubmitVo 提交的订单信息
* @return
*/
private OrderCreateInfo createOrderInfo(MemberDetailDTO memberDetailDTO, OrderSubmitVO orderSubmitVo) {
MemberDTO member = memberDetailDTO.getMember();
// 1. 生成订单号
long orderId = idWorker.nextId();
// 2. 创建订单和订单条目的基本信息
Order order = buildOrder(member, orderId, orderSubmitVo);
List<OrderItem> orderItems = buildOrderItems(orderId);
// 3. 价格计算
assert orderItems != null;
computePrice(order, orderItems);
OrderCreateInfo orderCreateInfo = new OrderCreateInfo();
orderCreateInfo.setOrder(order);
orderCreateInfo.setOrderItemList(orderItems);
orderCreateInfo.setFare(BigDecimal.ZERO);
orderCreateInfo.setPayPrice(order.getTotalAmount());
return orderCreateInfo;
}
use of com.whoiszxl.entity.Order in project shopzz by whoiszxl.
the class OrderServiceImpl method buildOrder.
/**
* 构建订单
* @param member
* @param orderId
* @return
*/
private Order buildOrder(MemberDTO member, long orderId, OrderSubmitVO orderSubmitVo) {
Order order = new Order();
order.setId(orderId);
order.setOrderSn(orderId + "");
// 1. 设置用户信息与订单状态
order.setMemberId(member.getId());
order.setUsername(member.getUsername());
order.setOrderStatus(OrderStatusConstants.UNKNOWN);
// 2. 配置收货信息
MemberAddressDTO memberAddress = memberFeignClient.getMemberAddress(orderSubmitVo.getMemberAddressId());
order.setReceiverName(memberAddress.getReciverName());
order.setReceiverPhone(memberAddress.getReciverPhone());
order.setReceiverPostCode("todo");
order.setReceiverProvince(memberAddress.getProvince());
order.setReceiverCity(memberAddress.getCity());
order.setReceiverRegion(memberAddress.getDistrict());
order.setReceiverDetailAddress(memberAddress.getDetailAddress());
order.setCreatedBy(member.getUsername());
order.setUpdatedBy(member.getUsername());
// 3. 配置支付类型
order.setPayType(orderSubmitVo.getPayType());
order.setOrderComment(orderSubmitVo.getOrderComment());
return order;
}
Aggregations