调整班次更新的机制

This commit is contained in:
aikai 2024-06-12 10:07:52 +08:00
parent 7eee7f1a81
commit 18ab3c1693
2 changed files with 9 additions and 2 deletions

View File

@ -70,12 +70,15 @@ public class AttendanceFixedServiceImpl implements AttendanceFixedService, Punch
groupId = attendanceGroupId;
attendanceFixedMapper.insertBatch(saveList);
}
LocalDateTime now = LocalDateTime.now();
int week = now.getDayOfWeek().getValue();
if (!editList.isEmpty()) {
Map<Integer, AttendanceFixedDO> map = oldList.stream().collect(Collectors.toMap(AttendanceFixedDO::getWeekTime, a -> a));
for (AttendanceFixedDO attendanceFixedDO : editList) {
AttendanceFixedDO item = map.get(attendanceFixedDO.getWeekTime());
boolean eqFlag = BeanUtil.isCommonFieldsEqual(attendanceFixedDO, item, "createTime", "updateTime", "creator", "updater", "deleted");
if (!eqFlag) {
// -- 判断当天是周几是否和当前修改的时间为同一天 如果是的话则判断则提示立即生效
if (!eqFlag && week == attendanceFixedDO.getWeekTime()) {
groupId = attendanceGroupId;
break;
}

View File

@ -71,12 +71,16 @@ public class AttendanceSchedulingServiceImpl implements AttendanceSchedulingServ
groupId = attendanceGroupId;
schedulingMapper.insertBatch(saveList);
}
//获取到当天是第几天
String schedulingKey = Constants.SCHEDULING + Constants.UNDERLINE + attendanceGroupId;
String indexDayObj = stringRedisTemplate.opsForValue().get(schedulingKey);
if (!editList.isEmpty()) {
Map<Integer, AttendanceSchedulingDO> map = oldList.stream().collect(Collectors.toMap(AttendanceSchedulingDO::getIndexDay, a -> a));
for (AttendanceSchedulingDO attendanceSchedulingDO : editList) {
AttendanceSchedulingDO item = map.get(attendanceSchedulingDO.getIndexDay());
boolean eqFlag = BeanUtil.isCommonFieldsEqual(attendanceSchedulingDO, item, "createTime", "updateTime", "creator", "updater", "deleted");
if (!eqFlag) {
// -- 判断当天是修改的数据是否是当天 - 如果是的话则需要更新
if (!eqFlag && (StrUtil.isNotEmpty(indexDayObj) && Integer.parseInt(indexDayObj) == attendanceSchedulingDO.getIndexDay())) {
groupId = attendanceGroupId;
break;
}