parameter.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. package com.cnd3b.common.parameter;
  2. import com.cnd3b.common.data.Row;
  3. import com.cnd3b.common.websocket.WebClientSocket;
  4. import p2.p2server.P2Server;
  5. import p2.pao.PaoRemote;
  6. import p2.pao.PaoSetRemote;
  7. import java.util.Date;
  8. import java.util.HashMap;
  9. import java.util.Map;
  10. import java.util.concurrent.ConcurrentHashMap;
  11. /**
  12. * 参数及全局数据表
  13. *
  14. * @author SHENJW
  15. */
  16. public class parameter {
  17. //token:userid
  18. public static HashMap<String, Long> tokenlist = new HashMap<String, Long>(16);
  19. //token:time
  20. public static HashMap<String, Date> requesttime = new HashMap<String, Date>(16);
  21. //userid:usermsg
  22. public static HashMap<Long, Row> userIdList = new HashMap<>(16);
  23. public static String defaultsiteid = "BWJ";
  24. /**
  25. * 登录-手机号、验证码
  26. */
  27. public static HashMap<String, String> phonenumber_password = new HashMap<>(16);
  28. /**
  29. * 登陆-验证码,来源
  30. */
  31. public static HashMap<String, String> password_client = new HashMap<>(16);
  32. /**
  33. * 登录-验证码、有效期
  34. */
  35. public static HashMap<String, Date> phonenumber_date = new HashMap<>(16);
  36. /**
  37. * 修改手机号-手机号、验证码
  38. */
  39. public static HashMap<String, String> changephonenumber_passwordmap = new HashMap<>(16);
  40. /**
  41. * 修改手机号-验证码、有效期
  42. */
  43. public static HashMap<String, Date> changephonenumber_date = new HashMap<>(16);
  44. /**
  45. * 账号注册验证码
  46. */
  47. public static HashMap<String, String> register_passwordmap = new HashMap<>(16);
  48. /**
  49. * 账号注册验证码、有效期
  50. */
  51. public static HashMap<String, Date> registerpassword_date = new HashMap<>(16);
  52. /**
  53. * 账号注册验证码
  54. */
  55. public static HashMap<Long, String> changeAdministrator_passwordmap = new HashMap<>(16);
  56. /**
  57. * 账号注册验证码、有效期
  58. */
  59. public static HashMap<Long, Date> changeAdministratorpassword_date = new HashMap<>(16);
  60. //websocket连接池 userid:(token:session)
  61. public static Map<Long, ConcurrentHashMap<String, WebClientSocket>> websocketClients = new ConcurrentHashMap<Long, ConcurrentHashMap<String, WebClientSocket>>();
  62. public static Map<Long, Date> loginDate = new HashMap<>();
  63. /**
  64. * 方法请求次数
  65. */
  66. public static HashMap<String, Long> callmethodTimes = new HashMap<String, Long>(16);
  67. /**
  68. * 方法请求从缓存获取次数
  69. */
  70. public static HashMap<String, Long> callmethod_fromcacheTimes = new HashMap<String, Long>(16);
  71. /**
  72. * 方法请求查询平均时间
  73. */
  74. public static HashMap<String, Long> callmethodTimeLong = new HashMap<String, Long>(16);
  75. /**
  76. * 方法请求查询最新时间
  77. */
  78. public static HashMap<String, Long> callmethodLastTimeLong = new HashMap<String, Long>(16);
  79. /**
  80. * 方法请求最近时间
  81. */
  82. public static HashMap<String, Date> lastcallmethodtime = new HashMap<String, Date>(16);
  83. public static boolean isdebug() {
  84. parameter_init();
  85. return isdebug;
  86. }
  87. public static boolean isminiapp() {
  88. parameter_init();
  89. return isminiapp;
  90. }
  91. public static long OBS_expireSeconds() {
  92. parameter_init();
  93. return OBS_expireSeconds;
  94. }
  95. public static String SQLiteFilePath() {
  96. parameter_init();
  97. return SQLiteFilePath;
  98. }
  99. public static String UpLoadExcelErrFilePath() {
  100. parameter_init();
  101. return UpLoadExcelErrFilePath;
  102. }
  103. public static String Bucket_endPoint() {
  104. parameter_init();
  105. return Bucket_endPoint;
  106. }
  107. public static String Bucket_location() {
  108. parameter_init();
  109. return Bucket_location;
  110. }
  111. public static String Bucket_ak() {
  112. parameter_init();
  113. return Bucket_ak;
  114. }
  115. public static String Bucket_sk() {
  116. parameter_init();
  117. return Bucket_sk;
  118. }
  119. public static void parameter_init() {
  120. if (isparameterinit) {
  121. return;
  122. }
  123. PaoSetRemote tparameter = null;
  124. try {
  125. tparameter = P2Server.getP2Server().getPaoSet("tparameter", P2Server.getP2Server().getSystemUserInfo());
  126. if (!tparameter.isEmpty()) {
  127. PaoRemote pao = tparameter.getPao(0);
  128. isdebug = pao.getBoolean("isdebug");
  129. isminiapp = pao.getBoolean("isminiapp");
  130. Bucket_ak = pao.getString("bucket_ak");
  131. Bucket_sk = pao.getString("bucket_sk");
  132. Bucket_endPoint = pao.getString("bucket_endpoint");
  133. Bucket_location = pao.getString("bucket_location");
  134. OBS_expireSeconds = pao.getLong("obs_expireseconds");
  135. SQLiteFilePath = pao.getString("sqlitefilepath");
  136. UpLoadExcelErrFilePath = pao.getString("uploadexcelerrfilepath");
  137. isparameterinit = true;
  138. }
  139. } catch (Exception e) {
  140. e.printStackTrace();
  141. } finally {
  142. try {
  143. tparameter.close();
  144. } catch (Exception e) {
  145. e.printStackTrace();
  146. }
  147. }
  148. }
  149. /**
  150. * 参数是否初始化
  151. */
  152. public static boolean isparameterinit = false;
  153. /**
  154. * 云存储参数
  155. */
  156. private static String Bucket_endPoint;
  157. private static String Bucket_location;
  158. private static String Bucket_ak;
  159. private static String Bucket_sk;
  160. /**
  161. * 是否调试模式
  162. */
  163. private static boolean isdebug;
  164. /**
  165. * 是否小程序
  166. */
  167. private static boolean isminiapp;
  168. /**
  169. * obs分享链接实效
  170. */
  171. private static long OBS_expireSeconds;
  172. /**
  173. * SQLlite数据库文件路径
  174. */
  175. private static String SQLiteFilePath;
  176. /**
  177. * 上传数据错误文件存放路径
  178. */
  179. private static String UpLoadExcelErrFilePath;
  180. }