package cn.iocoder.yudao.module.bpm.api.oa;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.api.oa.vo.invoice.BpmOAInvoiceDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.invoice.BpmOAInvoiceCreateReqVO;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAInvoiceService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

/**
 * Flowable 流程实例 Api 实现类
 */
@RestController
@Validated
public class BpmOAInvoiceApiImpl implements BpmOAInvoiceApi{

    @Resource
    private BpmOAInvoiceService invoiceService;


    @Override
    public CommonResult<Long> create(BpmOAInvoiceDTO createReqVO) {

        return success(invoiceService.createInvoice(getLoginUserId(), BeanUtils.toBean(createReqVO, BpmOAInvoiceCreateReqVO.class)));
    }
}
