|
@@ -22,6 +22,7 @@ import com.zjugis.module.adm.service.reportcomment.ReportCommentService;
|
|
|
import com.zjugis.module.adm.service.reportreceive.ReportReceiveService;
|
|
|
import com.zjugis.module.adm.service.reportworkload.ReportWorkloadService;
|
|
|
import com.zjugis.module.adm.service.workday.WorkdayService;
|
|
|
+import com.zjugis.module.adm.util.PageUtil;
|
|
|
import com.zjugis.module.system.api.dept.DeptApi;
|
|
|
import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import com.zjugis.module.system.api.user.AdminUserApi;
|
|
@@ -169,6 +170,7 @@ 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());
|
|
|
|
|
@@ -209,34 +211,30 @@ public class ReportServiceImpl implements ReportService {
|
|
|
//返回结果
|
|
|
List<ReportStatisticRespVO> resultList = new ArrayList<>();
|
|
|
for (String key : allReportMap.keySet()) {
|
|
|
- Map<String, List<ReportDO>> reportMap= allReportMap.get(key);
|
|
|
-
|
|
|
String[] keyArr = key.split("/");
|
|
|
- ReportStatisticRespVO statisticRespVO = new ReportStatisticRespVO();
|
|
|
- statisticRespVO.setReportYear(Short.valueOf(keyArr[0]));
|
|
|
- statisticRespVO.setReportMonth(Short.valueOf(keyArr[1]));
|
|
|
- statisticRespVO.setDeptId(keyArr[2]);
|
|
|
- statisticRespVO.setDeptName(deptMap.get(statisticRespVO.getDeptId()).getName());
|
|
|
- statisticRespVO.setUserId(keyArr[3]);
|
|
|
- statisticRespVO.setNickName(userMap.get(statisticRespVO.getUserId()).getNickname());
|
|
|
-
|
|
|
- //各日期周/日报情况
|
|
|
- List<ReportFillSituationVO> reportFillUnitList = new ArrayList<>();
|
|
|
- Map<String, List<WorkdayDO>> workDayOrWeekMap = allWorkDayOrWeekMap.get(statisticRespVO.getReportYear() + "/" + statisticRespVO.getReportMonth());
|
|
|
- Map<String, List<StatisticAttendanceSheetData>> attendanceStatisticMap = allAttendanceStatisticMap.get(statisticRespVO.getUserId() + "/" + statisticRespVO.getReportYear() + "/" + statisticRespVO.getReportMonth());
|
|
|
+ String year = keyArr[0];
|
|
|
+ String month = keyArr[1];
|
|
|
+ String deptId = keyArr[2];
|
|
|
+ String userId = keyArr[3];
|
|
|
|
|
|
+ Map<String, List<ReportDO>> reportMap= allReportMap.get(key);
|
|
|
+ Map<String, List<WorkdayDO>> workDayOrWeekMap = allWorkDayOrWeekMap.get(year + "/" + month);
|
|
|
+ Map<String, List<StatisticAttendanceSheetData>> attendanceStatisticMap = allAttendanceStatisticMap.get(userId + "/" + year + "/" + month);
|
|
|
Integer fillCount = reportMap.size(); //已填报告数量
|
|
|
Integer shouldFillCount = workDayOrWeekMap.size(); //默认应填报告数量
|
|
|
+
|
|
|
+ //各日期周/日报情况
|
|
|
+ List<ReportFillSituationVO> reportFillUnitList = new ArrayList<>();
|
|
|
for (String dateUnit : workDayOrWeekMap.keySet()) {
|
|
|
ReportFillSituationVO reportUnit = new ReportFillSituationVO();
|
|
|
//工作报告
|
|
|
List<ReportDO> reports = reportMap.get(dateUnit);
|
|
|
reportUnit.setReport(CollectionUtils.isNotEmpty(reports) ? reports.get(0) : null);
|
|
|
reportFillUnitList.add(reportUnit);
|
|
|
+ reportUnit.setDate(dateUnit);
|
|
|
|
|
|
+ //是否工作日/周
|
|
|
List<WorkdayDO> list = workDayOrWeekMap.get(dateUnit);
|
|
|
-
|
|
|
- reportUnit.setDate(dateUnit);
|
|
|
boolean isWorkWeek = list.stream().anyMatch(c -> "1".equals(c.getIsworkday()));
|
|
|
reportUnit.setIsworkday(isWorkWeek ? 1 : 0);
|
|
|
|
|
@@ -248,17 +246,24 @@ public class ReportServiceImpl implements ReportService {
|
|
|
reportUnit.setIsAskForLeave(statisticAttendanceSheet.getAskForLeaveCount() > 0 ? 1 : 0);
|
|
|
shouldFillCount = statisticAttendanceSheet.getWorkdayCount() == statisticAttendanceSheet.getAskForLeaveCount() ? shouldFillCount - 1 : shouldFillCount;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+ ReportStatisticRespVO statisticRespVO = new ReportStatisticRespVO();
|
|
|
+ statisticRespVO.setReportYear(year);
|
|
|
+ statisticRespVO.setReportMonth(month);
|
|
|
+ statisticRespVO.setDeptId(deptId);
|
|
|
+ statisticRespVO.setDeptName(deptMap.get(statisticRespVO.getDeptId()).getName());
|
|
|
+ statisticRespVO.setUserId(userId);
|
|
|
+ statisticRespVO.setNickName(userMap.get(statisticRespVO.getUserId()).getNickname());
|
|
|
statisticRespVO.setReportFillSituation(reportFillUnitList);
|
|
|
- statisticRespVO.setFilledCount(fillCount);
|
|
|
statisticRespVO.setShouldFilledCount(shouldFillCount);
|
|
|
statisticRespVO.setNotFilledCount(shouldFillCount - fillCount);
|
|
|
+ statisticRespVO.setFilledCount(fillCount);
|
|
|
statisticRespVO.setFillRate(fillCount * 1.0 / shouldFillCount);
|
|
|
resultList.add(statisticRespVO);
|
|
|
}
|
|
|
-
|
|
|
- Page<ReportStatisticRespVO> pages = PageUtil.getPages(reportStatisticReqDTO.getPageNo(), reportStatisticReqDTO.getPageNo(), resultList);
|
|
|
- return new PageResult<>(pages.getRecords(), pages.getTotal());
|
|
|
+ PageResult<ReportStatisticRespVO> pages = PageUtil.getPages(reportStatisticReqDTO.getPageNo(), reportStatisticReqDTO.getPageSize(), resultList);
|
|
|
+ return pages;
|
|
|
}
|
|
|
|
|
|
|