BAOLH
2026-11-10 4d730af0447c686133130d0116a0fa3dd82c2dca
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceGoOutServiceImpl.java
@@ -174,25 +174,34 @@
            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(23, 59, 59);
                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());
@@ -273,7 +282,7 @@
        User user1 = userRepository.getOne(SecurityUtils.getCurrentUserId());
        Role role = user1.getRoles().iterator().next();
        //除超管、总经理只能修改自己信息
        if (role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL) {
        if (!Constant.SUPER_LEVEL_LIST.contains(Long.valueOf(role.getLevel()))) {
            if (!Long.valueOf(resources.getUserId()).equals(SecurityUtils.getCurrentUserId())) {
                throw new BadRequestException("只能修改自己的记录");
            }
@@ -445,11 +454,11 @@
                throw new BadRequestException("审核通过或退回的不能进行删除");
            }
            //获取当前登入人信息
            // 获取当前登入人信息
            User user = userRepository.getOne(SecurityUtils.getCurrentUserId());
            Role role = user.getRoles().iterator().next();
            //除超管、总经理只能删除自己信息
            if (role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL) {
            // 除超管、总经理只能删除自己信息
            if (!Constant.SUPER_LEVEL_LIST.contains(Long.valueOf(role.getLevel()))) {
                if (!Long.valueOf(attendanceGoOut.get().getUserId()).equals(SecurityUtils.getCurrentUserId())) {
                    throw new BadRequestException("只能删除自己的记录");
                }