|
@@ -21,6 +21,7 @@ import com.sun.jna.Pointer;
|
|
|
|
|
|
import java.io.*;
|
|
|
import java.nio.ByteBuffer;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
@@ -61,16 +62,16 @@ public final class EventSearch {
|
|
|
struAcsEventCond.dwMajor = 0; // 主次事件类型设为0,代表查询所有事件
|
|
|
struAcsEventCond.dwMinor = 0; //
|
|
|
//开始时间
|
|
|
- struAcsEventCond.struStartTime.dwYear = 2024;
|
|
|
- struAcsEventCond.struStartTime.dwMonth = 10;
|
|
|
- struAcsEventCond.struStartTime.dwDay =22 ;
|
|
|
+ struAcsEventCond.struStartTime.dwYear = LocalDate.now().getYear();//当前年
|
|
|
+ struAcsEventCond.struStartTime.dwMonth = LocalDate.now().getMonthValue();//当前月
|
|
|
+ struAcsEventCond.struStartTime.dwDay = LocalDate.now().getDayOfMonth()-1 ;//当前月的日
|
|
|
struAcsEventCond.struStartTime.dwHour = 0;
|
|
|
struAcsEventCond.struStartTime.dwMinute = 0;
|
|
|
struAcsEventCond.struStartTime.dwSecond = 0;
|
|
|
//结束时间
|
|
|
- struAcsEventCond.struEndTime.dwYear = 2024;
|
|
|
- struAcsEventCond.struEndTime.dwMonth = 10;
|
|
|
- struAcsEventCond.struEndTime.dwDay = 23;
|
|
|
+ struAcsEventCond.struEndTime.dwYear = LocalDate.now().getYear();;
|
|
|
+ struAcsEventCond.struEndTime.dwMonth = LocalDate.now().getMonthValue();
|
|
|
+ struAcsEventCond.struEndTime.dwDay = LocalDate.now().getDayOfMonth();
|
|
|
struAcsEventCond.struEndTime.dwHour = 23;
|
|
|
struAcsEventCond.struEndTime.dwMinute = 59;
|
|
|
struAcsEventCond.struEndTime.dwSecond = 59;
|
|
@@ -143,19 +144,9 @@ public final class EventSearch {
|
|
|
attendance.setClockInTime(parsedTime);//打卡时间
|
|
|
attendance.setUserNumber(employeeNo);//学号
|
|
|
|
|
|
- List<StudentAttendanceDO> ST = studentAttendanceService.getStudentAttendanceByUserNumber(employeeNo);//获取这个学生的所有考勤记录
|
|
|
+ StudentAttendanceDO ST = studentAttendanceService.getStudentAttendanceOne(employeeNo,parsedTime);//获取这个学生的所有考勤记录
|
|
|
|
|
|
- boolean exists = false; // 用于标识是否存在打卡记录
|
|
|
-
|
|
|
- if (ST != null && !ST.isEmpty()) {
|
|
|
- for (StudentAttendanceDO attendanceRecord : ST) {
|
|
|
- if (attendanceRecord.getClockInTime().equals(parsedTime)) {
|
|
|
- exists = true; // 如果存在相同的打卡时间,标记为存在
|
|
|
- break; // 找到后直接跳出循环
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (!exists) { // 如果不存在,则进行打卡记录的创建
|
|
|
+ if (ST==null) { // 如果不存在,则进行打卡记录的创建
|
|
|
if (employeeNo != null && !employeeNo.equals("0")) {
|
|
|
System.out.println("学号:" + employeeNo);
|
|
|
AdminUserDO user = adminUserService.findUserByUserNumber(employeeNo);
|
|
@@ -166,10 +157,8 @@ public final class EventSearch {
|
|
|
attendance.setDeptId(user.getDeptId()); // 工作间id
|
|
|
attendance.setSupervisorId(user.getSupervisorId()); // 导师id
|
|
|
attendance.setClockInStatus(transformClockStatus(parsedTime)); // 打卡状态
|
|
|
- // attendance.setCreateTime(parsedTime); // 创建时间
|
|
|
- // attendance.setDeleted(false);
|
|
|
- Integer id = studentAttendanceService.createStudentAttendance(BeanUtils.toBean(attendance, StudentAttendanceSaveReqVO.class));
|
|
|
- System.out.println(id);
|
|
|
+ //插入考勤表
|
|
|
+ studentAttendanceService.createStudentAttendance(BeanUtils.toBean(attendance, StudentAttendanceSaveReqVO.class));
|
|
|
} else {
|
|
|
System.out.println("没有找到该用户" + employeeNo);
|
|
|
}
|
|
@@ -219,7 +208,7 @@ public final class EventSearch {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public static String transformClockStatus(LocalDateTime clockTimm){
|
|
|
+ public static String transformClockStatus(LocalDateTime clockTime){
|
|
|
return "0";
|
|
|
}
|
|
|
|