Commit db87b275 authored by 王琮's avatar 王琮

修改判断考勤是否存在的逻辑

parent 26a6b13a
package org.rcisoft.sys.attendance.schedule;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.rcisoft.sys.attendance.dao.AttendanceSyncRepository;
import org.rcisoft.sys.attendance.entity.Attendance;
import org.rcisoft.sys.attendance.entity.AttendanceSync;
......@@ -61,7 +62,11 @@ public class AttendanceSyncSchedule {
attendanceSync.setCreateDate(new Date());
attendanceSync.setPassageTime(all.get(i).getCrossTime());
// 判断考勤是否已经存在,已经存在不会添加
if (attendanceSyncRepository.queryAttendanceSyncs(attendanceSync).size() == 0)
QueryWrapper<AttendanceSync> wrapper = new QueryWrapper();
wrapper.eq("date_of_attendance",attendanceSync.getDateOfAttendance());
wrapper.eq("user_id",attendanceSync.getUserId());
List<AttendanceSync> attendanceSyncList = attendanceSyncRepository.selectList(wrapper);
if(attendanceSyncList.size()==0)
attendanceSyncRepository.addAttendanceSync(attendanceSync);
}
}
......
......@@ -53,9 +53,6 @@ public class AttendanceServiceImpl implements AttendanceService {
// 查询时间范围内员工的正常记录集合
List<DoorRecord> doorRecordList = doorRecordRepository.queryAttendance(attendance);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//这里可以指定日期的格式
// 根据用户分组(每个员工时间范围内的所有打卡记录)
// Map<Integer, List<DoorRecord>> listMap = doorRecordList.stream()
// .collect(Collectors.groupingBy(DoorRecord::getUserId));
// todo 2022/12/30 根据用户分组(每个员工时间范围内的所有打卡记录)
Map<String, List<DoorRecord>> listMap = doorRecordList.stream()
.collect(Collectors.groupingBy(DoorRecord::getPersonId));
......
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