| | |
| | | import me.zhengjie.modules.attendance.repository.AttendanceLeaveRepository;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceOvertimeRepository;
|
| | | import me.zhengjie.modules.attendance.service.AttendanceService;
|
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto;
|
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceQueryCriteria;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.project.service.ProjectPerformanceDetailService;
|
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailQueryCriteria;
|
| | | import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl;
|
| | | import me.zhengjie.modules.salary.domain.NewSalary;
|
| | | import me.zhengjie.modules.salary.repository.NewSalaryRepository;
|
| | | import me.zhengjie.modules.salary.service.NewSalaryService;
|
| | |
| | | // ==================== 以上为定时生成工资记录主要依赖 ====================
|
| | | private final MeritWageRepository meritWageRepository;
|
| | | private final MeritLevelRepository meritLevelRepository;
|
| | | private final WeComServiceImpl weComService;
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> queryAll(NewSalaryQueryCriteria criteria, Pageable pageable) {
|
| | |
| | | }
|
| | | // 获取用户列表
|
| | | List<UserSmallDto> userDtoList = userService.querySmallAll(userQueryCriteria);
|
| | | // 获取用户ID列表
|
| | | List<Long> userIds = userDtoList.stream().map(UserSmallDto::getId).collect(Collectors.toList());
|
| | | try {
|
| | | // 更新打卡状态为等待的考勤信息
|
| | | checkAttendanceStatus(userIds, criteria.getTargetYearMonth());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new BadRequestException("考勤信息获取失败!");
|
| | | }
|
| | |
|
| | | // 循环用户列表
|
| | | for (int i = 0; i < userDtoList.size(); i++) {
|
| | |
| | | throw new RuntimeException(errorMessage);
|
| | | }
|
| | | }
|
| | | // 更新打卡状态为等待的用户考勤信息
|
| | | public void checkAttendanceStatus(List<Long> userList, String targetYearMonth) throws Exception {
|
| | | // 考勤查询类
|
| | | AttendanceQueryCriteria attendanceQueryCriteriaStart = new AttendanceQueryCriteria();
|
| | | attendanceQueryCriteriaStart.setUserIds(userList);
|
| | | attendanceQueryCriteriaStart.setAttendanceDateLike(targetYearMonth.substring(0, 7));
|
| | | attendanceQueryCriteriaStart.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR);
|
| | | // 获取早打卡状态为等待的考勤记录
|
| | | List<AttendanceDto> attendanceListStart = attendanceService.queryAll(attendanceQueryCriteriaStart);
|
| | | AttendanceQueryCriteria attendanceQueryCriteriaEnd = new AttendanceQueryCriteria();
|
| | | attendanceQueryCriteriaEnd.setUserIds(userList);
|
| | | attendanceQueryCriteriaEnd.setAttendanceDateLike(targetYearMonth.substring(0, 7));
|
| | | attendanceQueryCriteriaEnd.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR);
|
| | | // 获取晚打卡状态为等待的考勤记录
|
| | | List<AttendanceDto> attendanceListEnd = attendanceService.queryAll(attendanceQueryCriteriaEnd);
|
| | | // 合并考勤记录
|
| | | if (!attendanceListEnd.isEmpty() || !attendanceListStart.isEmpty()) {
|
| | | attendanceListStart.addAll(attendanceListEnd);
|
| | | // 去重
|
| | | attendanceListStart = attendanceListStart.stream().distinct().collect(Collectors.toList());
|
| | | // 拉取考勤信息
|
| | | for (AttendanceDto attendance : attendanceListStart) {
|
| | | weComService.getWeComAttendanceListOfNight(String.valueOf(attendance.getAttendanceDate()).substring(0, 10), Collections.singletonList(userRepository.findById(attendance.getUserId()).orElseGet(User::new)));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Double getMeritWage(Double completedAchievementsHoursRate, Long level) {
|