package com.xhkjedu.sapi.config;

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

import java.io.UnsupportedEncodingException;

/**
 * @author ywx
 * @classname ConfigKey
 * @description 读取配置文件类
 * @date 2020/10/16 9:19
 **/
@Component
public class ConfigKey {

    public static Integer nummin;
    public static Integer nummax;
    public static Integer numadd;

    @Value("${nummin}")
    public void setNummin(Integer nummin) {
        ConfigKey.nummin = nummin;
    }

    @Value("${nummax}")
    public void setNummax(Integer nummax) {
        ConfigKey.nummax = nummax;
    }

    @Value("${numadd}")
    public void setNumadd(Integer numadd) {
        ConfigKey.numadd = numadd;
    }

    public static Integer redisdatatime;//缓存访问数据有效时长
    public static String secretKey;//secretKey必须为24位

    @Value("${redisdatatime}")
    public void setRedisdatatime(Integer redisdatatime) {
        ConfigKey.redisdatatime = redisdatatime;
    }

    @Value("${secretKey}")
    public void setSecretKey(String secretKey) {
        ConfigKey.secretKey = secretKey;
    }

    public static String cloudapi;//云平台接口
    public static String showurl;//文件访问路径
    public static String oldshowurl;//原文件访问路径
    public static String fileapi;//文件服务接口地址
    public static String dbname;//数据库名

    @Value("${cloudapi}")
    public void setCloudapi(String cloudapi) {
        this.cloudapi = cloudapi;
    }

    @Value("${file.showurl}")
    public void setShowurl(String showurl) {
        this.showurl = showurl;
    }

    @Value("${file.oldshowurl}")
    public void setOldshowurl(String oldshowurl) {
        this.oldshowurl = oldshowurl;
    }

    @Value("${fileapi}")
    public void setFileapi(String fileapi) {
        this.fileapi = fileapi;
    }

    @Value("${dbname}")
    public void setDbname(String dbname) {
        ConfigKey.dbname = dbname;
    }

    //领创对接参数
    public static String lcVisiturl;
    public static String lcAppId;
    public static String lcSecurityKey;
    public static String lcSchoolPrefix;

    @Value("${lc.lc_visiturl}")
    public void setLcVisiturl(String lcVisiturl){
        ConfigKey.lcVisiturl = lcVisiturl;
    }
    @Value("${lc.lc_app_id}")
    public void setLcAppId(String lcAppId){
        ConfigKey.lcAppId = lcAppId;
    }
    @Value("${lc.lc_security_key}")
    public void setLcSecurityKey(String lcSecurityKey){
        ConfigKey.lcSecurityKey = lcSecurityKey;
    }

    @Value("${lc.lc_school_prefix}")
    public void setLcSchoolPrefix(String lcSchoolPrefix){
        ConfigKey.lcSchoolPrefix = lcSchoolPrefix;
    }

    public static Integer syncnum;//一次同步数量

    @Value("${cron.syncnum}")
    public void setSyncnum(Integer syncnum) {
        ConfigKey.syncnum = syncnum;
    }
}
