| | |
| | | @Override |
| | | public PageInfo<ClockInStatisticsDto> getClockInStatistics(ClockInStatisticsVo query) { |
| | | PageInfo<ClockInStatisticsDto> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<Long> appUserIds = new ArrayList<>(); |
| | | List<Long> appUserIds1 = new ArrayList<>(); |
| | | List<Long> appUserIds2 = new ArrayList<>(); |
| | | List<Long> appUserIds3 = new ArrayList<>(); |
| | | //处理查询条件 |
| | | if(StringUtils.isNotEmpty(query.getName())){ |
| | | R<List<XpOperationsUser>> listR = xpOperationUserClient.listByName(query.getName()); |
| | | if(listR.getCode() == Constants.SUCCESS){ |
| | | List<Long> collect = listR.getData().stream().map(XpOperationsUser::getId).collect(Collectors.toList()); |
| | | appUserIds.addAll(collect); |
| | | appUserIds1.addAll(collect); |
| | | } |
| | | appUserIds.add(0L); |
| | | appUserIds1.add(0L); |
| | | } |
| | | if(null != query.getRoleId()){ |
| | | R<List<XpOperationsRole>> roleByRoleId = xpOperationUserClient.getXpOperationsRoleByRoleId(query.getRoleId()); |
| | | if(roleByRoleId.getCode() == Constants.SUCCESS){ |
| | | List<Long> collect = roleByRoleId.getData().stream().map(XpOperationsRole::getOperationsUserId).collect(Collectors.toList()); |
| | | appUserIds.addAll(collect); |
| | | appUserIds2.addAll(collect); |
| | | } |
| | | appUserIds.add(0L); |
| | | appUserIds2.add(0L); |
| | | } |
| | | if(StringUtils.isNotEmpty(query.getName()) && null != query.getRoleId()){ |
| | | for (Long l : appUserIds1) { |
| | | if(appUserIds2.contains(l)){ |
| | | appUserIds3.add(l); |
| | | } |
| | | } |
| | | }else{ |
| | | appUserIds3.addAll(appUserIds1); |
| | | appUserIds3.addAll(appUserIds2); |
| | | } |
| | | |
| | | String startTime = ""; |
| | |
| | | endTime = statisticDate.split(" - ")[1].split(" ")[0]; |
| | | } |
| | | //查询数据 |
| | | List<ClockInStatisticsDto> clockInStatistics = this.baseMapper.getClockInStatistics(pageInfo, appUserIds, startTime, endTime); |
| | | List<ClockInStatisticsDto> clockInStatistics = this.baseMapper.getClockInStatistics(pageInfo, appUserIds3, startTime, endTime); |
| | | List<String> appUserIdList = clockInStatistics.stream().map(ClockInStatisticsDto::getAppUserId).collect(Collectors.toList()); |
| | | List<Long> ids = appUserIdList.stream().map(Long::parseLong).collect(Collectors.toList()); |
| | | List<XpOperationsUserWithRoleVO> data = xpOperationUserClient.listByIdsWithRole(ids).getData(); |
| | |
| | | } |
| | | Integer shouldClockInDays = clockInStatistic.getShouldClockInDays(); |
| | | Integer clockInDays = clockInStatistic.getClockInDays(); |
| | | clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays); |
| | | Integer lateEarly = clockInStatistic.getLateEarly(); |
| | | clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays - lateEarly); |
| | | } |
| | | pageInfo.setRecords(clockInStatistics); |
| | | return pageInfo; |
| | |
| | | @Override |
| | | public void exportClockInStatistics(ClockInStatisticsVo query, HttpServletResponse response) { |
| | | PageInfo<ClockInStatisticsDto> pageInfo = new PageInfo<>(0, 10000); |
| | | List<Long> appUserIds = new ArrayList<>(); |
| | | List<Long> appUserIds1 = new ArrayList<>(); |
| | | List<Long> appUserIds2 = new ArrayList<>(); |
| | | List<Long> appUserIds3 = new ArrayList<>(); |
| | | //处理查询条件 |
| | | if(StringUtils.isNotEmpty(query.getName())){ |
| | | R<List<XpOperationsUser>> listR = xpOperationUserClient.listByName(query.getName()); |
| | | if(listR.getCode() == Constants.SUCCESS){ |
| | | List<Long> collect = listR.getData().stream().map(XpOperationsUser::getId).collect(Collectors.toList()); |
| | | appUserIds.addAll(collect); |
| | | appUserIds1.addAll(collect); |
| | | } |
| | | appUserIds.add(0L); |
| | | appUserIds1.add(0L); |
| | | } |
| | | if(null != query.getRoleId()){ |
| | | R<List<XpOperationsRole>> roleByRoleId = xpOperationUserClient.getXpOperationsRoleByRoleId(query.getRoleId()); |
| | | if(roleByRoleId.getCode() == Constants.SUCCESS){ |
| | | List<Long> collect = roleByRoleId.getData().stream().map(XpOperationsRole::getOperationsUserId).collect(Collectors.toList()); |
| | | appUserIds.addAll(collect); |
| | | appUserIds2.addAll(collect); |
| | | } |
| | | appUserIds.add(0L); |
| | | appUserIds2.add(0L); |
| | | } |
| | | if(StringUtils.isNotEmpty(query.getName()) && null != query.getRoleId()){ |
| | | for (Long l : appUserIds1) { |
| | | if(appUserIds2.contains(l)){ |
| | | appUserIds3.add(l); |
| | | } |
| | | } |
| | | }else{ |
| | | appUserIds3.addAll(appUserIds1); |
| | | appUserIds3.addAll(appUserIds2); |
| | | } |
| | | String startTime = ""; |
| | | String endTime = ""; |
| | |
| | | endTime = statisticDate.split(" - ")[1].split(" ")[0]; |
| | | } |
| | | //查询数据 |
| | | List<ClockInStatisticsDto> clockInStatistics = this.baseMapper.getClockInStatistics(pageInfo, appUserIds, startTime, endTime); |
| | | List<ClockInStatisticsDto> clockInStatistics = this.baseMapper.getClockInStatistics(pageInfo, appUserIds3, startTime, endTime); |
| | | List<String> appUserIdList = clockInStatistics.stream().map(ClockInStatisticsDto::getAppUserId).collect(Collectors.toList()); |
| | | List<Long> ids = appUserIdList.stream().map(Long::parseLong).collect(Collectors.toList()); |
| | | List<XpOperationsUserWithRoleVO> data = xpOperationUserClient.listByIdsWithRole(ids).getData(); |
| | |
| | | } |
| | | Integer shouldClockInDays = clockInStatistic.getShouldClockInDays(); |
| | | Integer clockInDays = clockInStatistic.getClockInDays(); |
| | | clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays); |
| | | Integer lateEarly = clockInStatistic.getLateEarly(); |
| | | clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays - lateEarly); |
| | | } |
| | | |
| | | ExcelUtil<ClockInStatisticsDto> excel = new ExcelUtil<ClockInStatisticsDto>(ClockInStatisticsDto.class); |