|
@@ -20,6 +20,7 @@ import com.xjrsoft.module.attendance.dto.StudentDetailsDto;
|
|
import com.xjrsoft.module.attendance.service.IAttendanceRuleCategoryService;
|
|
import com.xjrsoft.module.attendance.service.IAttendanceRuleCategoryService;
|
|
import com.xjrsoft.module.attendance.vo.ClassStatisticsVo;
|
|
import com.xjrsoft.module.attendance.vo.ClassStatisticsVo;
|
|
import com.xjrsoft.module.attendance.vo.StudentStatisticsPageVo;
|
|
import com.xjrsoft.module.attendance.vo.StudentStatisticsPageVo;
|
|
|
|
+import com.xjrsoft.module.attendance.vo.TimeRangeVo;
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
import com.xjrsoft.module.base.service.IBaseClassService;
|
|
import com.xjrsoft.module.base.service.IBaseClassService;
|
|
import com.xjrsoft.module.holiday.entity.HolidayDate;
|
|
import com.xjrsoft.module.holiday.entity.HolidayDate;
|
|
@@ -307,36 +308,43 @@ public class StudentStatisticsController {
|
|
//查询每个班的走读生实到人数
|
|
//查询每个班的走读生实到人数
|
|
Map<Long, List<StudentOutInRecordVo>> notStayMap = studentOutInRecordService.getNotStayList(startTime, endTime, classIds);
|
|
Map<Long, List<StudentOutInRecordVo>> notStayMap = studentOutInRecordService.getNotStayList(startTime, endTime, classIds);
|
|
//查询住校生的实到情况
|
|
//查询住校生的实到情况
|
|
- Map<Long, List<StudentOutInRecordVo>> stayMap = studentOutInRecordService.getStayList(startTime, endTime, classIds);
|
|
|
|
|
|
+// Map<Long, List<StudentOutInRecordVo>> stayMap = studentOutInRecordService.getStayList(startTime, endTime, classIds);
|
|
|
|
|
|
//查询各班的请假人数
|
|
//查询各班的请假人数
|
|
- Map<Long, Integer> classLeaveCount = studentLeaveService.getClassLeaveCount(startTime, endTime);
|
|
|
|
|
|
+ //Map<Long, Integer> classLeaveCount = studentLeaveService.getClassLeaveCount(startTime, endTime);
|
|
|
|
|
|
//计算2个时间相差的天数
|
|
//计算2个时间相差的天数
|
|
long days = ChronoUnit.DAYS.between(startTime.toLocalDate(), endTime.toLocalDate());
|
|
long days = ChronoUnit.DAYS.between(startTime.toLocalDate(), endTime.toLocalDate());
|
|
List<String> dayOfWeeks = new ArrayList<>();
|
|
List<String> dayOfWeeks = new ArrayList<>();
|
|
|
|
+ List<TimeRangeVo> timeRangeList = new ArrayList<>();
|
|
for (int i = 0; i <= days; i ++){
|
|
for (int i = 0; i <= days; i ++){
|
|
dayOfWeeks.add(startTime.plusDays(i).getDayOfWeek().name());
|
|
dayOfWeeks.add(startTime.plusDays(i).getDayOfWeek().name());
|
|
|
|
+ TimeRangeVo rangeVo = new TimeRangeVo();
|
|
|
|
+ rangeVo.setStartTime(startTime.plusDays(i));
|
|
|
|
+ rangeVo.setStartTime(startTime.plusDays(i).withHour(23).withMinute(59).withSecond(59));
|
|
|
|
+ timeRangeList.add(rangeVo);
|
|
}
|
|
}
|
|
|
|
|
|
for (ClassStatisticsVo record: attendancePage.getRecords()) {
|
|
for (ClassStatisticsVo record: attendancePage.getRecords()) {
|
|
- record.setLeaveCount(classLeaveCount.get(record.getId()) == null ? 0:classLeaveCount.get(record.getId()));
|
|
|
|
|
|
+ //查询班级的请假总人次
|
|
|
|
+ Integer allLeaveCount = 0;
|
|
|
|
+ for (TimeRangeVo rangeVo : timeRangeList) {
|
|
|
|
+ AttendanceStatisticDto statisticDto = new AttendanceStatisticDto();
|
|
|
|
+ statisticDto.setClassId(record.getId());
|
|
|
|
+ Long leaveCount = studentLeaveService.getLeaveCount(rangeVo.getStartTime(), rangeVo.getEndTime(), statisticDto);
|
|
|
|
+ allLeaveCount += (leaveCount.intValue() * 3);
|
|
|
|
+ }
|
|
|
|
+ record.setLeaveCount(allLeaveCount);
|
|
|
|
+
|
|
Set<Long> collect = notStayMap.get(record.getId()).stream().map(StudentOutInRecordVo::getUserId).collect(Collectors.toSet());
|
|
Set<Long> collect = notStayMap.get(record.getId()).stream().map(StudentOutInRecordVo::getUserId).collect(Collectors.toSet());
|
|
|
|
|
|
record.setActualCount(collect.size());
|
|
record.setActualCount(collect.size());
|
|
record.setStudentCount(record.getStudentCount() * dayOfWeeks.size() * 3);
|
|
record.setStudentCount(record.getStudentCount() * dayOfWeeks.size() * 3);
|
|
|
|
|
|
Integer lateCount = 0;
|
|
Integer lateCount = 0;
|
|
- for (String dayOfWeek : dayOfWeeks) {
|
|
|
|
- for (StudentOutInRecordVo outInRecord : notStayMap.get(record.getId())) {
|
|
|
|
- if("迟到".equals(outInRecord.getAttendanceStatus())){
|
|
|
|
- lateCount ++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- for (StudentOutInRecordVo outInRecord : stayMap.get(record.getId())) {
|
|
|
|
- if("迟到".equals(outInRecord.getAttendanceStatus())){
|
|
|
|
- lateCount ++;
|
|
|
|
- }
|
|
|
|
|
|
+ for (StudentOutInRecordVo outInRecord : notStayMap.get(record.getId())) {
|
|
|
|
+ if("迟到".equals(outInRecord.getAttendanceStatus())){
|
|
|
|
+ lateCount ++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|