From 51d7b5b62db52c8c80d0bac9d42c37e33ce48a5d Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 29 七月 2026 17:20:45 +0800
Subject: [PATCH] 1.手动下单:修复选择样品后查询的检测项缺失问题 2.人员考勤:修复同步ICC考勤数据报错问题

---
 performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java |  109 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 63 insertions(+), 46 deletions(-)

diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
index e220e51..825b21b 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
@@ -472,50 +472,55 @@
                 AtomicInteger maternityLeaveCount = new AtomicInteger(0);//浜у亣澶╂暟
                 AtomicInteger attendanceDayCount = new AtomicInteger(0);//鍑哄嫟澶╂暟
                 AtomicDouble attendanceWorkHourCount = new AtomicDouble(0D);//鍑哄嫟鎬绘椂闂�
-                for (int j = 0; j < shiftMapDtos.size(); j++) {
-                    PerformanceShiftMapDto shiftMapDto = shiftMapDtos.get(j);
-                    //缁熻鍚勫亣鏈熷拰鍏樊鐨勫ぉ鏁�
-                    if(StringUtils.contains(shiftMapDto.getShiftName(),holidayLeaveKeyword)){
-                        holidayCount.getAndIncrement();
-                    }else if(StringUtils.contains(shiftMapDto.getShiftName(),personalLeaveKeyword)){
-                        personalLeaveCount.getAndIncrement();
-                    }else if(StringUtils.contains(shiftMapDto.getShiftName(),annualLeaveKeyword)){
-                        annualLeaveCount.getAndIncrement();
-                    }else if(StringUtils.contains(shiftMapDto.getShiftName(),officialTripKeyword)){
-                        officialTripCount.getAndIncrement();
-                    }else if(StringUtils.contains(shiftMapDto.getShiftName(),marriageLeaveKeyword)){
-                        marriageLeaveCount.getAndIncrement();
-                    }else if(StringUtils.contains(shiftMapDto.getShiftName(),bereavementLeaveKeyword)){
-                        bereavementLeaveCount.getAndIncrement();
-                    }else if(StringUtils.contains(shiftMapDto.getShiftName(),sickLeaveKeyword)){
-                        sickLeaveCount.getAndIncrement();
-                    }else if(StringUtils.contains(shiftMapDto.getShiftName(),maternityLeaveKeyword)){
-                        maternityLeaveCount.getAndIncrement();
-                    }
-                    if(StringUtils.isAllBlank(shiftMapDto.getStartTime(),shiftMapDto.getEndTime())){
-                        shiftList.add(shiftMapDto.getShiftName());
-                    }else{
-                        //杩囨护褰撳墠浜哄憳鐨勭彮娆′俊鎭�
-                        StaffAttendanceVO vo = attendanceRecords.stream().filter(f->StringUtils.isNotBlank(f.getPersonCode())).filter(f -> StringUtils.equals(f.getPersonCode(), shiftMapDto.getPersonCode()) && f.getSwingDate().isEqual(shiftMapDto.getWorkTime())).findFirst().orElse(null);
-                        if(ObjectUtils.isEmpty(vo)){
-                            shiftList.add("");
+                for (int j = 0; j < attendanceDateList.size(); j++) {
+                    LocalDate localDate = attendanceDateList.get(j);
+                    PerformanceShiftMapDto shiftMapDto = shiftMapDtos.stream().filter(f -> f.getWorkTime().toLocalDate().equals(localDate)).findFirst().orElse(null);
+                    if(Objects.nonNull(shiftMapDto)){
+                        //缁熻鍚勫亣鏈熷拰鍏樊鐨勫ぉ鏁�
+                        if(StringUtils.contains(shiftMapDto.getShiftName(),holidayLeaveKeyword)){
+                            holidayCount.getAndIncrement();
+                        }else if(StringUtils.contains(shiftMapDto.getShiftName(),personalLeaveKeyword)){
+                            personalLeaveCount.getAndIncrement();
+                        }else if(StringUtils.contains(shiftMapDto.getShiftName(),annualLeaveKeyword)){
+                            annualLeaveCount.getAndIncrement();
+                        }else if(StringUtils.contains(shiftMapDto.getShiftName(),officialTripKeyword)){
+                            officialTripCount.getAndIncrement();
+                        }else if(StringUtils.contains(shiftMapDto.getShiftName(),marriageLeaveKeyword)){
+                            marriageLeaveCount.getAndIncrement();
+                        }else if(StringUtils.contains(shiftMapDto.getShiftName(),bereavementLeaveKeyword)){
+                            bereavementLeaveCount.getAndIncrement();
+                        }else if(StringUtils.contains(shiftMapDto.getShiftName(),sickLeaveKeyword)){
+                            sickLeaveCount.getAndIncrement();
+                        }else if(StringUtils.contains(shiftMapDto.getShiftName(),maternityLeaveKeyword)){
+                            maternityLeaveCount.getAndIncrement();
+                        }
+                        if(StringUtils.isAllBlank(shiftMapDto.getStartTime(),shiftMapDto.getEndTime())){
+                            shiftList.add(shiftMapDto.getShiftName());
                         }else{
-                            String actualWorkHours = Objects.toString(vo.getActualWorkHours(), "");
-                            Double diffHour = ObjectUtils.defaultIfNull(vo.getDiffHour(), 0D);
-                            if (StringUtils.isBlank(actualWorkHours)) {
+                            //杩囨护褰撳墠浜哄憳鐨勭彮娆′俊鎭�
+                            StaffAttendanceVO vo = attendanceRecords.stream().filter(f->StringUtils.isNotBlank(f.getPersonCode())).filter(f -> StringUtils.equals(f.getPersonCode(), shiftMapDto.getPersonCode()) && f.getSwingDate().isEqual(shiftMapDto.getWorkTime())).findFirst().orElse(null);
+                            if(ObjectUtils.isEmpty(vo)){
                                 shiftList.add("");
-                            } else {
-                                shiftList.add(Double.compare(diffHour, 0D) < 0 ? "-" + actualWorkHours : actualWorkHours);
-                                attendanceDayCount.getAndIncrement();
-                                attendanceWorkHourCount.getAndAdd(Double.parseDouble(actualWorkHours));
+                            }else{
+                                String actualWorkHours = Objects.toString(vo.getActualWorkHours(), "");
+                                Double diffHour = ObjectUtils.defaultIfNull(vo.getDiffHour(), 0D);
+                                if (StringUtils.isBlank(actualWorkHours)) {
+                                    shiftList.add("");
+                                } else {
+                                    shiftList.add(Double.compare(diffHour, 0D) < 0 ? "-" + actualWorkHours : actualWorkHours);
+                                    attendanceDayCount.getAndIncrement();
+                                    attendanceWorkHourCount.getAndAdd(Double.parseDouble(actualWorkHours));
+                                }
                             }
                         }
-                    }
-                    //鏈堝害缁熻鎵嶆彃鍏ユ壒娉ㄦ暟鎹�
-                    if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){
-                        if(StringUtils.isNotBlank(shiftMapDto.getAnnotationText())){
-                            annotationTextList.add(new StaffAttendanceAnnotationTextExcelData(i,j,shiftMapDto.getAnnotationText()));
+                        //鏈堝害缁熻鎵嶆彃鍏ユ壒娉ㄦ暟鎹�
+                        if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){
+                            if(StringUtils.isNotBlank(shiftMapDto.getAnnotationText())){
+                                annotationTextList.add(new StaffAttendanceAnnotationTextExcelData(i,j,shiftMapDto.getAnnotationText()));
+                            }
                         }
+                    }else{
+                        shiftList.add("");
                     }
                 }
                 if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){
@@ -763,22 +768,34 @@
     public static String restorePersonCode(Object number) {
         // 1. 绌哄�兼牎楠�
         if (number == null) {
-            throw new IllegalArgumentException("浼犲叆鏁板瓧涓嶈兘涓虹┖");
+            return "";
         }
 
+        String original = number.toString();
+        try {
         // 2. 缁熶竴杞崲涓哄瓧绗︿覆骞跺幓闄ら灏剧┖鏍�
-        String numStr = number.toString().trim();
+            String numStr = original.trim();
 
         // 3. 鏍¢獙鏄惁涓虹函鏁板瓧锛堟帓闄よ礋鏁般�侀潪鏁板瓧瀛楃锛�
-        if (!numStr.matches("\\d+")) {
-            throw new IllegalArgumentException("浼犲叆鐨勪笉鏄湁鏁堟鏁存暟锛�" + numStr);
-        }
+            String digitStr;
+            if (numStr.matches("\\d+")) {
+                digitStr = numStr;
+            } else if (numStr.matches("(?i)^ZT\\d+$")) {
+                digitStr = numStr.substring(2);
+            } else if (numStr.matches("(?i)^ZT-\\d+$")) {
+                digitStr = numStr.substring(3);
+            } else {
+                return original;
+            }
 
         // 4. 琛ュ墠缃�0鍒版寚瀹氶暱搴︼紙6浣嶏級锛岃秴鍑哄垯淇濈暀鍘熸暟瀛�
-        String paddedNum = String.format("%0" + DIGIT_LENGTH + "d", Long.parseLong(numStr));
+            String paddedNum = StringUtils.leftPad(digitStr, DIGIT_LENGTH, '0');
 
         // 5. 鎷兼帴鍓嶇紑杩斿洖
-        return PREFIX + paddedNum;
+            return PREFIX + paddedNum;
+        } catch (Exception e) {
+            return original;
+        }
     }
 
 }

--
Gitblit v1.9.3