|
|
@@ -115,33 +115,33 @@ public class StatisticsController {
|
|
|
detailsDto.setRuleCategoryId(dto.getRuleCategoryId());
|
|
|
List<TeacherStatisticsPageVo> list = attendanceRecordService.getList(detailsDto);
|
|
|
|
|
|
- Long actualCount = 0L;
|
|
|
- Long lateCount = 0L;
|
|
|
- Long leaveCount = 0L;
|
|
|
- Long absenteeismCount = 0L;
|
|
|
- Integer dividendCount = 0;
|
|
|
+ Set<Long> actualCount = new HashSet<>();
|
|
|
+ Set<Long> lateCount = new HashSet<>();
|
|
|
+ Set<Long> leaveCount = new HashSet<>();
|
|
|
+ Set<Long> absenteeismCount = new HashSet<>();
|
|
|
+ Set<Long> dividendCount = new HashSet<>();
|
|
|
Set<Long> teacherIds = new HashSet<>();
|
|
|
for (TeacherStatisticsPageVo recordVo : list) {
|
|
|
teacherIds.add(recordVo.getUserId());
|
|
|
if ("迟到".equals(recordVo.getStatus())) {
|
|
|
- lateCount++;
|
|
|
- dividendCount++;
|
|
|
+ lateCount.add(recordVo.getUserId());
|
|
|
+ dividendCount.add(recordVo.getUserId());
|
|
|
} else if ("请假".equals(recordVo.getStatus())) {
|
|
|
- leaveCount++;
|
|
|
- dividendCount++;
|
|
|
+ leaveCount.add(recordVo.getUserId());
|
|
|
+ dividendCount.add(recordVo.getUserId());
|
|
|
} else if ("缺勤".equals(recordVo.getStatus())) {
|
|
|
- absenteeismCount++;
|
|
|
- dividendCount++;
|
|
|
+ absenteeismCount.add(recordVo.getUserId());
|
|
|
+ dividendCount.add(recordVo.getUserId());
|
|
|
}
|
|
|
if (recordVo.getRecordTime() != null) {
|
|
|
- actualCount++;
|
|
|
- dividendCount++;
|
|
|
+ actualCount.add(recordVo.getUserId());
|
|
|
+ dividendCount.add(recordVo.getUserId());
|
|
|
}
|
|
|
}
|
|
|
- statisticsVo.setLateCount(lateCount);
|
|
|
- statisticsVo.setActualCount(actualCount);
|
|
|
- statisticsVo.setLeaveCount(leaveCount);
|
|
|
- statisticsVo.setAbsenteeismCount(absenteeismCount);
|
|
|
+ statisticsVo.setLateCount(lateCount.stream().count());
|
|
|
+ statisticsVo.setActualCount(actualCount.stream().count());
|
|
|
+ statisticsVo.setLeaveCount(leaveCount.stream().count());
|
|
|
+ statisticsVo.setAbsenteeismCount(absenteeismCount.stream().count());
|
|
|
|
|
|
// //查询不需要考勤的人
|
|
|
// List<AttendanceRuleCategory> ruleCategories = ruleCategoryService.list(
|
|
|
@@ -193,8 +193,8 @@ public class StatisticsController {
|
|
|
|
|
|
//计算出勤率
|
|
|
BigDecimal divide = BigDecimal.ZERO;
|
|
|
- if (dividendCount != 0) {
|
|
|
- divide = BigDecimal.valueOf(statisticsVo.getActualCount()).divide(BigDecimal.valueOf(dividendCount), 4, RoundingMode.HALF_UP);
|
|
|
+ if (!dividendCount.isEmpty()) {
|
|
|
+ divide = BigDecimal.valueOf(statisticsVo.getActualCount()).divide(BigDecimal.valueOf(dividendCount.size()), 4, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
statisticsVo.setAttendanceRate(divide.doubleValue() + "");
|
|
|
|