|
@@ -94,9 +94,9 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private CourseService courseService;
|
|
private CourseService courseService;
|
|
- //
|
|
|
|
- // @Autowired
|
|
|
|
- // private SysProperty sysProperty;
|
|
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private RandomPaperRepo randomPaperRepo;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PaperDtoAssembler paperDtoAssembler;
|
|
private PaperDtoAssembler paperDtoAssembler;
|
|
@@ -189,10 +189,21 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
- public void saveExtractConfig(ExtractConfig extractConfig) {
|
|
|
|
|
|
+ public void saveExtractConfigForRandomPaper(ExtractConfig extractConfig) {
|
|
Course course = courseService.getCourse(Long.valueOf(extractConfig.getOrgId()), extractConfig.getCourseCode());
|
|
Course course = courseService.getCourse(Long.valueOf(extractConfig.getOrgId()), extractConfig.getCourseCode());
|
|
extractConfig.setCourse(course);
|
|
extractConfig.setCourse(course);
|
|
extractConfig.setCourseName(course.getName());
|
|
extractConfig.setCourseName(course.getName());
|
|
|
|
+
|
|
|
|
+ RandomPaper query = new RandomPaper();
|
|
|
|
+ query.setId(extractConfig.getRandomPaperId());
|
|
|
|
+ query.setCourseId(Long.parseLong(course.getId()));
|
|
|
|
+ Example<RandomPaper> queryExample = Example.of(query);
|
|
|
|
+ boolean exists = randomPaperRepo.exists(queryExample);
|
|
|
|
+ if(!exists){
|
|
|
|
+ LOG.warn("随机抽题模板选择错误,与当前课程不匹配! courseId:{} randomPaperId:{}", course.getId(), extractConfig.getRandomPaperId());
|
|
|
|
+ throw new StatusException("500", "随机抽题模板选择错误,与当前课程不匹配!");
|
|
|
|
+ }
|
|
|
|
+
|
|
// 新增,id为空
|
|
// 新增,id为空
|
|
if (StringUtils.isBlank(extractConfig.getId())) {
|
|
if (StringUtils.isBlank(extractConfig.getId())) {
|
|
// 先查询
|
|
// 先查询
|