| | |
| | | import me.zhengjie.modules.system.repository.*; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.*; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserLevelWageMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserLoginMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserMapper; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria; |
| | | import me.zhengjie.utils.*; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.cache.annotation.CacheConfig; |
| | |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final SystemSettingRepository systemSettingRepository; |
| | | private final SysCompanyRepository sysCompanyRepository; |
| | | private final TaskDaliyService taskDaliyService; |
| | | |
| | | @Override |
| | | public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { |
| | |
| | | |
| | | @Override |
| | | public List<UserDto> queryAll(UserQueryCriteria criteria) { |
| | | // 日历类 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 日期格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 日历字符串 |
| | | String calendarStr = sdf.format(calendar.getTime()); |
| | | // 查询用户数据 |
| | | List<User> users = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)); |
| | | return userMapper.toDto(users); |
| | | List<UserDto> usersDto = userMapper.toDto(users); |
| | | // 循环用户 |
| | | for (int i= 0; i < usersDto.size(); i ++) { |
| | | // 根据用户ID、指定年月查询用户级别工资 |
| | | SysUserLevelWage sysUserLevelWage = sysUserLevelWageRepository.findTargetYearMonth(usersDto.get(i).getId(), calendarStr); |
| | | // 判断用户级别工资是否为空 |
| | | if (sysUserLevelWage != null) { |
| | | // 根据ID查询用户级别 |
| | | SysLevel sysLevel = sysLevelRepository.findById(sysUserLevelWage.getLevelId()).orElseGet(SysLevel::new); |
| | | // 用户 |
| | | usersDto.get(i).setLevelName(sysLevel.getName()); |
| | | } else { |
| | | // 用户 |
| | | usersDto.get(i).setLevelName(null); |
| | | } |
| | | } |
| | | return usersDto; |
| | | } |
| | | |
| | | @Override |
| | |
| | | user.setJobs(resources.getJobs()); |
| | | user.setPhone(resources.getPhone()); |
| | | user.setNickName(resources.getNickName()); |
| | | user.setCompany(resources.getCompany()); |
| | | user.setCompanyId(resources.getCompanyId()); |
| | | user.setGender(resources.getGender()); |
| | | user.setBirthday(resources.getBirthday()); |
| | | user.setAddress(resources.getAddress()); |
| | |
| | | for(Attendance attendance : attendanceList){ |
| | | CalendarVo onDuty = new CalendarVo(); |
| | | onDuty.setDate(df.format(attendance.getAttendanceDate())); |
| | | onDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getStartClockResults()).get("msg")) ? "上班打卡时间:" + attendance.getRosteringWorkStartTime().toString() : "上班:" + formateResult(attendance.getStartClockResults()).get("msg")); |
| | | onDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getStartClockResults()).get("msg")) ? "上班打卡时间:" + attendance.getActualWorkStartTime().toString() : "上班:" + formateResult(attendance.getStartClockResults()).get("msg")); |
| | | onDuty.setIsOk((Boolean) formateResult(attendance.getStartClockResults()).get("status")); |
| | | onDuty.setType(1); |
| | | CalendarVo offDuty = new CalendarVo(); |
| | | offDuty.setDate(df.format(attendance.getAttendanceDate())); |
| | | offDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getEndClockResults()).get("msg")) ? "下班打卡时间:" + attendance.getRosteringWorkEndTime().toString() : "下班:" + formateResult(attendance.getEndClockResults()).get("msg")); |
| | | offDuty.setTitle(Constant.ATTENDANCE_STATE_NORMAL.equals(formateResult(attendance.getEndClockResults()).get("msg")) ? "下班打卡时间:" + attendance.getActualWorkEndTime().toString() : "下班:" + formateResult(attendance.getEndClockResults()).get("msg")); |
| | | offDuty.setIsOk((Boolean) formateResult(attendance.getEndClockResults()).get("status")); |
| | | offDuty.setType(1); |
| | | calendarInfo.add(onDuty); |
| | |
| | | bussTimes = bussTimes + attendanceBusinessTravel.getTravelDuration(); |
| | | } |
| | | returnData.put("Times", attCheckOnDuration + attCheckOffDuration + goOutTimes + (bussTimes * 8)); |
| | | |
| | | // 任务日报查询类 |
| | | TaskDaliyQueryCriteria taskDaliyQueryCriteria = new TaskDaliyQueryCriteria(); |
| | | taskDaliyQueryCriteria.setUserId(userId); |
| | | taskDaliyQueryCriteria.setTargetYearMonth(baseDate); |
| | | // 查询某月已完成工时 |
| | | Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria); |
| | | // 月初到今天绩效时长 |
| | | returnData.put("achievementsTime", completedWork); |
| | | |
| | | return returnData; |
| | | } |
| | | |
| | |
| | | for (UserDto userDTO : queryAll) { |
| | | List<String> roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList()); |
| | | String levelName = userDTO.getLevelId() != null ? sysLevelRepository.findById(userDTO.getLevelId()).orElseGet(SysLevel::new).getName() : ""; |
| | | SystemSetting systemSetting = systemSettingRepository.findByValue(userDTO.getCompany()); |
| | | SysCompany sysCompany = sysCompanyRepository.findById(userDTO.getCompanyId()).orElseGet(SysCompany::new); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("用户名", userDTO.getUsername()); |
| | | map.put("角色", roles); |
| | |
| | | map.put("钉钉号", userDTO.getDingding()); |
| | | map.put("排班", userDTO.getSysRostering().getName()); |
| | | map.put("级别", levelName); |
| | | map.put("所属公司", systemSetting == null ? "" : systemSetting.getLabel()); |
| | | map.put("所属公司", sysCompany == null ? "" : sysCompany.getLabel()); |
| | | map.put("状态", userDTO.getEnabled() ? "启用" : "禁用"); |
| | | map.put("手机号码", userDTO.getPhone()); |
| | | map.put("修改密码的时间", userDTO.getPwdResetTime()); |