| | |
| | | LocalTime startTime = resources.getOutStartTime().toLocalDateTime().toLocalTime();
|
| | | LocalTime endTime = resources.getOutEndTime().toLocalDateTime().toLocalTime();
|
| | | long distance = ChronoUnit.DAYS.between(startDate, endDate);
|
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
|
| | | Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).forEach(localDate -> {
|
| | | // SysConfigHolidayDto sysConfigHolidayDto = sysConfigHolidayService.queryByHolidayDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
| | | // Boolean isWeekend = localDate.getDayOfWeek() == DayOfWeek.SATURDAY || localDate.getDayOfWeek() == DayOfWeek.SUNDAY;
|
| | | // if ((sysConfigHolidayDto == null && !isWeekend) ||
|
| | | // sysConfigHolidayDto != null && Constant.DATE_TYPE_WEEKDAY.equals(sysConfigHolidayDto.getDateType())) {
|
| | | AttendanceGoOut attendanceGoOut = new AttendanceGoOut();
|
| | | //resUserId为null说明是添加,反之
|
| | | // resUserId为null说明是添加,反之
|
| | | if (resources.getUserId() == null) {
|
| | | resources.setUserId(user.getId());
|
| | | }
|
| | | resources.setOutStartTime(Timestamp.valueOf(localDate.atTime(startTime)));
|
| | | resources.setOutEndTime(Timestamp.valueOf(localDate.atTime(endTime)));
|
| | |
|
| | | LocalDateTime goOutStartTime = localDate.atStartOfDay();
|
| | | LocalDateTime goOutEndTime = localDate.atTime(LocalTime.MAX);
|
| | | if (localDate.equals(endDate)) {
|
| | | goOutEndTime = localDate.atTime(endTime);
|
| | | }
|
| | | if (localDate.equals(startDate)) {
|
| | | goOutStartTime = localDate.atTime(startTime);
|
| | | }
|
| | | resources.setOutStartTime(Timestamp.valueOf(goOutStartTime));
|
| | | resources.setOutEndTime(Timestamp.valueOf(goOutEndTime));
|
| | |
|
| | | Double result = getRemainingTime(resources);
|
| | | resources.setOutDuration(result);
|
| | | resources.setApprovalStatus(Constant.GOOUT_APPROVE_STATUS_REVIEWED);
|
| | |
|
| | | // 判断是否提交企微审批
|
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
|
| | | if (siteTypes.size() > 0) {
|
| | | // 添加企微申请参数
|
| | | resources.setWecomType(dictDetailRepository.findByDictNameAndValue("go_out_type", resources.getOutOfOfficeType()).getLabel());
|