调整班次更新的机制
This commit is contained in:
parent
7eee7f1a81
commit
18ab3c1693
@ -70,12 +70,15 @@ public class AttendanceFixedServiceImpl implements AttendanceFixedService, Punch
|
|||||||
groupId = attendanceGroupId;
|
groupId = attendanceGroupId;
|
||||||
attendanceFixedMapper.insertBatch(saveList);
|
attendanceFixedMapper.insertBatch(saveList);
|
||||||
}
|
}
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
int week = now.getDayOfWeek().getValue();
|
||||||
if (!editList.isEmpty()) {
|
if (!editList.isEmpty()) {
|
||||||
Map<Integer, AttendanceFixedDO> map = oldList.stream().collect(Collectors.toMap(AttendanceFixedDO::getWeekTime, a -> a));
|
Map<Integer, AttendanceFixedDO> map = oldList.stream().collect(Collectors.toMap(AttendanceFixedDO::getWeekTime, a -> a));
|
||||||
for (AttendanceFixedDO attendanceFixedDO : editList) {
|
for (AttendanceFixedDO attendanceFixedDO : editList) {
|
||||||
AttendanceFixedDO item = map.get(attendanceFixedDO.getWeekTime());
|
AttendanceFixedDO item = map.get(attendanceFixedDO.getWeekTime());
|
||||||
boolean eqFlag = BeanUtil.isCommonFieldsEqual(attendanceFixedDO, item, "createTime", "updateTime", "creator", "updater", "deleted");
|
boolean eqFlag = BeanUtil.isCommonFieldsEqual(attendanceFixedDO, item, "createTime", "updateTime", "creator", "updater", "deleted");
|
||||||
if (!eqFlag) {
|
// -- 判断当天是周几是否和当前修改的时间为同一天 如果是的话则判断则提示立即生效
|
||||||
|
if (!eqFlag && week == attendanceFixedDO.getWeekTime()) {
|
||||||
groupId = attendanceGroupId;
|
groupId = attendanceGroupId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,16 @@ public class AttendanceSchedulingServiceImpl implements AttendanceSchedulingServ
|
|||||||
groupId = attendanceGroupId;
|
groupId = attendanceGroupId;
|
||||||
schedulingMapper.insertBatch(saveList);
|
schedulingMapper.insertBatch(saveList);
|
||||||
}
|
}
|
||||||
|
//获取到当天是第几天
|
||||||
|
String schedulingKey = Constants.SCHEDULING + Constants.UNDERLINE + attendanceGroupId;
|
||||||
|
String indexDayObj = stringRedisTemplate.opsForValue().get(schedulingKey);
|
||||||
if (!editList.isEmpty()) {
|
if (!editList.isEmpty()) {
|
||||||
Map<Integer, AttendanceSchedulingDO> map = oldList.stream().collect(Collectors.toMap(AttendanceSchedulingDO::getIndexDay, a -> a));
|
Map<Integer, AttendanceSchedulingDO> map = oldList.stream().collect(Collectors.toMap(AttendanceSchedulingDO::getIndexDay, a -> a));
|
||||||
for (AttendanceSchedulingDO attendanceSchedulingDO : editList) {
|
for (AttendanceSchedulingDO attendanceSchedulingDO : editList) {
|
||||||
AttendanceSchedulingDO item = map.get(attendanceSchedulingDO.getIndexDay());
|
AttendanceSchedulingDO item = map.get(attendanceSchedulingDO.getIndexDay());
|
||||||
boolean eqFlag = BeanUtil.isCommonFieldsEqual(attendanceSchedulingDO, item, "createTime", "updateTime", "creator", "updater", "deleted");
|
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;
|
groupId = attendanceGroupId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user