diff --git a/evo-admin/src/main/java/com/evo/attendance/controller/RzAttendanceController.java b/evo-admin/src/main/java/com/evo/attendance/controller/RzAttendanceController.java index 2ed910c..ef4e754 100644 --- a/evo-admin/src/main/java/com/evo/attendance/controller/RzAttendanceController.java +++ b/evo-admin/src/main/java/com/evo/attendance/controller/RzAttendanceController.java @@ -125,4 +125,10 @@ public class RzAttendanceController extends BaseController { return success(rzAttendanceDetailService.selectListByAttendanceId(id)); } + + @GetMapping(value = "/load/{id}") + public AjaxResult loadAttendance(@PathVariable("id") Long id) + { + return success(rzAttendanceService.loadAttendance(id)); + } } diff --git a/evo-admin/src/main/java/com/evo/attendance/service/IRzAttendanceService.java b/evo-admin/src/main/java/com/evo/attendance/service/IRzAttendanceService.java index 404051a..e6741ed 100644 --- a/evo-admin/src/main/java/com/evo/attendance/service/IRzAttendanceService.java +++ b/evo-admin/src/main/java/com/evo/attendance/service/IRzAttendanceService.java @@ -70,4 +70,7 @@ public interface IRzAttendanceService extends IService void addRzOverTime(String result, SysStaff sysStaff, DingShiftGroup dingsShiftGroup, String checkType, Date formatWorkDate, Date formatUserCheckTime, String timeResult, String remark, Double debiting); public RzAttendance queryNowDayAttendanceByStatisticalIdAndDate(Long staffId, Date date); + + public RzAttendance loadAttendance(Long id); + } diff --git a/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceServiceImpl.java b/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceServiceImpl.java index 356d9ca..02eb0fa 100644 --- a/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/attendance/service/impl/RzAttendanceServiceImpl.java @@ -534,104 +534,34 @@ public class RzAttendanceServiceImpl extends ServiceImpl>>>>>>>>>>>>>>>>> 出现未知打卡类型, 当前打卡类型"); - //终止继续执行 - return; - } - //判断打卡时间, 添加夜班次数 打卡时间在晚上7点以后 - if(dingsShift.getWorkHour() == 12 && attendance.getWorkSum().intValue() >= 12 && attendance.getWorkStartTime().getHours() > 12){ - attendance.setNightNumber(1); - //必须是8小时倒班制or单班制, 并且工作时长>=8小时, 并且 上班打开时间在12点至21点 算作中班 -- 2026-02-04 因1月份张克龙中班考勤问题, 刘杰面谈 - }else if(dingsShift.getWorkHour() == 8 && attendance.getWorkSum().intValue() >= 8 && attendance.getWorkStartTime().getHours() >= 12 && attendance.getWorkStartTime().getHours() < 21){ - attendance.setMiddleShiftNumber(1); - } - - getBaseMapper().updateRzAttendance(attendance); - //检查是否开启加班 - if(dingsShift.getOvertimeWork()){ - //如果开启了加班 -// BigDecimal hours = new BigDecimal(((userCheckTime - attendance.getWorkStartTime().getTime())/1000/60/60)).subtract(new BigDecimal(dingsShift.getWorkHour())).subtract(BigDecimal.valueOf(1)).subtract(new BigDecimal(String.valueOf(DataUtils.findDefaultValue(dingsShift.getDeductionHour(), 0)))); - //使用排班下班时间作为加班开始时间 - rzOverTimeService.overTimeCard(sysStaff, DateUtils.parseDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date(planCheckTime)), "yyyy-MM-dd HH:mm:ss")); - //员工打卡时间作为加班下班时间 - rzOverTimeService.overTimeOffDutyCard(sysStaff, formatUserCheckTime, "/"); - } - }else{ - log.info("未找到相关考勤班次数据, 疑似加班打卡=====>>>>> {}", result); - }*/ + calculationAddRzOverTime(result, sysStaff, ob); +// //打卡类型 +// String checkType = ob.getString("checkType"); +// //考勤组 +// String groupId = ob.getString("groupId"); +// //排班时间 +// Long planCheckTime = ob.getLong("planCheckTime"); +// // 格式化:先转Date对象,再格式化 +// String formatPlanCheckTime = DateUtils.parseDateToStr("HH:mm:ss", new Date(planCheckTime)); +// //用户打卡时间 +// Long userCheckTime = ob.getLong("userCheckTime"); +// //工作时间 (这里指的是哪一天的卡) +// Long workDate = ob.getLong("workDate"); +// /*** +// * 打卡结果 +// * Normal:正常 +// * Early:早退 +// * Late:迟到 +// * SeriousLate:严重迟到 +// * Absenteeism:旷工迟到 +// * NotSigned:未打卡 +// */ +// String timeResult = ob.getString("timeResult"); +// +// Date formatWorkDate = Date.from(Instant.ofEpochMilli(workDate)); +// Date formatUserCheckTime = Date.from(Instant.ofEpochMilli(userCheckTime)); +// DingShiftGroup dingsShiftGroup = dingsShiftGroupMapper.selectByGroupIdAndTypeAndCheckTime(groupId, checkType, formatPlanCheckTime); +// addRzOverTime(result, sysStaff, dingsShiftGroup, checkType, formatWorkDate, formatUserCheckTime, timeResult, null, 0d); break; } } @@ -662,7 +592,7 @@ public class RzAttendanceServiceImpl extends ServiceImpl>>>>>>>>>>>>>>>>> 出现未知打卡类型, 当前打卡类型"); @@ -706,6 +638,57 @@ public class RzAttendanceServiceImpl extends ServiceImpl "OnDuty".equals(((JSONObject)data).getString("checkType"))).findFirst().orElse(null); + calculationAddRzOverTime(result, sysStaff, onDutyObject); + JSONObject offDutyObject = (JSONObject) jsonArray.stream().filter(data -> "OffDuty".equals(((JSONObject)data).getString("checkType"))).findFirst().orElse(null); + calculationAddRzOverTime(result, sysStaff, offDutyObject); + } catch (Exception e) { + e.printStackTrace(); + log.error("重新抓取钉钉考勤结果异常, 异常原因是==>>{}, 打卡结果是=====>>>>> {}", e.getMessage(), result); + } + } + return attendance; + } + + public void calculationAddRzOverTime(String result ,SysStaff sysStaff, JSONObject ob){ + //打卡类型 + String checkType = ob.getString("checkType"); + //考勤组 + String groupId = ob.getString("groupId"); + //排班时间 + Long planCheckTime = ob.getLong("planCheckTime"); + // 格式化:先转Date对象,再格式化 + String formatPlanCheckTime = DateUtils.parseDateToStr("HH:mm:ss", new Date(planCheckTime)); + //用户打卡时间 + Long userCheckTime = ob.getLong("userCheckTime"); + //工作时间 (这里指的是哪一天的卡) + Long workDate = ob.getLong("workDate"); + /*** + * 打卡结果 + * Normal:正常 + * Early:早退 + * Late:迟到 + * SeriousLate:严重迟到 + * Absenteeism:旷工迟到 + * NotSigned:未打卡 + */ + String timeResult = ob.getString("timeResult"); + + Date formatWorkDate = Date.from(Instant.ofEpochMilli(workDate)); + Date formatUserCheckTime = Date.from(Instant.ofEpochMilli(userCheckTime)); + DingShiftGroup dingsShiftGroup = dingsShiftGroupMapper.selectByGroupIdAndTypeAndCheckTime(groupId, checkType, formatPlanCheckTime); + addRzOverTime(result, sysStaff, dingsShiftGroup, checkType, formatWorkDate, formatUserCheckTime, timeResult, null, 0d); + } @Async protected void sendAbnormalAttendance(SysStaff sysStaff, Date date){