List filteredLogs = umsAttendanceLogs.stream() .filter(log -> log.getAttendanceType() == 0 || log.getAttendanceType() == 2 || log.getAttendanceType() == 3) .collect(Collectors.toList());

UmsAttendanceLog 类属性说明:

  • 'attendanceLogId': 考勤记录id
  • 'userId': 员工id
  • 'deptId': 部门id
  • 'umsClassId': 班次id
  • 'attendanceTime': 打卡时间
  • 'type': 打卡类型 (0->上班, 1->下班)
  • 'attendanceType': 规则类型 (0->缺卡, 1->正常, 2->迟到, 3->早退, 4->矿工, 5->请假, 6->上班卡, 7->下班卡)
  • 'year': 年
  • 'month': 月
  • 'week': 周
  • 'day': 日
  • 'hourMinterSecond': 时分秒
  • 'attendanceLogType': 考勤记录类型 (0->移动端打卡, 1->考勤机打卡, 3->其他打卡设备)
  • 'img': 人脸照片

代码说明:

代码使用 Java Stream 的 filter() 方法,过滤 umsAttendanceLogs 列表中 attendanceType 属性值为 0(缺卡)、2(迟到)或 3(早退)的 UmsAttendanceLog 对象,并使用 collect(Collectors.toList()) 方法将过滤后的结果收集到一个新的 List<UmsAttendanceLog> 中。

Java Stream 过滤考勤记录:缺卡、迟到、早退

原文地址: https://www.cveoy.top/t/topic/nctX 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录