feat(attendance): 倒班逻辑重构
- 在WmsAttendanceScheduleMapper.xml中新增shiftStartTime2和shiftEndTime2字段映射 - 修改SQL查询语句以包含新的时间段字段 - 更新WmsAttendanceScheduleVo类添加shiftStartTime2和shiftEndTime2属性 - 修复倒班逻辑计算方式,调整周期天数判断条件 - 注释掉连续两天排班的相关业务逻辑
This commit is contained in:
@@ -102,6 +102,19 @@ public class WmsAttendanceScheduleVo {
|
||||
@ExcelProperty(value = "结束时间")
|
||||
private java.util.Date shiftEndTime;
|
||||
|
||||
/**
|
||||
* 班次开始时间2
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@ExcelProperty(value = "开始时间2")
|
||||
private java.util.Date shiftStartTime2;
|
||||
|
||||
/**
|
||||
* 班次结束时间2
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@ExcelProperty(value = "结束时间2")
|
||||
private java.util.Date shiftEndTime2;
|
||||
/**
|
||||
* 工时
|
||||
*/
|
||||
|
||||
@@ -228,7 +228,8 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
|
||||
// 判断是否为倒班日
|
||||
long cycleDays = rule.getCycleDays() != null ? rule.getCycleDays() : 10;
|
||||
boolean isChangeDay = (daysFromStart + 1) % cycleDays == 0;
|
||||
// boolean isChangeDay = (daysFromStart + 1) % cycleDays == 0;
|
||||
boolean isChangeDay = daysFromStart > 0 && daysFromStart % cycleDays == 0;
|
||||
|
||||
if (isChangeDay) {
|
||||
// 倒班日
|
||||
@@ -241,24 +242,24 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
schedule.setShiftId(rule.getShiftB());
|
||||
schedule.setShiftName(shiftB.getShiftName());
|
||||
}
|
||||
// 下一天也使用倒班班次(工作18小时)
|
||||
LocalDate nextDay = currentDate.plusDays(1);
|
||||
if (!nextDay.isAfter(endDate) && !isScheduleExists(bo.getUserId(), nextDay)) {
|
||||
WmsAttendanceSchedule nextSchedule = new WmsAttendanceSchedule();
|
||||
nextSchedule.setUserId(bo.getUserId());
|
||||
nextSchedule.setWorkDate(java.sql.Date.valueOf(nextDay));
|
||||
if (changeShiftB != null) {
|
||||
nextSchedule.setShiftId(rule.getChangeShiftBId());
|
||||
nextSchedule.setShiftName(changeShiftB.getShiftName());
|
||||
} else {
|
||||
nextSchedule.setShiftId(rule.getShiftB());
|
||||
nextSchedule.setShiftName(shiftB.getShiftName());
|
||||
}
|
||||
schedules.add(nextSchedule);
|
||||
}
|
||||
// // 下一天也使用倒班班次(工作18小时)
|
||||
// LocalDate nextDay = currentDate.plusDays(1);
|
||||
// if (!nextDay.isAfter(endDate) && !isScheduleExists(bo.getUserId(), nextDay)) {
|
||||
// WmsAttendanceSchedule nextSchedule = new WmsAttendanceSchedule();
|
||||
// nextSchedule.setUserId(bo.getUserId());
|
||||
// nextSchedule.setWorkDate(java.sql.Date.valueOf(nextDay));
|
||||
// if (changeShiftB != null) {
|
||||
// nextSchedule.setShiftId(rule.getChangeShiftBId());
|
||||
// nextSchedule.setShiftName(changeShiftB.getShiftName());
|
||||
// } else {
|
||||
// nextSchedule.setShiftId(rule.getShiftB());
|
||||
// nextSchedule.setShiftName(shiftB.getShiftName());
|
||||
// }
|
||||
// schedules.add(nextSchedule);
|
||||
// }
|
||||
isCurrentShiftA = false;
|
||||
currentDate = currentDate.plusDays(1); // 跳过下一天,因为已经处理了
|
||||
daysFromStart++;
|
||||
// currentDate = currentDate.plusDays(1); // 跳过下一天,因为已经处理了
|
||||
// daysFromStart++;
|
||||
} else {
|
||||
// 夜班转白班
|
||||
if (changeShiftA != null) {
|
||||
|
||||
Reference in New Issue
Block a user