timingURL.java 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. package com.ruoyi.system.utils;
  2. import com.alibaba.fastjson2.JSONObject;
  3. import com.hikvision.artemis.sdk.ArtemisHttpUtil;
  4. import com.hikvision.artemis.sdk.config.ArtemisConfig;
  5. import java.util.HashMap;
  6. import java.util.Map;
  7. /**
  8. * @Author:
  9. * @Date: 2023/1/3 15:01
  10. * @Describe:
  11. */
  12. public class timingURL {
  13. /**
  14. * 获取地上停车数据
  15. * @param parkSyscode 停车库唯一标识
  16. * @param entranceSyscode 出入口唯一标识
  17. * @param startTime 查询开始时间
  18. * @param endTime 查询结束时间
  19. * @param pageNo 目标页码
  20. * @return
  21. */
  22. public static String timingURL(String parkSyscode,String entranceSyscode,String startTime,String endTime, int pageNo) {
  23. /**
  24. * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
  25. */
  26. ArtemisConfig.host = "114.99.51.58:442"; // 平台的ip端口
  27. ArtemisConfig.appKey = "26665995"; // 密钥appkey
  28. ArtemisConfig.appSecret = "P9y9211M5ftH8P1Xrcef";// 密钥appSecret
  29. /**
  30. * STEP2:设置OpenAPI接口的上下文
  31. */
  32. final String ARTEMIS_PATH = "/artemis";
  33. /**
  34. * STEP3:设置接口的URI地址
  35. */
  36. final String previewURLsApi = ARTEMIS_PATH + "/api/pms/v1/crossRecords/page";
  37. //final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/entrance/entranceList";
  38. Map<String, String> path = new HashMap<String, String>(2) {
  39. {
  40. put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
  41. }
  42. };
  43. /**
  44. * STEP4:设置参数提交方式
  45. */
  46. String contentType = "application/json";
  47. /**
  48. * STEP5:组装请求参数
  49. */
  50. JSONObject jsonBody = new JSONObject();
  51. //停车库唯一标识
  52. jsonBody.put("parkSyscode", parkSyscode);
  53. //出入口唯一标识
  54. jsonBody.put("entranceSyscode", entranceSyscode);
  55. //查询开始时间
  56. //ISO8601格式:
  57. //yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:
  58. //2018-07-26T15:00:00+08:00
  59. jsonBody.put("startTime", startTime);
  60. //查询结束时间
  61. //ISO8601格式:
  62. //yyyy-MM-ddTHH:mm:ss+当前时区,例如北京时间:
  63. //2018-07-26T15:00:00+08:00
  64. jsonBody.put("endTime", endTime);
  65. //进出场标识 0-进场 1-出场
  66. jsonBody.put("vehicleOut", 0);
  67. //车辆分类 9-黑名单 10-固定车 11-临时车 12-预约车 14-特殊车
  68. jsonBody.put("carCategory", "10");
  69. //目标页码
  70. jsonBody.put("pageNo", pageNo);
  71. //每页记录数
  72. jsonBody.put("pageSize", 1000);
  73. //停车库唯一标识
  74. String body = jsonBody.toJSONString();
  75. /**
  76. * STEP6:调用接口
  77. */
  78. String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
  79. //System.out.println(result);
  80. /**
  81. * {
  82. * "code": "0",
  83. * "msg": "success",
  84. * "data": {
  85. * "total": 1,
  86. * "pageNo": 1,
  87. * "pageSize": 15,
  88. * "list": [
  89. * {
  90. * "crossRecordSyscode": "g45h245gh235g2354g",
  91. * "parkSyscode": "gqwerg354g345g35g",
  92. * "parkName": "停车库1",
  93. * "entranceSyscode": "rggergqw45ghw45gb",
  94. * "entranceName": "出入口1",
  95. * "roadwaySyscode": "a9rvy0y5029waurc92-cu5",
  96. * "roadwayName": "车道1",
  97. * "vehicleOut": 1,
  98. * "releaseMode": 2,
  99. * "releaseResult": 1,
  100. * "releaseWay": 1,
  101. * "releaseReason": 100,
  102. * "plateNo": "浙A12345",
  103. * "cardNo": "54523451",
  104. * "vehicleColor": 1,
  105. * "vehicleType": 1,
  106. * "plateColor": 1,
  107. * "plateType": 2,
  108. * "carCategory": "11",
  109. * "carCategoryName": "临时车",
  110. * "vehiclePicUri": "/pic?=d7ei703i10cd*73a-d5108a--22cd0c9d6592aiid=",
  111. * "plateNoPicUri": "/pic?=d7ei703i10cd*73a-d5108a--22cd0c9d6592aiid=",
  112. * "facePicUri": "/pic?=d7ei703i10cd*73a-d5108a--22cd0c9d6592aiid=",
  113. * "aswSyscode": "h4h45y13ty23hg24h",
  114. * "crossTime": "2018-07-26T15:00:00+08:00",
  115. * "createTime": "2018-07-26T15:00:00+08:00"
  116. * }
  117. * ]
  118. * }
  119. * }
  120. */
  121. return result;
  122. }
  123. }