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

import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.ShipOrderVO;
import com.xunhong.erp.turbo.biz.app.assembler.ShipOrderAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.ShipOrder;
import com.xunhong.erp.turbo.biz.domain.gateway.ShipOrderGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final ShipOrderAssembler shipOrderAssembler;
	private final ShipOrderGateway shipOrderGateway;

	public ShipOrderVO execute(ShipOrderCreateCmd shipOrderCreateCmd) {
		ShipOrder shipOrder = shipOrderGateway.save(shipOrderCreateCmd);

		return shipOrderAssembler.toShipOrderVO(shipOrder);
	}
}

