|
@@ -272,19 +272,21 @@ public class ReportServiceImpl implements ReportService {
|
|
|
public PageResult<ReportStatisticRespVO> getReportStatistics(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
Short year = reportStatisticReqDTO.getYear();
|
|
|
Short month = reportStatisticReqDTO.getMonth();
|
|
|
-
|
|
|
+ List<AdminUserRespDTO> records = new ArrayList<>();
|
|
|
//部门id及子部门id
|
|
|
Set<String> deptIds = null;
|
|
|
if (StringUtils.isNotBlank(reportStatisticReqDTO.getDeptId())) {
|
|
|
deptIds = convertSet(deptApi.getChildDeptList(reportStatisticReqDTO.getDeptId()).getCheckedData(), DeptRespDTO::getId);
|
|
|
//添加自身部门
|
|
|
deptIds.add(reportStatisticReqDTO.getDeptId());
|
|
|
+ records = adminUserApi.getUserListByDeptIds(deptIds).getData();
|
|
|
+ }else{
|
|
|
+ records = adminUserApi.getUserList().getData();
|
|
|
}
|
|
|
|
|
|
- //获取员工列表
|
|
|
- Page<StaffRecordSDO> staffPage = recordsService.getIncumbentStaffPage(reportStatisticReqDTO.getPageNo(), reportStatisticReqDTO.getPageSize(), deptIds, reportStatisticReqDTO.getUserId());
|
|
|
- //获取人员Map
|
|
|
- Map<String, AdminUserRespDTO> userMap = adminUserApi.getUserMap();
|
|
|
+ if(StrUtil.isNotBlank(reportStatisticReqDTO.getUserId())){
|
|
|
+ records = records.stream().filter(user -> reportStatisticReqDTO.getUserId().equals(user.getId())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
//获取工作报告
|
|
|
Map<String, List<ReportDO>> staffReportMap = this.getReport(reportStatisticReqDTO.getReportType(), year, month, deptIds, reportStatisticReqDTO.getUserId());
|
|
|
|
|
@@ -296,21 +298,20 @@ public class ReportServiceImpl implements ReportService {
|
|
|
shouldFillCount = workdayService.getMonthWorkWeekNum(year, month);
|
|
|
}
|
|
|
|
|
|
- List<StaffRecordSDO> records = staffPage.getRecords();
|
|
|
List<ReportStatisticRespVO> respList = new ArrayList<>();
|
|
|
- for (StaffRecordSDO staff : records) {
|
|
|
+ for (AdminUserRespDTO staff : records) {
|
|
|
ReportStatisticRespVO statisticRespVO = new ReportStatisticRespVO();
|
|
|
statisticRespVO.setReportYear(year);
|
|
|
statisticRespVO.setReportMonth(month);
|
|
|
|
|
|
- statisticRespVO.setUserId(staff.getUserId());
|
|
|
- statisticRespVO.setNickName(userMap.get(staff.getUserId()) == null ? null : userMap.get(staff.getUserId()).getNickname());
|
|
|
- statisticRespVO.setDeptId(userMap.get(staff.getUserId()) == null ? null : userMap.get(staff.getUserId()).getDeptId());
|
|
|
- statisticRespVO.setDeptName(userMap.get(staff.getUserId()) == null ? null : userMap.get(staff.getUserId()).getDeptName());
|
|
|
+ statisticRespVO.setUserId(staff.getId());
|
|
|
+ statisticRespVO.setNickName(staff.getNickname());
|
|
|
+ statisticRespVO.setDeptId(staff.getDeptId());
|
|
|
+ statisticRespVO.setDeptName(staff.getDeptName());
|
|
|
|
|
|
statisticRespVO.setReportType(reportStatisticReqDTO.getReportType());
|
|
|
statisticRespVO.setShouldFilledCount(shouldFillCount);
|
|
|
- List<ReportDO> staffReportList = staffReportMap.get(staff.getUserId());
|
|
|
+ List<ReportDO> staffReportList = staffReportMap.get(staff.getId());
|
|
|
statisticRespVO.setFilledCount(staffReportList == null ? 0 : staffReportList.size());
|
|
|
statisticRespVO.setNotFilledCount(shouldFillCount - statisticRespVO.getFilledCount());
|
|
|
statisticRespVO.setFillRate(statisticRespVO.getFilledCount() * 1.0 / shouldFillCount);
|
|
@@ -320,7 +321,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
respList = respList.stream()
|
|
|
.sorted(Comparator.comparing(c -> PinyinUtil.toFirstLetter(c.getDeptName()))).collect(Collectors.toList());
|
|
|
PageResult<ReportStatisticRespVO> pages = PageUtil.getPages(reportStatisticReqDTO.getPageNo(), reportStatisticReqDTO.getPageSize(), respList);
|
|
|
- pages.setTotal(staffPage.getTotal());
|
|
|
+ pages.setTotal(Long.valueOf(records.size()));
|
|
|
return pages;
|
|
|
}
|
|
|
|