|
@@ -200,8 +200,12 @@ public class StudentAttendanceController {
|
|
|
int limit = Math.min(20, attendanceList.size());
|
|
|
for (int i = 0; i < limit; i++) {
|
|
|
StudentAttendanceDO attendance = attendanceList.get(i);
|
|
|
+ if (attendance.getSupervisorId()!=null){
|
|
|
attendance.setSupervisor(adminUserService.getUser(attendance.getSupervisorId()).getNickname());
|
|
|
- attendance.setDeptName(deptService.getDept(attendance.getDeptId()).getName());
|
|
|
+ }
|
|
|
+ if (attendance.getDeptId()!=null) {
|
|
|
+ attendance.setDeptName(deptService.getDept(attendance.getDeptId()).getName());
|
|
|
+ }
|
|
|
// 将处理后的记录加入结果列表
|
|
|
result.add(attendance);
|
|
|
}
|
|
@@ -214,19 +218,24 @@ public class StudentAttendanceController {
|
|
|
// @PreAuthorize("@ss.hasPermission('system:student-attendance:dayError')")
|
|
|
public CommonResult<List<StudentAttendanceDO>> getDayStudentErrorAttendance () {
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
- StudentAttendancePageReqVO reqVO =new StudentAttendancePageReqVO();
|
|
|
+ StudentAttendancePageReqVO reqVO = new StudentAttendancePageReqVO();
|
|
|
reqVO.setDate(localDate);
|
|
|
- List<StudentAttendanceDO> attendanceList =studentAttendanceService.getStudentAttendanceErrorList(reqVO);
|
|
|
- List<StudentAttendanceDO> result = new ArrayList<>();
|
|
|
- int limit = Math.min(20, attendanceList.size());
|
|
|
- for (int i = 0; i < limit; i++) {
|
|
|
- StudentAttendanceDO attendance = attendanceList.get(i);
|
|
|
- attendance.setSupervisor(adminUserService.getUser(attendance.getSupervisorId()).getNickname());
|
|
|
- attendance.setDeptName(deptService.getDept(attendance.getDeptId()).getName());
|
|
|
- // 将处理后的记录加入结果列表
|
|
|
- result.add(attendance);
|
|
|
- }
|
|
|
- return success(result);
|
|
|
+
|
|
|
+ List<StudentAttendanceDO> attendanceList = studentAttendanceService.getStudentAttendanceErrorList(reqVO);
|
|
|
+ // 限制最多 20 条,处理数据并返回
|
|
|
+ return success(
|
|
|
+ attendanceList.stream()
|
|
|
+ .limit(20)
|
|
|
+ .peek(attendance -> {
|
|
|
+ if (attendance.getSupervisorId() != null) {
|
|
|
+ attendance.setSupervisor(adminUserService.getUser(attendance.getSupervisorId()).getNickname());
|
|
|
+ }
|
|
|
+ if (attendance.getDeptId() != null) {
|
|
|
+ attendance.setDeptName(deptService.getDept(attendance.getDeptId()).getName());
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList())
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
|