package com.malk.hangfu.controller;

import com.malk.hangfu.service.HangfuService;
import com.malk.server.common.McR;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;
import java.util.Objects;

/**
 * 功能：
 * 作者：hanxue
 * 日期：2025/11/6 15:24
 */
@RequestMapping
@RestController
public class FiletoDingController {
    @Autowired
    private HangfuService hangfuService;


//    同步审批流程的附件到钉盘
    @PostMapping("/syncFileToDing")
    public McR syncFileToDing(@RequestBody Map<String, Object> param) throws IOException {
        if (Objects.nonNull(param.get("formInstId"))){
            return hangfuService.syncFileToDing(param);
        }
        return McR.errorParam("实例id不能为空！");

    }


//    同步金蝶附件到钉盘
@PostMapping("/syncKindeeToDing")
public McR syncKindeeToDing(@RequestBody Map<String, Object> param) throws Exception {
    if (Objects.nonNull(param.get("formInstId"))){
        return hangfuService.syncKindeeToDing(param);
    }
    return McR.errorParam("实例id不能为空！");

}



}
