| | |
| | | attendance.setStartClockResults((ObjectUtil.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_NORMAL)) ? attendance.getStartClockResults() : Constant.ATTENDANCE_STATE_WAITFOR);
|
| | | attendance.setEndClockResults((ObjectUtil.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_NORMAL)) ? attendance.getEndClockResults() : Constant.ATTENDANCE_STATE_WAITFOR);
|
| | | // 考勤日期类是否是周末、节假日、工作日
|
| | | if (sysConfigHoliday == null && (calAttendDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) {
|
| | | if (sysConfigHoliday == null) {
|
| | | if (calAttendDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
|
| | | // 考勤记录:日期类型-双休
|
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKEND);
|
| | | } else if (sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) {
|
| | | // 考勤记录:日期类型-节假日
|
| | | attendance.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS);
|
| | | } else if (sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | // 考勤记录:日期类型-法定节假日
|
| | | attendance.setDateType(Constant.DATE_TYPE_HOLIDAYS);
|
| | | } else {
|
| | | // 考勤记录:日期类型-工作日
|
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKDAY);
|
| | | }
|
| | | } else {
|
| | | // 考勤记录:日期类型-节假日
|
| | | attendance.setDateType(sysConfigHoliday.getDateType());
|
| | | }
|
| | | // 时间格式化
|
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
| | |
| | | // 考勤记录:根据用户和日期查询
|
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), strAttendDate);
|
| | | Boolean isHoliday = false;
|
| | | if (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | if (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND)) {
|
| | | isHoliday = true;
|
| | | }
|
| | | // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(oapiDingTalkRecordResultList为空的情况下)
|
| | | if (ObjectUtils.isNotEmpty(attendance) && (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS))) {
|
| | | if (ObjectUtils.isNotEmpty(attendance) && isHoliday) {
|
| | | // 开始打卡结果
|
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME)){
|
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST);
|
| | |
| | | // 考勤记录:根据用户和日期查询
|
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), strAttendDate);
|
| | | Boolean isHoliday = false;
|
| | | if (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | if (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND)) {
|
| | | isHoliday = true;
|
| | | }
|
| | | // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(oapiDingTalkRecordResultList为空的情况下)
|
| | | if (ObjectUtils.isNotEmpty(attendance) && (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS))) {
|
| | | if (ObjectUtils.isNotEmpty(attendance) && isHoliday) {
|
| | | // 开始打卡结果
|
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){
|
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST);
|