Search in sources :

Example 1 with UnauthorizedException

use of com.amusing.start.exception.UnauthorizedException in project amusing-project by m-lvqingyu.

the class OrderInfoController method create.

/**
 * 订单创建
 *
 * @param from  订单信息
 * @return
 */
@PostMapping("create/v1")
public ApiResult<String> create(@Valid @RequestBody CreateFrom from) throws OrderException, UnauthorizedException {
    CreateDto createDto = fromToDto(from);
    String orderId = "";
    try {
        orderId = orderCreateService.create(createDto);
    } catch (Exception e) {
        log.error("[Order]-[create]-msg:{}", Throwables.getStackTraceAsString(e));
    }
    return StringUtils.isEmpty(orderId) ? ApiResult.result(OrderCode.ORDER_SAVE_FAIL) : ApiResult.ok(orderId);
}
Also used : UnauthorizedException(com.amusing.start.exception.UnauthorizedException) OrderException(com.amusing.start.order.exception.OrderException) CreateDto(com.amusing.start.order.dto.create.CreateDto) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

UnauthorizedException (com.amusing.start.exception.UnauthorizedException)1 CreateDto (com.amusing.start.order.dto.create.CreateDto)1 OrderException (com.amusing.start.order.exception.OrderException)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1