浏览代码

解决因为海康出入记录导致服务器司机的问题

dzx 1 月之前
父节点
当前提交
3d439afb73
共有 1 个文件被更改,包括 4 次插入18 次删除
  1. 4 18
      src/main/java/com/xjrsoft/module/hikvision/util/OutInRecordUtil.java

+ 4 - 18
src/main/java/com/xjrsoft/module/hikvision/util/OutInRecordUtil.java

@@ -12,7 +12,6 @@ import com.xjrsoft.module.attendance.entity.AttendanceRuleDetails;
 import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.sql.Types;
 import java.text.ParseException;
@@ -20,7 +19,10 @@ import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
-import java.util.*;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.atomic.AtomicInteger;
 
 
@@ -178,8 +180,6 @@ public class OutInRecordUtil {
     }
 
     private void InsertTeacherStudentRecords(JsonArray doorEventsResponse, FaceImportMapper faceImportMapper) throws ParseException {
-        List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
-        List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         List<Long> teacherUserIds = faceImportMapper.getTeacherUserIds();
         for (JsonElement element : doorEventsResponse) {
@@ -210,17 +210,11 @@ public class OutInRecordUtil {
             String recordTimeStr = ChangeTime(recordTime);
             if (teacherUserIds.contains(personId)) {
                 // 老师记录
-                if (teacherEventIdList.contains(eventId)) {
-                    continue;
-                }
                 LocalDateTime recordTimeDate = LocalDateTime.parse(recordTimeStr, formatter);
                 String attendanceStatus = discernTeacherStatus(recordTimeDate, status, personId);
                 teacherInsertRecord(personId, recordTimeStr, ApiUtil.GetRedirectURL(uri),status,eventId, attendanceStatus);
             } else {
                 // 学生记录
-                if (studentEventIdList.contains(eventId)){
-                    continue;
-                }
                 LocalDateTime recordTimeDate = LocalDateTime.parse(recordTimeStr, formatter);
                 String attendanceStatus = discernStudentStatus(recordTimeDate, status, personId);
                 studentInsertRecord(personId, faceImportMapper.GetTeacherIdByPersonId(personId),
@@ -579,8 +573,6 @@ public class OutInRecordUtil {
 
     public void GetTeacherAndStudentRecordsTest(FaceImportMapper faceImportMapper, JsonObject data) throws ParseException {
         try {
-            List<String> teacherEventIdList = faceImportMapper.GetTeacherUrlList();
-            List<String> studentEventIdList = faceImportMapper.GetStudentUrlList();
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 
             JsonObject paramsObject = data.getAsJsonObject("params");
@@ -616,17 +608,11 @@ public class OutInRecordUtil {
 
                 if (!Objects.equals(faceImportMapper.IsStudentTypeByPersonId(Long.valueOf(idNum)), "学生")) {
                     // 老师记录
-                    if (teacherEventIdList.contains(eventId)) {
-                        continue;
-                    }
                     LocalDateTime recordTimeDate = LocalDateTime.parse(recordTimeStr, formatter);
                     String attendanceStatus = discernTeacherStatus(recordTimeDate, status, Long.valueOf(idNum));
                     teacherInsertRecord(Long.valueOf(idNum), recordTimeStr, ApiUtil.GetRedirectURL(extEventPictureURL), status, eventId, attendanceStatus);
                 } else {
                     // 学生记录
-                    if (studentEventIdList.contains(eventId)){
-                        continue;
-                    }
                     LocalDateTime recordTimeDate = LocalDateTime.parse(recordTimeStr, formatter);
                     String attendanceStatus = discernStudentStatus(recordTimeDate, status, Long.valueOf(idNum));
                     studentInsertRecord(Long.valueOf(idNum), faceImportMapper.GetTeacherIdByPersonId(Long.valueOf(idNum)),