| | |
| | | } |
| | | |
| | | 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) || attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND)) { |
| | | // 因存在周六日是工作日的情况,所以不能单纯用周六日作为判断条件 |
| | | if (attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND)) { |
| | | isHoliday = true; |
| | | } |
| | | // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(返回结果为空数组的情况下) |
| | |
| | | } |
| | | |
| | | 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) || attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND)) { |
| | | // 因存在周六日是工作日的情况,所以不能单纯用周六日作为判断条件 |
| | | if (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为空的情况下) |
| | |
| | | } else { |
| | | // 上午 |
| | | if (day) { |
| | | // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况 |
| | | if (duration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if (duration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setStartClockResults(type); |
| | | attendance.setStartLocationResults(null); |
| | | } else { |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_LACK_OF_TIME); |
| | | } |
| | | } else { |
| | | // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况 |
| | | if (duration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if (duration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setEndClockResults(type); |
| | | attendance.setEndLocationResults(null); |
| | | } else { |
| | |
| | | } else { |
| | | //打卡的情况,修改考勤状态 |
| | | if (day) { |
| | | // TODO:20250805修改 排除休息日情况 |
| | | if ((duration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if ((duration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setStartClockResults(type); |
| | | attendance.setStartLocationResults(null); |
| | | } else { |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_LACK_OF_TIME); |
| | | } |
| | | } else { |
| | | // TODO:20250805修改 排除休息日情况 |
| | | if ((duration + noonResult1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if ((duration + noonResult1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setEndClockResults(type); |
| | | attendance.setEndLocationResults(null); |
| | | } else { |
| | |
| | | */ |
| | | public void setAttendance(Double sDuration, Double eDuration, Double result, Double noonResult, Attendance attendance, String type) { |
| | | if (ObjectUtils.isEmpty(eDuration) && ObjectUtils.isEmpty(noonResult)) { |
| | | // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况 |
| | | if (sDuration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // 上午时长 >= 上午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if (sDuration >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setStartClockResults(type); |
| | | attendance.setStartLocationResults(null); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | if (ObjectUtils.isEmpty(sDuration) && ObjectUtils.isEmpty(result)) { |
| | | // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况 |
| | | if (eDuration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // 下午时长 >= 下午排班时间 改打卡状态 否则 缺时 TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if (eDuration >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setEndClockResults(type); |
| | | attendance.setEndLocationResults(null); |
| | | } else { |
| | |
| | | */ |
| | | public void setAttendanceStart(Double sDuration, Double eDuration, Double result1, Double result, Double noonResult, Attendance attendance, String type) { |
| | | if (ObjectUtils.isEmpty(eDuration) && sDuration > 0) { |
| | | // TODO:20250805修改 排除休息日情况 |
| | | if ((sDuration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if ((sDuration + result1) >= result || attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setStartClockResults(type); |
| | | attendance.setStartLocationResults(null); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | if (ObjectUtils.isEmpty(sDuration) && eDuration > 0) { |
| | | // TODO:20250805修改 排除休息日情况 |
| | | if ((eDuration + result1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST)) { |
| | | // TODO:20250805修改 排除休息日情况(如果打卡了,考勤时间需要闭环) |
| | | if ((eDuration + result1) >= noonResult || attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_REST) || ((attendance.getDateType().equals(Constant.DATE_TYPE_WEEKEND) || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) && ((attendance.getActualWorkStartTime() == null) == (attendance.getActualWorkEndTime() == null)))) { |
| | | attendance.setEndClockResults(type); |
| | | attendance.setEndLocationResults(null); |
| | | } else { |
| | |
| | | // 个人报告 |
| | | UserQueryCriteria userQueryCriteria = new UserQueryCriteria(); |
| | | userQueryCriteria.setEnabled(true); |
| | | userQueryCriteria.setLoginEnabled(true); |
| | | userQueryCriteria.setWeComIdNotNull(true); |
| | | userQueryCriteria.getDeptIds().add(7L); |
| | | // 先查找是否存在子节点 |
| | |
| | | Gson gson = new Gson(); |
| | | // 特殊参数:开发-公共事务、公司-公共事务的项目名称细化到任务详情一级 |
| | | Set<Long> specialProjectType = new HashSet<>(Arrays.asList(46L, 47L)); |
| | | // 应用参数 |
| | | DateTimeFormatter ymdFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | Map<String, String> leaveTypeMap = dictDetailRepository.findByDictName(Constant.LEAVE_TYPE).stream().collect(Collectors.toMap(DictDetail::getValue, DictDetail::getLabel)); |
| | | |
| | | for (Long userId : userIds) { |
| | | // 查询用户信息 |
| | |
| | | return new BigDecimal(leave.getLeaveDuration()); |
| | | } |
| | | }).reduce(BigDecimal.ZERO, (res, cur) -> res.add(cur)); |
| | | String leaveHourDetail = leaveList.stream().map(leave -> { |
| | | BigDecimal leaveHour = leave.getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_DAY) ? new BigDecimal(8).multiply(new BigDecimal(leave.getLeaveDuration())) : new BigDecimal(leave.getLeaveDuration()); |
| | | return String.format("%s %s %sH", leave.getLeaveStartTime().toLocalDateTime().format(ymdFormatter), leaveTypeMap.get(leave.getLeaveType()), leaveHour.stripTrailingZeros().toPlainString()); |
| | | }).collect(Collectors.joining(";")); |
| | | // 统计换休信息 |
| | | AttendanceOvertimeQueryCriteria overtimeQueryCriteria = new AttendanceOvertimeQueryCriteria(); |
| | | overtimeQueryCriteria.setUserId(userId); |
| | |
| | | String submitTimestamp = String.valueOf(endTime.getTime()); |
| | | values.put("提交日期", new Record.TypedValue(Record.DataType.FIELD_TYPE_DATE_TIME, submitTimestamp).getValue()); |
| | | record.setValues(values); |
| | | // 请假详细 |
| | | RecordCellTextValue leaveDetail = new RecordCellTextValue(); |
| | | leaveDetail.setType("text"); |
| | | leaveDetail.setText(leaveHourDetail); |
| | | values.put("请假详细", new Record.TypedValue(Record.DataType.FIELD_TYPE_TEXT, Arrays.asList(leaveDetail)).getValue()); |
| | | |
| | | if (StringUtils.isNotBlank(record.getRecordId())) { |
| | | // 编辑记录 |