use of com.actionworks.flashsale.app.model.command.FlashPlaceOrderCommand in project flash-sale by ThoughtsBeta.
the class FlashOrderController method placeOrder.
@PostMapping(value = "/flash-orders")
@SentinelResource("PlaceOrderResource")
public SingleResponse<PlaceOrderResult> placeOrder(@RequestAttribute Long userId, @RequestBody FlashPlaceOrderRequest flashPlaceOrderRequest) {
FlashPlaceOrderCommand placeOrderCommand = FlashOrderBuilder.toCommand(flashPlaceOrderRequest);
AppSimpleResult<PlaceOrderResult> placeOrderResult = flashOrderAppService.placeOrder(userId, placeOrderCommand);
if (!placeOrderResult.isSuccess() || placeOrderResult.getData() == null) {
return ResponseBuilder.withSingle(placeOrderResult);
}
return SingleResponse.of(placeOrderResult.getData());
}
use of com.actionworks.flashsale.app.model.command.FlashPlaceOrderCommand in project flash-sale by ThoughtsBeta.
the class FlashOrderBuilder method toCommand.
public static FlashPlaceOrderCommand toCommand(FlashPlaceOrderRequest flashPlaceOrderRequest) {
FlashPlaceOrderCommand flashPlaceOrderCommand = new FlashPlaceOrderCommand();
BeanUtils.copyProperties(flashPlaceOrderRequest, flashPlaceOrderCommand);
return flashPlaceOrderCommand;
}
Aggregations