yang 3 år sedan
förälder
incheckning
9cd160b649

+ 252 - 3
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ClientController/ClientCarManageController.java

@@ -1,24 +1,274 @@
 package com.huimv.video.dhicc.controller.ClientController;
 
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 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 com.huimv.video.dhicc.entity.IccChannel;
+import com.huimv.video.dhicc.result.R;
+import net.sf.json.JSONObject;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import com.huimv.common.utils.Result;
 import javax.servlet.http.HttpServletRequest;
-import java.util.Map;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 
 @RestController
 @RequestMapping("car")
 public class ClientCarManageController {
-        //过车的数据
+
+  //列表车辆
+    @RequestMapping("/geCarList")
+    public GeneralResponse geCarList (HttpServletRequest request ,@RequestParam(name = "farmId") Integer farmId,
+            @RequestParam(name = "pageNum") Integer pageNum,
+            @RequestParam(name = "pageSize") Integer pageSize
+                                      ) throws ClientException {
+        if(farmId!=1){
+            //返回为空数据
+            return  null;
+        }
+        Long aLong = Long.valueOf(String.valueOf((new Date()).getTime()));
+
+        String URL = "/evo-apigw/ipms/car/list?"  ;  // 人员列表的接口
+        IClient iClient = new DefaultClient();
+        System.out.println("开始执行");
+        GeneralRequest generalRequest = new GeneralRequest(URL+"pageNum="+pageNum+"&pageSize="+pageSize+"&_="+aLong, Method.GET);
+        generalRequest.header("Content-Type", " application/json");
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        System.out.println("执行结束");
+        return generalResponse;
+    }
+
+
+   //添加基础车辆
+    @RequestMapping("/addCarBase")
+    public GeneralResponse addCarBase (HttpServletRequest request ,@RequestParam(name = "farmId") Integer farmId,
+                                      @RequestParam(name = "carCode") String carCode,//车辆编号
+                                      @RequestParam(name = "carNum")  String carNum //车牌号
+    ) throws ClientException {
+        if(farmId!=1){
+            return null ;
+        }
+
+        String URL = "/evo-apigw/ipms/car/add";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
+        System.out.println("开始执行");
+        Map<String, Object> value = new HashMap<>();
+        value.put("carCode",carCode);
+        value.put("carNum",carNum);
+        value.put("carNumColor",0);
+        value.put("carType",1);
+        value.put("carBrand",-1);
+        value.put("carColor",0);
+        value.put("listType",0);
+        value.put("parkType",1);
+        value.put("owner",null);
+        value.put("ownerId",null);
+        value.put("parkinglot",null);
+        value.put("memo",null);
+        value.put("deptName","技术部门");
+        value.put("deptId","2");
+        value.put("parkinglotCode","1");
+        value.put("noAllowEditParkingLot",new ArrayList<>());
+        List<Map>  a = new ArrayList<>();
+        Map<String, Object> value1 = new HashMap<>();
+        value1.put("code","0");
+        value1.put("name","未使用");
+        Map<String, Object> value2 = new HashMap<>();
+        value2.put("code","1");
+        value2.put("name","使用");
+        a.add(value1);
+        a.add(value2);
+        value.put("carStatusList",a);
+        generalRequest.body(JSON.toJSONString(value));
+        System.out.println(JSON.toJSONString(value));
+        //这种已经在配置文件里面安排了账号ip以及密码
+        generalRequest.header("Content-Type", " application/json");
+        //发起请求处理应答
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+
+     //白名单列表
+    @RequestMapping("/ShowCarWhiteList")
+    public GeneralResponse ShowCarWhiteList (HttpServletRequest request ,@RequestParam(name = "farmId") Integer farmId,
+                                       @RequestParam(name = "pageNum") String pageNum,//车辆编号
+                                       @RequestParam(name = "pageSize")  String pageSize //车牌号
+    ) throws ClientException {
+        if(farmId!=1){
+            return null ;
+        }
+        String timestamp = String.valueOf((new Date()).getTime());
+        Long aLong = Long.valueOf(timestamp);
+            String Url = "/evo-apigw/ipms/carWhiteList/sendCars?pageNum="+pageNum+"&pageSize="+pageSize+"&_="+aLong;
+            IClient iClient = new DefaultClient();
+            GeneralRequest generalRequest = new GeneralRequest(Url, Method.GET);
+            GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+
+
+    //黑名单列表
+    @RequestMapping("/ShowCarBlackList")
+    public GeneralResponse ShowCarBlackList (HttpServletRequest request ,@RequestParam(name = "farmId") Integer farmId,
+                                            @RequestParam(name = "pageNum") String pageNum,//车辆编号
+                                            @RequestParam(name = "pageSize")  String pageSize //车牌号
+    ) throws ClientException {
+        if(farmId!=1){
+            return null ;
+        }
+        String timestamp = String.valueOf((new Date()).getTime());
+        Long aLong = Long.valueOf(timestamp);
+        String Url = "/evo-apigw/ipms/carBlackList/sendCars?pageNum="+pageNum+"&pageSize="+pageSize+"&_="+aLong;
+        IClient iClient = new DefaultClient();
+        GeneralRequest generalRequest = new GeneralRequest(Url, Method.GET);
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+    //添加车辆进黑名单列表
+    @RequestMapping("/addCarBlackList")
+    public GeneralResponse addCarBlackList (HttpServletRequest request ,@RequestParam(name = "farmId") Integer farmId,
+                                             @RequestParam(name = "carId") String carId//车辆编号
+
+    ) throws ClientException {
+        if(farmId!=1){
+            return null ;
+        }
+        String URL = "/evo-apigw/ipms/carBlackList/update";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
+        System.out.println("开始执行");
+        Map<String, Object> value = new HashMap<>();
+        value.put("carId",carId);
+        value.put("validStartDay","2021-12-21");
+        value.put("validEndDay","2036-12-21");
+        value.put("deviceCodes","1002931,1002928");
+        generalRequest.body(JSON.toJSONString(value));
+        System.out.println(JSON.toJSONString(value));
+        //这种已经在配置文件里面安排了账号ip以及密码
+        generalRequest.header("Content-Type", " application/json");
+        //发起请求处理应答
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+
+
+
+    //添加车辆进白名单列表
+    @RequestMapping("/addCarWhiteList")
+    public GeneralResponse addCarWhiteList (HttpServletRequest request ,@RequestParam(name = "farmId") Integer farmId,
+                                            @RequestParam(name = "carId") String carId//车辆编号
+    ) throws ClientException {
+        if(farmId!=1){
+            return null ;
+        }
+
+        String URL = "/evo-apigw/ipms/carWhiteList/update";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
+        System.out.println("开始执行");
+        Map<String, Object> value = new HashMap<>();
+        value.put("carId",carId);
+        value.put("validStartDay","2021-12-21");
+        value.put("validEndDay","2036-12-21");
+        value.put("deviceCodes","1002931,1002928");
+        generalRequest.body(JSON.toJSONString(value));
+        System.out.println(JSON.toJSONString(value));
+        //这种已经在配置文件里面安排了账号ip以及密码
+        generalRequest.header("Content-Type", " application/json");
+        //发起请求处理应答
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+
+    //从白名单删除
+    @RequestMapping("/deleteFromCarWhiteList")
+    public GeneralResponse deleteFromCarWhiteList (@RequestBody Map<String, Object> params
+    ) throws ClientException {
+        Integer farmId= (int) params.get("farmId");
+        if(farmId!=1){
+            return null ;
+        }
+        String URL = "/evo-apigw/ipms/carWhiteList/delete/batch";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
+        System.out.println("开始执行");
+        generalRequest.body(JSON.toJSONString(params));
+        System.out.println(JSON.toJSONString(params));
+        //这种已经在配置文件里面安排了账号ip以及密码
+        generalRequest.header("Content-Type", " application/json");
+        //发起请求处理应答
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+
+
+
+    //从黑名单删除
+    @RequestMapping("/deleteFromCarBlackList")
+    public GeneralResponse deleteFromCarBlackList (@RequestBody Map<String, Object> params
+    ) throws ClientException {
+        Integer farmId= (int) params.get("farmId");
+        if(farmId!=1){
+            return null ;
+        }
+        String URL = "/evo-apigw/ipms/carBlackList/delete/batch";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
+        System.out.println("开始执行");
+        generalRequest.body(JSON.toJSONString(params));
+        System.out.println(JSON.toJSONString(params));
+        //这种已经在配置文件里面安排了账号ip以及密码
+        generalRequest.header("Content-Type", " application/json");
+        //发起请求处理应答
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+
+
+       //从基础表中删除
+    @RequestMapping("/deleteFromBaseCarList")
+    public GeneralResponse deleteFromBaseCarList (@RequestBody Map<String, Object> params
+    ) throws ClientException {
+        Integer farmId= (int) params.get("farmId");
+        if(farmId!=1){
+            return null ;
+        }
+        String URL = "/evo-apigw/ipms/car/delete/batch";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
+        System.out.println("开始执行");
+        generalRequest.body(JSON.toJSONString(params));
+        System.out.println(JSON.toJSONString(params));
+        //这种已经在配置文件里面安排了账号ip以及密码
+        generalRequest.header("Content-Type", " application/json");
+        //发起请求处理应答
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse ;
+    }
+
+
+
+
+    //过车的数据
         /**
          * 保存ntamade
          */
@@ -28,7 +278,6 @@ public class ClientCarManageController {
                 //返回为空数据
               return  new GeneralResponse() ;
             }
-
             System.out.println(request.getRequestURL()   );
             System.out.println(request.getQueryString());
             String queryString = request.getQueryString();

+ 1 - 6
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ClientController/ClientPersonManageController.java

@@ -11,12 +11,10 @@ import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
 import com.huimv.common.utils.StringUtilsWork;
 import com.huimv.video.dhicc.result.R;
 import com.huimv.video.dhicc.util.GetResponse;
-import com.huimv.video.dhicc.util.Result;
 import net.sf.json.JSONObject;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
@@ -26,7 +24,6 @@ import java.util.Map;
 //门禁是不一样的
 @RestController
 @RequestMapping("person")
-
 public class ClientPersonManageController {
 
 
@@ -38,8 +35,6 @@ public class ClientPersonManageController {
             //返回为空数据
             return  null;
         }
-
-
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Calendar c = Calendar.getInstance();
         Date date = new Date();
@@ -57,7 +52,7 @@ public class ClientPersonManageController {
             params1.put("endSwingTime",formatD);
         }
         params1.put("containDomain","1");
-        params1.put("openResult",0);
+        params1.put("openResult",0); //刷脸失败
         String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combined?";  //获取事件URL    post请求
     IClient iClient = new DefaultClient();
     String timestamp = String.valueOf((new Date()).getTime());