|
|
@@ -71,6 +71,9 @@ public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attenda
|
|
|
@Resource
|
|
|
WxCorpInfoMapper wxCorpInfoMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AttendanceMapper attendanceMapper;
|
|
|
+
|
|
|
private static final List<String> holidays = Arrays.asList("2025-01-01",
|
|
|
"2025-01-28", "2025-01-29", "2025-01-30", "2025-01-31", "2025-02-03", "2025-02-04",
|
|
|
"2025-04-04",
|
|
|
@@ -261,6 +264,7 @@ public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attenda
|
|
|
List<Department> departmentList = departmentService.list(new QueryWrapper<Department>());
|
|
|
List<AttendanceStaff> staffList = attendanceStaffService.list(new QueryWrapper<AttendanceStaff>().between("clock_date", firstDay, lastDay));
|
|
|
List<ApplyForm> applyFormList = applyFormService.getListByFirstDateAndLastDate(startDate, endDate);
|
|
|
+ List<Attendance> attendanceList = attendanceMapper.selectList(new QueryWrapper<Attendance>().between("clock_time", startDate.atStartOfDay(), endDate.atStartOfDay()));//enddate为下月第一天
|
|
|
//对于请假,按照交叉的部分重新计算时长
|
|
|
for (ApplyForm applyForm : applyFormList) {
|
|
|
if (applyForm.getType() == 3) {
|
|
|
@@ -308,9 +312,14 @@ public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attenda
|
|
|
strings.add(u.getInactiveDate()==null?"":u.getInactiveDate().format(formatter1));//离职日期
|
|
|
strings.add("");//备注
|
|
|
|
|
|
- List<AttendanceStaff> staffCollect = staffList.stream().filter(s -> s.getJobNumber().equals(u.getJobNumber())).collect(Collectors.toList());
|
|
|
+ List<AttendanceStaff> staffCollect = staffList.stream().filter(s -> s.getJobNumber().equalsIgnoreCase(u.getJobNumber())).collect(Collectors.toList());
|
|
|
List<AttendanceStaff> workDaysCollect = staffCollect.stream().filter(s -> s.getAttendanceType() != 12).collect(Collectors.toList());
|
|
|
strings.add(workDaysCollect.size()+"");//实际出勤天
|
|
|
+ if(u.getJobNumber().equals("LEW3385")){
|
|
|
+ for (AttendanceStaff staff : workDaysCollect) {
|
|
|
+ System.out.println(staff.getJobNumber());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
BigDecimal total8 = getDecimal(applyFormList,"病假",u.getJobNumber());
|
|
|
strings.add(total8.toString());
|
|
|
@@ -588,17 +597,42 @@ public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attenda
|
|
|
}
|
|
|
strings.add(countLess+"");
|
|
|
strings.add(countMore+"");
|
|
|
- List<ApplyForm> fixDakaCollection = applyFormList.stream().filter(a -> a.getType() == 6&&a.getApplyId().equals(u.getJobNumber())).collect(Collectors.toList());
|
|
|
- List<ApplyForm> qingjiaCollection = applyFormList.stream().filter(a -> a.getType() == 3&&a.getApplyId().equals(u.getJobNumber())).collect(Collectors.toList());
|
|
|
+ List<ApplyForm> fixDakaCollection = applyFormList.stream().filter(a -> a.getType() == 6&&a.getApplyId().equalsIgnoreCase(u.getJobNumber())).collect(Collectors.toList());
|
|
|
+ List<ApplyForm> qingjiaCollection = applyFormList.stream().filter(a -> a.getType() == 3&&a.getApplyId().equalsIgnoreCase(u.getJobNumber())).collect(Collectors.toList());
|
|
|
List<AttendanceStaff> unDaKacollect = staffCollect.stream().filter(s -> s.getClockStartTime() == null || s.getClockEndTime() == null).collect(Collectors.toList());
|
|
|
//两次没打卡,视为旷工,1次则为未打卡
|
|
|
- int kuanggongCount = (int) unDaKacollect.stream().filter(un -> un.getClockStartTime() == null && un.getClockEndTime() == null && !fixDakaCollection.stream().anyMatch(fix -> fix.getStartTime().toLocalDate().equals(un.getClockDate()))).count();
|
|
|
- unDaKacollect = unDaKacollect.stream().filter(un->(un.getClockStartTime() != null || un.getClockEndTime() != null )&& !fixDakaCollection.stream().anyMatch(fix->fix.getStartTime().toLocalDate().equals(un.getClockDate()))).collect(Collectors.toList());
|
|
|
- strings.add(unDaKacollect.size()+"");
|
|
|
|
|
|
+ /*
|
|
|
+ 处理只打了1次卡,没有记录入attendance_staff表的情况
|
|
|
+ * */
|
|
|
+ List<Attendance> attendances = attendanceList.stream().filter(attendance -> attendance.getJobNumber().equalsIgnoreCase(u.getJobNumber())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<LocalDate, List<Attendance>> dailyAttendances = attendances.stream().collect(Collectors.groupingBy(attendance -> {
|
|
|
+ //7点以前,算前一天的打卡
|
|
|
+ if (attendance.getClockTime().getHour() <= 6) {
|
|
|
+ return attendance.getClockTime().toLocalDate().minusDays(1);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return attendance.getClockTime().toLocalDate();
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ //工作日列表
|
|
|
List<LocalDate> workDaysListInRange = WorkDayCalculateUtils.getWorkDaysListInRange(((LocalDate)monthInfo.get("firstDay")).toString(),((LocalDate)monthInfo.get("lastDay")).toString(),2);
|
|
|
+
|
|
|
+ Set<Map.Entry<LocalDate, List<Attendance>>> onceAttendance = dailyAttendances.entrySet().stream()
|
|
|
+ .filter(entry -> workDaysListInRange.stream().anyMatch(workDay -> workDay.equals(entry.getKey()))
|
|
|
+ )
|
|
|
+ .filter(entry -> entry.getValue().size() == 1
|
|
|
+ && staffCollect.stream()
|
|
|
+ .noneMatch(unDaKa -> unDaKa.getClockDate().equals(entry.getKey()))
|
|
|
+ ).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ int kuanggongCount = (int) unDaKacollect.stream().filter(un -> un.getClockStartTime() == null && un.getClockEndTime() == null && !fixDakaCollection.stream().anyMatch(fix -> fix.getStartTime().toLocalDate().equals(un.getClockDate()))).filter(un-> workDaysListInRange.stream().anyMatch(workDay->workDay.equals(un.getClockDate()))).count();
|
|
|
+ unDaKacollect = unDaKacollect.stream().filter(un->(un.getClockStartTime() != null || un.getClockEndTime() != null )&& !fixDakaCollection.stream().anyMatch(fix->fix.getStartTime().toLocalDate().equals(un.getClockDate()))).collect(Collectors.toList());
|
|
|
+ int unDaKaco = unDaKacollect.size() + onceAttendance.size();
|
|
|
+ strings.add(unDaKaco + "");
|
|
|
kuanggongCount += workDaysListInRange.stream().filter(wD -> staffCollect.stream().noneMatch(sC -> sC.getClockDate().equals(wD)) && fixDakaCollection.stream().noneMatch(aF -> aF.getStartTime().toLocalDate().equals(wD)) && qingjiaCollection.stream().noneMatch(aF -> aF.getStartTime().toLocalDate().equals(wD))).collect(Collectors.toList()).size();
|
|
|
- strings.add(kuanggongCount + "");
|
|
|
+ //strings.add(kuanggongCount + "");
|
|
|
strings.set(12,kuanggongCount * 8.0 + "");
|
|
|
int xiaoyeCount = (int) staffCollect.stream().filter(s -> s.getAttendanceTypeName() != null && s.getAttendanceTypeName().contains("小夜班")).count();
|
|
|
int dayeCount = (int) staffCollect.stream().filter(s -> s.getAttendanceTypeName() != null && s.getAttendanceTypeName().contains("大夜班")).count();
|
|
|
@@ -608,7 +642,7 @@ public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attenda
|
|
|
strings.add(xiaoyeCount+"");//小夜班
|
|
|
strings.add(dayeCount+"");//大夜班
|
|
|
|
|
|
- List<ApplyForm> jiabanList = applyFormList.stream().filter(a -> a.getType() == 4 && a.getApplyId().equals(u.getJobNumber())).collect(Collectors.toList());
|
|
|
+ List<ApplyForm> jiabanList = applyFormList.stream().filter(a -> a.getType() == 4 && a.getApplyId().equalsIgnoreCase(u.getJobNumber())).collect(Collectors.toList());
|
|
|
BigDecimal zhouMoSum = jiabanList.stream().filter(a -> (a.getStartTime().toLocalDate().getDayOfWeek() == DayOfWeek.SATURDAY || a.getStartTime().toLocalDate().getDayOfWeek() == DayOfWeek.SUNDAY))
|
|
|
.map(ApplyForm::getSumTime)
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|