|
|
@@ -969,36 +969,26 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
@Override
|
|
|
public String importClockData(List<Map<Integer,String >> list) {
|
|
|
List<UserClockDataBo> userClockDataBos = clockDataToList(list);
|
|
|
- StringBuilder res = new StringBuilder();
|
|
|
+ StringBuilder failureMsg = new StringBuilder();
|
|
|
Long companyId = deptService.selectCompanyByDeptId();
|
|
|
+ int count = 0;
|
|
|
for (UserClockDataBo userClockDataBo : userClockDataBos) {
|
|
|
SysUser sysUser=null;
|
|
|
try {
|
|
|
sysUser = sysUserMapper.checkJobNumber(userClockDataBo.getJobNumber(), companyId);
|
|
|
}catch (Exception e){
|
|
|
- res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]查询异常,可能存在重名。");
|
|
|
+ failureMsg.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]查询异常,可能存在重名。");
|
|
|
}
|
|
|
|
|
|
if (sysUser==null){
|
|
|
- res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]不存在。");
|
|
|
+ failureMsg.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]不存在。");
|
|
|
}else {
|
|
|
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);
|
|
|
+ failureMsg.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]日期[").append(dateStr).append("]打卡不存在。");
|
|
|
}else {
|
|
|
for (ProjectStaffRecord psr : projectStaffRecords) {
|
|
|
ProjectStaffRecord update =new ProjectStaffRecord();
|
|
|
@@ -1006,8 +996,9 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
update.setCheckDuration(e.getDuration().doubleValue());
|
|
|
update.setCheckStatus(1);
|
|
|
projectStaffRecordMapper.updateByPrimaryKeySelective(update);
|
|
|
- res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]日期[").append(dateStr).append("]修改成功。");
|
|
|
+// res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]日期[").append(dateStr).append("]修改成功。");
|
|
|
}
|
|
|
+ count++;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1015,7 +1006,16 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- return res.toString();
|
|
|
+ if (failureMsg.length()==0){
|
|
|
+ failureMsg.insert(0, "恭喜您,数据全部导入成功!");
|
|
|
+ }else {
|
|
|
+ if (count>0){
|
|
|
+ failureMsg.insert(0, "恭喜您," + count + " 条数据导入成功,失败数据如下:");
|
|
|
+ }else {
|
|
|
+ failureMsg.insert(0, "导入失败,失败数据如下:");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return failureMsg.toString();
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1026,7 +1026,8 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
title = list.get(0).get(0);
|
|
|
String[] split = title.split(" ");
|
|
|
String date =split[split.length - 1];
|
|
|
- LocalDate localDate = DateUtils.parseLocalDate(date,"yyyy年MM月");
|
|
|
+ date = date+"01日";
|
|
|
+ LocalDate localDate = DateUtils.parseLocalDate(date,"yyyy年MM月dd日");
|
|
|
//标题
|
|
|
List<String> title2 = new ArrayList<>(list.get(2).values());
|
|
|
System.out.println(title2);
|