|
@@ -75,7 +75,6 @@ public class StudentAttendanceController {
|
|
|
UserPageReqVO reqVO =new UserPageReqVO();
|
|
|
reqVO.setUserType("1");//学生
|
|
|
List<AdminUserDO> userList = adminUserService.getUserList(reqVO);
|
|
|
- System.out.println(userList);
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
|
|
|
for (AdminUserDO user : userList) {
|
|
@@ -158,20 +157,20 @@ public class StudentAttendanceController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/page")
|
|
|
- @Operation(summary = "导师获得学生考勤记录分页")
|
|
|
+ @Operation(summary = "获得学生考勤记录分页")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-attendance:query')")
|
|
|
public CommonResult<PageResult<StudentAttendanceRespVO>> getStudentAttendancePage(@Valid StudentAttendancePageReqVO pageReqVO) {
|
|
|
PageResult<StudentAttendanceDO> pageResult = studentAttendanceService.getStudentAttendancePage(pageReqVO);
|
|
|
- System.out.println(pageResult);
|
|
|
+
|
|
|
return success(BeanUtils.toBean(pageResult, StudentAttendanceRespVO.class));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/errorPage")
|
|
|
- @Operation(summary = "导师获得学生考勤异常记录分页")
|
|
|
+ @Operation(summary = "获得学生考勤异常记录分页")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-attendance:ErrorQuery')")
|
|
|
public CommonResult<PageResult<StudentAttendanceRespVO>> getStudentAttendanceErrorPage(@Valid StudentAttendancePageReqVO pageReqVO) {
|
|
|
PageResult<StudentAttendanceDO> pageResult = studentAttendanceService.getStudentAttendanceErrorPage(pageReqVO);
|
|
|
- System.out.println(pageResult);
|
|
|
+
|
|
|
return success(BeanUtils.toBean(pageResult, StudentAttendanceRespVO.class));
|
|
|
}
|
|
|
|
|
@@ -207,6 +206,7 @@ public class StudentAttendanceController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@GetMapping("/dayErrorAttendance")
|
|
|
@Operation(summary = "获得所有人当日未打卡列表")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-attendance:dayError')")
|
|
@@ -225,36 +225,45 @@ public class StudentAttendanceController {
|
|
|
@Operation(summary = "周出勤统计")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-attendance:day')")
|
|
|
public CommonResult<weekendAttendanceResVO> getWeekendAttendance () {
|
|
|
- UserPageReqVO reqVO = new UserPageReqVO();
|
|
|
- reqVO.setUserType("1");
|
|
|
- List<AdminUserDO> studentList = adminUserService.getUserList(reqVO);
|
|
|
-
|
|
|
- // 获取当前这周
|
|
|
+ List<AdminUserDO>studentList = adminUserService.getAllUserList();
|
|
|
+ //获取当天所在的一周内
|
|
|
LocalDate today = LocalDate.now();
|
|
|
- LocalDate startDate = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
|
|
- LocalDate endDate = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
|
|
|
+ LocalDate startDate = today.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));
|
|
|
+ LocalDate endDate = today.with(TemporalAdjusters.nextOrSame(java.time.DayOfWeek.SUNDAY));
|
|
|
List<AdminUserDO> errorList = new ArrayList<>();
|
|
|
List<AdminUserDO> normalList = new ArrayList<>();
|
|
|
-
|
|
|
+ List<String> errorNameList =new ArrayList<>();
|
|
|
+ List<String> normalNameList =new ArrayList<>();
|
|
|
for (AdminUserDO student : studentList) {
|
|
|
if ("1".equals(student.getUserType())) {
|
|
|
List<StudentAttendanceDO> attendanceList = studentAttendanceService.getStudentAttendanceInRange(student.getUserNumber(), startDate, endDate);
|
|
|
- boolean hasWarning = attendanceList != null && attendanceList.stream().anyMatch(attendance -> "1".equals(attendance.getClockInStatus()));
|
|
|
-
|
|
|
- if (hasWarning) {
|
|
|
- errorList.add(student); // 有未打卡记录
|
|
|
- } else {
|
|
|
- normalList.add(student); // 没有未打卡记录
|
|
|
+ boolean hasWarning = false; // 标志位,表示是否有未打卡
|
|
|
+ if (attendanceList != null && !attendanceList.isEmpty()) {
|
|
|
+ for (StudentAttendanceDO attendance : attendanceList) {
|
|
|
+ if ("1".equals(attendance.getClockInStatus())) { // 有一个未打卡就添加
|
|
|
+ errorList.add(student);
|
|
|
+ errorNameList.add(student.getNickname());
|
|
|
+ hasWarning = true; // 设置标志为 true
|
|
|
+ System.out.println("异常的" + student.getUsername());
|
|
|
+ break; // 跳出循环
|
|
|
+ }
|
|
|
}
|
|
|
+ // 只有在没有警告的情况下才添加到正常列表
|
|
|
+ if (!hasWarning) {
|
|
|
+ normalList.add(student);
|
|
|
+ normalNameList.add(student.getNickname());
|
|
|
+ System.out.println("正常的: " + student.getUsername());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- // 创建结果对象并设置属性
|
|
|
+ Integer errorNum =errorList.size();
|
|
|
+ Integer normalNum =normalList.size();
|
|
|
weekendAttendanceResVO result = new weekendAttendanceResVO();
|
|
|
- result.setErrorNum(errorList.size());
|
|
|
- result.setNormalNum(normalList.size());
|
|
|
- result.setErrorNameList(errorList.stream().map(AdminUserDO::getNickname).collect(Collectors.toList()));
|
|
|
- result.setNormalNameList(normalList.stream().map(AdminUserDO::getNickname).collect(Collectors.toList()));
|
|
|
-
|
|
|
+ result.setErrorNum(errorNum);
|
|
|
+ result.setNormalNum(normalNum);
|
|
|
+ result.setErrorNameList(errorNameList);
|
|
|
+ result.setNormalNameList(normalNameList);
|
|
|
return success(result);
|
|
|
}
|
|
|
|