...
|
...
|
@@ -49,6 +49,73 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
BuyerOrderMetaMapper buyerOrderMetaMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 提交订单
|
|
|
* @param orderRequest
|
|
|
*/
|
|
|
public void confirm(OrderRequest orderRequest){
|
|
|
|
|
|
// 参数检查 ![待收货] 不合法
|
|
|
checkStatusAndRequest(orderRequest, OrderStatus.WAITING_RECEIVE);
|
|
|
|
|
|
// TODO 更新状态为待收货
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 取消订单
|
|
|
* @param orderRequest
|
|
|
*/
|
|
|
public void cancel(OrderRequest orderRequest){
|
|
|
|
|
|
// 状态 ![待付款] 不合法
|
|
|
checkStatusAndRequest(orderRequest, OrderStatus.WAITING_PAY);
|
|
|
|
|
|
// TODO
|
|
|
// 更新订单状态
|
|
|
// 更新skup的状态[可售] 卖家订单为[出售中]
|
|
|
// 减product skup的库存
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param orderRequest
|
|
|
* @param orderStatusEx
|
|
|
*/
|
|
|
private void checkStatusAndRequest(OrderRequest orderRequest, OrderStatus orderStatusEx ) {
|
|
|
// 参数检查
|
|
|
if (orderRequest.getUid() < 0
|
|
|
|| orderRequest.getOrderCode() < 0){
|
|
|
logger.warn("check uid or orderCode empty");
|
|
|
throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
|
|
|
}
|
|
|
|
|
|
// 订单存在 & 待付款的状态
|
|
|
// 查询订单状态
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderRequest.getOrderCode(), orderRequest.getUid());
|
|
|
if (buyerOrder == null){
|
|
|
logger.warn("check orderCode exist, uid is {}, orderCode is {}",
|
|
|
orderRequest.getUid(), orderRequest.getOrderCode() );
|
|
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
}
|
|
|
|
|
|
// 检查 订单状态
|
|
|
int status = buyerOrder.getStatus() == null ? -1 : buyerOrder.getStatus().intValue();
|
|
|
OrderStatus orderStatus = OrderStatus.getOrderStatus(status);
|
|
|
if (orderStatus == null || orderStatus.getCode() != orderStatusEx.getCode()){
|
|
|
logger.warn("check status invalidate, uid is {}, orderCode is {}, status is {}",
|
|
|
orderRequest.getUid(), orderRequest.getOrderCode(), buyerOrder.getStatus());
|
|
|
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取订单详情
|
|
|
* @param orderRequest
|
|
|
* @return
|
|
|
*/
|
|
|
public OrderDetailInfo getOrderDetail(OrderRequest orderRequest){
|
|
|
|
|
|
// 参数检查
|
...
|
...
|
|