package com.dtok.framework.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class UploadUtils {


    private static String tempDir;

    @Value("${file.tempDir}")
    public void setTempDir(String tempDir1){
        tempDir = tempDir1;
    }

    public static String getExcelDirFile() {

        // 构建上传文件的存放 "文件夹" 路径
        String fileDirPath = new String(tempDir);

        File fileDir = new File(fileDirPath);
        if (!fileDir.exists()) {
            // 递归生成文件夹
            fileDir.mkdirs();
        }
        return fileDir.getAbsolutePath();
    }
}
