package com.malk.pake.controller;

import com.malk.pake.service.DingOaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/yidaservice")
//@CrossOrigin//解决跨域问题
public class DingOaController {

    @Autowired
    private DingOaService dingOaService;

    //更新商机申报表单关联表单控件
    @PostMapping("updateShangjishenbao")
    public String updateShangjishenbao(String formInstanceId, String shenbaoName){

        String updateShangjishenbao = dingOaService.updateShangjishenbao(formInstanceId, shenbaoName);
        return updateShangjishenbao;
    }

    //商机周报通过后同步创建商机跟进表单
    @PostMapping("createShangjigenjin")
    public String createShangjigenjin(String formInstanceId,String user,String time){

        String createShangjigenjin = dingOaService.createShangjigenjin(formInstanceId,user,time);
        return createShangjigenjin;
    }

    //商机跟进表单通过后同步创建商机档案表的页签明细
    @PostMapping("createShangjiDangan")
    public String createShangjiDangan(String formInstanceId){

        String createShangjiDangan = dingOaService.createShangjiDangan(formInstanceId);
        return createShangjiDangan;
    }

    //采购合同发起用印通过后同步更新合同用印表单关联采购合同表单控件
    @PostMapping("updateHetongyongyin")
    public String updateHetongyongyin(String caigouhetongliushuihao, String caigouhetongName){

        String updateHetongyongyin = dingOaService.updateHetongyongyin(caigouhetongliushuihao,caigouhetongName);
        return updateHetongyongyin;
    }
}