|
@@ -186,38 +186,14 @@ public final class EventSearch {
|
|
|
if (ST==null) { // 如果不存在,则进行打卡记录的创建
|
|
|
if (employeeNo != null && !employeeNo.equals("0")) {
|
|
|
if (user != null &&"1".equals(user.getUserType())) {//在校生
|
|
|
- attendance.setStudentName(user.getNickname()); // 昵称
|
|
|
- attendance.setStudentId(user.getId()); // 学生id
|
|
|
- attendance.setDeptId(user.getDeptId()); // 工作间id
|
|
|
- attendance.setSupervisorId(user.getSupervisorId()); // 导师id
|
|
|
- attendance.setClockInStatus(transformClockStatus(parsedTime)); // 打卡状态
|
|
|
- attendance.setCreateTime(parsedTime);
|
|
|
- attendance.setUpdateTime(parsedTime);
|
|
|
- //插入考勤表
|
|
|
- studentAttendance.add(attendance);
|
|
|
- studentAttendanceService.createStudentAttendance(BeanUtils.toBean(attendance, StudentAttendanceSaveReqVO.class));
|
|
|
- } else {
|
|
|
- System.out.println("没有找到该用户" + employeeNo);
|
|
|
- }
|
|
|
- }
|
|
|
- }else {//存在打卡记录,判断更新照片(可能由于网络问题没有插入)
|
|
|
- if (ST.getPhoto()==null||ST.equals("")){
|
|
|
- ST.setPhoto(photoUrl);
|
|
|
- studentAttendanceService.updateStudentAttendance(BeanUtils.toBean(ST, StudentAttendanceSaveReqVO.class));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //检查并更新未打卡
|
|
|
- if (user!=null&&"1".equals(user.getUserType())) {
|
|
|
- if (employeeNo != null && !employeeNo.equals("0")) {
|
|
|
- StudentAttendancePageReqVO attendanceReqVO = new StudentAttendancePageReqVO();
|
|
|
- LocalDate localDate = LocalDate.now();
|
|
|
- if (localDate.equals(date)) {
|
|
|
- attendanceReqVO.setDate(localDate);
|
|
|
- attendanceReqVO.setUserNumber(user.getUserNumber());
|
|
|
- List<StudentAttendanceDO> result = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);//找到这天的未打卡记录
|
|
|
- if ("1".equals(user.getUserType())) {//只对在校生
|
|
|
- if (result.size() == 1) {//
|
|
|
+ StudentAttendancePageReqVO attendanceReqVO = new StudentAttendancePageReqVO();
|
|
|
+ LocalDate localDate = LocalDate.now();
|
|
|
+ if (localDate.equals(date)) {
|
|
|
+ attendanceReqVO.setDate(localDate);
|
|
|
+ attendanceReqVO.setUserNumber(user.getUserNumber());
|
|
|
+ attendance.setClockInStatus("1");
|
|
|
+ List<StudentAttendanceDO> result = studentAttendanceService.getStudentAttendanceAllList(attendanceReqVO);//找到这天的未打卡记录
|
|
|
+ if (result!=null&&!result.isEmpty()) {//有未打卡记录更新未打卡记录
|
|
|
StudentAttendanceDO re = result.get(0);
|
|
|
if ("1".equals(re.getClockInStatus())) {//找到未打卡的
|
|
|
re.setClockInStatus("0");//变成正常
|
|
@@ -227,13 +203,40 @@ public final class EventSearch {
|
|
|
if (photoUrl != null) {
|
|
|
re.setPhoto(photoUrl); //
|
|
|
}
|
|
|
- studentAttendance.add(re);//测试查询
|
|
|
+ studentAttendance.add(re);//
|
|
|
studentAttendanceService.updateStudentAttendance(BeanUtils.toBean(re, StudentAttendanceSaveReqVO.class));
|
|
|
}
|
|
|
+ }else {//无未打卡记录直接插入
|
|
|
+ attendance.setStudentName(user.getNickname()); // 昵称
|
|
|
+ attendance.setStudentId(user.getId()); // 学生id
|
|
|
+ attendance.setDeptId(user.getDeptId()); // 工作间id
|
|
|
+ attendance.setSupervisorId(user.getSupervisorId()); // 导师id
|
|
|
+ attendance.setClockInStatus(transformClockStatus(parsedTime)); // 打卡状态
|
|
|
+ attendance.setCreateTime(parsedTime);
|
|
|
+ attendance.setUpdateTime(parsedTime);
|
|
|
+ studentAttendance.add(attendance);
|
|
|
+ studentAttendanceService.createStudentAttendance(BeanUtils.toBean(attendance, StudentAttendanceSaveReqVO.class));
|
|
|
}
|
|
|
+ }else {//前一天的以免没有加载
|
|
|
+ attendance.setStudentName(user.getNickname()); // 昵称
|
|
|
+ attendance.setStudentId(user.getId()); // 学生id
|
|
|
+ attendance.setDeptId(user.getDeptId()); // 工作间id
|
|
|
+ attendance.setSupervisorId(user.getSupervisorId()); // 导师id
|
|
|
+ attendance.setClockInStatus(transformClockStatus(parsedTime)); // 打卡状态
|
|
|
+ attendance.setCreateTime(parsedTime);
|
|
|
+ attendance.setUpdateTime(parsedTime);
|
|
|
+ studentAttendance.add(attendance);
|
|
|
+ studentAttendanceService.createStudentAttendance(BeanUtils.toBean(attendance, StudentAttendanceSaveReqVO.class));
|
|
|
}
|
|
|
+ } else {
|
|
|
+ System.out.println("没有找到该用户" + employeeNo);
|
|
|
}
|
|
|
}
|
|
|
+ }else {//存在打卡记录,判断更新照片(可能由于网络问题没有插入)
|
|
|
+ if (ST.getPhoto() == null || ST.getPhoto().equals("")) {
|
|
|
+ ST.setPhoto(photoUrl);
|
|
|
+ studentAttendanceService.updateStudentAttendance(BeanUtils.toBean(ST, StudentAttendanceSaveReqVO.class));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
i++;
|