BAOLH
2025-08-13 538b7dc4a871e99a3e6353ec00e3a9e6b0df7e26
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
@@ -582,6 +582,20 @@
            updateAttendanceRecord(null, attendance, Constant.ATTENDANCE_STATE_LEAVE, day, leaveStartDuration, leaveEndDuration);
        }
        // TODO:20250813修改 增加打卡时间判断,打卡时间需要闭环
        Boolean actualTimeLoopFlag = ObjectUtils.isNotEmpty(attendance.getActualWorkStartTime()) == ObjectUtils.isNotEmpty(attendance.getActualWorkEndTime());
        if (!actualTimeLoopFlag) {
            List<String> editStatusList = Arrays.asList(Constant.ATTENDANCE_STATE_GOOUT, Constant.ATTENDANCE_STATE_BUSINESS, Constant.ATTENDANCE_STATE_LEAVE);
            if (ObjectUtils.isEmpty(attendance.getActualWorkStartTime()) && editStatusList.contains(attendance.getStartClockResults())) {
                attendance.setStartClockResults(Constant.ATTENDANCE_STATE_NOTSIGNED);
                attendance.setStartLocationResults(Constant.LOCATION_RESULTS_NOTSIGNED);
            }
            if (ObjectUtils.isEmpty(attendance.getActualWorkEndTime()) && editStatusList.contains(attendance.getEndClockResults())) {
                attendance.setEndClockResults(Constant.ATTENDANCE_STATE_NOTSIGNED);
                attendance.setEndLocationResults(Constant.LOCATION_RESULTS_NOTSIGNED);
            }
        }
//        // 查询考勤请假表
//        List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.findByUserIdAndDate(user.getId(), startDate.toLocalDateTime(), endDate.toLocalDateTime());
//        Double leaveDuration = new Double(0.00);//计算的总时长
@@ -764,16 +778,16 @@
            } else {
                // 上午
                if (day) {
                    // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时
                    if (duration >= result) {
                    // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
                    if (duration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                        attendance.setStartClockResults(type);
                        attendance.setStartLocationResults(null);
                    } else {
                        attendance.setStartClockResults(Constant.ATTENDANCE_STATE_LACK_OF_TIME);
                    }
                } else {
                    // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时
                    if (duration >= noonResult) {
                    // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
                    if (duration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                        attendance.setEndClockResults(type);
                        attendance.setEndLocationResults(null);
                    } else {
@@ -795,14 +809,16 @@
            } else {
                //打卡的情况,修改考勤状态
                if (day) {
                    if ((duration + result1) >= result) {
                    // TODO:20250805修改 排除休息日情况
                    if ((duration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                        attendance.setStartClockResults(type);
                        attendance.setStartLocationResults(null);
                    } else {
                        attendance.setStartClockResults(Constant.ATTENDANCE_STATE_LACK_OF_TIME);
                    }
                } else {
                    if ((duration + noonResult1) >= noonResult) {
                    // TODO:20250805修改 排除休息日情况
                    if ((duration + noonResult1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                        attendance.setEndClockResults(type);
                        attendance.setEndLocationResults(null);
                    } else {
@@ -874,9 +890,9 @@
     */
    public Boolean getCardSupplement(Long userId, String st, Timestamp checkTime) {
        if (ObjectUtils.isNotEmpty(checkTime)) {
            // 查询补卡记录
            // 查询补卡记录 TODO:20250805修改 正常考勤状态全部验证通过处理
            AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findByUserIdAndTime(userId, checkTime);
            if (ObjectUtils.isNotEmpty(attendanceCardreplacement) && st.equals(Constant.ATTENDANCE_STATE_NORMAL)) {
            if (ObjectUtils.isNotEmpty(attendanceCardreplacement) && (st.equals(Constant.ATTENDANCE_STATE_NORMAL) || st.equals(Constant.ATTENDANCE_STATE_LEAVE) || st.equals(Constant.ATTENDANCE_STATE_BUSINESS)|| st.equals(Constant.ATTENDANCE_STATE_GOOUT))) {
                return true;
            }
        }
@@ -921,8 +937,8 @@
     */
    public void setAttendance(Double sDuration, Double eDuration, Double result, Double noonResult, Attendance attendance, String type) {
        if (ObjectUtils.isEmpty(eDuration) && ObjectUtils.isEmpty(noonResult)) {
            // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时
            if (sDuration >= result) {
            // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
            if (sDuration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                attendance.setStartClockResults(type);
                attendance.setStartLocationResults(null);
            } else {
@@ -930,8 +946,8 @@
            }
        }
        if (ObjectUtils.isEmpty(sDuration) && ObjectUtils.isEmpty(result)) {
            // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时
            if (eDuration >= noonResult) {
            // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况
            if (eDuration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                attendance.setEndClockResults(type);
                attendance.setEndLocationResults(null);
            } else {
@@ -952,7 +968,8 @@
     */
    public void setAttendanceStart(Double sDuration, Double eDuration, Double result1, Double result, Double noonResult, Attendance attendance, String type) {
        if (ObjectUtils.isEmpty(eDuration) && sDuration > 0) {
            if ((sDuration + result1) >= result) {
            // TODO:20250805修改 排除休息日情况
            if ((sDuration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                attendance.setStartClockResults(type);
                attendance.setStartLocationResults(null);
            } else {
@@ -960,7 +977,8 @@
            }
        }
        if (ObjectUtils.isEmpty(sDuration) && eDuration > 0) {
            if ((eDuration + result1) >= noonResult) {
            // TODO:20250805修改 排除休息日情况
            if ((eDuration + result1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) {
                attendance.setEndClockResults(type);
                attendance.setEndLocationResults(null);
            } else {