ソースを参照

修改 车闸、人闸 bug

11868 1 週間 前
コミット
78b73a9672
23 ファイル変更1296 行追加66 行削除
  1. 2 2
      supervision-admin/src/main/java/com/supervision/web/ConnectSDK/carDoor/hik/ITCMain.java
  2. 114 63
      supervision-admin/src/main/java/com/supervision/web/ConnectSDK/carDoor/hik/VechileListManage.java
  3. 138 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/controller/NameListController.java
  4. 59 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/controller/VehicleAccessRecordController.java
  5. 47 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/entity/NameList.java
  6. 46 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/entity/VehicleAccessRecord.java
  7. 42 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/mapper/NameListMapper.java
  8. 25 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/mapper/VehicleAccessRecordMapper.java
  9. 145 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/service/Impl/NameListServiceImpl.java
  10. 63 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/service/Impl/VehicleAccessRecordServiceImpl.java
  11. 35 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/service/NameListService.java
  12. 20 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/service/VehicleAccessRecordService.java
  13. 54 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/service/impl/CarEventLogServiceImpl.java
  14. 38 0
      supervision-admin/src/main/java/com/supervision/web/carGateManage/service/impl/CarInfoServiceImpl.java
  15. 81 0
      supervision-admin/src/main/java/com/supervision/web/peopleGateManage/controller/PersonAccessRecordController.java
  16. 18 0
      supervision-admin/src/main/java/com/supervision/web/peopleGateManage/entity/PersonAccessRecord.java
  17. 31 0
      supervision-admin/src/main/java/com/supervision/web/peopleGateManage/mapper/PersonAccessRecordMapper.java
  18. 17 0
      supervision-admin/src/main/java/com/supervision/web/peopleGateManage/service/PersonAccessRecordService.java
  19. 49 0
      supervision-admin/src/main/java/com/supervision/web/peopleGateManage/service/impl/PersonAccessRecordServiceImpl.java
  20. 0 1
      supervision-admin/src/main/java/com/supervision/web/videoManage/controller/VideoController.java
  21. 117 0
      supervision-admin/src/main/resources/mapper/carGateManage/NameListMapper.xml
  22. 72 0
      supervision-admin/src/main/resources/mapper/carGateManage/VehicleAccessRecordMapper.xml
  23. 83 0
      supervision-admin/src/main/resources/mapper/peopleGateManage/PersonAccessRecordMapper.xml

+ 2 - 2
supervision-admin/src/main/java/com/supervision/web/ConnectSDK/carDoor/hik/ITCMain.java

@@ -165,7 +165,7 @@ public class ITCMain {
         switch (caseId.toLowerCase()) {
             case "1": {
                 logger.info("[Module]下发车辆授权名单示例代码");
-                vechileListManage.addVechileList(userID);
+//                vechileListManage.addVechileList(userID);
                 break;
             }
             case "2": {
@@ -175,7 +175,7 @@ public class ITCMain {
             }
             case "3": {
                 logger.info("[Module]删除车辆授权名单示例代码");
-                vechileListManage.deleteVechileList(userID);
+//                vechileListManage.deleteVechileList(userID);
                 break;
             }
             case "4": {

+ 114 - 63
supervision-admin/src/main/java/com/supervision/web/ConnectSDK/carDoor/hik/VechileListManage.java

@@ -4,15 +4,17 @@ package com.supervision.web.ConnectSDK.carDoor.hik;
 import com.supervision.web.ConnectSDK.carDoor.CommonMethod.ConfigFileUtil;
 import com.supervision.web.ConnectSDK.carDoor.NetSDKDemo.HCNetSDK;
 import com.sun.jna.Pointer;
+import com.supervision.web.carGateManage.entity.NameList;
 import org.dom4j.Document;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
+import java.util.Calendar;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -38,70 +40,111 @@ public class VechileListManage {
     public ISAPI isapi;
 
     // 车辆授权名单下发
-    public void addVechileList(int lUserID) throws Exception {
+    public void addVechileList(int lUserID, NameList nameList) throws Exception {
         if (fVehicleCrtlCB == null) {
-            fVehicleCrtlCB = new FVehicleCrtlCB();
+            fVehicleCrtlCB = new FVehicleCrtlCB(); // 初始化回调
         }
-        int lHandle =
-                hCNetSDK.NET_DVR_StartRemoteConfig(lUserID, HCNetSDK.NET_DVR_VEHICLELIST_CTRL_START, null, 0,
-                        fVehicleCrtlCB, Pointer.NULL);
-        if (lHandle <= -1) {
 
+        // 启动远程配置
+        int lHandle = hCNetSDK.NET_DVR_StartRemoteConfig(
+                lUserID,
+                HCNetSDK.NET_DVR_VEHICLELIST_CTRL_START,
+                null,
+                0,
+                fVehicleCrtlCB,
+                Pointer.NULL
+        );
+
+        if (lHandle <= -1) {
             logger.info("NET_DVR_StartRemoteConfig failed errorCode:" + hCNetSDK.NET_DVR_GetLastError());
             return;
         }
-        HCNetSDK.NET_DVR_VEHICLE_CONTROL_LIST_INFO struVehicleControl =
-                new HCNetSDK.NET_DVR_VEHICLE_CONTROL_LIST_INFO();
-        struVehicleControl.read();
-        struVehicleControl.dwSize = struVehicleControl.size();
-        struVehicleControl.dwChannel = 1; //通道号,出入口抓拍机,一体机默认1
-        String sLicense = "浙A12345";    //车牌号码
-        struVehicleControl.sLicense = sLicense.getBytes("GBK"); //车牌号码
-        struVehicleControl.byListType = 0; //名单属性:0- 授权名单,1- 非授权名单
-        struVehicleControl.byPlateType = 0; //0- 标准民用车与军车车牌  //参考SDK使用手册中车牌类型枚举类型
-        /**
-         * VCA_BLUE_PLATE
-         * 0- 蓝色车牌
-         * VCA_YELLOW_PLATE
-         * 1- 黄色车牌
-         * VCA_WHITE_PLATE
-         * 2- 白色车牌
-         * VCA_BLACK_PLATE
-         * 3- 黑色车牌
-         * VCA_GREEN_PLATE
-         * 4- 绿色车牌
-         * VCA_BKAIR_PLATE
-         * 5- 民航黑色车牌
-         * VCA_OTHER = 0xff
-         * 0xff- 其他
-         */
-        struVehicleControl.byPlateColor = 0; //车牌颜色
-        //有效开始时间
-        struVehicleControl.struStartTime.wYear = (short) 2024;
-        struVehicleControl.struStartTime.byMonth = (byte) 01;
-        struVehicleControl.struStartTime.byDay = (byte) 01;
-        struVehicleControl.struStartTime.byHour = (byte) 00;
-        struVehicleControl.struStartTime.byMinute = (byte) 00;
-        struVehicleControl.struStartTime.bySecond = (byte) 00;
-        //有效结束时间
-        struVehicleControl.struStopTime.wYear = (short) 2028;
-        struVehicleControl.struStopTime.byMonth = (byte) 12;
-        struVehicleControl.struStopTime.byDay = (byte) 30;
-        struVehicleControl.struStopTime.byHour = (byte) 23;
-        struVehicleControl.struStopTime.byMinute = (byte) 59;
-        struVehicleControl.struStopTime.bySecond = (byte) 59;
-        struVehicleControl.write();
-        boolean bSend = hCNetSDK.NET_DVR_SendRemoteConfig(lHandle, HCNetSDK.ENUM_SENDDATA,
-                struVehicleControl.getPointer(), struVehicleControl.size());
+
+        HCNetSDK.NET_DVR_VEHICLE_CONTROL_LIST_INFO car = new HCNetSDK.NET_DVR_VEHICLE_CONTROL_LIST_INFO();
+        car.read(); // 读取结构体初始值
+
+        car.dwSize = car.size(); // 结构体大小
+        car.dwChannel = (nameList.getChannel() != null ? nameList.getChannel() : 1); // 通道号,出入口抓拍机,一体机默认1,0xffffffff表示全部通道
+        car.dwDataIndex = (nameList.getDataIndex() != null ? nameList.getDataIndex().intValue() : 0); // 数据流水号,SDK会自动维护
+
+        // 车牌号,固定16字节,GBK编码,不够补0,多余截断 // 车牌号码,最大16字节,GBK编码
+        byte[] licenseBytes = new byte[16];
+        if (nameList.getPlateNumber() != null) {
+            byte[] tmp = nameList.getPlateNumber().getBytes("GBK");
+            System.arraycopy(tmp, 0, licenseBytes, 0, Math.min(tmp.length, 16));
+        }
+        car.sLicense = licenseBytes;
+
+        car.byListType = (byte) ("whitelist".equalsIgnoreCase(nameList.getType()) ? 0 : 1); // 名单类型:0-授权,1-非授权
+        car.byPlateType = (byte) (nameList.getPlateType() != null ? nameList.getPlateType() : 0); // 车牌类型,0-标准民用车(参考 SDK 枚举 VCA_PLATE_TYPE)
+        car.byPlateColor = (byte) (nameList.getPlateColor() != null ? nameList.getPlateColor() : 0); // 车牌颜色,0-蓝色,1-黄色,2-白色,3-黑色,4-绿色,5-民航黑,0xff-其他
+
+        car.byRes = (nameList.getReserved1() != null ? nameList.getReserved1() : new byte[21]); // 保留字段,置0
+
+        // 卡号信息,固定48字节,GBK编码 // 卡号信息,可选,置0
+        byte[] cardNoBytes = new byte[48];
+        if (nameList.getCardNo() != null) {
+            byte[] tmp = nameList.getCardNo().getBytes("GBK");
+            System.arraycopy(tmp, 0, cardNoBytes, 0, Math.min(tmp.length, 48));
+        }
+        car.sCardNo = cardNoBytes;
+
+        // 有效开始时间
+        Calendar cal = Calendar.getInstance();
+        if (nameList.getAccessStartTime() != null) {
+            cal.setTime(nameList.getAccessStartTime());
+        } else {
+            cal.set(2024, Calendar.JANUARY, 1, 0, 0, 0); // 默认开始时间
+        }
+        car.struStartTime.wYear = (short) cal.get(Calendar.YEAR);
+        car.struStartTime.byMonth = (byte) (cal.get(Calendar.MONTH) + 1);
+        car.struStartTime.byDay = (byte) cal.get(Calendar.DAY_OF_MONTH);
+        car.struStartTime.byHour = (byte) cal.get(Calendar.HOUR_OF_DAY);
+        car.struStartTime.byMinute = (byte) cal.get(Calendar.MINUTE);
+        car.struStartTime.bySecond = (byte) cal.get(Calendar.SECOND);
+
+        // 有效结束时间
+        if (nameList.getAccessEndTime() != null) {
+            cal.setTime(nameList.getAccessEndTime());
+        } else {
+            cal.setTime(new Date()); // 默认结束时间为当前时间
+        }
+        car.struStopTime.wYear = (short) cal.get(Calendar.YEAR);
+        car.struStopTime.byMonth = (byte) (cal.get(Calendar.MONTH) + 1);
+        car.struStopTime.byDay = (byte) cal.get(Calendar.DAY_OF_MONTH);
+        car.struStopTime.byHour = (byte) cal.get(Calendar.HOUR_OF_DAY);
+        car.struStopTime.byMinute = (byte) cal.get(Calendar.MINUTE);
+        car.struStopTime.bySecond = (byte) cal.get(Calendar.SECOND);
+
+        // 同步操作数,固定32字节,GBK编码 // 同步操作数(增量同步用,平台维护)
+        byte[] operateBytes = new byte[32];
+        if (nameList.getOperateIndex() != null) {
+            byte[] tmp = nameList.getOperateIndex().getBytes("GBK");
+            System.arraycopy(tmp, 0, operateBytes, 0, Math.min(tmp.length, 32));
+        }
+        car.sOperateIndex = operateBytes;
+
+        car.byRes1 = (nameList.getReserved2() != null ? nameList.getReserved2() : new byte[224]); // 保留字段,置0
+
+        car.write(); // 写入内存,准备下发
+
+        // 下发到设备
+        boolean bSend = hCNetSDK.NET_DVR_SendRemoteConfig(
+                lHandle,
+                HCNetSDK.ENUM_SENDDATA,
+                car.getPointer(),
+                car.size()
+        );
         if (!bSend) {
             System.err.println("NET_DVR_SendRemoteConfig失败,错误码:" + hCNetSDK.NET_DVR_GetLastError());
-            //关闭下发长连接
-            hCNetSDK.NET_DVR_StopRemoteConfig(lHandle);
+            hCNetSDK.NET_DVR_StopRemoteConfig(lHandle); // 关闭下发长连接
         }
+
         /**
          * 循环下发车牌名单,继续调用NET_DVR_SendRemoteConfig下发下一张车牌名单
          */
         // 循环判断下发状态
+        long startTime = System.currentTimeMillis();
         while (true) {
             if (iStatus == 1000 || iStatus == 1002) {
                 // 调用方法关闭长连接
@@ -113,6 +156,12 @@ public class VechileListManage {
                 }
                 break; // 退出循环
             }
+            if (System.currentTimeMillis() - startTime > 30_000) { // 超时30秒
+                logger.warn("下发超时,强制关闭长连接");
+                hCNetSDK.NET_DVR_StopRemoteConfig(lHandle);
+                break;
+            }
+            Thread.sleep(100); // 避免CPU空转
         }
     }
 
@@ -121,12 +170,16 @@ public class VechileListManage {
         public void invoke(int dwType, Pointer lpBuffer, int dwBufLen, Pointer pUserData) {
             switch (dwType) {
                 case HCNetSDK.NET_SDK_CALLBACK_TYPE_STATUS:
+
+                    // 读取 SDK 返回的状态字节
                     HCNetSDK.BYTE_ARRAY struCallbackStatus = new HCNetSDK.BYTE_ARRAY(40);
                     struCallbackStatus.write();
                     Pointer pStatus = struCallbackStatus.getPointer();
                     pStatus.write(0, lpBuffer.getByteArray(0, struCallbackStatus.size()), 0, dwBufLen);
                     struCallbackStatus.read();
 
+                    // 将前4个字节解析为状态值(小端序)
+                    int status = 0;
                     for (int i = 0; i < 4; i++) {
                         int ioffset = i * 8;
                         int iByte = struCallbackStatus.byValue[i] & 0xff;
@@ -136,18 +189,16 @@ public class VechileListManage {
                         case HCNetSDK.NET_SDK_CALLBACK_STATUS_SUCCESS:// NET_SDK_CALLBACK_STATUS_SUCCESS
                         {
                             logger.info("下发成功");
-                            //增加消息事件,查询成功之后调用NET_DVR_StopRemoteConfig释放资源
+                            // 增加消息事件,查询成功之后调用NET_DVR_StopRemoteConfig释放资源
                             break;
                         }
-
                         case HCNetSDK.NET_SDK_CALLBACK_STATUS_PROCESSING: {
                             logger.info("下发中...");
                             break;
                         }
-
                         case HCNetSDK.NET_SDK_CALLBACK_STATUS_FAILED: {
                             logger.info("下发失败,错误码: dwStatus:" + iStatus);
-                            //增加消息事件,查询失败之后调用NET_DVR_StopRemoteConfig释放资源
+                            // 增加消息事件,查询失败之后调用NET_DVR_StopRemoteConfig释放资源
                             break;
                         }
                     }
@@ -163,9 +214,9 @@ public class VechileListManage {
      *
      * @param lUserID
      */
-    public void searchVechileList(int lUserID) {
+    public String searchVechileList(int lUserID) {
         String searchVechileListUrl = "POST /ISAPI/Traffic/channels/1/searchLPListAudit";
-        //输入参数,XML或者JSON数据,查询多条人员信息json报文
+        // 输入参数,XML或者JSON数据,查询多条人员信息json报文
         Map<String, Object> parameter = new HashMap<>();
         parameter.put("searchID", UUID.randomUUID()); // 查询id
         parameter.put("maxResults", 30); // 最大查询数量
@@ -173,7 +224,7 @@ public class VechileListManage {
         logger.info("查询的json报文:" + strInbuff);
         String responseString = isapi.stdXMLConfig(lUserID, searchVechileListUrl, strInbuff);
         logger.info("查询返回报文:" + responseString);
-        return;
+        return responseString;
     }
 
     /**
@@ -181,9 +232,9 @@ public class VechileListManage {
      *
      * @param lUserID
      */
-    public void deleteVechileList(int lUserID) {
+    public void deleteVechileList(int lUserID, NameList nameList) {
         String deleteVechileListUrl = "PUT /ISAPI/Traffic/channels/1/DelLicensePlateAuditData?format=json";
-        //输入参数,XML或者JSON数据
+        // 输入参数,XML或者JSON数据
         Map<String, Object> parameter = new HashMap<>();
         parameter.put("plateColor", "yellow"); // 查询id
         parameter.put("licensePlate", "京AA12345"); // 最大查询数量
@@ -215,7 +266,7 @@ public class VechileListManage {
         isapi.stdXMLConfig(lUserID, "POST /ISAPI/ITC/Entrance/VCL", xmlInput);
     }
 
-    //  删除车牌授权名单输入报文
+    // 删除车牌授权名单输入报文
     public String deleteXml() {
         Document document1;
         Element root = DocumentHelper.createElement("VCLDelCond");
@@ -234,7 +285,7 @@ public class VechileListManage {
         return requestXml;
     }
 
-    //查询车牌授权名单输入报文
+    // 查询车牌授权名单输入报文
     public String getXml() {
         Document document1;
         Element root = DocumentHelper.createElement("VCLDelCond");

+ 138 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/controller/NameListController.java

@@ -0,0 +1,138 @@
+package com.supervision.web.carGateManage.controller;
+
+import com.supervision.web.carGateManage.entity.NameList;
+import com.supervision.web.carGateManage.service.NameListService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * @description 名单管理控制器
+ * 提供增删改查接口,包括批量删除和重复车牌校验
+ */
+@RestController
+@RequestMapping("/carCamera/nameList")
+public class NameListController {
+
+    @Resource
+    private NameListService nameListService;
+
+    /**
+     * 获取名单列表(分页)
+     * @param deviceId 设备ID,可选
+     * @param type 名单类型,可选(whitelist/blacklist/visitor)
+     * @param plateNumber 车牌号,可选,支持模糊查询
+     * @param page 页码,默认1
+     * @param pageSize 每页条数,默认10
+     * @return 包含records、total、page、pageSize、success字段
+     */
+    @GetMapping("/list")
+    public Map<String, Object> list(
+            @RequestParam(required = false) Long deviceId,
+            @RequestParam(required = false) String type,
+            @RequestParam(required = false) String plateNumber,
+            @RequestParam(defaultValue = "1") int page,
+            @RequestParam(defaultValue = "10") int pageSize
+    ) {
+        List<NameList> list = nameListService.getList(deviceId, type, plateNumber, page, pageSize);
+        int total = nameListService.getTotal(deviceId, type, plateNumber);
+        Map<String, Object> result = new HashMap<>();
+        result.put("records", list);
+        result.put("total", total);
+        result.put("page", page);
+        result.put("pageSize", pageSize);
+        result.put("success", true);
+        return result;
+    }
+
+    /**
+     * 新增名单
+     * 1. 校验同一设备+类型下车牌号是否重复
+     * 2. 插入数据库
+     * @param nameList 前端传入的名单对象
+     * @return success、msg、record
+     */
+    @PostMapping("/add")
+    public Map<String, Object> add(@RequestBody NameList nameList) {
+        Map<String, Object> result = new HashMap<>();
+
+        // 1. 校验车牌号是否重复
+        boolean exists = nameListService.exists(nameList.getDeviceId(), nameList.getPlateNumber(), nameList.getType());
+        if (exists) {
+            result.put("success", false);
+            result.put("msg", "车牌号已存在");
+            return result;
+        }
+
+        // 2. 插入
+        boolean success = nameListService.add(nameList);
+        result.put("success", success);
+        if (success) {
+            result.put("msg", "新增成功");
+            result.put("record", nameList); // 返回新增记录给前端
+        } else {
+            result.put("msg", "新增失败");
+        }
+        return result;
+    }
+
+    /**
+     * 更新名单
+     * 1. 校验车牌号是否重复(排除自己)
+     * 2. 更新数据库
+     * @param nameList 前端传入的名单对象
+     * @return success、msg、record
+     */
+    @PostMapping("/update")
+    public Map<String, Object> update(@RequestBody NameList nameList) {
+        Map<String, Object> result = new HashMap<>();
+
+        // 1. 校验车牌号是否重复(排除自己)
+        boolean exists = nameListService.existsExcludeId(nameList.getDeviceId(), nameList.getPlateNumber(), nameList.getType(), nameList.getId());
+        if (exists) {
+            result.put("success", false);
+            result.put("msg", "车牌号已存在");
+            return result;
+        }
+
+        // 2. 更新
+        boolean success = nameListService.update(nameList);
+        result.put("success", success);
+        result.put("msg", success ? "更新成功" : "更新失败");
+        result.put("record", success ? nameList : null);
+        return result;
+    }
+
+    /**
+     * 删除名单(单条或批量)
+     * @param params 前端传入 id 或 ids
+     * @return success、msg、deletedIds
+     */
+    @PostMapping("/delete")
+    public Map<String, Object> delete(@RequestBody Map<String, Object> params) {
+        Map<String, Object> result = new HashMap<>();
+        List<Long> ids = new ArrayList<>();
+
+        if (params.containsKey("id")) {
+            ids.add(((Number) params.get("id")).longValue());
+        } else if (params.containsKey("ids")) {
+            @SuppressWarnings("unchecked")
+            List<Number> rawIds = (List<Number>) params.get("ids");
+            rawIds.forEach(n -> ids.add(n.longValue()));
+        }
+
+        if (ids.isEmpty()) {
+            result.put("success", false);
+            result.put("msg", "未提供要删除的id");
+            result.put("deletedIds", null);
+            return result;
+        }
+
+        boolean success = nameListService.batchDelete(ids);
+        result.put("success", success);
+        result.put("msg", success ? "删除成功" : "删除失败");
+        result.put("deletedIds", success ? ids : null);
+        return result;
+    }
+}

+ 59 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/controller/VehicleAccessRecordController.java

@@ -0,0 +1,59 @@
+package com.supervision.web.carGateManage.controller;
+
+
+import com.github.pagehelper.PageInfo;
+import com.supervision.web.carGateManage.entity.VehicleAccessRecord;
+import com.supervision.web.carGateManage.service.VehicleAccessRecordService;
+import com.supervision.web.videoManage.domain.Video;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+@RestController
+@RequestMapping("/carCamera/accessRecord")
+public class VehicleAccessRecordController {
+
+    @Resource
+    private VehicleAccessRecordService vehicleAccessRecordService;
+
+    @PostMapping("/list")
+    public Map<String, Object> list(@RequestBody Map<String, Object> params) {
+        PageInfo<VehicleAccessRecord> pageInfo = vehicleAccessRecordService.getList(params);
+        Map<String, Object> result = new HashMap<>();
+        result.put("total", pageInfo.getTotal());
+        result.put("list", pageInfo.getList());
+        result.put("pageNum", pageInfo.getPageNum());
+        result.put("pageSize", pageInfo.getPageSize());
+        return result;
+    }
+
+    @PostMapping("/add")
+    public Map<String, Object> add(@RequestBody VehicleAccessRecord record) {
+        boolean success = vehicleAccessRecordService.add(record);
+        Map<String, Object> result = new HashMap<>();
+        result.put("success", success);
+        result.put("msg", success ? "添加成功" : "添加失败");
+        return result;
+    }
+
+    @PostMapping("/update")
+    public Map<String, Object> update(@RequestBody VehicleAccessRecord record) {
+        boolean success = vehicleAccessRecordService.update(record);
+        Map<String, Object> result = new HashMap<>();
+        result.put("success", success);
+        result.put("msg", success ? "修改成功" : "修改失败");
+        return result;
+    }
+
+    @PostMapping("/delete")
+    public Map<String, Object> delete(@RequestBody Map<String, Object> params) {
+        List<Long> ids = (List<Long>) params.get("ids");
+        boolean success = vehicleAccessRecordService.batchDelete(ids);
+        Map<String, Object> result = new HashMap<>();
+        result.put("success", success);
+        result.put("msg", success ? "删除成功" : "删除失败");
+        return result;
+    }
+}

+ 47 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/entity/NameList.java

@@ -0,0 +1,47 @@
+package com.supervision.web.carGateManage.entity;
+
+
+import lombok.Data;
+import java.util.Date;
+
+@Data
+public class NameList {
+
+    // ========== 基础信息 ==========
+    private Long id;                  // 主键ID,数据库自增,用于唯一标识一条名单记录
+    private Long deviceId;            // 设备ID,关联出入口抓拍机或门禁设备
+    private String plateNumber;       // 车牌号,用于识别车辆
+    private String type;              // 名单类型:whitelist-授权名单,blacklist-非授权名单
+    private Date accessStartTime;     // 有效开始时间,控制车辆可通过设备的起始时间
+    private Date accessEndTime;       // 有效结束时间,控制车辆可通过设备的结束时间
+    private Date createTime;          // 数据创建时间,数据库自动生成
+    private Date updateTime;          // 数据更新时间,数据库自动维护,每次更新自动刷新
+
+    // ========== SDK 下发相关 ==========
+    private Long dataIndex;           // SDK 数据流水号(dwDataIndex),用于标识平台中的记录,可选
+    private String operateIndex;      // SDK 同步操作数(sOperateIndex),用于增量同步,可选
+    private Integer channel;          // 通道号,出入口抓拍机或一体机默认1,可选,0xFFFFFFFF表示全部通道
+    private Integer plateType;        // 车牌类型,对应 SDK VCA_PLATE_TYPE 枚举,可选,默认0
+    private Integer plateColor;       // 车牌颜色,对应 SDK VCA_PLATE_COLOR 枚举,可选,默认0
+    private String cardNo;            // 卡号,可选字段,用于授权刷卡车辆
+    private byte[] reserved1;         // 保留字段,对应 SDK 结构体中的 byRes,可选
+    private byte[] reserved2;         // 保留字段,对应 SDK 结构体中的 byRes1,可选
+
+    // ========== 构造或辅助方法 ==========
+    /**
+     * 判断是否为授权名单
+     * @return true 如果是授权名单
+     */
+    public boolean isWhitelist() {
+        return "whitelist".equalsIgnoreCase(type);
+    }
+
+    /**
+     * 判断是否为非授权名单
+     * @return true 如果是非授权名单
+     */
+    public boolean isBlacklist() {
+        return "blacklist".equalsIgnoreCase(type);
+    }
+}
+

+ 46 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/entity/VehicleAccessRecord.java

@@ -0,0 +1,46 @@
+package com.supervision.web.carGateManage.entity;
+
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 车辆进出记录实体类
+ * 用于记录海康威视车牌识别设备上报的车辆进出事件
+ * 对应前端的“车辆进出记录”表格展示
+ */
+@Data
+public class VehicleAccessRecord {
+
+    /** 主键ID,自增 */
+    private Long id;
+
+    /** 车牌号,例如 "粤A12345" */
+    private String plateNumber;
+
+    /** 设备ID,对应设备表中的主键,用于区分来源设备 */
+    private Long deviceId;
+
+    /**
+     * 事件类型
+     * in:进场(车辆进入)
+     * out:出场(车辆离开)
+     */
+    private String eventType;
+
+    /** 抓拍时间,表示车辆被识别的具体时间 */
+    private Date captureTime;
+
+    /** 抓拍图片URL,用于展示车辆进出时的照片 */
+    private String photoUrl;
+
+    /** 备注信息,例如识别异常说明或人工补录原因 */
+    private String remark;
+
+    /** 记录创建时间(系统插入数据库的时间) */
+    private Date createTime;
+
+    /** 记录最后更新时间(系统修改记录时自动更新) */
+    private Date updateTime;
+}

+ 42 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/mapper/NameListMapper.java

@@ -0,0 +1,42 @@
+package com.supervision.web.carGateManage.mapper;
+
+
+import com.supervision.web.carGateManage.entity.NameList;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface NameListMapper {
+
+    List<NameList> getList(@Param("deviceId") Long deviceId,
+                            @Param("type") String type,
+                            @Param("plateNumber") String plateNumber,
+                            @Param("offset") int offset,
+                            @Param("pageSize") int pageSize);
+
+    List<NameList> getByIds(List<Long> ids);
+
+    NameList getById(Long id);
+
+    int getCount(@Param("deviceId") Long deviceId,
+                  @Param("type") String type,
+                  @Param("plateNumber") String plateNumber);
+
+    int exists(@Param("deviceId") Long deviceId,
+               @Param("plateNumber") String plateNumber,
+               @Param("type") String type);
+
+    int existsExcludeId(@Param("deviceId") Long deviceId,
+                        @Param("plateNumber") String plateNumber,
+                        @Param("type") String type,
+                        @Param("id") Long id);
+
+    int insert(NameList nameList);
+
+    int update(NameList nameList);
+
+    int deleteById(@Param("id") Long id);
+
+    int batchDelete(@Param("ids") List<Long> ids);
+
+}

+ 25 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/mapper/VehicleAccessRecordMapper.java

@@ -0,0 +1,25 @@
+package com.supervision.web.carGateManage.mapper;
+
+
+import com.supervision.web.carGateManage.entity.VehicleAccessRecord;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
+@Mapper
+public interface VehicleAccessRecordMapper {
+    List<VehicleAccessRecord> getList(@Param("deviceId") Long deviceId,
+                                      @Param("plateNumber") String plateNumber,
+                                      @Param("eventType") String eventType,
+                                      @Param("startTime") String startTime,
+                                      @Param("endTime") String endTime);
+
+    int insert(VehicleAccessRecord record);
+
+    int update(VehicleAccessRecord record);
+
+    int deleteById(Long id);
+
+    int deleteBatch(@Param("ids") List<Long> ids);
+}
+

+ 145 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/service/Impl/NameListServiceImpl.java

@@ -0,0 +1,145 @@
+package com.supervision.web.carGateManage.service.impl;
+
+
+import com.supervision.web.ConnectSDK.carDoor.CarDoorDeviceManager;
+import com.supervision.web.ConnectSDK.carDoor.hik.VechileListManage;
+import com.supervision.web.ConnectSDK.util.DeviceSession;
+import com.supervision.web.carGateManage.entity.NameList;
+import com.supervision.web.carGateManage.mapper.NameListMapper;
+import com.supervision.web.carGateManage.service.NameListService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service
+public class NameListServiceImpl implements NameListService {
+
+    @Resource
+    private NameListMapper nameListMapper;
+
+    @Resource
+    private VechileListManage vechileListManage;
+
+    @Autowired
+    private CarDoorDeviceManager carDoorDeviceManager;
+
+    @Override
+    public List<NameList> getList(Long deviceId, String type, String plateNumber, int page, int pageSize) {
+        int offset = (page - 1) * pageSize;
+        return nameListMapper.getList(deviceId, type, plateNumber, offset, pageSize);
+    }
+
+    @Override
+    public int getTotal(Long deviceId, String type, String plateNumber) {
+        return nameListMapper.getCount(deviceId, type, plateNumber);
+    }
+
+    // 新增名单并同步设备
+    public boolean add(NameList nameList) {
+        boolean dbSuccess = nameListMapper.insert(nameList) > 0;
+        if (dbSuccess) {
+            try {
+                int lUserID = getDeviceUserID(nameList.getDeviceId());
+                vechileListManage.addVechileList(lUserID, nameList); // 调用 SDK 同步
+            } catch (Exception e) {
+                // 可记录异常,但数据库已成功,可考虑补偿机制
+                e.printStackTrace();
+            }
+        }
+        return dbSuccess;
+    }
+
+    // 更新名单并同步设备
+    public boolean update(NameList nameList) {
+        boolean dbSuccess = nameListMapper.update(nameList) > 0;
+        if (dbSuccess) {
+            try {
+                int lUserID = getDeviceUserID(nameList.getDeviceId());
+                vechileListManage.addVechileList(lUserID, nameList); // SDK 覆盖旧名单
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return dbSuccess;
+    }
+
+    // 删除名单并同步设备
+    public boolean delete(Long id) {
+        NameList list = nameListMapper.getById(id);
+        if (list == null) return false;
+
+        boolean dbSuccess = nameListMapper.deleteById(id) > 0;
+        if (dbSuccess) {
+            try {
+                int lUserID = getDeviceUserID(list.getDeviceId());
+                vechileListManage.deleteVechileList(lUserID, list); // SDK 删除
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return dbSuccess;
+    }
+
+    @Override
+    public boolean batchDelete(List<Long> ids) {
+        boolean dbSuccess = nameListMapper.batchDelete(ids) > 0;
+        if (dbSuccess) {
+            ids.forEach(id -> {
+                NameList list = nameListMapper.getById(id);
+                if (list != null) {
+                    try {
+                        int lUserID = getDeviceUserID(list.getDeviceId());
+                        vechileListManage.deleteVechileList(lUserID, list);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        }
+        return dbSuccess;
+    }
+    @Override
+    public boolean exists(Long deviceId, String plateNumber, String type) {
+        return nameListMapper.exists(deviceId, plateNumber, type) > 0;
+    }
+
+    @Override
+    public boolean existsExcludeId(Long deviceId, String plateNumber, String type, Long id) {
+        return nameListMapper.existsExcludeId(deviceId, plateNumber, type, id) > 0;
+    }
+
+    @Override
+    public boolean syncToDevice(NameList nameList) {
+        try {
+            // 获取设备登录ID (假设已有登录逻辑)
+            int lUserID = getDeviceUserID(nameList.getDeviceId());
+            vechileListManage.addVechileList(lUserID, nameList); // 下发名单
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    @Override
+    public boolean deleteFromDevice(NameList nameList) {
+        try {
+            int lUserID = getDeviceUserID(nameList.getDeviceId());
+            vechileListManage.deleteVechileList(lUserID, nameList); // 删除名单
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    // 根据设备ID获取 SDK 登录返回的 UserID
+    private int getDeviceUserID(Long deviceId) {
+        DeviceSession deviceSession = carDoorDeviceManager.getDeviceSession(deviceId.toString());
+        return deviceSession.getUserID();
+    }
+}
+
+

+ 63 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/service/Impl/VehicleAccessRecordServiceImpl.java

@@ -0,0 +1,63 @@
+package com.supervision.web.carGateManage.service.impl;
+
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.supervision.web.carGateManage.entity.VehicleAccessRecord;
+import com.supervision.web.carGateManage.mapper.VehicleAccessRecordMapper;
+import com.supervision.web.carGateManage.service.VehicleAccessRecordService;
+import com.supervision.web.videoManage.domain.Video;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class VehicleAccessRecordServiceImpl implements VehicleAccessRecordService {
+
+    @Resource
+    private VehicleAccessRecordMapper vehicleAccessRecordMapper;
+
+    @Override
+    public PageInfo<VehicleAccessRecord> getList(Map<String, Object> params) {
+        int page = (int) params.getOrDefault("page", 1);
+        int size = (int) params.getOrDefault("size", 10);
+
+        Object deviceIdObj = params.get("deviceId");
+        Long deviceId = null;
+        if (deviceIdObj != null) {
+            deviceId = ((Number) deviceIdObj).longValue();
+        }
+
+        String plateNumber = (String) params.getOrDefault("plateNumber", null);
+        String eventType = (String) params.getOrDefault("eventType", null);
+        String startTime = (String) params.getOrDefault("startTime", null);
+        String endTime = (String) params.getOrDefault("endTime", null);
+
+        PageHelper.startPage(page, size);
+
+        List<VehicleAccessRecord> list = vehicleAccessRecordMapper.getList(deviceId, plateNumber, eventType, startTime, endTime);
+
+        return new PageInfo<>(list);
+    }
+
+    @Override
+    public boolean add(VehicleAccessRecord record) {
+        return vehicleAccessRecordMapper.insert(record) > 0;
+    }
+
+    @Override
+    public boolean update(VehicleAccessRecord record) {
+        return vehicleAccessRecordMapper.update(record) > 0;
+    }
+
+    @Override
+    public boolean delete(Long id) {
+        return vehicleAccessRecordMapper.deleteById(id) > 0;
+    }
+
+    @Override
+    public boolean batchDelete(List<Long> ids) {
+        return vehicleAccessRecordMapper.deleteBatch(ids) > 0;
+    }
+}

+ 35 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/service/NameListService.java

@@ -0,0 +1,35 @@
+package com.supervision.web.carGateManage.service;
+
+
+import com.supervision.web.carGateManage.entity.NameList;
+
+import java.util.List;
+
+public interface NameListService {
+
+    List<NameList> getList(Long deviceId, String type, String plateNumber, int page, int pageSize);
+
+    int getTotal(Long deviceId, String type, String plateNumber);
+
+    boolean add(NameList nameList);
+
+    boolean update(NameList nameList);
+
+    boolean delete(Long id);
+
+    boolean batchDelete(List<Long> ids);
+
+    boolean exists(Long deviceId, String plateNumber, String type);
+
+    boolean existsExcludeId(Long deviceId, String plateNumber, String type, Long id);
+
+    /**
+     * 同步单条名单到设备
+     */
+    boolean syncToDevice(NameList nameList);
+
+    /**
+     * 删除设备名单
+     */
+    boolean deleteFromDevice(NameList nameList);
+}

+ 20 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/service/VehicleAccessRecordService.java

@@ -0,0 +1,20 @@
+package com.supervision.web.carGateManage.service;
+
+
+import com.github.pagehelper.PageInfo;
+import com.supervision.web.carGateManage.entity.VehicleAccessRecord;
+import java.util.List;
+import java.util.Map;
+
+public interface VehicleAccessRecordService {
+    PageInfo<VehicleAccessRecord> getList(Map<String, Object> params);
+
+    boolean add(VehicleAccessRecord record);
+
+    boolean update(VehicleAccessRecord record);
+
+    boolean delete(Long id);
+
+    boolean batchDelete(List<Long> ids);
+}
+

+ 54 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/service/impl/CarEventLogServiceImpl.java

@@ -0,0 +1,54 @@
+package com.supervision.web.carGateManage.service.impl;
+
+import com.supervision.web.carGateManage.entity.CarEvent;
+import com.supervision.web.carGateManage.mapper.CarEventLogMapper;
+import com.supervision.web.carGateManage.service.CarEventLogService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class CarEventLogServiceImpl implements CarEventLogService {
+
+    @Resource
+    private CarEventLogMapper carEventLogMapper;
+
+    @Override
+    public Map<String, Object> getCarEventLogs(Map<String, Object> params) {
+        int pageNum = (int) params.getOrDefault("pageNum", 1);
+        int pageSize = (int) params.getOrDefault("pageSize", 24);
+        int offset = (pageNum - 1) * pageSize;
+
+        List<CarEvent> list = carEventLogMapper.selectByCondition(
+                (String) params.get("plateNumber"),
+                (String) params.get("ownerName"),
+                (String) params.get("phoneNumber"),
+                (String) params.get("eventType"),
+                (String) params.get("carType"),
+                (String) params.get("carGroup"),
+                (String) params.get("startTime"),
+                (String) params.get("endTime"),
+                offset, pageSize
+        );
+
+        int total = carEventLogMapper.countByCondition(
+                (String) params.get("plateNumber"),
+                (String) params.get("ownerName"),
+                (String) params.get("phoneNumber"),
+                (String) params.get("eventType"),
+                (String) params.get("carType"),
+                (String) params.get("carGroup"),
+                (String) params.get("startTime"),
+                (String) params.get("endTime")
+        );
+
+        Map<String, Object> result = new HashMap<>();
+        result.put("records", list);
+        result.put("total", total);
+        return result;
+    }
+}
+

+ 38 - 0
supervision-admin/src/main/java/com/supervision/web/carGateManage/service/impl/CarInfoServiceImpl.java

@@ -0,0 +1,38 @@
+package com.supervision.web.carGateManage.service.impl;
+import com.supervision.web.carGateManage.entity.CarInfo;
+import com.supervision.web.carGateManage.mapper.CarInfoMapper;
+import com.supervision.web.carGateManage.service.CarInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CarInfoServiceImpl implements CarInfoService {
+    @Autowired
+    private CarInfoMapper carInfoMapper;
+
+    @Override
+    public List<CarInfo> getCarList() {
+        return carInfoMapper.getCarList();
+    }
+
+    @Override
+    public int getCarCount() {
+        return carInfoMapper.countCars();  // 假设你有个 mapper
+    }
+    @Override
+    public int addCar(CarInfo carInfo) {
+        return carInfoMapper.insertCar(carInfo);
+    }
+
+    @Override
+    public int editCar(CarInfo carInfo) {
+        return carInfoMapper.updateCar(carInfo);
+    }
+
+    @Override
+    public int removeCar(Long id) {
+        return carInfoMapper.deleteCar(id);
+    }
+}

+ 81 - 0
supervision-admin/src/main/java/com/supervision/web/peopleGateManage/controller/PersonAccessRecordController.java

@@ -0,0 +1,81 @@
+package com.supervision.web.peopleGateManage.controller;
+
+import com.supervision.web.peopleGateManage.entity.PersonAccessRecord;
+import com.supervision.web.peopleGateManage.service.PersonAccessRecordService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+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 javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/peopleDoor/accessRecord")
+public class PersonAccessRecordController {
+
+    @Resource
+    private PersonAccessRecordService service;
+
+    @GetMapping("/list")
+    public Map<String, Object> list(Long deviceId, Long personId, String name, String eventType,
+                                    @RequestParam(required=false) Date startTime,
+                                    @RequestParam(required=false) Date endTime,
+                                    @RequestParam(defaultValue="1") int page,
+                                    @RequestParam(defaultValue="10") int pageSize) {
+        List<PersonAccessRecord>
+                list = service.getList(deviceId, personId, name, eventType, startTime, endTime, page, pageSize);
+        int total = service.getTotal(deviceId, personId, name, eventType, startTime, endTime);
+        Map<String, Object> map = new HashMap<>();
+        map.put("records", list);
+        map.put("total", total);
+        map.put("page", page);
+        map.put("pageSize", pageSize);
+        map.put("success", true);
+        return map;
+    }
+
+    @PostMapping("/add")
+    public Map<String,Object> add(@RequestBody PersonAccessRecord record){
+        boolean success = service.add(record);
+        Map<String,Object> map = new HashMap<>();
+        map.put("success", success);
+        map.put("msg", success ? "新增成功" : "新增失败");
+        return map;
+    }
+
+    @PostMapping("/update")
+    public Map<String,Object> update(@RequestBody PersonAccessRecord record){
+        boolean success = service.update(record);
+        Map<String,Object> map = new HashMap<>();
+        map.put("success", success);
+        map.put("msg", success ? "修改成功" : "修改失败");
+        return map;
+    }
+
+    @PostMapping("/delete")
+    public Map<String,Object> delete(@RequestBody Map<String,Object> params){
+        Long id = ((Number)params.get("id")).longValue();
+        boolean success = service.deleteById(id);
+        Map<String,Object> map = new HashMap<>();
+        map.put("success", success);
+        map.put("msg", success ? "删除成功" : "删除失败");
+        return map;
+    }
+
+    @PostMapping("/batchDelete")
+    public Map<String,Object> batchDelete(@RequestBody Map<String,Object> params){
+        @SuppressWarnings("unchecked")
+        List<Long> ids = (List<Long>) params.get("ids");
+        boolean success = service.deleteBatch(ids);
+        Map<String,Object> map = new HashMap<>();
+        map.put("success", success);
+        map.put("msg", success ? "批量删除成功" : "批量删除失败");
+        return map;
+    }
+}

+ 18 - 0
supervision-admin/src/main/java/com/supervision/web/peopleGateManage/entity/PersonAccessRecord.java

@@ -0,0 +1,18 @@
+package com.supervision.web.peopleGateManage.entity;
+
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class PersonAccessRecord {
+    private Long id;
+    private Long personId;
+    private String name;
+    private Long deviceId;
+    private String eventType;
+    private Date captureTime;
+    private String photoUrl;
+    private Date createTime;
+}

+ 31 - 0
supervision-admin/src/main/java/com/supervision/web/peopleGateManage/mapper/PersonAccessRecordMapper.java

@@ -0,0 +1,31 @@
+package com.supervision.web.peopleGateManage.mapper;
+
+
+import com.supervision.web.peopleGateManage.entity.PersonAccessRecord;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+@Mapper
+public interface PersonAccessRecordMapper {
+    List<PersonAccessRecord> getList(@Param("deviceId") Long deviceId,
+                                     @Param("personId") Long personId,
+                                     @Param("name") String name,
+                                     @Param("eventType") String eventType,
+                                     @Param("startTime") Date startTime,
+                                     @Param("endTime") Date endTime,
+                                     @Param("offset") int offset,
+                                     @Param("pageSize") int pageSize);
+    int getTotal(@Param("deviceId") Long deviceId,
+                 @Param("personId") Long personId,
+                 @Param("name") String name,
+                 @Param("eventType") String eventType,
+                 @Param("startTime") Date startTime,
+                 @Param("endTime") Date endTime);
+    int insert(PersonAccessRecord record);
+    int update(PersonAccessRecord record);
+    int deleteById(Long id);
+    int deleteBatch(@Param("ids") List<Long> ids);
+}

+ 17 - 0
supervision-admin/src/main/java/com/supervision/web/peopleGateManage/service/PersonAccessRecordService.java

@@ -0,0 +1,17 @@
+package com.supervision.web.peopleGateManage.service;
+
+
+import com.supervision.web.peopleGateManage.entity.PersonAccessRecord;
+
+import java.util.Date;
+import java.util.List;
+
+public interface PersonAccessRecordService {
+    List<PersonAccessRecord> getList(Long deviceId, Long personId, String name, String eventType, Date startTime, Date endTime, int page, int pageSize);
+    int getTotal(Long deviceId, Long personId, String name, String eventType, Date startTime, Date endTime);
+    boolean add(PersonAccessRecord record);
+    boolean update(PersonAccessRecord record);
+    boolean deleteById(Long id);
+    boolean deleteBatch(List<Long> ids);
+}
+

+ 49 - 0
supervision-admin/src/main/java/com/supervision/web/peopleGateManage/service/impl/PersonAccessRecordServiceImpl.java

@@ -0,0 +1,49 @@
+package com.supervision.web.peopleGateManage.service.impl;
+
+
+import com.supervision.web.peopleGateManage.entity.PersonAccessRecord;
+import com.supervision.web.peopleGateManage.mapper.PersonAccessRecordMapper;
+import com.supervision.web.peopleGateManage.service.PersonAccessRecordService;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class PersonAccessRecordServiceImpl implements PersonAccessRecordService {
+
+    @Resource
+    private PersonAccessRecordMapper mapper;
+
+    @Override
+    public List<PersonAccessRecord> getList(Long deviceId, Long personId, String name, String eventType, Date startTime, Date endTime, int page, int pageSize) {
+        int offset = (page - 1) * pageSize;
+        return mapper.getList(deviceId, personId, name, eventType, startTime, endTime, offset, pageSize);
+    }
+
+    @Override
+    public int getTotal(Long deviceId, Long personId, String name, String eventType, Date startTime, Date endTime) {
+        return mapper.getTotal(deviceId, personId, name, eventType, startTime, endTime);
+    }
+
+    @Override
+    public boolean add(PersonAccessRecord record) {
+        return mapper.insert(record) > 0;
+    }
+
+    @Override
+    public boolean update(PersonAccessRecord record) {
+        return mapper.update(record) > 0;
+    }
+
+    @Override
+    public boolean deleteById(Long id) {
+        return mapper.deleteById(id) > 0;
+    }
+
+    @Override
+    public boolean deleteBatch(List<Long> ids) {
+        return mapper.deleteBatch(ids) > 0;
+    }
+}
+

+ 0 - 1
supervision-admin/src/main/java/com/supervision/web/videoManage/controller/VideoController.java

@@ -141,7 +141,6 @@ public class VideoController {
     @PostMapping("/list")
     public Map<String, Object> listVideos(@RequestBody Map<String, Object> params) {
         PageInfo<Video> pageInfo = videoService.listAllPaged(params);
-
         Map<String, Object> result = new HashMap<>();
         result.put("total", pageInfo.getTotal());
         result.put("list", pageInfo.getList());

+ 117 - 0
supervision-admin/src/main/resources/mapper/carGateManage/NameListMapper.xml

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.supervision.web.carGateManage.mapper.NameListMapper">
+
+    <resultMap id="BaseResultMap" type="com.supervision.web.carGateManage.entity.NameList">
+        <id column="id" property="id"/>
+        <result column="device_id" property="deviceId"/>
+        <result column="plate_number" property="plateNumber"/>
+        <result column="type" property="type"/>
+        <result column="access_start_time" property="accessStartTime"/>
+        <result column="access_end_time" property="accessEndTime"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+    </resultMap>
+
+    <!-- 查询列表 -->
+    <select id="getList" resultMap="BaseResultMap">
+        SELECT *
+        FROM new_name_list
+        <where>
+            <if test="deviceId != null">
+                AND device_id = #{deviceId}
+            </if>
+            <if test="type != null and type != ''">
+                AND type = #{type}
+            </if>
+            <if test="plateNumber != null and plateNumber != ''">
+                AND plate_number LIKE CONCAT('%', #{plateNumber}, '%')
+            </if>
+        </where>
+        ORDER BY id DESC
+        LIMIT #{offset}, #{pageSize}
+    </select>
+
+    <!-- 查询总数 -->
+    <select id="getCount" resultType="int">
+        SELECT COUNT(*)
+        FROM new_name_list
+        <where>
+            <if test="deviceId != null">
+                AND device_id = #{deviceId}
+            </if>
+            <if test="type != null and type != ''">
+                AND type = #{type}
+            </if>
+            <if test="plateNumber != null and plateNumber != ''">
+                AND plate_number LIKE CONCAT('%', #{plateNumber}, '%')
+            </if>
+        </where>
+    </select>
+
+    <!-- 批量查询 -->
+    <select id="getByIds" resultMap="BaseResultMap" parameterType="list">
+        SELECT *
+        FROM new_name_list
+        WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <select id="getById" resultMap="BaseResultMap" parameterType="long">
+        SELECT *
+        FROM new_name_list
+        WHERE id = #{id}
+    </select>
+
+    <!-- 插入 -->
+    <insert id="insert" parameterType="com.supervision.web.carGateManage.entity.NameList">
+        INSERT INTO new_name_list(device_id, plate_number, type, access_start_time, access_end_time)
+        VALUES (#{deviceId}, #{plateNumber}, #{type}, #{accessStartTime}, #{accessEndTime})
+    </insert>
+
+    <!-- 更新 -->
+    <update id="update" parameterType="com.supervision.web.carGateManage.entity.NameList">
+        UPDATE new_name_list
+        SET
+            plate_number = #{plateNumber},
+            type = #{type},
+            access_start_time = #{accessStartTime},
+            access_end_time = #{accessEndTime}
+        WHERE id = #{id}
+    </update>
+
+    <!-- 单个删除 -->
+    <delete id="deleteById" parameterType="long">
+        DELETE FROM new_name_list WHERE id = #{id}
+    </delete>
+
+    <!-- 批量删除 -->
+    <delete id="batchDelete" parameterType="list">
+        DELETE FROM new_name_list
+        WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <!-- 校验重复 -->
+    <select id="exists" resultType="int">
+        SELECT COUNT(*) FROM new_name_list
+        WHERE device_id = #{deviceId} AND plate_number = #{plateNumber} AND type = #{type}
+    </select>
+
+    <!-- 校验重复(排除自己) -->
+    <select id="existsExcludeId" resultType="int">
+        SELECT COUNT(*)
+        FROM new_name_list
+        WHERE device_id = #{deviceId}
+        AND plate_number = #{plateNumber}
+        AND type = #{type}
+        AND id &lt;&gt; #{id}  <!-- 使用 &lt;>&gt; 代替 <> -->
+    </select>
+
+</mapper>

+ 72 - 0
supervision-admin/src/main/resources/mapper/carGateManage/VehicleAccessRecordMapper.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.supervision.web.carGateManage.mapper.VehicleAccessRecordMapper">
+
+    <resultMap id="BaseResultMap" type="com.supervision.web.carGateManage.entity.VehicleAccessRecord">
+        <id property="id" column="id"/>
+        <result property="plateNumber" column="plate_number"/>
+        <result property="deviceId" column="device_id"/>
+        <result property="eventType" column="event_type"/>
+        <result property="captureTime" column="capture_time"/>
+        <result property="photoUrl" column="photo_url"/>
+        <result property="remark" column="remark"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <select id="getList" resultMap="BaseResultMap">
+        SELECT *
+        FROM new_vehicle_access_record
+        WHERE 1=1
+        <if test="deviceId != null">
+          AND device_id = #{deviceId}
+        </if>
+        <if test="plateNumber != null and plateNumber != ''">
+          AND plate_number LIKE CONCAT('%', #{plateNumber}, '%')
+        </if>
+        <if test="eventType != null and eventType != ''">
+          AND event_type = #{eventType}
+        </if>
+        <if test="startTime != null">
+          AND capture_time &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+          AND capture_time &lt;= #{endTime}
+        </if>
+        ORDER BY capture_time DESC
+    </select>
+
+    <insert id="insert" parameterType="com.supervision.web.carGateManage.entity.VehicleAccessRecord">
+        INSERT INTO new_vehicle_access_record
+            (plate_number, device_id, event_type, capture_time, photo_url, remark)
+        VALUES
+            (#{plateNumber}, #{deviceId}, #{eventType}, #{captureTime}, #{photoUrl}, #{remark})
+    </insert>
+
+    <update id="update" parameterType="com.supervision.web.carGateManage.entity.VehicleAccessRecord">
+        UPDATE new_vehicle_access_record
+        SET plate_number=#{plateNumber},
+            device_id=#{deviceId},
+            event_type=#{eventType},
+            capture_time=#{captureTime},
+            photo_url=#{photoUrl},
+            remark=#{remark},
+            update_time=NOW()
+        WHERE id=#{id}
+    </update>
+
+    <delete id="deleteById" parameterType="long">
+        DELETE FROM new_vehicle_access_record WHERE id=#{id}
+    </delete>
+
+    <delete id="deleteBatch">
+        DELETE FROM new_vehicle_access_record
+        WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 83 - 0
supervision-admin/src/main/resources/mapper/peopleGateManage/PersonAccessRecordMapper.xml

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.supervision.web.peopleGateManage.mapper.PersonAccessRecordMapper">
+
+    <!-- 结果映射 -->
+    <resultMap id="BaseResultMap" type="com.supervision.web.peopleGateManage.entity.PersonAccessRecord">
+        <id property="id" column="id"/>
+        <result property="personId" column="person_id"/>
+        <result property="name" column="name"/>
+        <result property="deviceId" column="device_id"/>
+        <result property="eventType" column="event_type"/>
+        <result property="captureTime" column="capture_time"/>
+        <result property="photoUrl" column="photo_url"/>
+        <result property="remark" column="remark"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <!-- 查询列表 -->
+    <select id="getList" resultMap="BaseResultMap">
+        SELECT * FROM new_person_access_record
+        WHERE 1=1
+        <if test="deviceId != null"> AND device_id = #{deviceId} </if>
+        <if test="personId != null"> AND person_id = #{personId} </if>
+        <if test="name != null and name != ''"> AND name LIKE CONCAT('%', #{name}, '%') </if>
+        <if test="eventType != null and eventType != ''"> AND event_type = #{eventType} </if>
+        <if test="startTime != null"> AND capture_time &gt;= #{startTime} </if>
+        <if test="endTime != null"> AND capture_time &lt;= #{endTime} </if>
+        ORDER BY capture_time DESC
+        LIMIT #{offset}, #{pageSize}
+    </select>
+
+    <!-- 查询总数 -->
+    <select id="getTotal" resultType="int">
+        SELECT COUNT(*) FROM new_person_access_record
+        WHERE 1=1
+        <if test="deviceId != null"> AND device_id = #{deviceId} </if>
+        <if test="personId != null"> AND person_id = #{personId} </if>
+        <if test="name != null and name != ''"> AND name LIKE CONCAT('%', #{name}, '%') </if>
+        <if test="eventType != null and eventType != ''"> AND event_type = #{eventType} </if>
+        <if test="startTime != null"> AND capture_time &gt;= #{startTime} </if>
+        <if test="endTime != null"> AND capture_time &lt;= #{endTime} </if>
+    </select>
+
+    <!-- 插入 -->
+    <insert id="insert" parameterType="com.supervision.web.peopleGateManage.entity.PersonAccessRecord">
+        INSERT INTO new_person_access_record
+        (person_id, name, device_id, event_type, capture_time, photo_url, remark)
+        VALUES
+            (#{personId}, #{name}, #{deviceId}, #{eventType}, #{captureTime}, #{photoUrl}, #{remark})
+    </insert>
+
+    <!-- 更新 -->
+    <update id="update" parameterType="com.supervision.web.peopleGateManage.entity.PersonAccessRecord">
+        UPDATE new_person_access_record
+        SET person_id=#{personId},
+            name=#{name},
+            device_id=#{deviceId},
+            event_type=#{eventType},
+            capture_time=#{captureTime},
+            photo_url=#{photoUrl},
+            remark=#{remark},
+            update_time=NOW()
+        WHERE id=#{id}
+    </update>
+
+    <!-- 删除单条 -->
+    <delete id="deleteById" parameterType="long">
+        DELETE FROM new_person_access_record WHERE id=#{id}
+    </delete>
+
+    <!-- 批量删除 -->
+    <delete id="deleteBatch">
+        DELETE FROM new_person_access_record
+        WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>