Bladeren bron

下班打卡时,后一次打卡后删除该时间段之前打卡记录,只保留最后一次。

zhengqiang 5 jaren geleden
bovenliggende
commit
9cedb84f79

+ 5 - 2
common/src/main/java/com/jpsoft/smart/modules/business/service/impl/WorkAttendanceServiceImpl.java

@@ -159,15 +159,18 @@ public class WorkAttendanceServiceImpl implements WorkAttendanceService {
 						}
 					} else {
 						//todo 下班考勤
+
 						//早退
 						if (recordTime.compareTo(startTime)>0 && recordTime.compareTo(attendanceTime)<=0){
 							attendanceResult = WorkAttendance.LEAVE_EARLY;
 						}
 						else if(recordTime.compareTo(attendanceTime)>0 && recordTime.compareTo(endTime)<=0){
 							attendanceResult = WorkAttendance.SUCCESS;
+						}
 
-							//当天是否已经有该时段早退记录则删除,只保留最后一次正常下班打卡记录
-							List<WorkAttendance> workAttendances = workAttendanceDAO.findByPeriod(personId,alarmConfig.getId(),recordTime.toDate());
+						if(StringUtils.isNotEmpty(attendanceResult)) {
+							//当天是否已经有该时段记录,有则删除
+							List<WorkAttendance> workAttendances = workAttendanceDAO.findByPeriod(personId, alarmConfig.getId(), recordTime.toDate());
 
 							for (WorkAttendance workAttendance : workAttendances) {
 								workAttendance.setDelFlag(true);