Bläddra i källkod

新增新版考勤导入模版

anderx 1 år sedan
förälder
incheckning
7425c5b4a9

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

@@ -1043,24 +1043,29 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
             int index = 2;
             int day = 0;
             list2=list2.subList(2,size-1);
-            for (Object o : list2) {
-                UserClockDataDetailsBo userClockDataDetailsBo = new UserClockDataDetailsBo();
-                String str = o.toString();
-                userClockDataDetailsBo.setDuration(new BigDecimal(str));
-                String s = title2.get(index);
-                userClockDataDetailsBo.setDateStr(str);
-                if (s.equals("六")||s.equals("日")){
-                    day++;
-                    LocalDate localDate1 = localDate.withDayOfMonth(day);
-                    userClockDataDetailsBo.setDate(localDate1);
-                }else {
-                    day=Integer.parseInt(s);
-                    LocalDate localDate1 = localDate.withDayOfMonth(day);
-                    userClockDataDetailsBo.setDate(localDate1);
+            try {
+                for (Object o : list2) {
+                    UserClockDataDetailsBo userClockDataDetailsBo = new UserClockDataDetailsBo();
+                    String str = o.toString();
+                    userClockDataDetailsBo.setDuration(new BigDecimal(str));
+                    String s = title2.get(index);
+                    userClockDataDetailsBo.setDateStr(str);
+
+                        if (s.equals("六")||s.equals("日")){
+                            day++;
+                            LocalDate localDate1 = localDate.withDayOfMonth(day);
+                            userClockDataDetailsBo.setDate(localDate1);
+                        }else {
+                            day=Integer.parseInt(s);
+                            LocalDate localDate1 = localDate.withDayOfMonth(day);
+                            userClockDataDetailsBo.setDate(localDate1);
+                        }
+                    ul.add(userClockDataDetailsBo);
+                    index++;
                 }
-                ul.add(userClockDataDetailsBo);
-                index++;
-
+            }catch (DateTimeException dte){
+                int monthValue = localDate.getMonthValue();
+                throw new RuntimeException(StringUtils.format("日期格式{}月{}错误,请检查",monthValue, day));
             }
             userClockDataBo.setList(ul);
             listData.add(userClockDataBo);