|
@@ -14,7 +14,6 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.concurrent.locks.Lock;
|
|
|
|
|
@@ -36,7 +35,7 @@ public class StudentApplyRecordJob {
|
|
|
* 定时将“考生预约记录队列”中的数据保存至数据库
|
|
|
* 注:每N秒执行一次
|
|
|
*/
|
|
|
- // @Scheduled(fixedDelay = 30000, initialDelay = 30000)
|
|
|
+ @Scheduled(fixedDelay = 30000, initialDelay = 30000)
|
|
|
public void saveStudentApplyRecordJob() {
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
@@ -73,16 +72,19 @@ public class StudentApplyRecordJob {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Transactional
|
|
|
+ // @Transactional
|
|
|
public void saveOrUpdate(ApplyRecordCacheBean bean) {
|
|
|
LambdaQueryWrapper<StudentApplyEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(StudentApplyEntity::getStudentId, bean.getStudentId());
|
|
|
wrapper.eq(StudentApplyEntity::getExamSiteId, bean.getExamSiteId());
|
|
|
wrapper.eq(StudentApplyEntity::getTimePeriodId, bean.getTimePeriodId());
|
|
|
+ wrapper.eq(StudentApplyEntity::getStudentId, bean.getStudentId());
|
|
|
StudentApplyEntity existEntity = studentApplyService.getOne(wrapper);
|
|
|
+
|
|
|
+ String msg = String.format("%s_%s_%s_%s", bean.getStudentId(), bean.getExamSiteId(),
|
|
|
+ bean.getTimePeriodId(), bean.getCancel());
|
|
|
if (existEntity != null) {
|
|
|
if (!existEntity.getCancel()) {
|
|
|
- log.debug("{}_{}_{}_{} db exist", bean.getStudentId(), bean.getExamSiteId(), bean.getTimePeriodId(), bean.getCancel());
|
|
|
+ log.debug("{} 预约已存在,跳过!", msg);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -93,7 +95,7 @@ public class StudentApplyRecordJob {
|
|
|
updateWrapper.set(StudentApplyEntity::getUpdateTime, bean.getOperateTime());
|
|
|
updateWrapper.eq(StudentApplyEntity::getId, existEntity.getId());
|
|
|
studentApplyService.update(updateWrapper);
|
|
|
- log.debug("{}_{}_{}_{} db update", bean.getStudentId(), bean.getExamSiteId(), bean.getTimePeriodId(), bean.getCancel());
|
|
|
+ log.debug("{} 预约修改!", msg);
|
|
|
} else {
|
|
|
// 不存在则新增预约记录
|
|
|
StudentApplyEntity entity = new StudentApplyEntity();
|
|
@@ -105,7 +107,7 @@ public class StudentApplyRecordJob {
|
|
|
entity.setCreateTime(bean.getOperateTime());
|
|
|
entity.setUpdateTime(bean.getOperateTime());
|
|
|
studentApplyService.save(entity);
|
|
|
- log.debug("{}_{}_{}_{} db insert", bean.getStudentId(), bean.getExamSiteId(), bean.getTimePeriodId(), bean.getCancel());
|
|
|
+ log.debug("{} 预约新增!", msg);
|
|
|
}
|
|
|
}
|
|
|
|