Sfoglia il codice sorgente

新增新版考勤导入

anderx 1 anno fa
parent
commit
1f5fd72f68

+ 5 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -247,4 +247,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         // 将LocalDate转换为字符串
         return date.format(formatter);
     }
+
+    public static LocalDate parseLocalDate(String str, String format) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
+        return LocalDate.parse(str,formatter);
+    }
 }

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffRecordServiceImpl.java

@@ -1026,6 +1026,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         title = list.get(0).get(0);
         String[] split = title.split(" ");
         String date =split[split.length - 1];
+        LocalDate localDate = DateUtils.parseLocalDate(date,"yyyy年MM月");
         //标题
         List<String> title2 = new ArrayList<>(list.get(2).values());
         System.out.println(title2);
@@ -1046,8 +1047,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
                 String str = o.toString();
                 userClockDataDetailsBo.setDuration(new BigDecimal(str));
                 String s = title2.get(index);
-                userClockDataDetailsBo.setDateStr(s);
-                LocalDate localDate = LocalDate.parse(date);
+                userClockDataDetailsBo.setDateStr(str);
                 if (s.equals("六")||s.equals("日")){
                     day++;
                     LocalDate localDate1 = localDate.withDayOfMonth(day);