|
@@ -170,9 +170,8 @@ public class ReportServiceImpl implements ReportService {
|
|
|
*/
|
|
|
@Override
|
|
|
public PageResult<ReportStatisticRespVO> getReportStatistics(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
-
|
|
|
//工作日/周map 2024/2 -> value
|
|
|
- Map<String, Map<String, List<WorkdayDO>>> allWorkDayOrWeekMap = workdayService.getReportWorkMap(reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth(), reportStatisticReqDTO.getReportType());
|
|
|
+ LinkedHashMap<String, LinkedHashMap<String, List<WorkdayDO>>> allWorkDayOrWeekMap = workdayService.getReportWorkMap(reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth(), reportStatisticReqDTO.getReportType());
|
|
|
|
|
|
//部门id及子部门id
|
|
|
Set<String> deptIds = null;
|
|
@@ -183,15 +182,23 @@ public class ReportServiceImpl implements ReportService {
|
|
|
}
|
|
|
|
|
|
//统计考勤请假数据
|
|
|
- String reportType = reportStatisticReqDTO.getReportType();
|
|
|
AttendanceSheetQueryDTO attendanceSheetListReq = new AttendanceSheetQueryDTO();
|
|
|
attendanceSheetListReq.setDeptIdList(deptIds);
|
|
|
attendanceSheetListReq.setUserId(attendanceSheetListReq.getUserId());
|
|
|
LocalDateTime[] dateTimeRange = new LocalDateTime[]{getStartDateTime(reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth()), getEndDateTime(reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth())};
|
|
|
attendanceSheetListReq.setAttendanceDate(dateTimeRange);
|
|
|
List<StatisticAttendanceSheetData> statisticAttendanceSheetData = attendanceSheetService.statisticAttendanceData(attendanceSheetListReq, reportStatisticReqDTO.getReportType());
|
|
|
- Map<String, Map<String, List<StatisticAttendanceSheetData>>> allAttendanceStatisticMap = statisticAttendanceSheetData.stream().collect(Collectors.groupingBy(c -> c.getUserId() + "/" + c.getYear() + "/" + c.getMonth(),
|
|
|
- Collectors.groupingBy(c -> "daily".equals(reportType) ? c.getAttendanceDate().toString() : c.getWeek().toString()))); //考勤统计map 111/2024/2 -> value
|
|
|
+ Map<String, Map<String, List<StatisticAttendanceSheetData>>> allAttendanceStatisticMap = new HashMap<>();
|
|
|
+ if("daily".equals(reportStatisticReqDTO.getReportType())){
|
|
|
+ allAttendanceStatisticMap = statisticAttendanceSheetData.stream().collect(
|
|
|
+ Collectors.groupingBy(c -> c.getUserId() + "/" + c.getAttendanceDate().getYear() + "/" + c.getAttendanceDate().getMonthValue(),
|
|
|
+ Collectors.groupingBy(c->c.getAttendanceDate().toLocalDate().toString()))); //考勤统计map 111/2024/2 -> value
|
|
|
+
|
|
|
+ }else{
|
|
|
+ allAttendanceStatisticMap = statisticAttendanceSheetData.stream().collect(
|
|
|
+ Collectors.groupingBy(c -> c.getUserId() + "/" + c.getYear() + "/" + c.getMonth(),
|
|
|
+ Collectors.groupingBy(c->c.getWeek().toString()))); //考勤统计map 111/2024/2 -> value
|
|
|
+ }
|
|
|
|
|
|
//获取工作报告
|
|
|
ReportReqDTO reportReqDTO = new ReportReqDTO();
|
|
@@ -200,8 +207,15 @@ public class ReportServiceImpl implements ReportService {
|
|
|
reportReqDTO.setReportMonth(reportStatisticReqDTO.getMonth());
|
|
|
reportReqDTO.setUserId(reportStatisticReqDTO.getUserId());
|
|
|
List<ReportDO> reportList = reportMapper.selectList(reportReqDTO, deptIds);
|
|
|
- Map<String, Map<String, List<ReportDO>>> allReportMap = reportList.stream().collect(Collectors.groupingBy(c -> c.getReportYear() + "/" + c.getReportMonth() + "/" + c.getDeptId() + "/" + c.getUserId(),
|
|
|
- Collectors.groupingBy(c -> "daily".equals(reportType) ? c.getReportStartDate().toString() : c.getReportWeek().toString())));
|
|
|
+ Map<String, Map<String, List<ReportDO>>> allReportMap = new HashMap<>();
|
|
|
+ if("daily".equals(reportStatisticReqDTO.getReportType())){
|
|
|
+ allReportMap = reportList.stream().collect(Collectors.groupingBy(c -> c.getReportStartDate().getYear() + "/" +c.getReportStartDate().getMonthValue() + "/" + c.getDeptId() + "/" + c.getUserId(),
|
|
|
+ Collectors.groupingBy(c-> c.getReportStartDate().toLocalDate().toString(),Collectors.toList())));
|
|
|
+ }else{
|
|
|
+ allReportMap = reportList.stream().collect(Collectors.groupingBy(c -> c.getReportYear() + "/" + c.getReportMonth() + "/" + c.getDeptId() + "/" + c.getUserId(),
|
|
|
+ Collectors.groupingBy(c-> c.getReportWeek().toString(),Collectors.toList())));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
List<String> userIds = reportList.stream().map(ReportDO::getUserId).distinct().collect(Collectors.toList());
|
|
|
Map<String, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
|
@@ -229,7 +243,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
ReportFillSituationVO reportUnit = new ReportFillSituationVO();
|
|
|
//工作报告
|
|
|
List<ReportDO> reports = reportMap.get(dateUnit);
|
|
|
- reportUnit.setReport(CollectionUtils.isNotEmpty(reports) ? reports.get(0) : null);
|
|
|
+ reportUnit.setReportId(CollectionUtils.isNotEmpty(reports) ? reports.get(0).getId() : null);
|
|
|
reportFillUnitList.add(reportUnit);
|
|
|
reportUnit.setDate(dateUnit);
|
|
|
|