| | |
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceMapper;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl;
|
| | | import me.zhengjie.modules.system.domain.Role;
|
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday;
|
| | | import me.zhengjie.modules.system.domain.SysRostering;
|
| | | import me.zhengjie.modules.system.domain.User;
|
| | | import me.zhengjie.modules.system.repository.DictDetailRepository;
|
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
|
| | | import me.zhengjie.modules.system.repository.SysRosteringRepository;
|
| | | import me.zhengjie.modules.system.repository.UserRepository;
|
| | | import me.zhengjie.modules.system.domain.*;
|
| | | import me.zhengjie.modules.system.repository.*;
|
| | | import me.zhengjie.modules.system.service.dto.SysConfigHolidayQueryCriteria;
|
| | | import me.zhengjie.utils.*;
|
| | | import org.apache.commons.lang3.ObjectUtils;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<String,Object> queryAllNotNormal(AttendanceQueryCriteria criteria, Pageable pageable) {
|
| | |
|
| | | if (criteria.getUserId() == null) {
|
| | | List<String> wecomExcludeList = dictDetailRepository.findByDictName("wecom_exclude_list").stream().map(DictDetail::getValue).collect(Collectors.toList());
|
| | | criteria.setUserIds(userRepository.findAllByEnabled(true).stream().filter(user ->!wecomExcludeList.contains(user.getWeComId())).map(User::getId).collect(Collectors.toList()));
|
| | | }
|
| | |
|
| | | criteria.setStartClockResultsList(Arrays.asList(Constant.ATTENDANCE_START_EARLY, Constant.ATTENDANCE_START_LATE, Constant.ATTENDANCE_STATE_WAITFOR, Constant.ATTENDANCE_STATE_NOTSIGNED, Constant.ATTENDANCE_STATE_LACK_OF_TIME));
|
| | | criteria.setEndClockResultsList(Arrays.asList(Constant.ATTENDANCE_START_EARLY, Constant.ATTENDANCE_START_LATE, Constant.ATTENDANCE_STATE_WAITFOR, Constant.ATTENDANCE_STATE_NOTSIGNED, Constant.ATTENDANCE_STATE_LACK_OF_TIME));
|
| | | Page<Attendance> page = attendanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
| | | //将实体转换为Dto(重写)
|
| | | Function<Attendance, AttendanceDto> func = attendance -> {
|
| | | // 将实体类转换成DTO
|
| | | AttendanceDto attendanceDto = attendanceMapper.toDto(attendance);
|
| | | //查询用户信息
|
| | | User user = userRepository.findById(attendanceDto.getUserId()).orElseGet(User::new);
|
| | | attendanceDto.setUserName(user.getNickName());
|
| | | return attendanceDto;
|
| | | };
|
| | | return PageUtil.toPage(page.map(func));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<AttendanceDto> queryAll(AttendanceQueryCriteria criteria){
|
| | | return attendanceMapper.toDto(attendanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
| | | }
|