Commit 1ac2c160 authored by 赵啸非's avatar 赵啸非

优化考勤计算

parent bfcd6bd2
......@@ -138,8 +138,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
public void addAttendanceOtherRecordList(List<AttendanceRecordHikEntity> hikEntityList, Context context) throws Exception {
List<AttendanceRecordHikEntity> collect = hikEntityList.stream().sorted(Comparator.comparing(AttendanceRecordHikEntity::getAttendanceDate)).collect(Collectors.toList());
Map<Long, List<AttendanceRecordHikEntity>> listMap = collect.stream().collect(Collectors.groupingBy(AttendanceRecordHikEntity::getStaffId));
List<AttendanceRecordEntity> saveList = new ArrayList<>();
List<AttendanceRecordEntity> updateList = new ArrayList<>();
Map<Long, List<AttendanceGroupStaffEntity>> groupStaffMap = attendanceGroupStaffService.find(new AttendanceGroupStaffQuery()).parallelStream().collect(Collectors.groupingBy(x -> x.getStaffId()));
Map<Long, AttendanceGroupEntity> groupMap = attendanceGroupService.find(new AttendanceGroupQuery()).parallelStream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
......@@ -154,6 +153,8 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
for (Map.Entry<Long, List<AttendanceRecordHikEntity>> itemEntry : listMap.entrySet()) {
//按人员
List<AttendanceRecordEntity> saveList = new ArrayList<>();
List<AttendanceRecordEntity> updateList = new ArrayList<>();
Long staffId = itemEntry.getKey();
List<AttendanceRecordHikEntity> recordHikEntityList = itemEntry.getValue();
Map<String, List<AttendanceRecordHikEntity>> dateRecordMap = recordHikEntityList.stream().collect(Collectors.groupingBy(hikEntity -> DateUtil.formatDate(hikEntity.getAttendanceDate())));
......@@ -291,20 +292,23 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
}
}
}
if (!ObjectUtils.isEmpty(saveList)) {
for (AttendanceRecordEntity attendanceRecordEntity : saveList) {
attendanceRecordService.save(attendanceRecordEntity, context);
if (!ObjectUtils.isEmpty(saveList)) {
attendanceRecordService.save(saveList);
/* for (AttendanceRecordEntity attendanceRecordEntity : saveList) {
attendanceRecordService.save(attendanceRecordEntity, context);
}*/
}
}
if (!ObjectUtils.isEmpty(updateList)) {
for (AttendanceRecordEntity attendanceRecordEntity : updateList) {
attendanceRecordService.update(attendanceRecordEntity, context);
if (!ObjectUtils.isEmpty(updateList)) {
attendanceRecordService.update(updateList);
/* for (AttendanceRecordEntity attendanceRecordEntity : updateList) {
attendanceRecordService.update(attendanceRecordEntity, context);
}*/
}
}
}
......
......@@ -46,8 +46,9 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
Content-Type: application/json
{
"attendanceDateStart": "2024-07-01",
"attendanceDateEnd": "2024-07-30"
"attendanceDateStart": "2024-06-01",
"attendanceDateEnd": "2024-06-31",
"staffId": 447
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment