From 2ea3b36a810adcb639f4d3c72c860f722f601927 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 30 三月 2026 16:17:29 +0800
Subject: [PATCH] 绩效管理:人员能力功能模块

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
index 104239e..99d2aaf 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
@@ -36,6 +36,7 @@
 import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
+import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -170,6 +171,8 @@
                  * 姝e父锛氬綋鍓嶇彮娆$粨鏉熷悗绗竴娆″嚭闂ㄦ椂闂�
                  * 寮傚父(鏃╅��)锛氭棤褰撳墠鐝缁撴潫鍒颁笅涓�鐝寮�濮嬪墠鐨勫嚭闂ㄨ褰曞苟涓旀渶鍚庝竴娆″嚭闂ㄥ湪褰撳墠鐝鏃堕棿鑼冨洿鍐咃紝鍙栧綋鍓嶇彮娆℃渶鍚庝竴娆″嚭闂ㄦ椂闂�
                  */
+                //褰撳墠鏃堕棿
+                LocalDateTime now  = LocalDateTime.now(ZoneId.of("Asia/Shanghai"));
                 // 褰撳墠鐝寮�濮嬪ぉ0鐐规椂闂�
                 LocalDateTime startDateTime = LocalDateTime.of(p.getWorkTime().toLocalDate(), LocalTime.MIN);
                 // 褰撳墠鐝缁撴潫澶�24鐐规椂闂�
@@ -224,7 +227,7 @@
                                     && s.getSwingTime().isBefore(nextShiftStartDateTime))
                             .min(Comparator.comparing(StaffAttendanceTrackingRecord::getSwingTime))
                             .orElse(new StaffAttendanceTrackingRecord());
-                    if (BeanUtil.isEmpty(exitRecord)) {
+                    if (BeanUtil.isEmpty(exitRecord) && !now.isBefore(currentShiftEndDateTime)) {
                         exitRecord = exitRecords.stream()
                                 .filter(s -> (s.getSwingTime().isAfter(currentShiftStartDateTime)
                                         && s.getSwingTime().isBefore(currentShiftEndDateTime)))
@@ -258,9 +261,13 @@
                 vo.setCreateTime(recordList.get(0).getCreateTime());
                 vo.setUpdateUser(recordList.get(0).getUpdateUser());
                 vo.setUpdateTime(recordList.get(0).getUpdateTime());
-                vo.setResult(ClockInState.ABNORMAL.getValue());
-                if(ObjectUtils.allNotNull(vo.getWorkClockInState(),vo.getOffClockInState())){
-                    vo.setResult(Integer.min(vo.getWorkClockInState(),vo.getOffClockInState()));
+                //褰撳墠鏃堕棿鍦ㄤ笅鐝椂闂磋繃鍚庢墠鍒ゆ柇鑰冨嫟缁撴灉
+                if(!now.isBefore(currentShiftEndDateTime)){
+                    if(ObjectUtils.allNotNull(vo.getWorkClockInState(),vo.getOffClockInState())){
+                        vo.setResult(Integer.min(vo.getWorkClockInState(),vo.getOffClockInState()));
+                    }else{
+                        vo.setResult(ClockInState.ABNORMAL.getValue());
+                    }
                 }
                 // 璁$畻缂哄嫟鏃堕暱
                 if (ObjectUtils.allNotNull(vo.getActualWorkHours(), vo.getPlannedWorkHours())) {
@@ -373,7 +380,12 @@
         long pages = getPages(size,total);
         int startIndex = Math.toIntExact((current - 1) * size >= total ? (pages - 1) * size : (current - 1) * size);
         int endIndex = Math.toIntExact(Math.min(current * size, total));
-        List<StaffAttendanceVO> records = resultList.subList(startIndex, endIndex);
+        List<StaffAttendanceVO> records;
+        if(resultList.isEmpty()){
+            records = new ArrayList<>();
+        }else{
+            records = resultList.subList(startIndex, endIndex);
+        }
         resultPage.setRecords(records);
         resultPage.setTotal(total);
         resultPage.setSize(size);

--
Gitblit v1.9.3