|
|
@@ -59,6 +59,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.text.ParseException;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
@@ -70,6 +71,7 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -112,33 +114,41 @@ public class AttendanceStatisticsServiceImpl extends MPJBaseServiceImpl<Attendan
|
|
|
statistics.setStatus(0);
|
|
|
statisticsMapper.insert(statistics);
|
|
|
|
|
|
- List<LocalDate> dateList = getDatesBetween(dto.getStartDate(), dto.getEndDate());
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
- if(dateList.contains(now.toLocalDate())){
|
|
|
- OutInRecordUtil outInRecordUtil = new OutInRecordUtil();
|
|
|
- LocalDateTime startDateTime = now.plusDays(-1).withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
- LocalDateTime endDateTime = startDateTime.plusDays(1).plusSeconds(-1);
|
|
|
-
|
|
|
- Map<Long, AttendanceRuleDetailsUserVo> teacherRules = ruleCategoryService.getAllTeacherTodyRule(now.getDayOfWeek().name());
|
|
|
-// //教师&学生拉取数据
|
|
|
-// outInRecordUtil.getTeacherRecords(faceImportMapper, startDateTime, endDateTime, teacherRules);
|
|
|
-// //拉取车辆数据
|
|
|
-// outInRecordUtil.GetVehicleRecord(faceImportMapper, startDateTime, endDateTime);
|
|
|
-
|
|
|
- AttendanceRecordTask recordTask = new AttendanceRecordTask();
|
|
|
- recordTask.teacherAttendanceRecord(startDateTime, statistics.getTimePeriod(),
|
|
|
- userService,
|
|
|
- ruleCategoryService,
|
|
|
- holidayDateService,
|
|
|
- wfTeacherleaveService,
|
|
|
- outInRecordService,
|
|
|
- carOutInRecordService,
|
|
|
- recordService);
|
|
|
- }
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ List<LocalDate> dateList = getDatesBetween(dto.getStartDate(), dto.getEndDate());
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ if(dateList.contains(now.toLocalDate())){
|
|
|
+ OutInRecordUtil outInRecordUtil = new OutInRecordUtil();
|
|
|
+ LocalDateTime startDateTime = now.withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ LocalDateTime endDateTime = startDateTime.plusDays(1).plusSeconds(-1);
|
|
|
+
|
|
|
+ Map<Long, AttendanceRuleDetailsUserVo> teacherRules = ruleCategoryService.getAllTeacherTodyRule(now.getDayOfWeek().name());
|
|
|
+
|
|
|
+ try {
|
|
|
+ //教师
|
|
|
+ outInRecordUtil.getTeacherRecords(faceImportMapper, startDateTime, endDateTime, teacherRules);
|
|
|
+ //拉取车辆数据
|
|
|
+ outInRecordUtil.GetVehicleRecord(faceImportMapper, startDateTime, endDateTime);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ Log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ AttendanceRecordTask recordTask = new AttendanceRecordTask();
|
|
|
+ recordTask.teacherAttendanceRecord(startDateTime, statistics.getTimePeriod(),
|
|
|
+ userService,
|
|
|
+ ruleCategoryService,
|
|
|
+ holidayDateService,
|
|
|
+ wfTeacherleaveService,
|
|
|
+ outInRecordService,
|
|
|
+ carOutInRecordService,
|
|
|
+ recordService
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //1、同步出入记录的数据
|
|
|
+ //2、固化考勤数据
|
|
|
+ refreshRecord(statistics.getId());
|
|
|
+ });
|
|
|
|
|
|
- //1、同步出入记录的数据
|
|
|
- //2、固化考勤数据
|
|
|
- refreshRecord(statistics.getId());
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
Log.error(e.getMessage(), e);
|