package com.gz.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author LiuchangLan
 * @date 2021/2/25 17:40
 */
@Slf4j
@Configuration
public class FileUploadConfig {

    /** 文档附件根目录地址*/
    public static String ARCHIVE_FILE_ROOT_DIRECTORY;

    /** 附件根目录地址*/
    public static String FILE_ROOT_DIRECTORY;

    /** 附件上传目录 归档年份/全宗号-保管期限（归档年度）-文件格式   文件格式只有 PDF和TF*/
    public static final String ARCHIVE_UPLOAD_PATH_PDF_FOMAT = "/%s/%s-%s（%s）-%s";

    public static final String ARCHIVE_UPLOAD_PATH_TIF_FOMAT = "/%s/%s-%s（%s）-%s/%s";

    @Value("${upload-file.archive-file-root-directory}")
    public void setArchiveFileRootDirectory(String uploadFileRootDirectory) {
        log.info("文档附件根目录地址:{}",uploadFileRootDirectory);
        ARCHIVE_FILE_ROOT_DIRECTORY = uploadFileRootDirectory;
    }


    @Value("${upload-file.file-root-directory}")
    public void setFileRootDirectory(String uploadFileRootDirectory) {
        log.info("其他附件根目录地址:{}",uploadFileRootDirectory);
        FILE_ROOT_DIRECTORY = uploadFileRootDirectory;
    }
}
