package com.cnd3b.common.parameter; import com.cnd3b.common.data.Row; import com.cnd3b.common.websocket.WebClientSocket; import p2.p2server.P2Server; import p2.pao.PaoRemote; import p2.pao.PaoSetRemote; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 参数及全局数据表 * * @author SHENJW */ public class parameter { //token:userid public static HashMap tokenlist = new HashMap(16); //token:time public static HashMap requesttime = new HashMap(16); //userid:usermsg public static HashMap userIdList = new HashMap<>(16); public static String defaultsiteid = "BWJ"; /** * 登录-手机号、验证码 */ public static HashMap phonenumber_password = new HashMap<>(16); /** * 登陆-验证码,来源 */ public static HashMap password_client = new HashMap<>(16); /** * 登录-验证码、有效期 */ public static HashMap phonenumber_date = new HashMap<>(16); /** * 修改手机号-手机号、验证码 */ public static HashMap changephonenumber_passwordmap = new HashMap<>(16); /** * 修改手机号-验证码、有效期 */ public static HashMap changephonenumber_date = new HashMap<>(16); /** * 账号注册验证码 */ public static HashMap register_passwordmap = new HashMap<>(16); /** * 账号注册验证码、有效期 */ public static HashMap registerpassword_date = new HashMap<>(16); /** * 账号注册验证码 */ public static HashMap changeAdministrator_passwordmap = new HashMap<>(16); /** * 账号注册验证码、有效期 */ public static HashMap changeAdministratorpassword_date = new HashMap<>(16); //websocket连接池 userid:(token:session) public static Map> websocketClients = new ConcurrentHashMap>(); public static Map loginDate = new HashMap<>(); /** * 方法请求次数 */ public static HashMap callmethodTimes = new HashMap(16); /** * 方法请求从缓存获取次数 */ public static HashMap callmethod_fromcacheTimes = new HashMap(16); /** * 方法请求查询平均时间 */ public static HashMap callmethodTimeLong = new HashMap(16); /** * 方法请求查询最新时间 */ public static HashMap callmethodLastTimeLong = new HashMap(16); /** * 方法请求最近时间 */ public static HashMap lastcallmethodtime = new HashMap(16); public static boolean isdebug() { parameter_init(); return isdebug; } public static boolean isminiapp() { parameter_init(); return isminiapp; } public static long OBS_expireSeconds() { parameter_init(); return OBS_expireSeconds; } public static String SQLiteFilePath() { parameter_init(); return SQLiteFilePath; } public static String UpLoadExcelErrFilePath() { parameter_init(); return UpLoadExcelErrFilePath; } public static String Bucket_endPoint() { parameter_init(); return Bucket_endPoint; } public static String Bucket_location() { parameter_init(); return Bucket_location; } public static String Bucket_ak() { parameter_init(); return Bucket_ak; } public static String Bucket_sk() { parameter_init(); return Bucket_sk; } public static void parameter_init() { if (isparameterinit) { return; } PaoSetRemote tparameter = null; try { tparameter = P2Server.getP2Server().getPaoSet("tparameter", P2Server.getP2Server().getSystemUserInfo()); if (!tparameter.isEmpty()) { PaoRemote pao = tparameter.getPao(0); isdebug = pao.getBoolean("isdebug"); isminiapp = pao.getBoolean("isminiapp"); Bucket_ak = pao.getString("bucket_ak"); Bucket_sk = pao.getString("bucket_sk"); Bucket_endPoint = pao.getString("bucket_endpoint"); Bucket_location = pao.getString("bucket_location"); OBS_expireSeconds = pao.getLong("obs_expireseconds"); SQLiteFilePath = pao.getString("sqlitefilepath"); UpLoadExcelErrFilePath = pao.getString("uploadexcelerrfilepath"); isparameterinit = true; } } catch (Exception e) { e.printStackTrace(); } finally { try { tparameter.close(); } catch (Exception e) { e.printStackTrace(); } } } /** * 参数是否初始化 */ public static boolean isparameterinit = false; /** * 云存储参数 */ private static String Bucket_endPoint; private static String Bucket_location; private static String Bucket_ak; private static String Bucket_sk; /** * 是否调试模式 */ private static boolean isdebug; /** * 是否小程序 */ private static boolean isminiapp; /** * obs分享链接实效 */ private static long OBS_expireSeconds; /** * SQLlite数据库文件路径 */ private static String SQLiteFilePath; /** * 上传数据错误文件存放路径 */ private static String UpLoadExcelErrFilePath; }