|
|
@@ -12,6 +12,7 @@ import com.google.gson.JsonObject;
|
|
|
import com.google.gson.JsonParser;
|
|
|
import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
+import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.attendance.dto.AddAttendanceStatisticsDto;
|
|
|
import com.xjrsoft.module.attendance.dto.AttendanceStatisticsPageDto;
|
|
|
@@ -71,7 +72,6 @@ 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;
|
|
|
|
|
|
/**
|
|
|
@@ -114,45 +114,15 @@ public class AttendanceStatisticsServiceImpl extends MPJBaseServiceImpl<Attendan
|
|
|
statistics.setStatus(0);
|
|
|
statisticsMapper.insert(statistics);
|
|
|
|
|
|
- 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);
|
|
|
throw new MyException("添加报错,请联系管理员");
|
|
|
+ }finally{
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -227,6 +197,42 @@ public class AttendanceStatisticsServiceImpl extends MPJBaseServiceImpl<Attendan
|
|
|
statistics.setModifyDate(new Date());
|
|
|
this.updateById(statistics);
|
|
|
|
|
|
+ List<LocalDate> dateList2 = getDatesBetween(statistics.getStartDate(), statistics.getEndDate());
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ if(dateList2.contains(now.toLocalDate())){
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ String sql = "DELETE FROM teacher_attendance_record WHERE attendance_date = '" + now.toLocalDate().format(dtf) + "'" +
|
|
|
+ " AND time_interval = " + statistics.getTimePeriod();
|
|
|
+ SqlRunnerAdapter.db().delete(sql);
|
|
|
+
|
|
|
+ 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
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//2、删除以前的数据
|
|
|
statisticsRecordService.remove(
|
|
|
new QueryWrapper<AttendanceStatisticsRecord>().lambda()
|