Constant.java 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package com.hssx.cloudmodel.constant;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.hssx.cloudmodel.util.HttpKit;
  5. import com.hssx.cloudmodel.util.HttpRespMsg;
  6. import com.hssx.cloudmodel.util.WechatTemplateMessage;
  7. import org.apache.commons.lang3.StringEscapeUtils;
  8. import java.io.IOException;
  9. import java.security.KeyManagementException;
  10. import java.security.NoSuchAlgorithmException;
  11. import java.security.NoSuchProviderException;
  12. import java.text.SimpleDateFormat;
  13. import java.util.Date;
  14. import java.util.HashMap;
  15. import java.util.Map;
  16. /**
  17. * Author: 吴涛涛
  18. * Date : 2019 - 07 - 24 16:00
  19. * Description:<描述>常量配置类
  20. * Version: 1.0
  21. */
  22. public class Constant {
  23. public static final String DEFAULT_PWD = "000000";//默认密码
  24. public static final Integer ASSETS_COMPANY = 0;//资产方编号
  25. public static final Integer PRODUCER_COMPANY = 1;//生产方编号
  26. public static final Integer SYS_PARENT_ID = 0;//系统管理员的上级id
  27. public static final Integer SYS_ID = 1;//系统管理员的id
  28. public static final String MOULD_PREFIX = "YMMJ";//模具编号前缀
  29. public static final String PROJECT_PREFIX = "YMXM";//项目编号
  30. public static final String UPLOAD = "上传";//上传
  31. public static final String DOWNLOAD = "下载";//下载
  32. public static final Integer UPDATE_AUTHORITY = 0;//修改权限
  33. public static final Integer DOWNLOAD_AUTHORITY = 1;//下载权限
  34. public static final Integer VIEW_AUTHORITY = 2;//浏览权限
  35. public static final Integer APPROVAL_AUTHORITY = 3;//审批权限
  36. public static final String WARNING_NOTICE_TEMPLATE_ID = "-EpBbqgMN2cCBf6pUSlFXGNlstkeCidVEejTOhrGcy4";//告警通知模板id
  37. public static final String MAINTAIN_NOTICE_TEMPLATE_ID = "VcU9E2f3Nn4uR6S1z57VBaLeBAhEO4vfivo3Tug_BKE";//保养通知模板id
  38. public static final String WECHAT_SECRET = "473ee2fab33e6d8a885800403d777581";//secret
  39. public static final String WECHAT_APPID = "wx42c0f9d19a4756a7";//appId
  40. // public static void main(String[] args){
  41. // System.out.println("222222");
  42. // String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
  43. // + "wx42c0f9d19a4756a7" + "&secret=" + "473ee2fab33e6d8a885800403d777581";
  44. // String resp;
  45. // String resp1;
  46. // try {
  47. // resp1 = HttpKit.get(url, true);
  48. // resp1 = StringEscapeUtils.unescapeJava(resp1);
  49. // System.out.println("222222");
  50. // JSONObject json = (JSONObject) JSON.parse(resp1);
  51. // System.out.println("json"+json);
  52. // // 获取值赋值给全局变量
  53. // if (!json.containsKey("errcode")) {
  54. // System.out.println("222222");
  55. // String newAccessToken = json.getString("access_token");
  56. // String url1 = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
  57. // + newAccessToken;
  58. // WechatTemplateMessage wechat = new WechatTemplateMessage();
  59. // wechat.setTemplate_id("VcU9E2f3Nn4uR6S1z57VBaLeBAhEO4vfivo3Tug_BKE");
  60. // wechat.setTouser("o9g4t1rTLsDu62HrreOoMWPT4ldA");
  61. // wechat.setAppid("wx42c0f9d19a4756a7");
  62. // Map<String, Map<String, String>> data = new HashMap<>();
  63. // Map<String, String> first = new HashMap<>();
  64. // Map<String, String> value1 = new HashMap<>();
  65. // Map<String, String> value2 = new HashMap<>();
  66. // Map<String, String> value3 = new HashMap<>();
  67. // Map<String, String> value4 = new HashMap<>();
  68. // Map<String, String> remark = new HashMap<>();
  69. // // 推送信息主体
  70. // first.put("value", "你好,你有新的保养通知");//firstData推送标题
  71. // data.put("first", first);
  72. // value1.put("value", "1111");
  73. // SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
  74. // data.put("keyword1", value1);
  75. // value2.put("value", "南京");
  76. // data.put("keyword2", value2);
  77. // value3.put("value", sdf.format(new Date()));
  78. // data.put("keyword3", value3);
  79. // value4.put("value", "给水泵内燃力");
  80. // data.put("keyword4", value4);
  81. // remark.put("value", "给水泵内燃力不足");
  82. // data.put("remark", remark);
  83. // wechat.setData(data);
  84. // String jsonString = JSONObject.toJSONString(wechat);
  85. // System.out.println("jsonString"+jsonString);
  86. // resp = HttpKit.post(url1, jsonString);
  87. // System.out.println("222222");
  88. // System.out.println("resp0"+resp);
  89. // resp = StringEscapeUtils.unescapeJava(resp);
  90. // System.out.println("resp"+resp);
  91. // json = (JSONObject) JSON.parse(resp);
  92. // System.out.println("json"+json);
  93. // }
  94. // } catch (NoSuchAlgorithmException e) {
  95. // e.printStackTrace();
  96. // } catch (NoSuchProviderException e) {
  97. // e.printStackTrace();
  98. // } catch (IOException e) {
  99. // e.printStackTrace();
  100. // } catch (KeyManagementException e) {
  101. // e.printStackTrace();
  102. // }
  103. // }
  104. }