Selaa lähdekoodia

提交题库后端

weiwenhai 6 vuotta sitten
vanhempi
commit
063bbd444a

+ 34 - 1
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/provider/HandleSyncCloudServiceProvider.java

@@ -206,7 +206,40 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
 	@Override
 	public SyncExamResp syncExam(SyncExamReq req) {
 		// TODO Auto-generated method stub
-		return null;
+		Long rootOrgId = req.getRootOrgId();
+		Long id = req.getId();
+		String name = req.getName();
+		String examType = req.getExamType();
+		if (StringUtils.isBlank(name)) {
+			throw new StatusException("Q-018213", "name is null");
+		}
+		if (null == id) {
+			throw new StatusException("Q-018216", "id is null");
+		}
+		if (null == rootOrgId) {
+			throw new StatusException("Q-018219", "rootOrgId is null");
+		}
+		if (StringUtils.isBlank(examType)) {
+			throw new StatusException("Q-018223", "examType is null");
+		}
+		//同步调卷规则
+		Query query = new Query();
+		query.addCriteria(Criteria.where("orgId").is(rootOrgId+""));
+		query.addCriteria(Criteria.where("examId").is(id+""));
+		query.addCriteria(Criteria.where("course.enable").is("true"));
+		List<ExtractConfig> extractConfigs = this.mongoTemplate.find(query, ExtractConfig.class);
+		if (extractConfigs != null && extractConfigs.size() > 0) {
+			int i = 0;
+		    for (ExtractConfig extractConfig : extractConfigs) {
+		    	extractConfig.setExamName(name);
+		    	extractConfig.setExamType(examType);
+		    	extractConfig.setExamType(examType);
+		    }
+		    extractConfigRepo.save(extractConfigs);
+		    log.debug("调卷规则同步完成,已经同步数量:"+ i);
+		}
+		SyncExamResp resp = new SyncExamResp();
+		return resp;
 	}
 
 	@Override

+ 2 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigFileServiceImpl.java

@@ -425,10 +425,10 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
             if (extractConfig == null) {
                 throw new RuntimeException("该考试下的课程“" + examCourseDto.getCourseName() + "”没有制定调卷规则,不能批量导出,请保存调卷规则生成文件");
             }
-            /*if (extractConfig.getIfFinish() == null || extractConfig.getIfFinish() == 0) {
+            if (extractConfig.getIfFinish() == null || extractConfig.getIfFinish() == 0) {
                 throw new RuntimeException("该考试下的课程“" + examCourseDto.getCourseName() + "”考试文件没有生成,不能批量导出,请保存调卷规则生成文件");
             }
-            checkExamFileExists(examId, examCourseDto.getCourseCode(), exportType, examCourseDto.getCourseName());*/
+            checkExamFileExists(examId, examCourseDto.getCourseCode(), exportType, examCourseDto.getCourseName());
             List<ExamPaper> examPapers = extractConfig.getExamPaperList();
             if(examPapers == null || examPapers.size()<1){
             	throw new RuntimeException("该考试下的课程“" + examCourseDto.getCourseName() + "”没有绑定试卷。");