|
@@ -328,68 +328,140 @@ public class StudentAttendanceController {
|
|
|
|
|
|
|
|
|
|
|
|
- //当周有一次未打卡则异常
|
|
|
+// //当周有一次未打卡则异常
|
|
|
+// @GetMapping("/weekendAttendance")
|
|
|
+// @Operation(summary = "周出勤统计")
|
|
|
+//// @PreAuthorize("@ss.hasPermission('system:student-attendance:day')")
|
|
|
+// public CommonResult<weekendAttendanceResVO> getWeekendAttendance () {
|
|
|
+//
|
|
|
+// //获取当天所在的一周内
|
|
|
+// LocalDate today = LocalDate.now();
|
|
|
+// LocalDate startDate = today.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));
|
|
|
+// LocalDate endDate = today.with(TemporalAdjusters.nextOrSame(java.time.DayOfWeek.SUNDAY));
|
|
|
+//// reqVO.setDateRange(startDate,endDate);
|
|
|
+// //每天的正常/未打卡/请假
|
|
|
+//
|
|
|
+// Map<LocalDate, Object> dailyNormalList = new HashMap<>();
|
|
|
+// Map<LocalDate, Object> dailyErrorList = new HashMap<>();
|
|
|
+// Map<LocalDate, Object> dailyExcuseList = new HashMap<>();
|
|
|
+//
|
|
|
+// LocalDate currentDay = startDate;
|
|
|
+// while (!currentDay.isAfter(endDate)) {//不等于最后一天
|
|
|
+// dailyNormalList.put(currentDay, new ArrayList<>());
|
|
|
+// dailyErrorList.put(currentDay, new ArrayList<>());
|
|
|
+// dailyExcuseList.put(currentDay, new ArrayList<>());
|
|
|
+// currentDay = currentDay.plusDays(1);
|
|
|
+// }
|
|
|
+//
|
|
|
+// currentDay = startDate;//重新设置
|
|
|
+// StudentAttendancePageReqVO attendanceReqVO =new StudentAttendancePageReqVO();
|
|
|
+// while (!currentDay.isAfter(endDate)) {
|
|
|
+// attendanceReqVO.setDate(currentDay); // 设置为当前一天
|
|
|
+// attendanceReqVO.setClockInStatus("0");
|
|
|
+// List<StudentAttendanceDO> normalList= studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+// attendanceReqVO.setClockInStatus("1");
|
|
|
+// List<StudentAttendanceDO> errorList = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+// attendanceReqVO.setClockInStatus("2");
|
|
|
+// List<StudentAttendanceDO> excuseList = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+//
|
|
|
+// // 如果当天没有打卡记录,则添加该学生到对应日期的错误列表中
|
|
|
+// if (!normalList.isEmpty()) {
|
|
|
+// dailyNormalList.put(currentDay,normalList.size());
|
|
|
+// }
|
|
|
+// if (!errorList.isEmpty()) {
|
|
|
+// dailyErrorList.put(currentDay,errorList.size());
|
|
|
+// }
|
|
|
+// if (!excuseList.isEmpty()) {
|
|
|
+// dailyExcuseList.put(currentDay,excuseList.size());
|
|
|
+// }
|
|
|
+// // 转到下一个日期
|
|
|
+// currentDay = currentDay.plusDays(1);
|
|
|
+// }
|
|
|
+// weekendAttendanceResVO result = new weekendAttendanceResVO();
|
|
|
+// result.setDailyNormalList(dailyNormalList);
|
|
|
+// result.setDailyErrorList(dailyErrorList);
|
|
|
+// result.setDailyExcuseList(dailyExcuseList);
|
|
|
+// return success(result);
|
|
|
+// }
|
|
|
+
|
|
|
@GetMapping("/weekendAttendance")
|
|
|
@Operation(summary = "周出勤统计")
|
|
|
// @PreAuthorize("@ss.hasPermission('system:student-attendance:day')")
|
|
|
public CommonResult<weekendAttendanceResVO> getWeekendAttendance () {
|
|
|
- List<AdminUserDO>studentList = adminUserService.getAllUserList();
|
|
|
+
|
|
|
//获取当天所在的一周内
|
|
|
LocalDate today = LocalDate.now();
|
|
|
LocalDate startDate = today.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));
|
|
|
LocalDate endDate = today.with(TemporalAdjusters.nextOrSame(java.time.DayOfWeek.SUNDAY));
|
|
|
- StudentAttendancePageReqVO reqVO =new StudentAttendancePageReqVO();
|
|
|
- reqVO.setDateRange(startDate,endDate);
|
|
|
- List<AdminUserDO> errorList = new ArrayList<>();
|
|
|
- List<AdminUserDO> normalList = new ArrayList<>();
|
|
|
- for (AdminUserDO student : studentList) {
|
|
|
- if ("1".equals(student.getUserType())) {
|
|
|
- reqVO.setUserNumber(student.getUserNumber());
|
|
|
- reqVO.setClockInStatus("1");//找他未打卡的
|
|
|
- List<StudentAttendanceDO> attendanceList = studentAttendanceService.getStudentAttendanceList(reqVO);
|
|
|
- if (!attendanceList.isEmpty()) {
|
|
|
- errorList.add(student);
|
|
|
- } else {
|
|
|
- normalList.add(student);
|
|
|
- }
|
|
|
+// reqVO.setDateRange(startDate,endDate);
|
|
|
+ //每天的正常/未打卡/请假
|
|
|
+
|
|
|
+ Map<LocalDate, Object> dailyNormalList = new HashMap<>();
|
|
|
+ Map<LocalDate, Object> dailyErrorList = new HashMap<>();
|
|
|
+ Map<LocalDate, Object> dailyExcuseList = new HashMap<>();
|
|
|
+
|
|
|
+ LocalDate currentDay = startDate;
|
|
|
+ while (!currentDay.isAfter(endDate)) {//不等于最后一天
|
|
|
+ dailyNormalList.put(currentDay, new ArrayList<>());
|
|
|
+ dailyErrorList.put(currentDay, new ArrayList<>());
|
|
|
+ dailyExcuseList.put(currentDay, new ArrayList<>());
|
|
|
+ currentDay = currentDay.plusDays(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ currentDay = startDate;//重新设置
|
|
|
+ StudentAttendancePageReqVO attendanceReqVO =new StudentAttendancePageReqVO();
|
|
|
+ while (!currentDay.isAfter(endDate)) {
|
|
|
+ attendanceReqVO.setDate(currentDay); // 设置为当前一天
|
|
|
+ attendanceReqVO.setClockInStatus("0");
|
|
|
+ List<StudentAttendanceDO> normalList= studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+ attendanceReqVO.setClockInStatus("1");
|
|
|
+ List<StudentAttendanceDO> errorList = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+ attendanceReqVO.setClockInStatus("2");
|
|
|
+ List<StudentAttendanceDO> excuseList = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+
|
|
|
+ // 如果当天没有打卡记录,则添加该学生到对应日期的错误列表中
|
|
|
+ if (!normalList.isEmpty()) {
|
|
|
+ dailyNormalList.put(currentDay,normalList.size());
|
|
|
+ }
|
|
|
+ if (!errorList.isEmpty()) {
|
|
|
+ dailyErrorList.put(currentDay,errorList.size());
|
|
|
+ }
|
|
|
+ if (!excuseList.isEmpty()) {
|
|
|
+ dailyExcuseList.put(currentDay,excuseList.size());
|
|
|
}
|
|
|
+ // 转到下一个日期
|
|
|
+ currentDay = currentDay.plusDays(1);
|
|
|
}
|
|
|
- Integer errorNum =errorList.size();
|
|
|
- Integer normalNum =normalList.size();
|
|
|
weekendAttendanceResVO result = new weekendAttendanceResVO();
|
|
|
- result.setErrorNum(errorNum);
|
|
|
- result.setNormalNum(normalNum);
|
|
|
+ result.setDailyNormalList(dailyNormalList);
|
|
|
+ result.setDailyErrorList(dailyErrorList);
|
|
|
+ result.setDailyExcuseList(dailyExcuseList);
|
|
|
return success(result);
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
@GetMapping("/dayAttendanceCount")
|
|
|
@Operation(summary = "日出勤统计")
|
|
|
public CommonResult<weekendAttendanceResVO> getDayAttendance () {
|
|
|
- List<AdminUserDO>studentList = adminUserService.getAllUserList();
|
|
|
+
|
|
|
LocalDate today = LocalDate.now();
|
|
|
+ StudentAttendancePageReqVO attendanceReqVO =new StudentAttendancePageReqVO();
|
|
|
+ attendanceReqVO.setDate(today);
|
|
|
+ attendanceReqVO.setClockInStatus("0");
|
|
|
+ List<StudentAttendanceDO> normalList= studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+ attendanceReqVO.setClockInStatus("1");
|
|
|
+ List<StudentAttendanceDO> errorList = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
+ attendanceReqVO.setClockInStatus("2");
|
|
|
+ List<StudentAttendanceDO> excuseList = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);
|
|
|
|
|
|
- StudentAttendancePageReqVO reqVO =new StudentAttendancePageReqVO();
|
|
|
- reqVO.setDate(today);
|
|
|
- List<AdminUserDO> errorList = new ArrayList<>();
|
|
|
- List<AdminUserDO> normalList = new ArrayList<>();
|
|
|
- for (AdminUserDO student : studentList) {
|
|
|
- if ("1".equals(student.getUserType())) {
|
|
|
- reqVO.setUserNumber(student.getUserNumber());
|
|
|
- reqVO.setClockInStatus("1");//找他未打卡的
|
|
|
- List<StudentAttendanceDO> attendanceList = studentAttendanceService.getStudentAttendanceList(reqVO);
|
|
|
- if (!attendanceList.isEmpty()) {
|
|
|
- errorList.add(student);
|
|
|
- } else {
|
|
|
- normalList.add(student);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
Integer errorNum =errorList.size();
|
|
|
Integer normalNum =normalList.size();
|
|
|
+ Integer excuseNum =excuseList.size();
|
|
|
weekendAttendanceResVO result = new weekendAttendanceResVO();
|
|
|
result.setErrorNum(errorNum);
|
|
|
result.setNormalNum(normalNum);
|
|
|
+ result.setExcuseNum(excuseNum);
|
|
|
return success(result);
|
|
|
}
|
|
|
|