package com.zt.plat.module.erp.api;

import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.erp.api.dto.BillMainSubmitErpReqDTO;
import com.zt.plat.module.erp.api.dto.ErpBillMainSaveReqDTO;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpBillMainSaveReqVO;
import com.zt.plat.module.erp.service.erp.ErpBillMainService;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Validated
@Slf4j
public class ErpBillMainApiImpl implements ErpBillMainApi{

    @Resource
    private ErpBillMainService erpBillMainService;

    @Override
    public String submitBillMainToErp(ErpBillMainSaveReqDTO reqDTO) {
        ErpBillMainSaveReqVO erpBillMainSaveReqDTO = BeanUtils.toBean(reqDTO,ErpBillMainSaveReqVO.class);
        return erpBillMainService.submitBillMainToErp(erpBillMainSaveReqDTO);
    }

    @Override
    public String submitBillMainReverseToErp(ErpBillMainSaveReqDTO reqDTO) {
        ErpBillMainSaveReqVO erpBillMainSaveReqDTO = BeanUtils.toBean(reqDTO,ErpBillMainSaveReqVO.class);
        return erpBillMainService.submitBillMainReverseToErp(erpBillMainSaveReqDTO);
    }

    @Override
    public String submitErp(BillMainSubmitErpReqDTO reqDTO) {
        return erpBillMainService.submitErp(reqDTO);
    }
}
