|
|
@@ -2,7 +2,6 @@ package com.ruoyi.system.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.sql.SQLException;
|
|
|
-import java.sql.SQLIntegrityConstraintViolationException;
|
|
|
import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
@@ -14,15 +13,11 @@ import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
import com.ruoyi.common.enums.UserRolesType;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
-import com.ruoyi.project.bo.ProjectStaffRecordInput;
|
|
|
-import com.ruoyi.project.bo.ProjectStaffRecordOut;
|
|
|
import com.ruoyi.project.domain.ProjectStaff;
|
|
|
import com.ruoyi.project.domain.ProjectStaffRecord;
|
|
|
-import com.ruoyi.project.domain.ProjectTask;
|
|
|
import com.ruoyi.project.mapper.ProjectStaffMapper;
|
|
|
import com.ruoyi.project.mapper.ProjectStaffRecordMapper;
|
|
|
import com.ruoyi.project.mapper.ProjectTaskMapper;
|
|
|
-import com.ruoyi.project.service.ProjectStaffRecordService;
|
|
|
import com.ruoyi.system.domain.*;
|
|
|
import com.ruoyi.system.mapper.*;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
@@ -40,7 +35,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
-import com.ruoyi.common.utils.bean.BeanValidators;
|
|
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
|
import com.ruoyi.system.service.ISysConfigService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
@@ -966,11 +960,54 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
int matched = list.size()-unmatched;
|
|
|
//合并到打卡表
|
|
|
userRecordMapper.userRecordMerge(userId);
|
|
|
+ //直接补数据
|
|
|
+ List<SysUser> userList = new ArrayList<>();
|
|
|
+ for (UserRecord e : collect) {
|
|
|
+ ProjectStaffRecord newPR = new ProjectStaffRecord();
|
|
|
+ pushUser(newPR,e,userList);
|
|
|
+ projectStaffRecordMapper.insertSelective(newPR);
|
|
|
+ }
|
|
|
//清楚考勤合并数据
|
|
|
userRecordMapper.deleteByUserId(userId);
|
|
|
- //直接补数据
|
|
|
|
|
|
- return AjaxResult.success(String.format("导入数据未匹配%s条,完成匹配%s条.", unmatched,matched));
|
|
|
+ return AjaxResult.success(String.format("导入数据未匹配新增数据%s条,完成匹配%s条.", unmatched,matched));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void pushUser(ProjectStaffRecord newPR, UserRecord e, List<SysUser> userList) {
|
|
|
+ Long userid=null;
|
|
|
+ String name=null;
|
|
|
+ if (userList.isEmpty()){
|
|
|
+ SysUser sysUser = userMapper.selectDDUserId(e.getDdUserId());
|
|
|
+ userList.add(sysUser);
|
|
|
+ userid=sysUser.getUserId();
|
|
|
+ name=sysUser.getNickName();
|
|
|
+ }else {
|
|
|
+ boolean exist = false;
|
|
|
+ for (SysUser sysUser : userList) {
|
|
|
+ if (sysUser.getDdUserId().equals(e.getDdUserId())){
|
|
|
+ exist=true;
|
|
|
+ userid=sysUser.getUserId();
|
|
|
+ name=sysUser.getNickName();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!exist){
|
|
|
+ SysUser sysUser = userMapper.selectDDUserId(e.getDdUserId());
|
|
|
+ userList.add(sysUser);
|
|
|
+ userid=sysUser.getUserId();
|
|
|
+ name=sysUser.getNickName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newPR.setAid(userid);
|
|
|
+ newPR.setName(name);
|
|
|
+ newPR.setInitDuration(e.getCheckDuration());
|
|
|
+ newPR.setCheckDuration(e.getCheckDuration());
|
|
|
+ newPR.setDuration(e.getCheckDuration());
|
|
|
+ newPR.setRecordTime(e.getRecordTime());
|
|
|
+ newPR.setCreateTime(Calendar.getInstance().getTime());
|
|
|
+ newPR.setProcessStatus(2);
|
|
|
+ newPR.setProjectStatus(0);
|
|
|
+ newPR.setContent("系统生成打卡");
|
|
|
}
|
|
|
|
|
|
@Override
|