package com.jtyjy.pdf2pptx.controller;

import com.jtyjy.pdf2pptx.service.ConverterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ConvertController {

    @Autowired
    private ConverterService converterService;

    @PostMapping("/file/convert")
    public Object convert(String filePath){
        long totalTime = converterService.converterPdf2Pptx(filePath);
        Map<String,Object> data = new HashMap();
        data.put("code",0);
        data.put("message","文件转换完成，耗时："+totalTime+"ms");
        return data;
    }

}
