| | |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | private final OapiDingTalkMethod oapiDingTalkMethod; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceQueryCriteria criteria, Pageable pageable){ |
| | |
| | | */ |
| | | @Override |
| | | public void addAttendanceInfo(Attendance attendance) throws Exception { |
| | | // 获取今天日期 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String todayDate = sdf.format(new Date()); |
| | | if(attendance.getAttendanceDate().compareTo(Timestamp.valueOf(todayDate)) >= 0){ |
| | | throw new BadRequestException("只能更新小于等于今天的考勤信息"); |
| | | } |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String attendanceDate = df.format(attendance.getAttendanceDate()); |
| | | List<User> userList = new ArrayList<>(); |
| | |
| | | User user = userRepository.findById(attendance.getUserId()).orElseGet(User::new); |
| | | userList.add(user); |
| | | } |
| | | // 调用0时定时任务 |
| | | dingTalkService.getDingTalkAttendanceList(attendance.getAttendanceDate()); |
| | | // 选择日期和员工更新员工的考勤信息,未选择员工则更新所有人 |
| | | dingTalkService.getDingTalkAttendanceListOfNoonOrNight(attendanceDate ,userList); |
| | | } |