parameter.java 4.6 KB

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