package com.fjhx.controller.purchase;

import com.fjhx.entity.purchase.Purchase;
import com.fjhx.service.purchase.PurchaseFlowService;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 采购：流程 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-12-01
 */
@RestController
@RequestMapping("/purchase/flow")
public class PurchaseFlowController {

    @Autowired
    private PurchaseFlowService purchaseFlowService;

    /**
     * 发起
     *
     * @param entity
     * @return
     */
    @PostMapping(value = "/start")
    public R start(@RequestBody Purchase entity) {
        purchaseFlowService.start(entity);
        return R.success();
    }

    /**
     * 审批
     *
     * @param entity
     * @return
     */
    @PostMapping(value = "/examine")
    public R examine(@RequestBody Purchase entity) {
        purchaseFlowService.examine(entity);
        return R.success();
    }

    /**
     * 详情
     *
     * @param entity
     * @return
     */
    @PostMapping(value = "/details")
    public R details(@RequestBody Purchase entity) {
        Purchase details = purchaseFlowService.details(entity);
        return R.success(details);
    }

}

