package com.sunxung.factoring.web.financing;

import com.sunxung.factoring.entity.ResponseJson;
import com.sunxung.factoring.entity.financing.apply.CFinancingBasicInfo;
import com.sunxung.factoring.entity.financing.contract.ContractSignConfirm;
import com.sunxung.factoring.service.financing.apply.FinancingApplyService;
import com.sunxung.factoring.service.financing.contract.IContractSignConfirmService;
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;

/**
 * @Description : 融资申请对外接口
 * @Author : L.Jia
 * @Date: 2024-01-03 14:46
 */

@RestController
@RequestMapping("/api/financing")
public class FinancingApplyApiController {

    @Autowired
    private FinancingApplyService financingApplyService;
    @Autowired
    private IContractSignConfirmService contractSignConfirmService;

    /***
     * C端融资申请提交，B端开启审批流
     * @param financingBasicInfo
     * @return
     */
    @PostMapping("/startApply")
    public ResponseJson apply(@RequestBody CFinancingBasicInfo financingBasicInfo) {
        financingApplyService.startProcess(financingBasicInfo);
        return new ResponseJson("提交成功");
    }

    /***
     * C端合同签署提交
     * @param contractSignConfirm
     * @return
     */
    @PostMapping("/editContractSignConfirm")
    public ResponseJson editContractSignConfirm(@RequestBody ContractSignConfirm contractSignConfirm) {
        contractSignConfirmService.editContractSignConfirm(contractSignConfirm);
        return new ResponseJson("提交成功");
    }
}
