brealin 9 ヶ月 前
コミット
99443e785f

+ 3 - 4
src/main/java/com/xjrsoft/module/hikvision/util/DataUtil.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.hikvision.util;
 
 import cn.hutool.db.Db;
+import com.alibaba.druid.sql.visitor.functions.Trim;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
@@ -478,9 +479,7 @@ public class DataUtil {
 
             JsonObject paramJson = new JsonObject();
             paramJson.addProperty("clientId", clientId);
-            paramJson.addProperty("plateNo", carMessageApply.getCarNumber());
-            System.out.println(faceImportMapper.GetHikvisonPersonId(carMessageApply.getId().toString()));
-            System.out.println(faceImportMapper.GetHikvisonPersonId(carMessageApply.getId().toString()));
+            paramJson.addProperty("plateNo", carMessageApply.getCarNumber().trim());
             paramJson.addProperty("personId", faceImportMapper.GetHikvisonPersonId(carMessageApply.getId().toString()));
 
             int vehicleTypeNum;
@@ -508,7 +507,7 @@ public class DataUtil {
         for (CarMessageApply carMessageApply : dataList) {
             JsonObject paramJsonTime = new JsonObject();
             paramJsonTime.addProperty("parkSyscode", "c69f2a7c48a74216bcab7d65f24d4a09");
-            paramJsonTime.addProperty("plateNo", carMessageApply.getCarNumber());
+            paramJsonTime.addProperty("plateNo", carMessageApply.getCarNumber().trim());
             paramJsonTime.addProperty("startTime", String.valueOf(carMessageApply.getStartTime()));
             paramJsonTime.addProperty("endTime", String.valueOf(carMessageApply.getEndTime()));
             apiUtil.doPost(apiPathTime, String.valueOf(paramJsonTime), tagMap, null);

+ 251 - 0
src/main/java/com/xjrsoft/module/hikvision/util/Out_In_RecordUtil.java

@@ -0,0 +1,251 @@
+package com.xjrsoft.module.hikvision.util;
+
+import cn.hutool.db.Db;
+import com.alibaba.excel.Empty;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
+
+import java.sql.SQLException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+public class Out_In_RecordUtil {
+    private void teacherInsertRecord(Db db, Long userId, String recordTime, String facePhoto,int status, String eventId) throws SQLException {
+
+        String sql = "INSERT INTO teacher_out_in_record(create_date, user_id, record_time, face_photo, eventId, status,delete_mark,enabled_mark) " +
+                "VALUES(now(), '"  + userId + "', '" + recordTime + "', '" +
+                facePhoto + "', '" + eventId + "', '" +status + "',0,1)";
+        db.execute(sql);
+    }
+
+    private void studentInsertRecord(Db db, Long userId, Long teacherId, Long classId, String facePhoto, String recordTime, int status, String eventId) throws SQLException {
+        String sql = "INSERT INTO student_out_in_record(create_date, user_id, teacher_id, class_id, face_photo, record_time , eventId,status,delete_mark,enabled_mark) " +
+                "VALUES(now(), '" + userId + "', '" + teacherId + "', '" +
+                classId + "', '" + facePhoto + "', '" + recordTime + "', '" + eventId + "', '" + status + "',0,1)";
+        db.execute(sql);
+    }
+
+
+    public void visitInsertRecord(Db db, Long reservation_school_people_id, String recordTime,String facePhoto, int status) throws SQLException {
+        String sql = "INSERT INTO visitor_out_in_record(create_date, reservation_school_people_id, record_time, face_photo, status,delete_mark,enabled_mark) " +
+                "VALUES(now(), '"  + reservation_school_people_id + "', '" +
+                 recordTime + "', '" + facePhoto + "', '" + status +  "',0,1)";
+        db.execute(sql);
+    }
+
+    private void vehicleInsertRecord(Db db, Long carMessageApplyId, String recordTime, String reservationSchoolPeopleId, int category, String facePhoto, int status) throws SQLException {
+        String sql = "INSERT INTO car_out_in_record(create_date, car_message_apply_id, record_time, face_photo, status,reservation_school_people_id, category,delete_mark,enabled_mark) " +
+                "VALUES(now(), '"  + carMessageApplyId + "', '" +
+                recordTime + "', '" + facePhoto + "', '" + status + "', '" + reservationSchoolPeopleId + "', '" + category  +  "',0,1)";
+        db.execute(sql);
+    }
+
+    public void GetTeacherAndStudentRecords(Db use, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+        JsonArray responseBuilder = new JsonArray();
+
+        AtomicInteger pageNo = new AtomicInteger(1);
+        int pageSize = 100;
+        boolean hasMorePages = true;
+
+        while (hasMorePages) {
+            String response = GetDoorEvent(pageNo, pageSize);
+
+            JsonElement responseElement = new Gson().fromJson(response, JsonElement.class);
+            JsonArray dataList = responseElement.getAsJsonObject().getAsJsonObject("data").getAsJsonArray("list");
+
+            for (JsonElement item : dataList) {
+                responseBuilder.add(item);
+            }
+
+            JsonObject responseJson = new Gson().fromJson(response, JsonObject.class);
+            int totalCount = responseJson.getAsJsonObject("data").get("totalPage").getAsInt();
+            hasMorePages = pageNo.getAndIncrement() * pageSize < totalCount;
+        }
+        // Process the records
+        InsertTeacherStudentRecords(use, responseBuilder, faceImportMapper);
+    }
+
+    private void InsertTeacherStudentRecords(Db use, JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+        List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
+        List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
+
+        for (JsonElement element : doorEventsResponse) {
+            JsonObject item = element.getAsJsonObject();
+
+            Long personId;
+            try {
+                personId = item.get("personId").isJsonNull() ? null : item.get("personId").getAsLong();
+            }catch (Exception e){
+                continue;
+            }
+            if (personId == null) continue;
+
+            int status = item.get("inAndOutType").getAsInt();
+            String uri = item.get("picUri").isJsonNull() ? null : item.get("picUri").getAsString();
+            String recordTime = item.get("eventTime").isJsonNull() ? null : item.get("eventTime").getAsString();
+            String eventId = item.get("eventId").isJsonNull() ? null : item.get("eventId").getAsString();
+
+            if (!Objects.equals(faceImportMapper.IsStudentTypeByPersonId(personId), "学生")) {
+                // 老师记录
+                if (teacherEventIdList.contains(eventId)) continue;
+                teacherInsertRecord(use, personId, ChangeTime(recordTime), ApiUtil.GetRedirectURL(uri),status,eventId);
+            } else {
+                // 学生记录
+                if (studentEventIdList.contains(eventId)) continue;
+                studentInsertRecord(use, personId, faceImportMapper.GetTeacherIdByPersonId(personId),
+                        faceImportMapper.GetClassIdByPersonId(personId), ApiUtil.GetRedirectURL(uri), ChangeTime(recordTime), status,eventId);
+            }
+        }
+    }
+
+    public void GetVisitRecord(Db use, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+        ApiUtil apiUtil = new ApiUtil();
+
+        AtomicInteger pageNo = new AtomicInteger(1);
+        int pageSize = 100;
+        boolean hasMorePages = true;
+        JsonArray responseBuilder = new JsonArray();
+        JsonArray responseDoorBuilder = new JsonArray();
+
+        String apiPath = "/api/visitor/v1/event/turnover/search";
+
+        while (hasMorePages) {
+            JsonObject paramJson = new JsonObject();
+            paramJson.addProperty("pageNo", pageNo.get());
+            paramJson.addProperty("pageSize", pageSize);
+
+            String response = apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
+            String responseDoor = GetDoorEvent(pageNo,pageSize);
+
+            JsonElement responseElement = new Gson().fromJson(response, JsonElement.class);
+            JsonElement responseDoorElement = new Gson().fromJson(responseDoor, JsonElement.class);
+
+            JsonArray dataList = responseElement.getAsJsonObject().getAsJsonObject("data").getAsJsonArray("rows");
+            JsonArray dataDoorList = responseDoorElement.getAsJsonObject().getAsJsonObject("data").getAsJsonArray("list");
+
+            for (JsonElement item : dataList) {
+                responseBuilder.add(item);
+            }
+
+            for (JsonElement item : dataDoorList) {
+                responseDoorBuilder.add(item);
+            }
+
+            JsonObject responseJson = new Gson().fromJson(response, JsonObject.class);
+            int totalCount = responseJson.getAsJsonObject("data").get("total").getAsInt();
+            hasMorePages = pageNo.getAndIncrement() * pageSize < totalCount;
+        }
+
+        InsertVisitRecords(use, responseBuilder,responseDoorBuilder,faceImportMapper);
+    }
+
+    private void InsertVisitRecords(Db use, JsonArray eventsResponse, JsonArray doorEventsResponse,FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+        List<Long> visit_id_list = faceImportMapper.GetReservationSchoolIdList();
+
+        for (JsonElement element : eventsResponse) {
+            JsonObject item = element.getAsJsonObject();
+
+            String picUri = item.get("visitorPhotoUri").isJsonNull() ? null : ApiUtil.GetRedirectURL(item.get("visitorPhotoUri").getAsString());
+            String orderId = item.get("orderId").isJsonNull() ? null : item.get("orderId").getAsString();
+            String eventTime = item.get("eventTime").isJsonNull() ? null : ChangeTime(item.get("eventTime").getAsString());
+            //todo: reservationSchoolId
+//            Long reservationSchoolId = faceImportMapper.GetReservationSchoolId(orderId) == null ? 1 : faceImportMapper.GetReservationSchoolId(orderId);
+
+            int status = -1;
+            for (JsonElement e : doorEventsResponse){
+                JsonObject ele = e.getAsJsonObject();
+                if (ele.get("eventId") == item.get("eventId")){
+                    status = ele.get("inAndOutType").getAsInt();
+                    break;
+                }
+            }
+
+            if (visit_id_list.contains(1)) continue;
+            visitInsertRecord(use, Long.parseLong("123"), eventTime, picUri, status);
+        }
+
+    }
+
+    public void GetVehicleRecord(Db use, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+        ApiUtil apiUtil = new ApiUtil();
+
+        AtomicInteger pageNo = new AtomicInteger(1);
+        int pageSize = 1000;
+        boolean hasMorePages = true;
+        JsonArray responseBuilder = new JsonArray();
+
+        String apiPath = "/api/pms/v1/crossRecords/page";
+
+        while (hasMorePages) {
+            JsonObject paramJson = new JsonObject();
+            paramJson.addProperty("pageNo", pageNo.getAndIncrement());
+            paramJson.addProperty("pageSize", pageSize);
+
+            String response = apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
+            JsonElement responseElement = new Gson().fromJson(response, JsonElement.class);
+            JsonArray dataList = responseElement.getAsJsonObject().getAsJsonObject("data").getAsJsonArray("list");
+
+            for (JsonElement item : dataList) {
+                responseBuilder.add(item);
+            }
+
+            JsonObject responseJson = new Gson().fromJson(response, JsonObject.class);
+            int totalCount = responseJson.getAsJsonObject("data").get("total").getAsInt();
+            hasMorePages = pageNo.getAndIncrement() * pageSize < totalCount;
+        }
+
+        InsertVehicleRecords(use, responseBuilder,faceImportMapper);
+    }
+
+    private void InsertVehicleRecords(Db use, JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+        List<String> vehicle_id_list = faceImportMapper.GetVehicleIdList();
+
+        for (JsonElement element : doorEventsResponse) {
+            JsonObject item = element.getAsJsonObject();
+
+            String carMessageApplyIdStr = faceImportMapper.GetCarMessageApplyIdByCarNumber(item.get("plateNo").getAsString().trim());
+            Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? 0 : Long.parseLong(carMessageApplyIdStr);
+            int releaseMode = item.get("releaseMode").isJsonNull() ? null : item.get("releaseMode").getAsInt();
+            String eventTime = item.get("crossTime").isJsonNull() ? null : ChangeTime(item.get("crossTime").getAsString());
+            String crossRecordSyscode = item.get("crossRecordSyscode").isJsonNull() ? null : item.get("crossRecordSyscode").getAsString();
+            int status = item.get("vehicleOut").isJsonNull() ? null : item.get("vehicleOut").getAsInt();
+
+            if(vehicle_id_list.contains(crossRecordSyscode)) continue;
+
+            JsonElement facePicUriElement = item.get("facePicUri");
+            String facePicUri;
+            if (facePicUriElement == null || facePicUriElement.isJsonNull()) {
+                facePicUri = "null";
+            } else {
+                facePicUri = ApiUtil.GetRedirectURL(facePicUriElement.getAsString());
+            }
+
+            vehicleInsertRecord(use, carId, eventTime, crossRecordSyscode,releaseMode,facePicUri,status);
+        }
+    }
+
+    private String GetDoorEvent(AtomicInteger pageNo, int pageSize){
+        ApiUtil apiUtil = new ApiUtil();
+        String apiPath = "/api/acs/v2/door/events";
+        JsonObject paramJson = new JsonObject();
+        paramJson.addProperty("pageNo", pageNo.get());
+        paramJson.addProperty("pageSize", pageSize);
+
+        return apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
+    }
+
+
+    private String ChangeTime(String recordTime) throws ParseException {
+        SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+        SimpleDateFormat mysqlFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = isoFormat.parse(recordTime);
+        return mysqlFormat.format(date);
+    }
+
+}

+ 0 - 147
src/main/java/com/xjrsoft/module/hikvision/util/Teacher_Student_OutIn_RecordUtil.java

@@ -1,147 +0,0 @@
-package com.xjrsoft.module.hikvision.util;
-
-import cn.hutool.db.Db;
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
-
-import java.sql.SQLException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-
-public class Teacher_Student_OutIn_RecordUtil {
-    public void teacherInsertRecord(Db db, Long userId, String recordTime, String facePhoto,int status, String eventId) throws SQLException {
-
-        String sql = "INSERT INTO teacher_out_in_record(create_date, user_id, record_time, face_photo, eventId, status,delete_mark,enabled_mark) " +
-                "VALUES(now(), '"  + userId + "', '" + recordTime + "', '" +
-                facePhoto + "', '" + eventId + "', '" +status + "',0,1)";
-        db.execute(sql);
-    }
-
-    public void studentInsertRecord(Db db, Long userId, Long teacherId, Long classId, String facePhoto, String recordTime, int status, String eventId) throws SQLException {
-        String sql = "INSERT INTO student_out_in_record(create_date, user_id, teacher_id, class_id, face_photo, record_time , eventId,status,delete_mark,enabled_mark) " +
-                "VALUES(now(), '" + userId + "', '" + teacherId + "', '" +
-                classId + "', '" + facePhoto + "', '" + recordTime + "', '" + eventId + "', '" + status + "',0,1)";
-        db.execute(sql);
-    }
-
-
-    public void visitInsertRecord(Db db, Long reservation_school_people_id, String recordTime,Long facePhoto, int status) throws SQLException {
-        String sql = "INSERT INTO visitor_out_in_record(create_date, reservation_school_people_id, record_time, face_photo, status,delete_mark,enabled_mark) " +
-                "VALUES(now(), '"  + reservation_school_people_id + "', '" +
-                 recordTime + "', '" + facePhoto + "', '" + status +  "',0,1)";
-        db.execute(sql);
-    }
-
-    public String GetDoorEvents(Db use, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
-        ApiUtil apiUtil = new ApiUtil();
-
-        String apiPath = "/api/acs/v2/door/events";
-        JsonArray responseBuilder = new JsonArray();
-
-        AtomicInteger pageNo = new AtomicInteger(1);
-        int pageSize = 100;
-        boolean hasMorePages = true;
-
-        while (hasMorePages) {
-            JsonObject paramJson = new JsonObject();
-            paramJson.addProperty("pageNo", pageNo.get());
-            paramJson.addProperty("pageSize", pageSize);
-
-            String response = apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
-            JsonElement responseElement = new Gson().fromJson(response, JsonElement.class);
-            JsonArray dataList = responseElement.getAsJsonObject().getAsJsonObject("data").getAsJsonArray("list");
-
-            for (JsonElement item : dataList) {
-                responseBuilder.add(item);
-            }
-
-            JsonObject responseJson = new Gson().fromJson(response, JsonObject.class);
-            int totalCount = responseJson.getAsJsonObject("data").get("totalPage").getAsInt();
-            hasMorePages = pageNo.getAndIncrement() < totalCount;
-        }
-        // Process the records
-        InsertTeacherStudentRecords(use, responseBuilder, faceImportMapper);
-        return responseBuilder.toString();
-    }
-
-
-    public void InsertTeacherStudentRecords(Db use, JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
-        Teacher_Student_OutIn_RecordUtil teacherStudentOutInRecordUtil = new Teacher_Student_OutIn_RecordUtil();
-        List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
-        List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
-
-        for (JsonElement element : doorEventsResponse) {
-            JsonObject item = element.getAsJsonObject();
-
-            Long personId;
-            try {
-                personId = item.get("personId").isJsonNull() ? null : item.get("personId").getAsLong();
-            }catch (Exception e){
-                continue;
-            }
-            if (personId == null) continue;
-
-            int status = item.get("inAndOutType").getAsInt();
-            String uri = item.get("picUri").isJsonNull() ? null : item.get("picUri").getAsString();
-            String recordTime = item.get("eventTime").isJsonNull() ? null : item.get("eventTime").getAsString();
-            String eventId = item.get("eventId").isJsonNull() ? null : item.get("eventId").getAsString();
-
-            if (!Objects.equals(faceImportMapper.IsStudentTypeByPersonId(personId), "学生")) {
-                // 老师记录
-                if (teacherEventIdList.contains(eventId)) continue;
-                teacherStudentOutInRecordUtil.teacherInsertRecord(use, personId, ChangeTime(recordTime), ApiUtil.GetRedirectURL(uri),status,eventId);
-            } else {
-                // 学生记录
-                if (studentEventIdList.contains(eventId)) continue;
-                teacherStudentOutInRecordUtil.studentInsertRecord(use, personId, faceImportMapper.GetTeacherIdByPersonId(personId),
-                        faceImportMapper.GetClassIdByPersonId(personId), ApiUtil.GetRedirectURL(uri), ChangeTime(recordTime), status,eventId);
-            }
-        }
-    }
-
-    void GetVisitRecord(){
-        ApiUtil apiUtil = new ApiUtil();
-        JsonObject paramJson = new JsonObject();
-        paramJson.addProperty("pageNo", 1);
-        paramJson.addProperty("pageSize", 100);
-
-        Map<String, String> querys = new HashMap<>();
-        querys.put("tagId", "frs");
-
-        String apiPath = "/api/visitor/v2/visiting/records";
-        String response = apiUtil.doPost(apiPath, String.valueOf(paramJson), querys);
-
-        JsonObject doorEventsJson = new Gson().fromJson(response, JsonObject.class);
-        JsonArray dataList = doorEventsJson.getAsJsonObject("data").getAsJsonArray("list");
-
-        for (JsonElement element : dataList) {
-            JsonObject item = element.getAsJsonObject();
-            if (item.get("orderId").isJsonNull()) {
-                // 访客记录
-                Long orderId = item.get("orderId").getAsLong();
-                String picUri = item.get("picUri").getAsString();
-                String visitStartTime = item.get("visitStartTime").getAsString();
-                // int status?
-
-                // mapper
-
-//                Teacher_Student_OutIn_RecordUtil teacherStudentOutInRecordUtil = new Teacher_Student_OutIn_RecordUtil();
-//                teacherStudentOutInRecordUtil.visitInsertRecord();db...);
-            }
-        }
-    }
-
-    private String ChangeTime(String recordTime) throws ParseException {
-        SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
-        SimpleDateFormat mysqlFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        Date date = isoFormat.parse(recordTime);
-        return mysqlFormat.format(date);
-    }
-
-}

+ 3 - 11
src/main/java/com/xjrsoft/module/job/InsertOutInRecordTask.java

@@ -4,10 +4,7 @@ import cn.hutool.db.Db;
 import cn.hutool.extra.spring.SpringUtil;
 import com.xjrsoft.common.constant.GlobalConstant;
 import com.xjrsoft.common.utils.DatasourceUtil;
-import com.xjrsoft.module.hikvision.entity.HikvisionData;
-import com.xjrsoft.module.hikvision.util.DataUtil;
-import com.xjrsoft.module.hikvision.util.Teacher_Student_OutIn_RecordUtil;
-import com.xjrsoft.module.schedule.entity.JianyueData;
+import com.xjrsoft.module.hikvision.util.Out_In_RecordUtil;
 import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,11 +12,6 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.sql.DataSource;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 /**
  * @author dzx
@@ -31,7 +23,7 @@ public class InsertOutInRecordTask {
     @Autowired
     private FaceImportMapper faceImportMapper;
 
-    Teacher_Student_OutIn_RecordUtil teacherStudentOutInRecordUtil = new Teacher_Student_OutIn_RecordUtil();
+    Out_In_RecordUtil out_in_recordUtil = new Out_In_RecordUtil();
 
     @Scheduled(cron = "0 */15 * * * ?")
     public void RefreshConnectionPool() {
@@ -46,7 +38,7 @@ public class InsertOutInRecordTask {
             Db use = Db.use(datasource);
 
             //教师&学生拉取数据
-            teacherStudentOutInRecordUtil.GetDoorEvents(use, faceImportMapper);
+            out_in_recordUtil.GetTeacherAndStudentRecords(use, faceImportMapper);
 
             log.info("数据推送完成");
         } catch (Exception e) {

+ 6 - 0
src/main/java/com/xjrsoft/module/teacher/mapper/FaceImportMapper.java

@@ -22,5 +22,11 @@ public interface FaceImportMapper {
 
     List<String> GetStudentUrlList();
     List<String> GetTeacherUrlList();
+
+    List<Long> GetReservationSchoolIdList();
+    Long GetReservationSchoolId(@Param("id") String id);
+
+    String GetCarMessageApplyIdByCarNumber(@Param("id") String id);
+    List<String> GetVehicleIdList();
 }
 

+ 27 - 1
src/main/resources/mapper/teacher/TeacherFaceImportMapper.xml

@@ -44,7 +44,7 @@
     <select id="GetHikvisonPersonId" parameterType="string" resultType="java.lang.String">
         select t.hikvision_id
         from hikvision_data t
-        left join car_message_apply t1 on t1.id = t.source_id
+        left join car_message_apply t1 on t1.user_id = t.source_id
         <if test="id != null">
             where t1.id = #{id}
         </if>
@@ -86,4 +86,30 @@
         select t.eventId
         from teacher_out_in_record t
     </select>
+
+    <select id="GetReservationSchoolIdList" resultType="java.lang.Long">
+        SELECT reservation_school_people_id
+        FROM visitor_out_in_record
+    </select>
+
+    <select id="GetReservationSchoolId"  parameterType="string" resultType="java.lang.Long">
+        SELECT reservation_schoo_id
+        FROM reservation_school_people
+        <if test="id != null">
+            WHERE registration_result::text LIKE '%"orderId":"' || #{id} || '"%'
+        </if>
+    </select>
+
+    <select id="GetCarMessageApplyIdByCarNumber"  parameterType="string" resultType="java.lang.String">
+        SELECT id
+        from car_message_apply
+        <if test="id != null">
+            WHERE car_number = #{id}
+        </if>
+    </select>
+
+    <select id="GetVehicleIdList" resultType="java.lang.String">
+        SELECT reservation_school_people_id
+        FROM car_out_in_record
+    </select>
 </mapper>

+ 4 - 4
src/test/java/com/xjrsoft/module/job/HikvisionBaseDataTaskTest.java

@@ -12,14 +12,13 @@ import com.xjrsoft.module.evaluate.controller.EvaluateItemController;
 import com.xjrsoft.module.hikvision.entity.HikvisionData;
 import com.xjrsoft.module.hikvision.util.ApiUtil;
 import com.xjrsoft.module.hikvision.util.DataUtil;
+import com.xjrsoft.module.hikvision.util.Out_In_RecordUtil;
 import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.schedule.entity.JianyueData;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
-import com.xjrsoft.module.hikvision.util.Teacher_Student_OutIn_RecordUtil;
 import lombok.var;
 import org.junit.jupiter.api.Test;
-import org.junit.platform.commons.logging.LoggerFactory;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -33,7 +32,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Logger;
 
 /**
  * @author dzx
@@ -48,6 +46,8 @@ class HikvisionBaseDataTaskTest {
     @Autowired
     EvaluateItemController evaluateItemController;
 
+    Out_In_RecordUtil outInRecordUtil = new Out_In_RecordUtil();
+
     @Test
     void test() throws Exception {
         DataSource datasource = DatasourceUtil.getDataSource(GlobalConstant.DEFAULT_DATASOURCE_KEY);
@@ -104,7 +104,7 @@ class HikvisionBaseDataTaskTest {
 //        String carTableName = "car_message_apply";
 //        selectCar(use, carTableName);
 
-
+        outInRecordUtil.GetVisitRecord(use,faceImportMapper);
 //        selecAllPersonById(use);
         selectResource(use);
     }