|
@@ -349,15 +349,17 @@ public class ReportServiceImpl implements ReportService {
|
|
|
/**
|
|
|
* 获取员工工作报告Map(工作日且未请假)
|
|
|
*
|
|
|
- * @param reportType 报告类型
|
|
|
- * @param year 年份
|
|
|
- * @param month 月份
|
|
|
- * @param deptId 部门Id
|
|
|
- * @param userId 用户Id
|
|
|
- * @param monthWorkDay 工作日
|
|
|
+ * @param reportType 报告类型
|
|
|
+ * @param year 年份
|
|
|
+ * @param month 月份
|
|
|
+ * @param deptId 部门Id
|
|
|
+ * @param userId 用户Id
|
|
|
+ * @param monthWorkDay 工作日
|
|
|
+ * @param allLeaveDayOrWeekMap 每个用户全天请假的日期数量/每个用户全周请假的日期数量
|
|
|
* @return
|
|
|
*/
|
|
|
- private Map<String, List<ReportDO>> getReport(String reportType, Short year, Short month, Set<String> deptId, String userId, List<WorkdayDO> monthWorkDay) {
|
|
|
+ private Map<String, List<ReportDO>> getReport(String reportType, Short year, Short month, Set<String> deptId, String userId,
|
|
|
+ List<WorkdayDO> monthWorkDay, Map<String,Integer> allLeaveDayOrWeekMap) {
|
|
|
LambdaQueryWrapper<ReportDO> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.select(ReportDO::getReportStartDate, ReportDO::getReportYear, ReportDO::getReportMonth, ReportDO::getReportWeek, ReportDO::getDeptId, ReportDO::getUserId, ReportDO::getId);
|
|
|
queryWrapper.eq(ReportDO::getIsTemp, false);
|
|
@@ -407,6 +409,8 @@ public class ReportServiceImpl implements ReportService {
|
|
|
if (CollectionUtil.isEmpty(attendanceSheetDOS)) {
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ int allLeaveDayOrWeekCount = 0;
|
|
|
//判断整天请假/整周请假,并过滤
|
|
|
if ("daily".equals(reportType)) {
|
|
|
Set<LocalDate> allLeaveDaySet = new HashSet<>();
|
|
@@ -418,7 +422,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
allLeaveDaySet.add(date.toLocalDate());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ allLeaveDayOrWeekCount = allLeaveDaySet.size();
|
|
|
//日报中过滤掉上下午都请假的那天的日报
|
|
|
if (CollectionUtil.isNotEmpty(allLeaveDaySet)) {
|
|
|
userReportList = userReportList.stream().filter(c -> !allLeaveDaySet.contains(c.getReportStartDate())).collect(Collectors.toList());
|
|
@@ -437,12 +441,16 @@ public class ReportServiceImpl implements ReportService {
|
|
|
allLeaveWeekSet.add(date);
|
|
|
}
|
|
|
}
|
|
|
+ allLeaveDayOrWeekCount = allLeaveWeekSet.size();
|
|
|
//周报中过滤掉当周都请假的那一周周报
|
|
|
if (CollectionUtil.isNotEmpty(allLeaveWeekSet)) {
|
|
|
userReportList = userReportList.stream().filter(c -> !allLeaveWeekSet.contains(c.getReportYear() + "-" + c.getReportMonth() + "-" + c.getReportWeek())).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ allLeaveDayOrWeekMap.put(userId, allLeaveDayOrWeekCount);
|
|
|
+
|
|
|
reportMap.put(reportUserId, userReportList);
|
|
|
}
|
|
|
|
|
@@ -523,7 +531,9 @@ public class ReportServiceImpl implements ReportService {
|
|
|
}
|
|
|
|
|
|
//获取人员工作报告Map(工作日/周且未整天/整周请假)
|
|
|
- Map<String, List<ReportDO>> staffReportMap = this.getReport(reportType, year, month, deptIds, userId, monthWorkDay);
|
|
|
+ Map<String,Integer> allLeaveDayOrWeekMap = new HashMap<>();
|
|
|
+
|
|
|
+ Map<String,List<ReportDO>> staffReportMap = this.getReport(reportType, year, month, deptIds, userId, monthWorkDay,allLeaveDayOrWeekMap);
|
|
|
|
|
|
List<ReportStatisticRespVO> respList = new ArrayList<>();
|
|
|
for (AdminUserRespDTO staff : userList) {
|
|
@@ -538,12 +548,12 @@ public class ReportServiceImpl implements ReportService {
|
|
|
statisticRespVO.setDeptId(staff.getDeptId());
|
|
|
statisticRespVO.setDeptName(staff.getDeptName());
|
|
|
|
|
|
-
|
|
|
- statisticRespVO.setShouldFilledCount(shouldFillCount);
|
|
|
+ Integer leaveDays = allLeaveDayOrWeekMap.get(staff.getId());
|
|
|
+ statisticRespVO.setShouldFilledCount(shouldFillCount - leaveDays);
|
|
|
List<ReportDO> staffReportList = staffReportMap.get(staff.getId());
|
|
|
statisticRespVO.setFilledCount(staffReportList == null ? 0 : staffReportList.size());
|
|
|
- statisticRespVO.setNotFilledCount(shouldFillCount - statisticRespVO.getFilledCount() < 0 ? 0 : shouldFillCount - statisticRespVO.getFilledCount());
|
|
|
- statisticRespVO.setFillRate(statisticRespVO.getFilledCount() * 1.0 / shouldFillCount > 1 ? 1 : statisticRespVO.getFilledCount() * 1.0 / shouldFillCount);
|
|
|
+ statisticRespVO.setNotFilledCount(statisticRespVO.getShouldFilledCount() - statisticRespVO.getFilledCount() < 0 ? 0 : statisticRespVO.getShouldFilledCount() - statisticRespVO.getFilledCount());
|
|
|
+ statisticRespVO.setFillRate(statisticRespVO.getFilledCount() * 1.0 / shouldFillCount > 1 ? 1 : statisticRespVO.getFilledCount() * 1.0 / statisticRespVO.getShouldFilledCount());
|
|
|
|
|
|
respList.add(statisticRespVO);
|
|
|
}
|
|
@@ -678,7 +688,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
deptStat.setNotFilledCount(deptStat.getNotFilledCount() + vo.getNotFilledCount());
|
|
|
deptStat.setFilledCount(deptStat.getFilledCount() + vo.getFilledCount());
|
|
|
deptStat.setFillRate(deptStat.getShouldFilledCount() == 0 ? null
|
|
|
- : deptStat.getFilledCount() * 1.0 / deptStat.getShouldFilledCount() > 1 ? 1 : deptStat.getFilledCount() * 1.0 / deptStat.getShouldFilledCount() );
|
|
|
+ : deptStat.getFilledCount() * 1.0 / deptStat.getShouldFilledCount() > 1 ? 1 : deptStat.getFilledCount() * 1.0 / deptStat.getShouldFilledCount());
|
|
|
}
|
|
|
List<DeptReportStatisticRespVO> deptStatisticValue = deptStatisticMap.values().stream().collect(Collectors.toList());
|
|
|
|
|
@@ -782,6 +792,9 @@ public class ReportServiceImpl implements ReportService {
|
|
|
if (StrUtil.isNotBlank(reportWorkloadStatisticReqDTO.getUserId())) {
|
|
|
queryWrapper.eq("USER_ID", reportWorkloadStatisticReqDTO.getUserId());
|
|
|
}
|
|
|
+// if (StrUtil.isNotBlank(reportWorkloadStatisticReqDTO.getUserId())) {
|
|
|
+// queryWrapper.eq("USER_ID", reportWorkloadStatisticReqDTO.getUserId());
|
|
|
+// }
|
|
|
if (StrUtil.isNotBlank(reportWorkloadStatisticReqDTO.getDeptId())) {
|
|
|
List<String> deptIdList = Arrays.asList(reportWorkloadStatisticReqDTO.getDeptId().split(","));
|
|
|
queryWrapper.in("DEPT_ID", deptIdList);
|