瀏覽代碼

新增新版考勤导入

anderx 1 年之前
父節點
當前提交
30fc8cdddf

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

@@ -744,14 +744,14 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
                 pids.add(p.getPid());
             }
         }else {
-            throw new ServiceException(String.format("新增必须知道打卡项目编号"));
+            throw new ServiceException("新增必须知道打卡项目编号");
         }
     }
 
     @Override
     public AjaxResult myDuration(Long id,String recordTime) {
         String maxDurationProjectFlag = configService.selectConfigByKey("maxDurationProject");
-        Boolean flag = Boolean.parseBoolean(maxDurationProjectFlag);
+        boolean flag = Boolean.parseBoolean(maxDurationProjectFlag);
         if (flag){
             if (id==null){
                 return AjaxResult.error("项目不能为空");
@@ -971,7 +971,6 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         List<UserClockDataBo> userClockDataBos = clockDataToList(list);
         StringBuilder res = new StringBuilder();
         Long companyId = deptService.selectCompanyByDeptId();
-
         for (UserClockDataBo userClockDataBo : userClockDataBos) {
             SysUser sysUser=null;
             try {
@@ -989,16 +988,17 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
                     Date date = DateUtils.LocalDateToDate(e.getDate());
                     List<ProjectStaffRecord> projectStaffRecords = projectStaffRecordMapper.selectByAidAndTime(sysUser.getUserId(), dateStr, dateStr + " 23:59:59");
                     if (projectStaffRecords==null|| projectStaffRecords.isEmpty()){
-                        ProjectStaffRecord update =new ProjectStaffRecord();
-                        update.setCheckDuration(e.getDuration().doubleValue());
-                        update.setDuration(e.getDuration().doubleValue());
-                        update.setInitDuration(0d);
-                        update.setAid(sysUser.getUserId());
-                        update.setName(sysUser.getNickName());
-                        update.setProjectStatus(2);
-                        update.setRecordTime(date);
-                        update.setCheckStatus(1);
-                        projectStaffRecordMapper.insertSelective(update);
+                        res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]不存在。");
+//                        ProjectStaffRecord update =new ProjectStaffRecord();
+//                        update.setCheckDuration(e.getDuration().doubleValue());
+//                        update.setDuration(e.getDuration().doubleValue());
+//                        update.setInitDuration(0d);
+//                        update.setAid(sysUser.getUserId());
+//                        update.setName(sysUser.getNickName());
+//                        update.setProjectStatus(2);
+//                        update.setRecordTime(date);
+//                        update.setCheckStatus(1);
+//                        projectStaffRecordMapper.insertSelective(update);
                     }else {
                         for (ProjectStaffRecord psr : projectStaffRecords) {
                             ProjectStaffRecord update =new ProjectStaffRecord();
@@ -1035,8 +1035,8 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
             Map<Integer, String> map = list.get(i);
             List<String> list2 = new ArrayList<>(map.values());
             UserClockDataBo userClockDataBo = new UserClockDataBo();
-            userClockDataBo.setJobNumber((String) map.get(0));
-            userClockDataBo.setUsername((String) map.get(1));
+            userClockDataBo.setJobNumber(map.get(0));
+            userClockDataBo.setUsername(map.get(1));
             List<UserClockDataDetailsBo> ul = new ArrayList<>();
             int index = 2;
             int day = 0;