| | |
| | | **/ |
| | | public interface AttendanceCardreplacementRepository extends JpaRepository<AttendanceCardreplacement, Long>, JpaSpecificationExecutor<AttendanceCardreplacement> { |
| | | |
| | | //查询补卡记录是否存在 |
| | | // 查询补卡记录是否存在 |
| | | @Query(value = "SELECT * from attendance_cardreplacement WHERE user_id = ? and card_replacement_time = ? and approval_status != 'card_approve_status_refuse'",nativeQuery = true) |
| | | AttendanceCardreplacement findByUserIdAndCardReplacementTime(Long userId, Timestamp checkTime); |
| | | |
| | |
| | | @Query(value = "SELECT COUNT(*) FROM `attendance_cardreplacement` WHERE user_id = ? and card_replacement_time like %?% and approval_status in('card_approve_status_reviewed','card_approve_status_agree')",nativeQuery = true) |
| | | Integer count(Long userId, String baseDate); |
| | | |
| | | //根据userId和补卡时间查询已通过的补卡记录 |
| | | // 根据userId和补卡时间查询已通过的补卡记录 |
| | | @Query(value = "SELECT * from attendance_cardreplacement WHERE user_id = ? and card_replacement_time = ? and approval_status = 'card_approve_status_agree'",nativeQuery = true) |
| | | AttendanceCardreplacement findByUserIdAndTime(Long userId, Timestamp checkTime); |
| | | |
| | | // 根据userId和补卡日期(年月日)和补卡区分查询已通过的补卡记录 |
| | | @Query(value = "SELECT * FROM attendance_cardreplacement WHERE user_id = ?1 AND card_replacement_time LIKE ?2% AND card_replacement_distinguish = ?3 AND approval_status = 'card_approve_status_agree'",nativeQuery = true) |
| | | AttendanceCardreplacement findByUserIdAndDateAndType(Long userId, String date, String type); |
| | | } |
| | |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
|
| | | import me.zhengjie.modules.system.repository.SysRosteringRepository;
|
| | | import me.zhengjie.modules.system.repository.UserRepository;
|
| | | import me.zhengjie.utils.StringUtils;
|
| | | import org.apache.commons.lang3.ObjectUtils;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
| | | }
|
| | | // 早打卡
|
| | | if ("OnDuty".equals(oapiDingTalkRecordResult.getCheckType())) {
|
| | | // 补充上班补卡记录
|
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkStartTime()) && !isHoliday && (attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) {
|
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON, attendance);
|
| | | }
|
| | | // 调用验证状态方法
|
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getStartClockResults(), attendance.getActualWorkStartTime());
|
| | | // 考勤记录
|
| | |
| | | }
|
| | | // 晚打卡
|
| | | if ("OffDuty".equals(oapiDingTalkRecordResult.getCheckType())) {
|
| | | // 补充下班补卡记录
|
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkEndTime()) && !isHoliday && (attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) {
|
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF, attendance);
|
| | | }
|
| | | // 调用验证状态方法
|
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getEndClockResults(), attendance.getActualWorkEndTime());
|
| | | // 考勤记录
|
| | |
| | | }
|
| | | // 早打卡
|
| | | if ("OnDuty".equals(oapiDingTalkRecordResult.getCheckType())) {
|
| | | // 补充上班补卡记录
|
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkStartTime()) && !isHoliday && (attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) {
|
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON, attendance);
|
| | | }
|
| | | // 调用验证状态方法
|
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getStartClockResults(),attendance.getActualWorkStartTime());
|
| | | // 考勤记录
|
| | |
| | | }
|
| | | // 晚打卡
|
| | | if ("OffDuty".equals(oapiDingTalkRecordResult.getCheckType())) {
|
| | | // 补充下班补卡记录
|
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkEndTime()) && !isHoliday && (attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) {
|
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF, attendance);
|
| | | }
|
| | | // 调用验证状态方法
|
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getEndClockResults(),attendance.getActualWorkEndTime());
|
| | | // 考勤记录
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 补充补卡记录
|
| | | *
|
| | | * @param userId / 用户ID
|
| | | * @param checkTime / 补卡日期(yyyy-MM-dd)
|
| | | * @param type / 补卡区分
|
| | | * @param attendance / 考勤记录
|
| | | */
|
| | | public void cardDatetimeSupplement(Long userId, String checkTime, String type, Attendance attendance) {
|
| | | if (ObjectUtils.isNotEmpty(checkTime) && StringUtils.isNotBlank(type)) {
|
| | | // 查询补卡记录
|
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findByUserIdAndDateAndType(userId, checkTime, type);
|
| | | if (ObjectUtils.isNotEmpty(attendanceCardreplacement)) {
|
| | | if (Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON.equals(type)) {
|
| | | attendance.setActualWorkStartTime(attendanceCardreplacement.getCardReplacementTime());
|
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_NORMAL);
|
| | | attendance.setStartLocationResults(Constant.LOCATION_RESULTS_NORMAL);
|
| | | } else if (Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF.equals(type)) {
|
| | | attendance.setActualWorkEndTime(attendanceCardreplacement.getCardReplacementTime());
|
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_NORMAL);
|
| | | attendance.setEndLocationResults(Constant.LOCATION_RESULTS_NORMAL);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | Timestamp checkInTime = unixtimeToTimestamp(weComRecordResult.getCheckinTime()); |
| | | // 早打卡 |
| | | if ("上班打卡".equals(weComRecordResult.getCheckinType())) { |
| | | // 补充上班补卡记录 |
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkStartTime()) && !isHoliday && (attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) { |
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON, attendance); |
| | | } |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(), attendance.getStartClockResults(), attendance.getActualWorkStartTime()); |
| | | // 考勤记录 |
| | |
| | | } |
| | | // 晚打卡 |
| | | if ("下班打卡".equals(weComRecordResult.getCheckinType())) { |
| | | // 补充下班补卡记录 |
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkEndTime()) && !isHoliday && (attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) { |
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF, attendance); |
| | | } |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(), attendance.getEndClockResults(), attendance.getActualWorkEndTime()); |
| | | // 考勤记录 |
| | |
| | | Timestamp checkInTime = unixtimeToTimestamp(weComRecordResult.getCheckinTime()); |
| | | // 早打卡 |
| | | if ("上班打卡".equals(weComRecordResult.getCheckinType())) { |
| | | // 补充上班补卡记录 |
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkStartTime()) && !isHoliday && (attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) { |
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON, attendance); |
| | | } |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(), attendance.getStartClockResults(), attendance.getActualWorkStartTime()); |
| | | // 考勤记录 |
| | |
| | | } |
| | | // 晚打卡 |
| | | if ("下班打卡".equals(weComRecordResult.getCheckinType())) { |
| | | // 补充下班补卡记录 |
| | | if (ObjectUtils.isEmpty(attendance.getActualWorkEndTime()) && !isHoliday && (attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) || attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_LACK_OF_TIME))) { |
| | | cardDatetimeSupplement(attendance.getUserId(), strAttendDate, Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF, attendance); |
| | | } |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(), attendance.getEndClockResults(), attendance.getActualWorkEndTime()); |
| | | // 考勤记录 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 补充补卡记录 |
| | | * |
| | | * @param userId / 用户ID |
| | | * @param checkTime / 补卡日期(yyyy-MM-dd) |
| | | * @param type / 补卡区分 |
| | | * @param attendance / 考勤记录 |
| | | */ |
| | | public void cardDatetimeSupplement(Long userId, String checkTime, String type, Attendance attendance) { |
| | | if (ObjectUtils.isNotEmpty(checkTime) && StringUtils.isNotBlank(type)) { |
| | | // 查询补卡记录 |
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findByUserIdAndDateAndType(userId, checkTime, type); |
| | | if (ObjectUtils.isNotEmpty(attendanceCardreplacement)) { |
| | | if (Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON.equals(type)) { |
| | | attendance.setActualWorkStartTime(attendanceCardreplacement.getCardReplacementTime()); |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_NORMAL); |
| | | attendance.setStartLocationResults(Constant.LOCATION_RESULTS_NORMAL); |
| | | } else if (Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF.equals(type)) { |
| | | attendance.setActualWorkEndTime(attendanceCardreplacement.getCardReplacementTime()); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_NORMAL); |
| | | attendance.setEndLocationResults(Constant.LOCATION_RESULTS_NORMAL); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 没打卡情况(考勤按钮) |
| | | * |
| | | * @param sDuration |