SystemParamCache.java 3.32 KB
package com.bsth.data;

import com.bsth.common.SystemParamKeys;
import com.bsth.service.SystemParamService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Hill
 */
@Component
public class SystemParamCache implements InitializingBean {

    @Autowired
    private SystemParamService systemParamService;

    private static SystemParamService systemParamService1;

    public static String getSpecialRoles() {
        return systemParamService1.getValue(SystemParamKeys.SPECIAL_ROLES);
    }

    public static String getUrlHttpGpsRealCache() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL_CACHE);
    }

    public static String getUrlHttpGpsReal() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL);
    }

    public static String getUrlHttpDirective() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DIRECTIVE);
    }

    public static String getUrlHttpRfid() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_RFID);
    }

    public static String getUrlHttpReport(String param) {
        return systemParamService1.getValue(String.format(SystemParamKeys.URL_HTTP_REPORT, param));
    }

    public static String getUrlHttpTicketing() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_TICKETING);
    }

    public static String getUrlHttpDsmAck() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DSM_ACK);
    }

    public static String getUrlHttpCpAck() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_CP_ACK);
    }

    public static String getMailAdmin() {
        return systemParamService1.getValue(SystemParamKeys.MAIL_ADMIN);
    }

    public static String getMailWaybill() {
        return systemParamService1.getValue(SystemParamKeys.MAIL_WAYBILL);
    }

    public static boolean getEnabledFirstLastGeneration() {
        return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FIRST_LAST_GENERATION));
    }

    public static boolean getEnabledFilterSqlInjection() {
        return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_FILTER_SQL_INJECTION));
    }

    public static boolean getEnabledSso() {
        return Boolean.parseBoolean(systemParamService1.getValue(SystemParamKeys.ENABLED_SSO));
    }

    public static String getSsoSystemCode() {
        return systemParamService1.getValue(SystemParamKeys.SSO_SYSTEM_CODE);
    }

    public static String getUrlHttpSsoLogin() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGIN);
    }

    public static String getUrlHttpSsoLogout() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_LOGOUT);
    }

    public static final String URL_HTTP_SSO_AUTH = "url.http.sso.auth";
    public static String getUrlHttpSsoAuth() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_SSO_AUTH);
    }

    public static String getUrlHttpPwd() {
        return systemParamService1.getValue(SystemParamKeys.URL_HTTP_PWD);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        systemParamService1 = systemParamService;
        systemParamService1.refresh();
    }
}