anderx пре 1 година
родитељ
комит
89e29e1163

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

@@ -975,7 +975,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         for (UserClockDataBo userClockDataBo : userClockDataBos) {
             SysUser sysUser=null;
             try {
-                sysUser = sysUserMapper.selectByNikeName(userClockDataBo.getUsername(), companyId);
+                sysUser = sysUserMapper.checkJobNumber(userClockDataBo.getJobNumber(), companyId);
             }catch (Exception e){
                 res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]查询异常,可能存在重名。");
             }
@@ -986,14 +986,25 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
                 List<UserClockDataDetailsBo> list1 = userClockDataBo.getList();
                 for (UserClockDataDetailsBo e : list1) {
                     String dateStr=DateUtils.LocalDateToStr(e.getDate());
+                    Date date = DateUtils.LocalDateToDate(e.getDate());
                     List<ProjectStaffRecord> projectStaffRecords = projectStaffRecordMapper.selectByAidAndTime(sysUser.getUserId(), dateStr, dateStr + " 23:59:59");
                     if (projectStaffRecords==null|| projectStaffRecords.isEmpty()){
-                        res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]日期[").append(dateStr).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();
                             update.setId(psr.getId());
                             update.setCheckDuration(e.getDuration().doubleValue());
+                            update.setCheckStatus(1);
                             projectStaffRecordMapper.updateByPrimaryKeySelective(update);
                             res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]日期[").append(dateStr).append("]修改成功。");
                         }