|
|
@@ -8210,7 +8210,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (leaveSheet.getOwnerId().equals(curUser.getId()) &&
|
|
|
(leaveSheet.getStartDate().isEqual(date) || leaveSheet.getEndDate().isEqual(date)
|
|
|
|| (leaveSheet.getStartDate().isBefore(date) && leaveSheet.getEndDate().isAfter(date)))) {
|
|
|
- noRecord.status = MessageUtils.message("leave.leave");
|
|
|
+ if (leaveSheet.getStartDate().isEqual(leaveSheet.getEndDate())) {
|
|
|
+ //请假单为一天内的
|
|
|
+ noRecord.status = "请假" + leaveSheet.getTimeHours() + "h";
|
|
|
+ } else {
|
|
|
+ noRecord.status = dtf.format(leaveSheet.getStartDate())+"~"+dtf.format(leaveSheet.getEndDate()) +" 请假" + leaveSheet.getTimeHours() + "h";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
noReportDataList.add(noRecord);
|
|
|
@@ -14334,6 +14339,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
TimeType timeType = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", user.getCompanyId()));
|
|
|
Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
Integer companyId = company.getId();
|
|
|
+ List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
|
|
|
// 获取部门的所有子部门
|
|
|
List<Department> departments = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
@@ -14390,13 +14396,22 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
pagedData = new ArrayList<>(allReportByDate.subList(startIndex, endIndex));
|
|
|
//处理日期显示
|
|
|
for (int i = 0; i < pagedData.size(); i++) {
|
|
|
+ HashMap mapItem = pagedData.get(i);
|
|
|
String createDate = new SimpleDateFormat("yyyy-MM-dd")
|
|
|
- .format((java.sql.Date) pagedData.get(i).get("createDate"));
|
|
|
- pagedData.get(i).put("createDate", createDate);
|
|
|
+ .format((java.sql.Date) mapItem.get("createDate"));
|
|
|
+ mapItem.put("createDate", createDate);
|
|
|
//计算非加班工时
|
|
|
- double workingTime = (Double) pagedData.get(i).get("duration");
|
|
|
- double overtime = (Double) pagedData.get(i).get("overtimeHours");
|
|
|
- pagedData.get(i).put("normalWorkingTime", workingTime - overtime);
|
|
|
+ double workingTime = (Double) mapItem.get("duration");
|
|
|
+ double overtime = (Double) mapItem.get("overtimeHours");
|
|
|
+ mapItem.put("normalWorkingTime", workingTime - overtime);
|
|
|
+ //处理部门审核人
|
|
|
+ String deptAuditorId = (String)mapItem.get("deptAuditorName");
|
|
|
+ if (deptAuditorId != null) {
|
|
|
+ User targetUser = allUserList.stream().filter(us->us.getId().equals(deptAuditorId)).findFirst().orElse(null);
|
|
|
+ if (targetUser != null) {
|
|
|
+ mapItem.put("deptAuditorName", targetUser.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -14453,6 +14468,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
titles.add("正常工作时长(h)");
|
|
|
titles.add("加班时长(h)");
|
|
|
titles.add("工作内容");
|
|
|
+ titles.add("当前审核人");
|
|
|
titles.add("审核状态");
|
|
|
|
|
|
dataList.add(titles);
|
|
|
@@ -14528,14 +14544,14 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
|
|
|
// 工作内容
|
|
|
item.add(map.get("content") != null ? (String) map.get("content") : "");
|
|
|
-
|
|
|
+
|
|
|
// 审核状态
|
|
|
Integer state = (Integer) map.get("state");
|
|
|
String auditStatus = "";
|
|
|
if (state != null) {
|
|
|
switch (state) {
|
|
|
case 0:
|
|
|
- auditStatus = "待审批";
|
|
|
+ auditStatus = "待审核";
|
|
|
break;
|
|
|
case 1:
|
|
|
auditStatus = "已通过";
|
|
|
@@ -14550,6 +14566,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
auditStatus = "-";
|
|
|
}
|
|
|
}
|
|
|
+ if ("待审核".equals(auditStatus)) {
|
|
|
+ if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
+ item.add("$userName=" + (map.get("deptAuditorName") == null ? "" : map.get("deptAuditorName")) + "$");
|
|
|
+ } else {
|
|
|
+ item.add((String) map.get("deptAuditorName"));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.add("-");
|
|
|
+ }
|
|
|
item.add(auditStatus);
|
|
|
|
|
|
dataList.add(item);
|
|
|
@@ -14726,12 +14751,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
// 4. 当日考勤记录 - 格式化为:日期&姓名&时长H
|
|
|
if (map.get("cardTime") != null) {
|
|
|
String cardRecord = map.get("cardStartTime") + "~" + map.get("cardEndTime");
|
|
|
- //判断如果结束时间小于开始时间,说明是次日,需要加上次日
|
|
|
- if (map.get("cardStartTime") != null && map.get("cardEndTime") != null) {
|
|
|
- if (LocalTime.parse(map.get("cardEndTime").toString()).isBefore(LocalTime.parse(map.get("cardStartTime").toString()))) {
|
|
|
- cardRecord += " (+1)";
|
|
|
- }
|
|
|
- }
|
|
|
cardRecord += " " +
|
|
|
String.format("%.2f", map.get("cardTime")) + "H";
|
|
|
map.put("cardRecord", cardRecord);
|
|
|
@@ -14951,12 +14970,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
// 4. 当日考勤记录 - 格式化为:日期&姓名&时长H
|
|
|
if (map.get("cardTime") != null) {
|
|
|
String cardRecord = map.get("cardStartTime") + "~" + map.get("cardEndTime");
|
|
|
- //判断如果结束时间小于开始时间,说明是次日,需要加上次日
|
|
|
- if (map.get("cardStartTime") != null && map.get("cardEndTime") != null) {
|
|
|
- if (LocalTime.parse(map.get("cardEndTime").toString()).isBefore(LocalTime.parse(map.get("cardStartTime").toString()))) {
|
|
|
- cardRecord += " (+1)";
|
|
|
- }
|
|
|
- }
|
|
|
cardRecord += " " +
|
|
|
String.format("%.2f", map.get("cardTime")) + "H";
|
|
|
map.put("cardRecord", cardRecord);
|
|
|
@@ -15021,6 +15034,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
titles.add("[正常工时]明细条数");
|
|
|
titles.add("[加班工时]明细条数");
|
|
|
titles.add("审核流程");
|
|
|
+ titles.add("当前审核人");
|
|
|
titles.add("审核状态");
|
|
|
|
|
|
dataList.add(titles);
|
|
|
@@ -15046,8 +15060,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
// 员工
|
|
|
if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
item.add("$userName=" + (map.get("userName") == null ? "" : map.get("userName")) + "$");
|
|
|
- } else if (dingding != null && dingding.getContactNeedTranslate() == 1) {
|
|
|
- item.add("$userName=" + (map.get("userName") == null ? "" : map.get("userName")) + "$");
|
|
|
} else {
|
|
|
item.add((String) map.get("userName"));
|
|
|
}
|
|
|
@@ -15111,6 +15123,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
} else {
|
|
|
item.add("-");
|
|
|
}
|
|
|
+ if (map.get("auditStatusText") != null && "待审核".equals(map.get("auditStatusText"))) {
|
|
|
+ if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
+ item.add("$userName=" + (map.get("auditorName") == null ? "" : map.get("auditorName")) + "$");
|
|
|
+ } else {
|
|
|
+ item.add((String) map.get("auditorName"));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.add("-");
|
|
|
+ }
|
|
|
// 审核状态
|
|
|
item.add(map.get("auditStatusText") != null ? (String) map.get("auditStatusText") : "");
|
|
|
|
|
|
@@ -15161,6 +15182,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
DateTimeFormatter createTimeFormatterLocal = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
//获取公司全部成员
|
|
|
List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
+ System.out.println("allUserList.size==="+allUserList.size() + ", companyId=" + companyId);
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
//由于第一行需要指明列对应的标题
|
|
|
@@ -15241,28 +15263,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
return msg;
|
|
|
}
|
|
|
String jobNumber = row.getCell(8) != null?row.getCell(8).getStringCellValue().trim():null;
|
|
|
-// if (StringUtils.isEmpty(jobNumber)) {
|
|
|
-// msg.setError("员工工号不能为空");
|
|
|
-// return msg;
|
|
|
-// }
|
|
|
-// //检查人员是否存在
|
|
|
-// Optional<User> any = allUserList.stream().filter(u -> (u.getJobNumber()!=null&&u.getJobNumber().equals(jobNumber))).sorted(new Comparator<User>() {
|
|
|
-// @Override
|
|
|
-// public int compare(User o1, User o2) {
|
|
|
-// return o1.getIsActive() > o2.getIsActive() ? -1 : 1;
|
|
|
-// }
|
|
|
-// }).findAny();
|
|
|
-// if (!any.isPresent()) {
|
|
|
-// //msg.setError("人员["+username+"]不存在,请先在组织结构中添加或者通过钉钉同步导入");
|
|
|
-// msg.setError("工号:" + jobNumber + "不存在,请在系统组织架构中完善");
|
|
|
-// return msg;
|
|
|
-// }
|
|
|
-// User reportCreator = any.get();
|
|
|
String username = row.getCell(7).getStringCellValue().trim();
|
|
|
//检查人员是否存在
|
|
|
Optional<User> any;
|
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(username)).findFirst();
|
|
|
- any = allUserList.stream().filter(u -> u.getName().equals(username)||(u.getJobNumber()!=null&&u.getJobNumber().equals(jobNumber))||(optional.isPresent()&&((u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))||(u.getDingdingUserid()!=null&&u.getDingdingUserid().equals(optional.get().getCorpwxUserid()))))).sorted(new Comparator<User>() {
|
|
|
+ any = allUserList.stream().filter(u -> (u.getJobNumber()!=null&&u.getJobNumber().equals(jobNumber))||(optional.isPresent()&&((u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))||(u.getDingdingUserid()!=null&&u.getDingdingUserid().equals(optional.get().getCorpwxUserid()))))).sorted(new Comparator<User>() {
|
|
|
@Override
|
|
|
public int compare(User o1, User o2) {
|
|
|
return o1.getIsActive() > o2.getIsActive() ? -1 : 1;
|
|
|
@@ -15310,8 +15315,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
String overtimeCell = row.getCell(4) == null?null:row.getCell(4).getStringCellValue();
|
|
|
Integer isOvertime = 0;
|
|
|
if (!StringUtils.isEmpty(overtimeCell)) {
|
|
|
- overtimeCell = overtimeCell.replace("H", "");
|
|
|
- isOvertime = overtimeCell.equals("正常工时")?1:0;
|
|
|
+ overtimeCell = overtimeCell.trim();
|
|
|
+ isOvertime = overtimeCell.equals("正常工时")?0:1;
|
|
|
}
|
|
|
String isAbnormal = row.getCell(5) == null?null:row.getCell(5).getStringCellValue();
|
|
|
Integer extraField1 = "正常".equals(isAbnormal)? 0 : 1;
|