yaozc2021
2024-11-22 0799f543beca64dd1c6007e18cb8d8388b2fc391
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/DingTalkServiceImpl.java
@@ -124,6 +124,9 @@
                    } 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);
@@ -184,7 +187,7 @@
                    // 考勤记录:根据用户和日期查询
                    Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), strAttendDate);
                    // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(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))) {
                    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(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){
                            attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST);
@@ -285,7 +288,7 @@
                    // 考勤记录:根据用户和日期查询
                    Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), strAttendDate);
                    // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(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))) {
                    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(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){
                            attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST);
@@ -446,6 +449,19 @@
                }
            }
        }else{
            // 查询考勤外出表
            List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(user.getId(),attendance.getRosteringWorkStartTime().toLocalDateTime(),attendance.getRosteringWorkEndTime().toLocalDateTime());
            for(AttendanceGoOut attendanceGoOut : attendanceGoOutList){
                // attendDate不等于null 说明是考勤信息按钮
                if(ObjectUtils.isNotEmpty(attendDate)){
                    // 上午时长、下午时长
                    leaveStartDuration += getStartDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance);
                    leaveEndDuration += getEndDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance);
                }else{
                    // 上午or下午总时长
                    leaveDuration += getDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance,day);
                }
            }
            for(AttendanceLeave attendanceLeave : attendanceLeaveList){
                // attendDate不等于null 说明是考勤信息按钮
                if(ObjectUtils.isNotEmpty(attendDate)){