dzx 8 месяцев назад
Родитель
Сommit
ca13252ff5

+ 4 - 5
src/main/java/com/xjrsoft/module/hikvision/controller/EventController.java

@@ -31,7 +31,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
-import java.sql.SQLException;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.util.List;
 import java.util.List;
 import java.util.Objects;
 import java.util.Objects;
@@ -58,8 +57,8 @@ public class EventController {
         new Thread(() -> {
         new Thread(() -> {
             try {
             try {
                 outInRecordUtil.GetVehicleRecordTest(faceImportMapper, eventData);
                 outInRecordUtil.GetVehicleRecordTest(faceImportMapper, eventData);
-            } catch (SQLException | ParseException e) {
+            } catch (ParseException e) {
-                log.error("Error processing event data", e);
+                throw new RuntimeException(e);
             }
             }
         }).start();
         }).start();
 
 
@@ -140,7 +139,7 @@ public class EventController {
                         weChatService.sendTemplateMessage(weChatSendMessageDto);
                         weChatService.sendTemplateMessage(weChatSendMessageDto);
                     }
                     }
                 }
                 }
-            } catch (SQLException | ParseException e) {
+            } catch (ParseException e) {
                 log.error("Error processing event data", e);
                 log.error("Error processing event data", e);
             }
             }
         }).start();
         }).start();
@@ -155,7 +154,7 @@ public class EventController {
         new Thread(() -> {
         new Thread(() -> {
             try {
             try {
                 outInRecordUtil.GetVisitRecordsTest(faceImportMapper, eventData);
                 outInRecordUtil.GetVisitRecordsTest(faceImportMapper, eventData);
-            } catch (SQLException | ParseException e) {
+            } catch (ParseException e) {
                 log.error("Error processing event data", e);
                 log.error("Error processing event data", e);
             }
             }
         }).start();
         }).start();

+ 15 - 16
src/main/java/com/xjrsoft/module/hikvision/util/OutInRecordUtil.java

@@ -12,7 +12,6 @@ import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
-import java.sql.SQLException;
 import java.sql.Types;
 import java.sql.Types;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -28,7 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 public class OutInRecordUtil {
 public class OutInRecordUtil {
     private static final Logger log = LoggerFactory.getLogger(OutInRecordUtil.class);
     private static final Logger log = LoggerFactory.getLogger(OutInRecordUtil.class);
 
 
-    private void teacherInsertRecord(Long userId, String recordTime, String facePhoto, int status, String eventId, String attendanceStatus) throws SQLException {
+    private void teacherInsertRecord(Long userId, String recordTime, String facePhoto, int status, String eventId, String attendanceStatus){
         String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
         String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
 
 
         String sql = "INSERT INTO teacher_out_in_record(create_date, user_id, record_time, face_photo, eventId, status,delete_mark,enabled_mark, attendance_status) " +
         String sql = "INSERT INTO teacher_out_in_record(create_date, user_id, record_time, face_photo, eventId, status,delete_mark,enabled_mark, attendance_status) " +
@@ -37,7 +36,7 @@ public class OutInRecordUtil {
         SqlRunnerAdapter.db().insert(sql);
         SqlRunnerAdapter.db().insert(sql);
     }
     }
 
 
-    private void studentInsertRecord(Long userId, Long teacherId, Long classId, String facePhoto, String recordTime, int status, String eventId, String attendanceStatus) throws SQLException {
+    private void studentInsertRecord(Long userId, Long teacherId, Long classId, String facePhoto, String recordTime, int status, String eventId, String attendanceStatus){
         String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
         String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
 
 
         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, attendance_status) " +
         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, attendance_status) " +
@@ -47,7 +46,7 @@ public class OutInRecordUtil {
     }
     }
 
 
 
 
-    public void visitInsertRecord(Long reservation_school_people_id, String recordTime,String facePhoto, String status, String eventId) throws SQLException {
+    public void visitInsertRecord(Long reservation_school_people_id, String recordTime,String facePhoto, String status, String eventId){
         String sql = "INSERT INTO visitor_out_in_record(create_date, reservation_school_people_id, record_time, face_photo, event_id, status,delete_mark,enabled_mark) " +
         String sql = "INSERT INTO visitor_out_in_record(create_date, reservation_school_people_id, record_time, face_photo, event_id, status,delete_mark,enabled_mark) " +
                 "VALUES(now(), '"  + reservation_school_people_id + "', '" +
                 "VALUES(now(), '"  + reservation_school_people_id + "', '" +
                  recordTime + "', '" + facePhoto + "', '" + eventId + "', '" + status +  "',0,1)";
                  recordTime + "', '" + facePhoto + "', '" + eventId + "', '" + status +  "',0,1)";
@@ -55,7 +54,7 @@ public class OutInRecordUtil {
     }
     }
 
 
     private void vehicleInsertRecord(Long carMessageApplyId, String recordTime, int releaseReason, int category, String facePhoto, int status, String planNo, String crossRecordSyscode,
     private void vehicleInsertRecord(Long carMessageApplyId, String recordTime, int releaseReason, int category, String facePhoto, int status, String planNo, String crossRecordSyscode,
-                                     int releaseResult, int releaseWay, int vehicleType, String phone, String name) throws SQLException {
+                                     int releaseResult, int releaseWay, int vehicleType, String phone, String name){
         String phoneValue = (phone != null && !phone.equals("null")) ? phone : "";
         String phoneValue = (phone != null && !phone.equals("null")) ? phone : "";
         String nameValue = (name != null && !name.equals("null")) ? name : "";
         String nameValue = (name != null && !name.equals("null")) ? name : "";
         String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
         String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
@@ -83,7 +82,7 @@ public class OutInRecordUtil {
 
 
     }
     }
 
 
-    public void GetTeacherAndStudentRecords(FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+    public void GetTeacherAndStudentRecords(FaceImportMapper faceImportMapper) throws ParseException {
         JsonArray responseBuilder = new JsonArray();
         JsonArray responseBuilder = new JsonArray();
 
 
         AtomicInteger pageNo = new AtomicInteger(1);
         AtomicInteger pageNo = new AtomicInteger(1);
@@ -108,7 +107,7 @@ public class OutInRecordUtil {
         InsertTeacherStudentRecords(responseBuilder, faceImportMapper);
         InsertTeacherStudentRecords(responseBuilder, faceImportMapper);
     }
     }
 
 
-    private void InsertTeacherStudentRecords(JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+    private void InsertTeacherStudentRecords(JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws ParseException {
         List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
         List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
         List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
         List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@@ -159,7 +158,7 @@ public class OutInRecordUtil {
         }
         }
     }
     }
 
 
-    String discernTeacherStatus(LocalDateTime recordTime, int status, Long userId) throws SQLException {
+    String discernTeacherStatus(LocalDateTime recordTime, int status, Long userId){
         String attendanceStatus = "";
         String attendanceStatus = "";
         String dayOfWeek = recordTime.getDayOfWeek().name();
         String dayOfWeek = recordTime.getDayOfWeek().name();
         String sql = "SELECT t2.* FROM attendance_rule_category t1" +
         String sql = "SELECT t2.* FROM attendance_rule_category t1" +
@@ -214,7 +213,7 @@ public class OutInRecordUtil {
         return attendanceStatus;
         return attendanceStatus;
     }
     }
 
 
-    String discernStudentStatus(LocalDateTime recordTime, int status, Long studentUserId) throws SQLException {
+    String discernStudentStatus(LocalDateTime recordTime, int status, Long studentUserId){
         String attendanceStatus = "";
         String attendanceStatus = "";
         String dayOfWeek = recordTime.getDayOfWeek().name();
         String dayOfWeek = recordTime.getDayOfWeek().name();
         String sql = "SELECT t2.* FROM attendance_rule_category t1" +
         String sql = "SELECT t2.* FROM attendance_rule_category t1" +
@@ -288,7 +287,7 @@ public class OutInRecordUtil {
         return attendanceStatus;
         return attendanceStatus;
     }
     }
 
 
-    public void GetVisitRecord(FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+    public void GetVisitRecord(FaceImportMapper faceImportMapper) throws ParseException {
         ApiUtil apiUtil = new ApiUtil();
         ApiUtil apiUtil = new ApiUtil();
 
 
         AtomicInteger pageNo = new AtomicInteger(1);
         AtomicInteger pageNo = new AtomicInteger(1);
@@ -329,7 +328,7 @@ public class OutInRecordUtil {
         InsertVisitRecords(responseBuilder,responseDoorBuilder,faceImportMapper);
         InsertVisitRecords(responseBuilder,responseDoorBuilder,faceImportMapper);
     }
     }
 
 
-    private void InsertVisitRecords(JsonArray eventsResponse, JsonArray doorEventsResponse,FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+    private void InsertVisitRecords(JsonArray eventsResponse, JsonArray doorEventsResponse,FaceImportMapper faceImportMapper) throws ParseException {
 
 
         for (JsonElement element : eventsResponse) {
         for (JsonElement element : eventsResponse) {
             List<String> visit_id_list = faceImportMapper.GetReservationSchoolIdList();
             List<String> visit_id_list = faceImportMapper.GetReservationSchoolIdList();
@@ -358,7 +357,7 @@ public class OutInRecordUtil {
 
 
     }
     }
 
 
-    public void GetVehicleRecord(FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+    public void GetVehicleRecord(FaceImportMapper faceImportMapper) throws ParseException {
         ApiUtil apiUtil = new ApiUtil();
         ApiUtil apiUtil = new ApiUtil();
 
 
         AtomicInteger pageNo = new AtomicInteger(1);
         AtomicInteger pageNo = new AtomicInteger(1);
@@ -389,7 +388,7 @@ public class OutInRecordUtil {
         InsertVehicleRecords(responseBuilder,faceImportMapper);
         InsertVehicleRecords(responseBuilder,faceImportMapper);
     }
     }
 
 
-    private void InsertVehicleRecords(JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
+    private void InsertVehicleRecords(JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws ParseException {
         List<String> vehicle_id_list = faceImportMapper.GetVehicleIdList();
         List<String> vehicle_id_list = faceImportMapper.GetVehicleIdList();
 
 
         for (JsonElement element : doorEventsResponse) {
         for (JsonElement element : doorEventsResponse) {
@@ -479,7 +478,7 @@ public class OutInRecordUtil {
         return mysqlFormat.format(date);
         return mysqlFormat.format(date);
     }
     }
 
 
-    public void GetTeacherAndStudentRecordsTest(FaceImportMapper faceImportMapper, JsonObject data) throws SQLException, ParseException {
+    public void GetTeacherAndStudentRecordsTest(FaceImportMapper faceImportMapper, JsonObject data) throws ParseException {
         try {
         try {
             List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
             List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
             List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
             List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
@@ -541,7 +540,7 @@ public class OutInRecordUtil {
     }
     }
 
 
 
 
-    public void GetVehicleRecordTest(FaceImportMapper faceImportMapper, String data) throws SQLException, ParseException {
+    public void GetVehicleRecordTest(FaceImportMapper faceImportMapper, String data) throws ParseException {
         if (data != null) {
         if (data != null) {
             List<String> vehicle_id_list = faceImportMapper.GetVehicleIdList();
             List<String> vehicle_id_list = faceImportMapper.GetVehicleIdList();
             try {
             try {
@@ -613,7 +612,7 @@ public class OutInRecordUtil {
         }
         }
     }
     }
 
 
-    public void GetVisitRecordsTest(FaceImportMapper faceImportMapper, String data) throws SQLException, ParseException {
+    public void GetVisitRecordsTest(FaceImportMapper faceImportMapper, String data) throws ParseException {
         if (data != null) {
         if (data != null) {
             List<String> visit_id_list = faceImportMapper.GetVisitIdList();
             List<String> visit_id_list = faceImportMapper.GetVisitIdList();