|
@@ -0,0 +1,317 @@
|
|
|
|
+package com.huimv.produce.dhicc.util;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.dahuatech.hutool.http.Method;
|
|
|
|
+import com.dahuatech.icc.exception.ClientException;
|
|
|
|
+import com.dahuatech.icc.oauth.http.DefaultClient;
|
|
|
|
+import com.dahuatech.icc.oauth.http.IClient;
|
|
|
|
+import com.dahuatech.icc.oauth.model.v202010.GeneralRequest;
|
|
|
|
+import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
|
|
|
|
+import net.sf.json.JSONObject;
|
|
|
|
+import com.huimv.produce.dhicc.result.R;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+public class GetResponse {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * //查车辆过去七天的接口
|
|
|
|
+ * @param begin 开始时间
|
|
|
|
+ * @param end 结束时间
|
|
|
|
+ * @return
|
|
|
|
+ * @throws ClientException
|
|
|
|
+ */
|
|
|
|
+ public String SendMassageGetPage(String begin, String end ) throws ClientException {
|
|
|
|
+ String param = "queryTimeBegin=" + begin + "&queryTimeEnd=" + end;
|
|
|
|
+ String Url = "/evo-apigw/ipms/carcapture/find/conditions?";
|
|
|
|
+ IClient iClient = new DefaultClient();
|
|
|
|
+ System.out.println("开始执行");
|
|
|
|
+ String newUrl = Url + param;
|
|
|
|
+ System.out.println(newUrl);
|
|
|
|
+ GeneralRequest generalRequest = new GeneralRequest(newUrl, Method.GET);
|
|
|
|
+ GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
|
+ System.out.println("执行结束");
|
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
|
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
|
+ JSONObject bject = JSONObject.fromObject(data);
|
|
|
|
+ Object data1 = bject.get("totalRows"); //打印 2390
|
|
|
|
+ return data1.toString();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * //查人员通过过去几个小时的接口---正常通过
|
|
|
|
+ * @param begin 开始时间
|
|
|
|
+ * @param end 结束时间
|
|
|
|
+ * @return
|
|
|
|
+ * @throws ClientException
|
|
|
|
+ */
|
|
|
|
+ public String SendMassageGetPagePerson(String begin, String end ) throws ClientException {
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("startSwingTime",begin);
|
|
|
|
+ params.put("endSwingTime",end);
|
|
|
|
+ params.put("openType",61);
|
|
|
|
+ String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combinedCount?systime="; //获取事件URL post请求
|
|
|
|
+ IClient iClient = new DefaultClient();
|
|
|
|
+ String timestamp = String.valueOf((new Date()).getTime());
|
|
|
|
+ Long aLong = Long.valueOf(timestamp);
|
|
|
|
+ String NewUrl = URL + aLong;
|
|
|
|
+ System.out.println("开始执行");
|
|
|
|
+ //这种已经在配置文件里面安排了账号ip以及密码
|
|
|
|
+ GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
|
|
|
|
+ System.out.println(NewUrl);
|
|
|
|
+ generalRequest.header("Content-Type", " application/json");
|
|
|
|
+ System.out.println(JSON.toJSONString(params));
|
|
|
|
+ //里面是
|
|
|
|
+ generalRequest.body(JSON.toJSONString(params));
|
|
|
|
+ //发起请求处理应答
|
|
|
|
+ GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
|
+ System.out.println("执行结束");
|
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
|
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
|
+ return data.toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * //查人员通过过去几个小时的接口---异常通过
|
|
|
|
+ * @param begin 开始时间
|
|
|
|
+ * @param end 结束时间
|
|
|
|
+ * @return
|
|
|
|
+ * @throws ClientException
|
|
|
|
+ */
|
|
|
|
+ public String SendMassageGetPagePersonAlarm(String begin, String end ) throws ClientException {
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("startSwingTime",begin);
|
|
|
|
+ params.put("endSwingTime",end);
|
|
|
|
+ params.put("containDomain","1");
|
|
|
|
+ params.put("openResult",0);
|
|
|
|
+ String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combinedCount?systime="; //获取事件URL post请求
|
|
|
|
+ IClient iClient = new DefaultClient();
|
|
|
|
+ String timestamp = String.valueOf((new Date()).getTime());
|
|
|
|
+ Long aLong = Long.valueOf(timestamp);
|
|
|
|
+ String NewUrl = URL + aLong;
|
|
|
|
+ System.out.println("开始执行");
|
|
|
|
+ //这种已经在配置文件里面安排了账号ip以及密码
|
|
|
|
+ GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
|
|
|
|
+ System.out.println(NewUrl);
|
|
|
|
+ generalRequest.header("Content-Type", " application/json");
|
|
|
|
+ System.out.println(JSON.toJSONString(params));
|
|
|
|
+ //里面是
|
|
|
|
+ generalRequest.body(JSON.toJSONString(params));
|
|
|
|
+ //发起请求处理应答
|
|
|
|
+ GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
|
+ System.out.println("执行结束");
|
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
|
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
|
+ return data.toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * //查洗消时间次数的接口-----
|
|
|
|
+ * @param begin 开始时间
|
|
|
|
+ * @param end 结束时间
|
|
|
|
+ * @return
|
|
|
|
+ * @throws ClientException
|
|
|
|
+ */
|
|
|
|
+ public String SendMassageXixiaoPerson(String begin, String end ) throws ClientException {
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("alarmStartDateString",begin);
|
|
|
|
+ params.put("alarmEndDateString",end);
|
|
|
|
+ params.put("alarmType",303);
|
|
|
|
+ params.put("dbType",0);
|
|
|
|
+ params.put("deviceCategory",1);
|
|
|
|
+ String[] nodeCodeList= new String[3];
|
|
|
|
+ nodeCodeList[0]= "1002871$1$0$0" ;
|
|
|
|
+ nodeCodeList[1]= "1002872$1$0$0" ;
|
|
|
|
+ nodeCodeList[2]= "1002873$1$0$0" ;
|
|
|
|
+
|
|
|
|
+ params.put("nodeCodeList",nodeCodeList);
|
|
|
|
+ String URL = "/evo-apigw/evo-event/1.0.0/alarm-record/count-num"; //获取事件URL post请求
|
|
|
|
+ IClient iClient = new DefaultClient();
|
|
|
|
+ String NewUrl = URL ;
|
|
|
|
+ System.out.println("开始执行");
|
|
|
|
+ //这种已经在配置文件里面安排了账号ip以及密码
|
|
|
|
+ GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
|
|
|
|
+ System.out.println(NewUrl);
|
|
|
|
+ generalRequest.header("Content-Type", " application/json");
|
|
|
|
+ System.out.println(JSON.toJSONString(params));
|
|
|
|
+ //里面是
|
|
|
|
+ generalRequest.body(JSON.toJSONString(params));
|
|
|
|
+ //发起请求处理应答
|
|
|
|
+ GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
|
+ System.out.println("执行结束");
|
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
|
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
|
+ JSONObject jsonObject1 = JSONObject.fromObject(data);
|
|
|
|
+ System.out.println(jsonObject1);
|
|
|
|
+ return jsonObject1.get("value").toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * //查洗消时间次数的接口-----
|
|
|
|
+ * @param begin 开始时间
|
|
|
|
+ * @param end 结束时间
|
|
|
|
+ * @return
|
|
|
|
+ * @throws ClientException
|
|
|
|
+ */
|
|
|
|
+ public String SendMassageSiZhuRecord(String begin, String end ) throws ClientException {
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("alarmStartDateString",begin);
|
|
|
|
+ params.put("alarmEndDateString",end);
|
|
|
|
+ params.put("alarmType",303);
|
|
|
|
+ params.put("dbType",0);
|
|
|
|
+ params.put("deviceCategory",1);
|
|
|
|
+ String[] nodeCodeList= new String[64];
|
|
|
|
+ nodeCodeList[0]= "1002874$1$0$0" ;
|
|
|
|
+ nodeCodeList[1]= "1002875$1$0$0" ;
|
|
|
|
+ nodeCodeList[2]= "1002876$1$0$0" ;
|
|
|
|
+ nodeCodeList[3]= "1002877$1$0$0" ;
|
|
|
|
+ nodeCodeList[4]= "1002878$1$0$0" ;
|
|
|
|
+ nodeCodeList[5]= "1002879$1$0$0" ;
|
|
|
|
+ nodeCodeList[6]= "1002880$1$0$0" ;
|
|
|
|
+ nodeCodeList[7]= "1002881$1$0$0" ;
|
|
|
|
+ nodeCodeList[8]= "1002882$1$0$0" ;
|
|
|
|
+ nodeCodeList[9]= "1002883$1$0$0" ;
|
|
|
|
+ nodeCodeList[10]= "1002884$1$0$0" ;
|
|
|
|
+ nodeCodeList[11]= "1002885$1$0$0" ;
|
|
|
|
+ nodeCodeList[12]= "1002886$1$0$0" ;
|
|
|
|
+ nodeCodeList[13]= "1002887$1$0$0" ;
|
|
|
|
+ nodeCodeList[14]= "1002888$1$0$0" ;
|
|
|
|
+ nodeCodeList[15]= "1002889$1$0$0" ;
|
|
|
|
+ nodeCodeList[16]= "1002890$1$0$0" ;
|
|
|
|
+ nodeCodeList[17]= "1002891$1$0$0" ;
|
|
|
|
+ nodeCodeList[18]= "1002892$1$0$0" ;
|
|
|
|
+ nodeCodeList[19]= "1002893$1$0$0" ;
|
|
|
|
+ nodeCodeList[20]= "1002894$1$0$0" ;
|
|
|
|
+ nodeCodeList[21]= "1002895$1$0$0" ;
|
|
|
|
+ nodeCodeList[22]= "1002896$1$0$0" ;
|
|
|
|
+ nodeCodeList[23]= "1002897$1$0$0" ;
|
|
|
|
+ nodeCodeList[24]= "1002898$1$0$0" ;
|
|
|
|
+ nodeCodeList[25]= "1002899$1$0$0" ;
|
|
|
|
+ nodeCodeList[26]= "1002900$1$0$0" ;
|
|
|
|
+ nodeCodeList[27]= "1002901$1$0$0" ;
|
|
|
|
+ nodeCodeList[28]= "1002902$1$0$0" ;
|
|
|
|
+ nodeCodeList[29]= "1002903$1$0$0" ;
|
|
|
|
+ nodeCodeList[30]= "1002904$1$0$0" ;
|
|
|
|
+ nodeCodeList[31]= "1002905$1$0$0" ;
|
|
|
|
+ nodeCodeList[32]= "1002906$1$0$0" ;
|
|
|
|
+ nodeCodeList[33]= "1002907$1$0$0" ;
|
|
|
|
+ nodeCodeList[34]= "1002908$1$0$0" ;
|
|
|
|
+ nodeCodeList[35]= "1002909$1$0$0" ;
|
|
|
|
+ nodeCodeList[36]= "1002910$1$0$0" ;
|
|
|
|
+ nodeCodeList[37]= "1002911$1$0$0" ;
|
|
|
|
+ nodeCodeList[38]= "1002912$1$0$0" ;
|
|
|
|
+ nodeCodeList[39]= "1002913$1$0$0" ;
|
|
|
|
+ nodeCodeList[40]= "1002939$1$0$0" ;
|
|
|
|
+ nodeCodeList[41]= "1002939$1$0$1" ;
|
|
|
|
+ nodeCodeList[42]= "1002939$1$0$2" ;
|
|
|
|
+ nodeCodeList[43]= "1002939$1$0$3" ;
|
|
|
|
+ nodeCodeList[44]= "1002939$1$0$4" ;
|
|
|
|
+ nodeCodeList[45]= "1002939$1$0$5" ;
|
|
|
|
+ nodeCodeList[46]= "1002939$1$0$6" ;
|
|
|
|
+ nodeCodeList[47]= "1002939$1$0$7" ;
|
|
|
|
+ nodeCodeList[48]= "1002939$1$0$8" ;
|
|
|
|
+ nodeCodeList[49]= "1002939$1$0$9" ;
|
|
|
|
+ nodeCodeList[50]= "1002940$1$0$0" ;
|
|
|
|
+ nodeCodeList[51]= "1002940$1$0$1" ;
|
|
|
|
+ nodeCodeList[52]= "1002940$1$0$2" ;
|
|
|
|
+ nodeCodeList[53]= "1002940$1$0$3" ;
|
|
|
|
+ nodeCodeList[54]= "1002940$1$0$4" ;
|
|
|
|
+ nodeCodeList[55]= "1002940$1$0$5" ;
|
|
|
|
+ nodeCodeList[56]= "1002940$1$0$6" ;
|
|
|
|
+ nodeCodeList[57]= "1002940$1$0$7" ;
|
|
|
|
+ nodeCodeList[58]= "1002939$1$0$10" ;
|
|
|
|
+ nodeCodeList[59]= "1002939$1$0$11" ;
|
|
|
|
+ nodeCodeList[60]= "1002939$1$0$12" ;
|
|
|
|
+ nodeCodeList[61]= "1002939$1$0$13";
|
|
|
|
+ nodeCodeList[62]= "1002939$1$0$14" ;
|
|
|
|
+ nodeCodeList[63]= "1002939$1$0$15" ;
|
|
|
|
+ params.put("nodeCodeList",nodeCodeList);
|
|
|
|
+ String URL = "/evo-apigw/evo-event/1.0.0/alarm-record/count-num"; //获取事件URL post请求
|
|
|
|
+ IClient iClient = new DefaultClient();
|
|
|
|
+ String NewUrl = URL ;
|
|
|
|
+ System.out.println("开始执行");
|
|
|
|
+ //这种已经在配置文件里面安排了账号ip以及密码
|
|
|
|
+ GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
|
|
|
|
+ System.out.println(NewUrl);
|
|
|
|
+ generalRequest.header("Content-Type", " application/json");
|
|
|
|
+ System.out.println(JSON.toJSONString(params));
|
|
|
|
+ //里面是
|
|
|
|
+ generalRequest.body(JSON.toJSONString(params));
|
|
|
|
+ //发起请求处理应答
|
|
|
|
+ GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
|
+ System.out.println("执行结束");
|
|
|
|
+ JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
|
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
|
+ JSONObject jsonObject1 = JSONObject.fromObject(data);
|
|
|
|
+ System.out.println(jsonObject1);
|
|
|
|
+ return jsonObject1.get("value").toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public Object SendMassagePost(String param , String Url , String chooseMethod ) throws ClientException {
|
|
|
|
+ IClient iClient = new DefaultClient();
|
|
|
|
+ System.out.println("开始执行");
|
|
|
|
+ String newUrl = Url + param;
|
|
|
|
+ //这种已经在配置文件里面安排了账号ip以及密码 现在变了
|
|
|
|
+ GeneralRequest generalRequest = new GeneralRequest(newUrl, Method.POST);
|
|
|
|
+ GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
|
|
|
|
+ System.out.println("执行结束");
|
|
|
|
+ return R.ok("请求成功").put("token",generalResponse);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|