Search in sources :

Example 1 with QueuedPlaceOrderService

use of com.actionworks.flashsale.app.service.placeorder.queued.QueuedPlaceOrderService in project flash-sale by ThoughtsBeta.

the class DefaultFlashOrderAppService method getPlaceOrderTaskResult.

@Override
public AppSimpleResult<OrderTaskHandleResult> getPlaceOrderTaskResult(Long userId, Long itemId, String placeOrderTaskId) {
    if (userId == null || itemId == null || StringUtils.isEmpty(placeOrderTaskId)) {
        throw new BizException(INVALID_PARAMS);
    }
    if (placeOrderService instanceof QueuedPlaceOrderService) {
        QueuedPlaceOrderService queuedPlaceOrderService = (QueuedPlaceOrderService) placeOrderService;
        OrderTaskHandleResult orderTaskHandleResult = queuedPlaceOrderService.getPlaceOrderResult(userId, itemId, placeOrderTaskId);
        if (!orderTaskHandleResult.isSuccess()) {
            return AppSimpleResult.failed(orderTaskHandleResult.getCode(), orderTaskHandleResult.getMessage(), orderTaskHandleResult);
        }
        return AppSimpleResult.ok(orderTaskHandleResult);
    } else {
        return AppSimpleResult.failed(ORDER_TYPE_NOT_SUPPORT);
    }
}
Also used : QueuedPlaceOrderService(com.actionworks.flashsale.app.service.placeorder.queued.QueuedPlaceOrderService) OrderTaskHandleResult(com.actionworks.flashsale.app.model.result.OrderTaskHandleResult) BizException(com.actionworks.flashsale.app.exception.BizException)

Aggregations

BizException (com.actionworks.flashsale.app.exception.BizException)1 OrderTaskHandleResult (com.actionworks.flashsale.app.model.result.OrderTaskHandleResult)1 QueuedPlaceOrderService (com.actionworks.flashsale.app.service.placeorder.queued.QueuedPlaceOrderService)1