|
@@ -131,16 +131,26 @@ public class StudentAttendanceController {
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建学生请假记录")
|
|
@Operation(summary = "创建学生请假记录")
|
|
@PreAuthorize("@ss.hasPermission('system:student-attendance:create')")
|
|
@PreAuthorize("@ss.hasPermission('system:student-attendance:create')")
|
|
- public CommonResult<Integer> createStudentAttendance(@Valid @RequestBody StudentAttendanceSaveReqVO createReqVO) {
|
|
|
|
- Long studentId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
|
- AdminUserDO student =adminUserService.getUser(studentId);
|
|
|
|
- createReqVO.setStudentId(studentId);
|
|
|
|
- createReqVO.setStudentName(student.getNickname());
|
|
|
|
- createReqVO.setUserNumber(student.getUserNumber());
|
|
|
|
- createReqVO.setDeptId(String.valueOf(student.getDeptId()));
|
|
|
|
- createReqVO.setSupervisorId(student.getSupervisorId());//导师id
|
|
|
|
- createReqVO.setClockInStatus("2");//请假
|
|
|
|
- return success(studentAttendanceService.createStudentAttendance(createReqVO));
|
|
|
|
|
|
+ public CommonResult<String> createStudentAttendance(@Valid @RequestBody StudentAttendanceSaveReqVO createReqVO) {
|
|
|
|
+ LocalDate nowDate = LocalDate.now();
|
|
|
|
+ if (createReqVO.getDate().isBefore(nowDate)){
|
|
|
|
+ return success("该日期有问题");
|
|
|
|
+ }else if (createReqVO.getDate().equals(nowDate)){//正好是当日
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else if(createReqVO.getDate().isAfter(nowDate)){//创建日期在当日之后
|
|
|
|
+ Long studentId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
|
+ AdminUserDO student =adminUserService.getUser(studentId);
|
|
|
|
+ createReqVO.setStudentId(studentId);
|
|
|
|
+ createReqVO.setStudentName(student.getNickname());
|
|
|
|
+ createReqVO.setUserNumber(student.getUserNumber());
|
|
|
|
+ createReqVO.setDeptId(String.valueOf(student.getDeptId()));
|
|
|
|
+ createReqVO.setSupervisorId(student.getSupervisorId());//导师id
|
|
|
|
+ createReqVO.setClockInStatus("2");//请假
|
|
|
|
+ studentAttendanceService.createStudentAttendance(createReqVO);
|
|
|
|
+ return success("请求请假成功");
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
@PutMapping("/update")
|