浏览代码

导入用户打卡数据开发,时间处理修改

anderx 1 年之前
父节点
当前提交
aa0910ece8
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

+ 8 - 4
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -761,15 +761,16 @@ public class SysUserServiceImpl implements ISysUserService
                               }else {
                                   days++;
                               }
+
                               newUserlock.setClockDate(s);
                               newUserlock.setClockTime(LocalDate.of(year,month,days));
-                              int startHour = Integer.parseInt(split[0].split(":")[0].trim());
-                              int startMinute = Integer.parseInt(split[0].split(":")[1].trim());
+                              int startHour = Integer.parseInt(getTime(split[0].split(":")[0]));
+                              int startMinute = Integer.parseInt(getTime(split[0].split(":")[1]));
                               LocalDateTime startTime=LocalDateTime.of(year,month,days,startHour,startMinute);
                               newUserlock.setStartTime(startTime);
                               if (newUserlock.getStauts()==0){
-                                  int endHour = Integer.parseInt(split[split.length - 1].split(":")[0].trim());
-                                  int endMinute = Integer.parseInt(split[split.length - 1].split(":")[1].trim());
+                                  int endHour = Integer.parseInt(getTime(split[split.length - 1].split(":")[0]));
+                                  int endMinute = Integer.parseInt(getTime(split[split.length - 1].split(":")[1]));
                                   LocalDateTime endTime=LocalDateTime.of(year,month,days,endHour,endMinute);
                                   newUserlock.setEndTime(endTime);
                                   Double hours = getHuors(startTime, endTime);
@@ -807,6 +808,9 @@ public class SysUserServiceImpl implements ISysUserService
         return list;
     }
 
+    private String  getTime(String s) {
+        return s.replace("外勤","").trim();
+    }
 
 
     private  Double getHuors(LocalDateTime startTime, LocalDateTime endTime) {