Browse Source

更新,给皖事通提供剩余车位数接口

Administrator 2 years ago
parent
commit
d242d7af4e

+ 172 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/parkLot/GetCameraPreviewURL.java

@@ -4,6 +4,7 @@ package com.ruoyi.web.controller.parkLot;
 import com.alibaba.fastjson2.JSONObject;
 import com.hikvision.artemis.sdk.ArtemisHttpUtil;
 import com.hikvision.artemis.sdk.config.ArtemisConfig;
+import com.ruoyi.common.utils.StringUtils;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -78,5 +79,176 @@ public class GetCameraPreviewURL {
          */
         return result;
     }
+
+    /**
+     * 获取实时地面停车场场内车数据
+     * @return
+     */
+    public static String GetTempCarInRecordsURL(String plateNo,String startTime,String endTime,String pageNo,String pageSize) {
+        /**
+         * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
+         */
+        ArtemisConfig.host = "114.99.51.58:442"; // 平台的ip端口
+        ArtemisConfig.appKey = "26665995";  // 密钥appkey
+        ArtemisConfig.appSecret = "P9y9211M5ftH8P1Xrcef";// 密钥appSecret
+
+        /**
+         * STEP2:设置OpenAPI接口的上下文
+         */
+        final String ARTEMIS_PATH = "/artemis";
+        /**
+         * STEP3:设置接口的URI地址
+         */
+        final String previewURLsApi = ARTEMIS_PATH + "/api/pms/v1/tempCarInRecords/page";
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
+            }
+        };
+
+        /**
+         * STEP4:设置参数提交方式
+         */
+        String contentType = "application/json";
+
+        /**
+         * STEP5:组装请求参数
+         */
+        JSONObject jsonBody = new JSONObject();
+        jsonBody.put("pageNo",1);
+        jsonBody.put("pageSize",1000);
+        if (StringUtils.isNotBlank(plateNo)){
+            jsonBody.put("plateNo", plateNo);
+        }
+        if (StringUtils.isNotBlank(startTime)){
+            jsonBody.put("startTime", startTime);
+            jsonBody.put("endTime", endTime);
+        }
+        if (StringUtils.isNotBlank(pageNo)){
+            jsonBody.put("pageNo",pageNo);
+            jsonBody.put("pageSize",pageSize);
+        }
+        String body = jsonBody.toJSONString();
+        /**
+         * STEP6:调用接口
+         */
+        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
+        System.out.println(result);
+        /**
+         * {
+         *     "code": "0",
+         *     "msg": "success",
+         *     "data": {
+         *         "total": 1,
+         *         "pageNo": 1,
+         *         "pageSize": 15,
+         *         "list": [
+         *             {
+         *                 "inRecordSyscode": "h45h45h45ghhn45tg245g45r",
+         *                 "vehiclePicUri": "/pic?=d7ei703i10cd*73a-d5108a--22c6592ai2b4*=3d4id=",
+         *                 "cardNo": "613453453",
+         *                 "inTime": "2018-07-26T15:00:00+08:00",
+         *                 "parkTime": "1天1小时1分钟",
+         *                 "parkSyscode": "hju56jyt54h4h245g2345g345fg",
+         *                 "parkName": "停车库1",
+         *                 "plateNoPicUri": "/pic?=d7ei703i10cd*73a-d5108a--22c592ai2b4*=3",
+         *                 "aswSyscode": "g45ghertg34fh4hy245tgy234tg5",
+         *                 "plateNo": "浙A12345"
+         *             }
+         *         ]
+         *     }
+         * }
+         */
+        return result;
+    }
+
+    /**
+     * 查询车辆包期信息
+     * @return
+     */
+    public static String GetChargeURL(String startTime,String endTime,String pageNo,String pageSize) {
+        /**
+         * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
+         */
+        ArtemisConfig.host = "114.99.51.58:442"; // 平台的ip端口
+        ArtemisConfig.appKey = "26665995";  // 密钥appkey
+        ArtemisConfig.appSecret = "P9y9211M5ftH8P1Xrcef";// 密钥appSecret
+
+        /**
+         * STEP2:设置OpenAPI接口的上下文
+         */
+        final String ARTEMIS_PATH = "/artemis";
+        /**
+         * STEP3:设置接口的URI地址
+         */
+        final String previewURLsApi = ARTEMIS_PATH + "/api/pms/v1/car/charge/page";
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
+            }
+        };
+
+        /**
+         * STEP4:设置参数提交方式
+         */
+        String contentType = "application/json";
+
+        /**
+         * STEP5:组装请求参数
+         */
+        JSONObject jsonBody = new JSONObject();
+        jsonBody.put("pageNo",1);
+        jsonBody.put("pageSize",1000);
+        if (StringUtils.isNotBlank(startTime)){
+            jsonBody.put("startTime", startTime);
+            jsonBody.put("endTime", endTime);
+        }
+        if (StringUtils.isNotBlank(pageNo)){
+            jsonBody.put("pageNo",pageNo);
+            jsonBody.put("pageSize",pageSize);
+        }
+        String body = jsonBody.toJSONString();
+        /**
+         * STEP6:调用接口
+         */
+        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
+        System.out.println(result);
+        /**
+         * {
+         *     "code": "0",
+         *     "msg": "success",
+         *     "data": {
+         *         "total": 1,
+         *         "pageNo": 1,
+         *         "pageSize": 15,
+         *         "list": [
+         *             {
+         *                 "regionIndexCode": "s7f0wef9-weuf0we0f",
+         *                 "vehicleId": "as78da790sd99u29u9129uddav90s",
+         *                 "plateNo": "浙A12345",
+         *                 "cardNo": "6518959562033",
+         *                 "personId": "as9du12d9219d1-2ud012d22d",
+         *                 "personName": "Jack",
+         *                 "categoryCode": "0ff8231a93604c4d849dad519451fb03",
+         *                 "categoryName": "VIP车辆"
+         *                 "validity": [
+         *                     {
+         *                         "parkSyscode": "gqwerg354g345g35g",
+         *                         "parkName": "停车库1",
+         *                         "functionTime": [
+         *                             {
+         *                                 "startTime": "2018-07-26",
+         *                                 "endTime": "2018-07-27"
+         *                             }
+         *                         ]
+         *                     }
+         *                 ]
+         *             }
+         *         ]
+         *     }
+         * }
+         */
+        return result;
+    }
 }
 

+ 17 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/parkLot/ParkLotController.java

@@ -3,12 +3,20 @@ package com.ruoyi.web.controller.parkLot;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.*;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAccessor;
+import java.util.Date;
 import java.util.concurrent.TimeUnit;
 
 import static com.ruoyi.common.constant.CacheConstants.LEFT_PLACE;
@@ -48,4 +56,13 @@ public class ParkLotController extends BaseController {
         return leftPlaceRedis;
     }
 
+    /**
+     * 获取实时地面停车场场内车数据
+     * @return
+     */
+    @PostMapping("/tempCarInRecords")
+    public TableDataInfo tempCarInRecords(String plateNo,String startTime,String endTime,String pageNo,String pageSize) {
+       // String result = GetCameraPreviewURL.GetChargeURL("2018-07-26T15:00:00+08:00",);
+      return   getDataTable(null);
+    }
 }