diff --git a/zeroerr_oa-recruit/src/main/java/cn/zeroerr/controller/HomePageController.java b/zeroerr_oa-recruit/src/main/java/cn/zeroerr/controller/HomePageController.java index 53cad5c..eb65007 100644 --- a/zeroerr_oa-recruit/src/main/java/cn/zeroerr/controller/HomePageController.java +++ b/zeroerr_oa-recruit/src/main/java/cn/zeroerr/controller/HomePageController.java @@ -8,14 +8,12 @@ import cn.zeroerr.domain.dto.AnnouncementDTO; import cn.zeroerr.domain.dto.FollowDTO; import cn.zeroerr.domain.dto.HomePageDTO; import cn.zeroerr.domain.dto.PostDetailDTO; -import cn.zeroerr.domain.entity.EntryManage; -import cn.zeroerr.domain.entity.RecruitProcessTask; -import cn.zeroerr.domain.entity.ResumeFollowRecord; -import cn.zeroerr.domain.entity.ResumeHandleRecord; +import cn.zeroerr.domain.entity.*; import cn.zeroerr.domain.vo.PostListVO; import cn.zeroerr.domain.vo.ResumeStatVO; import cn.zeroerr.service.*; import cn.zeroerr.system.service.RecruitStructureService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -51,6 +49,8 @@ public class HomePageController extends BaseController { private RecruitStructureService recruitStructureService; @Autowired private EntryManageService entryManageService; + @Autowired + private PostGradeService postGradeService; @Anonymous @GetMapping("/getResumeStat") @@ -133,68 +133,6 @@ public class HomePageController extends BaseController { resumeStatVO.setEntryPercent(0d); } -// // 使用流进行分组并求和 -// Map groupedSum = resumeHandleRecordList.stream() -// .collect(Collectors.groupingBy(ResumeHandleRecord::getPostId, -// Collectors.summingInt(ResumeHandleRecord::getSeenNum))); -// -// // 将 Map.Entry 转换为 PostIdSeenNum 对象并排序 -// List postList = groupedSum.entrySet().stream() -// .map(entry -> new PostIdSeenNumDTO(entry.getKey(), entry.getValue())) -// .sorted(Comparator.comparingInt(PostIdSeenNumDTO::getSeenNum).reversed()) -// .map(PostIdSeenNumDTO::getPostId) -// .collect(Collectors.toList()); -// // 根据 postId 去重 -// List distinctRecords = new ArrayList<>(resumeHandleRecordList.stream() -// .collect(Collectors.toMap(ResumeHandleRecord::getPostId, record -> record, (existing, replacement) -> existing)) -// .values()); -// -// //8.某月份,某岗位面试人数List 9.某月份,某岗位入职人数List 10.某月份,优先级高的七个岗位名字 -// //找到面试跟踪里,该岗位的面试(终试)人数 -// List interviewList = resumeFollowRecordService.getPostInterViewList(postList, firstDay, lastDay); -// //根据岗位分组 -// Map> postInterviewMap = new HashMap<>(); -// if (!CollectionUtils.isEmpty(interviewList)) { -// postInterviewMap = interviewList.stream().collect(Collectors.groupingBy(ResumeFollowRecord::getPostId)); -// } -// //找到面试跟踪里,该岗位的入职人数 -// List entryList = resumeFollowRecordService.getPostEntryList(postList, firstDay, lastDay); -// Map> postEntryMap = new HashMap<>(); -// if (!CollectionUtils.isEmpty(entryList)) { -// postEntryMap = entryList.stream().collect(Collectors.groupingBy(ResumeFollowRecord::getPostId)); -// } -// //岗位list -// List postNameList = new ArrayList<>(); -// //面试人数 -// List postInterviewCounts = new ArrayList<>(); -// //入职人数 -// List postEntryCounts = new ArrayList<>(); -// -// for (ResumeHandleRecord resumeHandleRecord :distinctRecords) { -// //保存该岗位的名字 -// postNameList.add(resumeHandleRecord.getPostName()); -// //根据岗位id找到该岗位在筛选时间内 面试(终试)人数 -// if (!CollectionUtils.isEmpty(postInterviewMap.get(resumeHandleRecord.getPostId()))) { -// postInterviewCounts.add(postInterviewMap.get(resumeHandleRecord.getPostId()).size()); -// } else { -// postInterviewCounts.add(0); -// } -// -// //根据岗位id找到该岗位在筛选时间内 入职人数 -// if (!CollectionUtils.isEmpty(postEntryMap.get(resumeHandleRecord.getPostId()))) { -// postEntryCounts.add(postEntryMap.get(resumeHandleRecord.getPostId()).size()); -// } else { -// postEntryCounts.add(0); -// } -// -// } -// resumeStatVO.setPostEntryCounts(postEntryCounts); -// resumeStatVO.setPostInterviewCounts(postInterviewCounts); -// resumeStatVO.setPostNameList(postNameList); - - - //11.合格简历百分比:100 ;电话面试通过百分比:电话通过人数/简历合格数 ; 初试通过百分比: 初试通过人数/初试到面人数 ; 终试通过百分比:终试通过人数/终试到面人数。 - // 对resumeFollowRecordList根据postId进行分组 Map> groupedResumeFollowRecords = resumeFollowRecordList.stream() @@ -231,13 +169,13 @@ public class HomePageController extends BaseController { //某月份,某岗位约面人数 List postInviteCounts = new ArrayList<>(); //某月份,某岗位到面(初试)人数 - List postArriveCounts = new ArrayList<>(); + List postArriveCounts = new ArrayList<>(); //某月份,某岗位的终试人数 - List postFinalCounts = new ArrayList<>(); + List postFinalCounts = new ArrayList<>(); //某月份,某岗位接受offer数 List postOfferCounts = new ArrayList<>(); //某月份,某岗位的入职数 - List postEntryCounts = new ArrayList<>(); + List postEntryCounts = new ArrayList<>(); //某月份,岗位名字 List postNameList = new ArrayList<>(); //某月份,岗位ids @@ -311,12 +249,12 @@ public class HomePageController extends BaseController { postDetailDTO.setPostInviteCounts(0); } - //封装到面数 - if (!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)) { - postDetailDTO.setPostArriveCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getFirstReach()) && "1".equals(record.getFirstReach())).count()); - } else { - postDetailDTO.setPostArriveCounts(0L); - } +// //封装到面数 +// if (!CollectionUtils.isEmpty(resumeFollowRecordListByPostId)) { +// postDetailDTO.setPostArriveCounts(resumeFollowRecordListByPostId.stream().filter(record -> Objects.nonNull(record.getFirstReach()) && "1".equals(record.getFirstReach())).count()); +// } else { +// postDetailDTO.setPostArriveCounts(0L); +// } postDetailDTOList.add(postDetailDTO); } ); @@ -329,7 +267,7 @@ public class HomePageController extends BaseController { post -> { postIdsList.add(post.getPostId()); postNameList.add(post.getPostName()); - postArriveCounts.add(post.getPostArriveCounts()); + //postArriveCounts.add(post.getPostArriveCounts()); postInviteCounts.add(post.getPostInviteCounts()); postDownLoadCounts.add(post.getPostDownLoadCounts()); postSelfCounts.add(post.getPostSelfCounts()); @@ -345,10 +283,36 @@ public class HomePageController extends BaseController { resumeStatVO.setPostSelfCounts(postSelfCounts); resumeStatVO.setPostDownLoadCounts(postDownLoadCounts); resumeStatVO.setPostInviteCounts(postInviteCounts); - resumeStatVO.setPostArriveCounts(postArriveCounts); + //resumeStatVO.setPostArriveCounts(postArriveCounts); resumeStatVO.setPostNameList(postNameList); resumeStatVO.setPostIdsList(postIdsList); + //根据postIdsList,封装里面每个岗位的到面数(初试数)、终试数、入职数。 + if(!CollectionUtils.isEmpty(postIdsList)){ + postIdsList.forEach( + postId->{ + //寻找该岗位该月份的实际到面人数(初面人数) + List filteredFirstReachList = resumeFollowRecordActualArrivedList.stream() + .filter(record -> record.getPostId().equals(postId)) + .collect(Collectors.toList()); + postArriveCounts.add(filteredFirstReachList.size()); + //寻找该岗位的终试人数 + List filteredFinalReachList = resumeFollowRecordFinalArrivedList.stream() + .filter(record -> record.getPostId().equals(postId)) + .collect(Collectors.toList()); + postFinalCounts.add(filteredFinalReachList.size()); + //寻找该岗位的入职人数 +// List filteredEntryReachList = entryManageList.stream() +// .filter(record -> record.getPostId().equals(postId)) +// .collect(Collectors.toList()); +// postEntryCounts.add(filteredEntryReachList.size()); + } + ); + } + resumeStatVO.setPostArriveCounts(postArriveCounts); + resumeStatVO.setPostFinalCounts(postFinalCounts); + //resumeStatVO.setPostEntryCounts(postEntryCounts); + List funnelDataList = new ArrayList<>(); @@ -503,9 +467,9 @@ public class HomePageController extends BaseController { //封装公告内容 List announcementDTOList = new ArrayList<>(); - // 获取近五天的日期范围 + // 获取近七天的日期范围 LocalDate now = LocalDate.now(); - LocalDate fiveDaysLater = now.plusDays(5); + LocalDate fiveDaysLater = now.plusDays(7); // 获取近五天预计入职的人,并按时间分类 Map> groupByJoinDate = entryManageService.getListByWeek(now, fiveDaysLater) diff --git a/zeroerr_oa-recruit/src/main/java/cn/zeroerr/domain/vo/ResumeStatVO.java b/zeroerr_oa-recruit/src/main/java/cn/zeroerr/domain/vo/ResumeStatVO.java index 47053ad..65f87e3 100644 --- a/zeroerr_oa-recruit/src/main/java/cn/zeroerr/domain/vo/ResumeStatVO.java +++ b/zeroerr_oa-recruit/src/main/java/cn/zeroerr/domain/vo/ResumeStatVO.java @@ -64,7 +64,13 @@ public class ResumeStatVO { private List postInviteCounts; @ApiModelProperty(value = "某月份,某岗位到面人数") - private List postArriveCounts; + private List postArriveCounts; + + @ApiModelProperty(value = "某月份,某岗位终面人数") + private List postFinalCounts; + + @ApiModelProperty(value = "某月份,某岗位入职人数") + private List postEntryCounts; @ApiModelProperty(value = "某月份,岗位名字") private List postNameList;