|
@@ -301,18 +301,19 @@ public class TimePeriodExamRoomServiceImpl extends ServiceImpl<TimePeriodExamRoo
|
|
|
}
|
|
|
|
|
|
//容量验证
|
|
|
- ExamSiteEntity examSite = examSiteService.getById(examSiteCacheBean.getExamSiteId());
|
|
|
- int availableCount, haveApplyCount;
|
|
|
+ int availableCount, haveApplyCount, oldCount;
|
|
|
for (TimePeriodExamRoomEntity toUpdate : toBeUpdated) {
|
|
|
- //只处理关闭时段
|
|
|
- if (!toUpdate.getEnable()) {
|
|
|
+ TimePeriodExamSiteBean bean = existingMap.get(toUpdate.getId());
|
|
|
+ //只处理从开启到关闭的时段
|
|
|
+ if (bean != null && bean.getEnable() && !toUpdate.getEnable()) {
|
|
|
// 剩余的容量,从缓存中获取
|
|
|
availableCount = applyTaskCacheService.getApplyAvailableCount(examSiteCacheBean.getExamSiteId(), toUpdate.getTimePeriodId());
|
|
|
+ // 修改之前的容量
|
|
|
+ oldCount = oldCapacityMap.getOrDefault(toUpdate.getTimePeriodId(), 0);
|
|
|
// 已预约的容量
|
|
|
- haveApplyCount = examSite.getCapacity() - availableCount;
|
|
|
- //保存前的容量
|
|
|
- Integer capacity = oldCapacityMap.get(toUpdate.getTimePeriodId());
|
|
|
- int remainCount = capacity - examRoom.getCapacity();
|
|
|
+ haveApplyCount = oldCount - availableCount;
|
|
|
+ // 关闭之后的剩余容量
|
|
|
+ int remainCount = oldCount - examRoom.getCapacity();
|
|
|
if (haveApplyCount > remainCount) {
|
|
|
TimePeriodEntity timePeriod = timePeriodService.getById(toUpdate.getTimePeriodId());
|
|
|
String dateStr = DateUtil.getShortDateByLongTime(timePeriod.getStartTime());
|