소스 검색

修正时间问题

yang 3 년 전
부모
커밋
c8de77396e

+ 0 - 6
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/BaseController/SysTelecomEventController.java

@@ -53,19 +53,13 @@ public class SysTelecomEventController {
         }
 
         DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        Date date = new Date();
         Date startTime = fmt.parse(startTimeString);
         Date endTime = fmt.parse(endTimeString);
-
-         long timeGap = date.getTime()-startTime.getTime();
         QueryWrapper<SysTelecomEvent> wrapper = new QueryWrapper<>();
         wrapper.eq("farm_id", farmId);
         if(StringUtilsWork.isNotBlank(deviceId)){
             wrapper.eq("device_id", deviceId);
         }
-        if (timeGap<1000*60*60*72){
-            startTime = new Date(endTime.getTime()-1000*60*60*100);
-        }
         wrapper.between("event_time", startTime, endTime);
         wrapper.orderByDesc( "event_time" );
         Page<SysTelecomEvent> page = sysTelecomEventService.page(new Page< >(current, size), wrapper);

+ 44 - 1
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/FaceAIController/AiFaceController.java

@@ -2,11 +2,54 @@ package com.huimv.video.dhicc.controller.FaceAIController;
 
 
 //金铭的人脸识别数据的接口  放这个里面
-public class AiFaceController {
 
 
+import com.alibaba.fastjson.JSONObject;
+import com.dahuatech.icc.exception.ClientException;
+import com.dahuatech.icc.oauth.http.DefaultClient;
+import com.dahuatech.icc.oauth.http.IClient;
+import com.huimv.common.utils.Result;
+import com.huimv.common.utils.StringUtilsWork;
+import com.huimv.video.dhicc.util.HttpClient;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
+import static com.huimv.video.dhicc.icc.CommonConstant.IPAndPort;
+
+@RestController
+@RequestMapping("/AiFaceCount")
+public class AiFaceController {
 
+    //这个接口里面的条件还是后端来写死吧  后端写比前端写简单一点
+    @RequestMapping("/fr/groups")
+    public Result addgroupspeople(HttpServletRequest request,
+                                  @RequestParam(name = "name") String name
+    ) throws Exception {
+        System.out.println(name);
+         //这儿直接写死了
+        String URL = "http://36.26.62.70:10080/api/fr/groups";
+        System.out.println(URL);
+        //发送请求
+        HttpClient httpClient = new HttpClient(URL);
+        httpClient.setHttps(false);
+        httpClient.addParameter("name", name);
+        httpClient.post();
+        String content = httpClient.getContent();
+        JSONObject jsonObject = JSONObject.parseObject(content);
+        System.out.println(jsonObject.toJSONString());
+        System.out.println("添加底库");
+        return new Result(10000, "添加成功",true);
+    }
 
 
 

+ 1 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ScreenController/ScreenPersonController.java

@@ -18,6 +18,7 @@ import java.util.*;
 @RequestMapping("/screen/person")
 public class ScreenPersonController {
 
+    //成功通行记录
     @RequestMapping("/count_person_record")
     public R ddgetCarRecord(HttpServletRequest request,@RequestParam(name = "farmId") Integer farmId   ) throws ClientException, ParseException {
 

+ 19 - 16
huimv-farm-video/src/main/java/com/huimv/video/dhicc/util/GetResponse.java

@@ -18,8 +18,6 @@ import java.util.Map;
 
 public class GetResponse {
 
-
-
     /**
      *  //查车辆通行数量的接口**不分进出
      * @param begin  开始时间
@@ -28,21 +26,27 @@ public class GetResponse {
      * @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?";
+        //条件只有开始结束时间  有问题 这个是条数  有统计条数的专门接口
+        //时间参数这里之前让前端传了  我这里只做转发  现在自己加上去
+        String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combinedCount?systime=";  //获取事件URL    post请求
         IClient iClient = new DefaultClient();
-        System.out.println("开始执行");
-        String newUrl = Url + param;
-        System.out.println(newUrl);
-        GeneralRequest generalRequest = new GeneralRequest(newUrl, Method.GET);
+        String timestamp = String.valueOf((new Date()).getTime());
+        Long aLong = Long.valueOf(timestamp);
+        String NewUrl = URL + aLong;
+        //这种已经在配置文件里面安排了账号ip以及密码
+        GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
+        generalRequest.header("Content-Type", " application/json");
+        //设置时间参数
+        Map<String, Object> params = new HashMap<>();
+        params.put("startSwingTime",begin);
+        params.put("endSwingTime",end);
+        params.put("openType","61");//刷脸开门
+        //里面是
+        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   bject = JSONObject.fromObject(data);
-        Object data1 = bject.get("totalRows"); //打印 2390
-        return data1.toString();
-
+        Object data = JSONObject.fromObject(generalResponse.getResult()).get("data");
+        return data.toString();
     }
 
     /**
@@ -58,7 +62,6 @@ public class GetResponse {
         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("执行结束");