|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.boot.core.exception.StatusException;
|
|
|
import com.qmth.exam.reserve.bean.applytask.TimePeriodReq;
|
|
|
import com.qmth.exam.reserve.bean.timeperiod.TimePeriodExamSiteBean;
|
|
|
+import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
|
|
|
import com.qmth.exam.reserve.dao.TimePeriodDao;
|
|
|
import com.qmth.exam.reserve.entity.ApplyTaskEntity;
|
|
|
import com.qmth.exam.reserve.entity.TimePeriodEntity;
|
|
@@ -26,6 +27,9 @@ public class TimePeriodServiceImpl extends ServiceImpl<TimePeriodDao, TimePeriod
|
|
|
@Autowired
|
|
|
private OperateLogService logService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ApplyTaskCacheService cacheService;
|
|
|
+
|
|
|
@Override
|
|
|
public void saveTimePeriod(Long userId, Long id, List<TimePeriodReq> timeList) {
|
|
|
ApplyTaskEntity task = taskService.getById(id);
|
|
@@ -35,7 +39,14 @@ public class TimePeriodServiceImpl extends ServiceImpl<TimePeriodDao, TimePeriod
|
|
|
TimePeriodEntity timePeriod = new TimePeriodEntity();
|
|
|
BeanUtils.copyProperties(time, timePeriod);
|
|
|
timePeriod.setApplyTaskId(id);
|
|
|
- this.saveOrUpdate(timePeriod);
|
|
|
+ //保存或更新
|
|
|
+ if (time.getId() == null) {
|
|
|
+ save(timePeriod);
|
|
|
+ //更新剩余可约数量的缓存
|
|
|
+ cacheService.initApplyAvailableCountCacheForTimePeriods(timePeriod.getId());
|
|
|
+ } else {
|
|
|
+ updateById(timePeriod);
|
|
|
+ }
|
|
|
}
|
|
|
logService.insertOperateLog(userId, EventType.SAVE_TIME_PERIOD, null);
|
|
|
}
|