use of com.paascloud.provider.model.domain.OmcOrder in project paascloud-master by paascloud.
the class OmcOrderServiceImpl method getOrderDetail.
@Override
public OrderVo getOrderDetail(Long userId, String orderNo) {
logger.info("获取订单明细, userId={}, orderNo={}", userId, orderNo);
OmcOrder order = omcOrderMapper.selectByUserIdAndOrderNo(userId, orderNo);
if (null == order) {
throw new OmcBizException(ErrorCodeEnum.OMC10031005, orderNo);
}
List<OmcOrderDetail> orderItemList = omcOrderDetailService.getListByOrderNoUserId(orderNo, userId);
return assembleOrderVo(order, orderItemList);
}
use of com.paascloud.provider.model.domain.OmcOrder in project paascloud-master by paascloud.
the class OmcOrderServiceImpl method cancelOrderDoc.
@Override
public int cancelOrderDoc(LoginAuthDto loginAuthDto, String orderNo) {
Long userId = loginAuthDto.getUserId();
OmcOrder order = omcOrderMapper.selectByUserIdAndOrderNo(userId, orderNo);
if (order == null) {
logger.error("该用户此订单不存在, userId={}, orderNo={}", userId, orderNo);
throw new OmcBizException(ErrorCodeEnum.OMC10031003);
}
if (order.getStatus() != OmcApiConstant.OrderStatusEnum.NO_PAY.getCode()) {
throw new OmcBizException(ErrorCodeEnum.OMC10031004);
}
OmcOrder updateOrder = new OmcOrder();
updateOrder.setId(order.getId());
updateOrder.setStatus(OmcApiConstant.OrderStatusEnum.CANCELED.getCode());
return omcOrderMapper.updateByPrimaryKeySelective(updateOrder);
}
use of com.paascloud.provider.model.domain.OmcOrder in project paascloud-master by paascloud.
the class OmcOrderServiceImpl method queryOrderDtoByOrderNo.
@Override
public OrderDto queryOrderDtoByOrderNo(String orderNo) {
OmcOrder omcOrder = this.queryByOrderNo(orderNo);
if (omcOrder == null) {
throw new OmcBizException(ErrorCodeEnum.OMC10031005, orderNo);
}
ModelMapper modelMapper = new ModelMapper();
return modelMapper.map(omcOrder, OrderDto.class);
}
use of com.paascloud.provider.model.domain.OmcOrder in project paascloud-master by paascloud.
the class OmcOrderServiceImpl method assembleOrderVoList.
private List<OrderVo> assembleOrderVoList(List<OmcOrder> orderList, Long userId) {
List<OrderVo> orderVoList = Lists.newArrayList();
for (OmcOrder order : orderList) {
List<OmcOrderDetail> orderItemList;
if (userId == null) {
orderItemList = omcOrderDetailService.getListByOrderNo(order.getOrderNo());
} else {
orderItemList = omcOrderDetailService.getListByOrderNoUserId(order.getOrderNo(), userId);
}
OrderVo orderVo = assembleOrderVo(order, orderItemList);
orderVoList.add(orderVo);
}
return orderVoList;
}
use of com.paascloud.provider.model.domain.OmcOrder in project paascloud-master by paascloud.
the class OmcOrderServiceImpl method assembleOrder.
private OmcOrder assembleOrder(Long userId, Long shippingId, BigDecimal payment) {
OmcOrder order = new OmcOrder();
long orderNo = this.generateOrderNo();
order.setOrderNo(String.valueOf(orderNo));
order.setStatus(OmcApiConstant.OrderStatusEnum.NO_PAY.getCode());
order.setPostage(0);
order.setPaymentType(GlobalConstant.PaymentTypeEnum.ONLINE_PAY.getCode());
order.setPayment(payment);
order.setUserId(userId);
order.setShippingId(shippingId);
order.setId(super.generateId());
// 发货时间等等
// 付款时间等等
int rowCount = omcOrderMapper.insertSelective(order);
if (rowCount > 0) {
return order;
}
return null;
}
Aggregations