package com.xhkjedu.sexam.utils;

import com.xhkjedu.sexam.listener.MessageSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author ywx
 * @classname ConvertUtil
 * @description 文件转换工具类
 * @date 2021/10/27 9:32
 **/
@Component
public class ConvertUtil {
    @Autowired
    private MessageSender messageSender;

    /**
     * 学生答案图片合并mq
     *
     * @param [psqid, userAnswers, device(1线上线下2答题卡)]
     * @return void
     * @author ywx
     * @date 2022/5/9 14:57
     */
    public void imgMerge(Integer psqid, List<String> userAnswers, Integer device) {
        messageSender.imgMerge(psqid, userAnswers, device);
    }

    /**
     * @Description  答题卡base64转pdf
     * @Param [epid, examid, imgs, savefolder]
     * @Return void
     * @Author wn
     * @Date 2022/8/2 17:20
     **/
    public void baseToPdf(Integer examid,Integer epid, List<String> imgs, String savefolder,Integer scantroncol,String filename) {
        messageSender.base64ToPdf(examid,epid,imgs, savefolder,scantroncol,filename);
    }

    /**
     * @Description 扫码出错答题卡base64转图片
     * @Param [serrorid, imgs, savefolder]
     * @Return void
     * @Author wn
     * @Date 2022/9/19 9:50
     **/
    public void baseToScanImg(Integer serrorid,Integer examid, List<String> imgs, String savefolder) {
        messageSender.base64ToScanImg(serrorid,examid,imgs,savefolder);
    }


    /** 考试附件试卷图片转pdf
     * @Description
     * @Param [imgs, epid]
     * @Return void
     * @Author wn
     * @Date 2022/11/1 10:51
     **/
    public void imgToPdf(List<String> imgs,Integer epid){
        messageSender.ImgToPdf(imgs,epid);
    }

    /**
     * @Description 考试报告html转pdf
     * @Param [map]
     * @Author ywx
     * @Date 2023/2/14 11:24
     * @return void
     **/
    public void htmlToPdf(Map map) {
        messageSender.htmlToPdf(map);
    }
}
