|
@@ -48,6 +48,9 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
|
|
|
@Resource
|
|
|
private ApplyFormService applyFormService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AttendanceRuleService attendanceRuleService;
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg refreshData(String month) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
@@ -67,6 +70,7 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
|
|
|
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
|
|
localDates.add(date);
|
|
|
}
|
|
|
+ List<AttendanceRule> ruleList = attendanceRuleService.list();
|
|
|
|
|
|
List<Attendance> attendanceList = attendanceService.list(new QueryWrapper<Attendance>()
|
|
|
.eq("month", month)
|
|
@@ -248,93 +252,103 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ AttendanceRule baiBanRule = ruleList.get(0);
|
|
|
+ AttendanceRule yichangBaiBan1Rule = ruleList.get(1);
|
|
|
+ AttendanceRule yichangBaiBan2Rule = ruleList.get(2);
|
|
|
+ AttendanceRule zhongBanRule = ruleList.get(3);
|
|
|
+ AttendanceRule xiaoyeBan1Rule = ruleList.get(4);
|
|
|
+ AttendanceRule xiaoyeBan2Rule = ruleList.get(5);
|
|
|
+ AttendanceRule dayeBanRule = ruleList.get(6);
|
|
|
+ AttendanceRule yichangxiaoyeBan1Rule = ruleList.get(7);
|
|
|
+ AttendanceRule yichangxiaoyeBan2Rule = ruleList.get(8);
|
|
|
+
|
|
|
|
|
|
//早班上下班时间判断
|
|
|
- Optional<Attendance> zaoShangCount = attendances.stream().filter(a ->!a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 7, 0))
|
|
|
- &&!a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 8, 30))
|
|
|
+ Optional<Attendance> zaoShangCount = attendances.stream().filter(a ->!a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, baiBanRule.getBeginWorkStartTime().getHour(),baiBanRule.getBeginWorkStartTime().getMinute()))
|
|
|
+ &&!a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, baiBanRule.getBeginWorkEndTime().getHour(), baiBanRule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
- Optional<Attendance> zaoXiaCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 20, 30))
|
|
|
+ Optional<Attendance> zaoXiaCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, baiBanRule.getEndWorkStartTime().getHour(), baiBanRule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, baiBanRule.getEndWorkEndTime().getHour(), baiBanRule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
//异常早班1时间判断
|
|
|
- Optional<Attendance> zaoShangYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 8, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 9, 30))
|
|
|
+ Optional<Attendance> zaoShangYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan1Rule.getBeginWorkStartTime().getHour(),yichangBaiBan1Rule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan1Rule.getBeginWorkEndTime().getHour(), yichangBaiBan1Rule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
- Optional<Attendance> zaoXiaYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 20, 30)))
|
|
|
+ Optional<Attendance> zaoXiaYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan1Rule.getEndWorkStartTime().getHour(), yichangBaiBan1Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan1Rule.getEndWorkEndTime().getHour(), yichangBaiBan1Rule.getEndWorkEndTime().getMinute())))
|
|
|
.max(Comparator.comparing(Attendance::getClockTime));
|
|
|
|
|
|
//异常早班2时间判断
|
|
|
- Optional<Attendance> zaoShangYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 9, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 10, 30))
|
|
|
+ Optional<Attendance> zaoShangYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan2Rule.getBeginWorkStartTime().getHour(),yichangBaiBan2Rule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan2Rule.getBeginWorkEndTime().getHour(), yichangBaiBan2Rule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
- Optional<Attendance> zaoXiaYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 20, 30))
|
|
|
+ Optional<Attendance> zaoXiaYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan2Rule.getEndWorkStartTime().getHour(), yichangBaiBan2Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangBaiBan2Rule.getEndWorkEndTime().getHour(), yichangBaiBan2Rule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
|
|
|
//中班上下班时间判断
|
|
|
- Optional<Attendance> zhongShangCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 12, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 13, 30))
|
|
|
+ Optional<Attendance> zhongShangCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, zhongBanRule.getBeginWorkStartTime().getHour(), zhongBanRule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, zhongBanRule.getBeginWorkEndTime().getHour(), zhongBanRule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
|
|
|
- Optional<Attendance> zhongXiaCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 20, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 21, 30))
|
|
|
+ Optional<Attendance> zhongXiaCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, zhongBanRule.getEndWorkStartTime().getHour(), zhongBanRule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, zhongBanRule.getBeginWorkEndTime().getHour(), zhongBanRule.getBeginWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
//小夜班(1)上下班时间判断
|
|
|
- Optional<Attendance> xiaoYeShangCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 15, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
|
|
|
+ Optional<Attendance> xiaoYeShangCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, xiaoyeBan1Rule.getBeginWorkStartTime().getHour(), xiaoyeBan1Rule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, xiaoyeBan1Rule.getBeginWorkEndTime().getHour(), xiaoyeBan1Rule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
|
|
|
boolean isLastDay = endDate.isEqual(LocalDate.of(year, monthValue, dayValue));//是否是该月份最后一天
|
|
|
Optional<Attendance> xiaoYeXiaCount = isLastDay ?
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 23, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, 0, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, xiaoyeBan1Rule.getEndWorkStartTime().getHour(), xiaoyeBan1Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, xiaoyeBan1Rule.getEndWorkEndTime().getHour(), xiaoyeBan1Rule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime)):
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 23, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, 0, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, xiaoyeBan1Rule.getEndWorkStartTime().getHour(), xiaoyeBan1Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, xiaoyeBan1Rule.getEndWorkEndTime().getHour(), xiaoyeBan1Rule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
|
|
|
//小夜班(2)上下班时间判断
|
|
|
- Optional<Attendance> xiaoYeShang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 17, 30))
|
|
|
+ Optional<Attendance> xiaoYeShang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, xiaoyeBan2Rule.getEndWorkStartTime().getHour(), xiaoyeBan2Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, xiaoyeBan2Rule.getEndWorkEndTime().getHour(), xiaoyeBan2Rule.getEndWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
Optional<Attendance> xiaoYeXia2Count = isLastDay ?
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue+1, 1, 0, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, 1, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue+1, 1, xiaoyeBan2Rule.getEndWorkStartTime().getHour(), xiaoyeBan2Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, xiaoyeBan2Rule.getEndWorkEndTime().getHour(), xiaoyeBan2Rule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime)):
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue+1, 0, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, 1, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue+1, xiaoyeBan2Rule.getEndWorkStartTime().getHour(), xiaoyeBan2Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, xiaoyeBan2Rule.getEndWorkEndTime().getHour(), xiaoyeBan2Rule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
|
|
|
//异常小夜班(1)上下班时间判断
|
|
|
- Optional<Attendance> xiaoYeShangYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 13, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 14, 30))
|
|
|
+ Optional<Attendance> xiaoYeShangYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan1Rule.getBeginWorkStartTime().getHour(), yichangxiaoyeBan1Rule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan1Rule.getBeginWorkEndTime().getHour(), yichangxiaoyeBan1Rule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
- Optional<Attendance> xiaoYeXiaYiChang1Count =attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 21, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 22, 30))).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
+ Optional<Attendance> xiaoYeXiaYiChang1Count =attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan1Rule.getEndWorkStartTime().getHour(), yichangxiaoyeBan1Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan1Rule.getEndWorkEndTime().getHour(), yichangxiaoyeBan1Rule.getEndWorkEndTime().getMinute()))).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
|
|
|
//异常小夜班(2)上下班时间判断
|
|
|
- Optional<Attendance> xiaoYeShangYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 14, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 15, 30))
|
|
|
+ Optional<Attendance> xiaoYeShangYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan2Rule.getBeginWorkStartTime().getHour(), yichangxiaoyeBan2Rule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan2Rule.getBeginWorkEndTime().getHour(), yichangxiaoyeBan2Rule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
- Optional<Attendance> xiaoYeXiaYiChang2Count =attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 22, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 23, 30))).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
+ Optional<Attendance> xiaoYeXiaYiChang2Count =attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan2Rule.getEndWorkStartTime().getHour(), yichangxiaoyeBan2Rule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, yichangxiaoyeBan2Rule.getEndWorkEndTime().getHour(), yichangxiaoyeBan2Rule.getEndWorkEndTime().getMinute()))).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
|
|
|
//大夜班上下班时间判断
|
|
|
Optional<Attendance> daYeShangCount =isLastDay ?
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 23, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, 0, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, dayeBanRule.getBeginWorkStartTime().getHour(), dayeBanRule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, dayeBanRule.getBeginWorkEndTime().getHour(), dayeBanRule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst():
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 23, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, 0, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, dayeBanRule.getBeginWorkStartTime().getHour(), dayeBanRule.getBeginWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, dayeBanRule.getBeginWorkEndTime().getHour(), dayeBanRule.getBeginWorkEndTime().getMinute()))
|
|
|
).findFirst();
|
|
|
|
|
|
Optional<Attendance> daYeXiaCount =isLastDay ?
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue+1, 1, 7, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, 8, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue+1, 1, dayeBanRule.getEndWorkStartTime().getHour(), dayeBanRule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue+1, 1, dayeBanRule.getEndWorkEndTime().getHour(), dayeBanRule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime)):
|
|
|
- attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue+1, 7, 30))
|
|
|
- && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, 8, 30))
|
|
|
+ attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue+1, dayeBanRule.getEndWorkStartTime().getHour(), dayeBanRule.getEndWorkStartTime().getMinute()))
|
|
|
+ && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue+1, dayeBanRule.getEndWorkEndTime().getHour(), dayeBanRule.getEndWorkEndTime().getMinute()))
|
|
|
).max(Comparator.comparing(Attendance::getClockTime));
|
|
|
|
|
|
//1先判断白班
|