package com.xunhong.erp.turbo.biz.app.executor.cmd;

import com.xunhong.erp.turbo.api.biz.dto.cmd.OrderCostCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.OrderCostVO;
import com.xunhong.erp.turbo.biz.app.assembler.OrderCostAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.OrderCost;
import com.xunhong.erp.turbo.biz.domain.gateway.OrderCostGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author shenyifei
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class OrderCostCreateCmdExe {

	private final OrderCostAssembler orderCostAssembler;
	private final OrderCostGateway orderCostGateway;

	public OrderCostVO execute(OrderCostCreateCmd orderCostCreateCmd) {
		OrderCost orderCost = orderCostGateway.save(orderCostCreateCmd);

		return orderCostAssembler.toOrderCostVO(orderCost);
	}
}

