package com.njcn.utils;

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

import java.io.File;
import java.io.Serializable;
import java.net.URL;

@Component("appConfig")
public class AppConfig implements Serializable {

    @Value("${WAVE_PATH}")
    private String wavePath;

    @Value("${TMP_PATH}")
    private String tmppath;

    @Value("${SYS_TYPE}")
    private String sysType;

    @Value("${SYS_TYPE_ZT}")
    private String sysTypeZt;

    @Value("${SYS_TYPE_WT}")
    private String sysTypeWt;

    @Value("${PID_Number}")
    private String pidNumber;

    @Value("${REPORT_DAY:1}")
    private int reportday;

    @Value("${ZOOKEEPER}")
    private String zOOKEEPER;

    @Value("${GROUPID}")
    private String gROUPID;

    @Value("${TOPIC}")
    private String tOPIC;

    @Value("${KAFKA_LOG}")
    private String kAFKA_LOG;

    @Value("${REPORT_PATH}")
    private String reportPath;

    @Value("${WEBSOCKET}")
    private String websocket;

    @Value("${SOCKETPORT}")
    private String socketPort;

    @Value("${SSO_URL}")
    private String ssoUrl;

    @Value("${SSO_JUDGE}")
    private String ssoJudge;

    @Value("${ONE_CONTAINER}")
    private boolean oneContainer;

    @Value("${pqs9200.regist.url}")
    private String pqs9200RegistUrl;

    @Value("${pqs9000.regist.url}")
    private String pqs9000RegistUrl;

    @Value("${MAIL_FLAG}")
    private String mailflag;
    
    @Value("${MAIL_HOST}")
    private String mailhost;

    @Value("${MAIL_ADDRESS}")
    private String mailAddress;

    @Value("${SMTP_NUM}")
    private String smtpnum;

    @Value("${SYSTEM_FLAG}")
    private String systemFlag;

    @Value("${MSG_USER}")
    private String msgUser;

    @Value("${MSG_PASSWORD}")
    private String msgPassword;

    @Value("${overRunDay}")
    private Integer overRunDay;

    @Value("${SYSTEM_HOST}")
    private String systemHost;

    @Value("${CDKEY_ENCY:1}")
    private Integer cdkeyEncy;


    @Value("${THIRDNAME:四川专职第三方}")
    private String thirdName;

    public String getMsgUser() {
        return msgUser;
    }

    public void setMsgUser(String msgUser) {
        this.msgUser = msgUser;
    }

    public String getMsgPassword() {
        return msgPassword;
    }

    public void setMsgPassword(String msgPassword) {
        this.msgPassword = msgPassword;
    }

    public String getReportPath() {
        return reportPath;
    }

    public void setReportPath(String reportPath) {
        this.reportPath = reportPath;
    }

    public String getPqs9200RegistUrl() {
        return pqs9200RegistUrl;
    }

    public void setPqs9200RegistUrl(String pqs9200RegistUrl) {
        this.pqs9200RegistUrl = pqs9200RegistUrl;
    }

    public String getPqs9000RegistUrl() {
        return pqs9000RegistUrl;
    }

    public void setPqs9000RegistUrl(String pqs9000RegistUrl) {
        this.pqs9000RegistUrl = pqs9000RegistUrl;
    }

    public boolean isOneContainer() {
        return oneContainer;
    }

    public void setOneContainer(boolean oneContainer) {
        this.oneContainer = oneContainer;
    }

    public String getSsoJudge() {
        return ssoJudge;
    }

    public void setSsoJudge(String ssoJudge) {
        this.ssoJudge = ssoJudge;
    }

    public String getTmppath() {
        File file = new File(tmppath);
        // 判断目录或文件是否存在
        if (!file.exists()) {  // 不存在
            //String separator = File.separator+"";
            String strClassName = getClass().getName();
            String strPackageName = "";
            if (getClass().getPackage() != null) {
                strPackageName = getClass().getPackage().getName();
            }
            String strClassFileName = "";
            if (!"".equals(strPackageName)) {
                strClassFileName = strClassName.substring(strPackageName.length() + 1,
                        strClassName.length());
            } else {
                strClassFileName = strClassName;
            }
            URL url = null;
            url = getClass().getResource(strClassFileName + ".class");
            String strURL = url.toString();
            strURL = strURL.substring(strURL.indexOf('/') + 1, strURL
                    .lastIndexOf('/'));
            return strURL.substring(0, strURL.indexOf("/"));
        } else {
            return tmppath;
        }
    }

    public void setTmppath(String tmppath) {
        this.tmppath = tmppath;
    }

    public String getWavePath() {
        File file = new File(wavePath);
        // 判断目录或文件是否存在
        if (!file.exists()) {  // 不存在
            //String separator = File.separator+"";
            String strClassName = getClass().getName();
            String strPackageName = "";
            if (getClass().getPackage() != null) {
                strPackageName = getClass().getPackage().getName();
            }
            String strClassFileName = "";
            if (!"".equals(strPackageName)) {
                strClassFileName = strClassName.substring(strPackageName.length() + 1,
                        strClassName.length());
            } else {
                strClassFileName = strClassName;
            }
            URL url = null;
            url = getClass().getResource(strClassFileName + ".class");
            String strURL = url.toString();
            strURL = strURL.substring(strURL.indexOf('/') + 1, strURL
                    .lastIndexOf('/'));
            return strURL.substring(0, strURL.indexOf("/")) + File.separator + "Comtrade";
        } else {
            return wavePath;
        }
    }

    public void setWavePath(String wavePath) {
        this.wavePath = wavePath;
    }

    public String getSysType() {
        return sysType;
    }

    public void setSysType(String sysType) {
        this.sysType = sysType;
    }

    public String getSysTypeZt() {
        return sysTypeZt;
    }

    public void setSysTypeZt(String sysTypeZt) {
        this.sysTypeZt = sysTypeZt;
    }

    public String getSysTypeWt() {
        return sysTypeWt;
    }

    public void setSysTypeWt(String sysTypeWt) {
        this.sysTypeWt = sysTypeWt;
    }

    public String getPidNumber() {
        return pidNumber;
    }

    public void setPidNumber(String pidNumber) {
        this.pidNumber = pidNumber;
    }

    public String getSsoUrl() {
        return ssoUrl;
    }

    public void setSsoUrl(String ssoUrl) {
        this.ssoUrl = ssoUrl;
    }

    public String getzOOKEEPER() {
        return zOOKEEPER;
    }

    public void setzOOKEEPER(String zOOKEEPER) {
        this.zOOKEEPER = zOOKEEPER;
    }

    public String getgROUPID() {
        return gROUPID;
    }

    public void setgROUPID(String gROUPID) {
        this.gROUPID = gROUPID;
    }

    public String gettOPIC() {
        return tOPIC;
    }

    public void settOPIC(String tOPIC) {
        this.tOPIC = tOPIC;
    }

    public String getkAFKA_LOG() {
        return kAFKA_LOG;
    }

    public void setkAFKA_LOG(String kAFKA_LOG) {
        this.kAFKA_LOG = kAFKA_LOG;
    }

    public String getWebsocket() {
        return websocket;
    }

    public void setWebsocket(String websocket) {
        this.websocket = websocket;
    }

    public int getReportday() {
        return reportday;
    }

    public void setReportday(int reportday) {
        this.reportday = reportday;
    }

    public String getMailflag() {
		return mailflag;
	}

	public void setMailflag(String mailflag) {
		this.mailflag = mailflag;
	}

	public String getMailhost() {
        return mailhost;
    }

    public void setMailhost(String mailhost) {
        this.mailhost = mailhost;
    }

    public String getMailAddress() {
        return mailAddress;
    }

    public void setMailAddress(String mailAddress) {
        this.mailAddress = mailAddress;
    }

    public String getSmtpnum() {
        return smtpnum;
    }

    public void setSmtpnum(String smtpnum) {
        this.smtpnum = smtpnum;
    }

    public String getSystemFlag() {
        return systemFlag;
    }

    public void setSystemFlag(String systemFlag) {
        this.systemFlag = systemFlag;
    }

    public String getSocketPort() {
        return socketPort;
    }

    public void setSocketPort(String socketPort) {
        this.socketPort = socketPort;
    }

    public Integer getOverRunDay() {
        return overRunDay;
    }

    public void setOverRunDay(Integer overRunDay) {
        this.overRunDay = overRunDay;
    }

    public String getSystemHost() {
        return systemHost;
    }

    public void setSystemHost(String systemHost) {
        this.systemHost = systemHost;
    }

    public Integer getCdkeyEncy() {
        return cdkeyEncy;
    }

    public void setCdkeyEncy(Integer cdkeyEncy) {
        this.cdkeyEncy = cdkeyEncy;
    }

    public String getThirdName() {
        return thirdName;
    }

    public void setThirdName(String thirdName) {
        this.thirdName = thirdName;
    }
}
