package com.ruoyi.web.controller.common;

import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.utils.SendSmsUtils;
import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.system.domain.vo.WordVo;
import org.springframework.security.access.prepost.PreAuthorize;
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;
import org.xlsx4j.sml.Worksheet;

import java.util.concurrent.TimeUnit;

import static com.ruoyi.common.constant.CommonConstants.LOGIN_USER_SMS;

/**
 * @Author: tjf
 * @Date: 2024/5/15 10:35
 * @Describe:
 */
@RestController
@RequestMapping("/word")
public class WordController {
    /**
     * word文档签名
     *
     * @return
     */
    @PostMapping("/wordFilePath")
    @PreAuthorize("@ss.hasPermi('word:wordFilePath:wordFilePath')")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult wordFilePath(@RequestBody WordVo wordVo) {
        String wordFilePath = wordVo.getWordFilePath();
        String image = wordVo.getImage();
        AjaxResult ajaxResult = WordUtil.wordFilePath(wordFilePath, image);
        return ajaxResult;
    }

    /**
     * Excel文档签名
     *
     * @return
     */
    @PostMapping("/excelFilePath")
    @PreAuthorize("@ss.hasPermi('word:excelFilePath:excelFilePath')")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult excelFilePath(@RequestBody WordVo wordVo) {
        //excel表格位置
        String excelFilePath = wordVo.getWordFilePath();
        //图片
        String image = wordVo.getImage();
        return AjaxResult.success();
    }
}
