|
@@ -26,6 +26,8 @@ import cn.com.qmth.examcloud.commons.api.response.SyncOrgResp;
|
|
import cn.com.qmth.examcloud.commons.api.response.SyncSpecialtyResp;
|
|
import cn.com.qmth.examcloud.commons.api.response.SyncSpecialtyResp;
|
|
import cn.com.qmth.examcloud.commons.api.response.SyncStudentResp;
|
|
import cn.com.qmth.examcloud.commons.api.response.SyncStudentResp;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
|
+import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
|
|
|
|
+import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
|
|
import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
|
|
import cn.com.qmth.examcloud.core.questions.dao.ExtractConfigRepo;
|
|
import cn.com.qmth.examcloud.core.questions.dao.ExtractConfigRepo;
|
|
@@ -36,6 +38,10 @@ import cn.com.qmth.examcloud.core.questions.dao.entity.ExtractConfig;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
|
|
|
|
|
|
+import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author weiwenhai
|
|
* @author weiwenhai
|
|
* @date 2018.10.11
|
|
* @date 2018.10.11
|
|
@@ -58,6 +64,9 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
PaperRepo paperRepo;
|
|
PaperRepo paperRepo;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ MongoTemplate mongoTemplate;
|
|
|
|
|
|
@ApiOperation(value = "同步课程")
|
|
@ApiOperation(value = "同步课程")
|
|
@PostMapping("syncCourse")
|
|
@PostMapping("syncCourse")
|
|
@@ -84,6 +93,7 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
|
|
//同步调卷规则
|
|
//同步调卷规则
|
|
List<ExtractConfig> extractConfigs= extractConfigRepo.findByCourseCodeAndOrgId(courseCode,rootOrgId.toString());
|
|
List<ExtractConfig> extractConfigs= extractConfigRepo.findByCourseCodeAndOrgId(courseCode,rootOrgId.toString());
|
|
if (extractConfigs != null && extractConfigs.size() > 0) {
|
|
if (extractConfigs != null && extractConfigs.size() > 0) {
|
|
|
|
+ int i = 0;
|
|
for (ExtractConfig extractConfig : extractConfigs) {
|
|
for (ExtractConfig extractConfig : extractConfigs) {
|
|
extractConfig.setCourseName(courseName);
|
|
extractConfig.setCourseName(courseName);
|
|
Course course = extractConfig.getCourse();
|
|
Course course = extractConfig.getCourse();
|
|
@@ -103,12 +113,15 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
|
|
tempCourse.setCreateTime(CommonUtils.getCurDateTime());
|
|
tempCourse.setCreateTime(CommonUtils.getCurDateTime());
|
|
extractConfig.setCourse(tempCourse);
|
|
extractConfig.setCourse(tempCourse);
|
|
}
|
|
}
|
|
|
|
+ i++;
|
|
}
|
|
}
|
|
extractConfigRepo.save(extractConfigs);
|
|
extractConfigRepo.save(extractConfigs);
|
|
|
|
+ log.debug("调卷规则同步完成,已经同步数量:"+ i);
|
|
}
|
|
}
|
|
//同步试卷
|
|
//同步试卷
|
|
List<Paper> papers = paperRepo.findByCourseNoAndOrgId(courseCode, rootOrgId.toString());
|
|
List<Paper> papers = paperRepo.findByCourseNoAndOrgId(courseCode, rootOrgId.toString());
|
|
if (papers != null && papers.size() > 0) {
|
|
if (papers != null && papers.size() > 0) {
|
|
|
|
+ int i = 0;
|
|
for (Paper paper : papers) {
|
|
for (Paper paper : papers) {
|
|
Course course = paper.getCourse();
|
|
Course course = paper.getCourse();
|
|
if(course != null){
|
|
if(course != null){
|
|
@@ -127,12 +140,18 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
|
|
tempCourse.setCreateTime(CommonUtils.getCurDateTime());
|
|
tempCourse.setCreateTime(CommonUtils.getCurDateTime());
|
|
paper.setCourse(tempCourse);
|
|
paper.setCourse(tempCourse);
|
|
}
|
|
}
|
|
|
|
+ i++;
|
|
}
|
|
}
|
|
paperRepo.save(papers);
|
|
paperRepo.save(papers);
|
|
|
|
+ log.debug("试卷同步完成,已经同步数量:"+ i);
|
|
}
|
|
}
|
|
//同步试题
|
|
//同步试题
|
|
- List<Question> questions = quesRepo.findByCourseNoAndOrgId(courseCode, rootOrgId.toString());
|
|
|
|
|
|
+ Query query = new Query();
|
|
|
|
+ query.addCriteria(Criteria.where("orgId").is(rootOrgId.toString()));
|
|
|
|
+ query.addCriteria(Criteria.where("course.code").is(courseCode));
|
|
|
|
+ List<Question> questions = this.mongoTemplate.find(query, Question.class);
|
|
if (questions != null && questions.size() > 0) {
|
|
if (questions != null && questions.size() > 0) {
|
|
|
|
+ int i = 0;
|
|
for (Question question : questions) {
|
|
for (Question question : questions) {
|
|
Course course = question.getCourse();
|
|
Course course = question.getCourse();
|
|
if(course != null){
|
|
if(course != null){
|
|
@@ -151,8 +170,10 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
|
|
tempCourse.setCreateTime(CommonUtils.getCurDateTime());
|
|
tempCourse.setCreateTime(CommonUtils.getCurDateTime());
|
|
question.setCourse(tempCourse);
|
|
question.setCourse(tempCourse);
|
|
}
|
|
}
|
|
|
|
+ i++;
|
|
}
|
|
}
|
|
quesRepo.save(questions);
|
|
quesRepo.save(questions);
|
|
|
|
+ log.debug("试题同步完成,已经同步数量:"+ i);
|
|
}
|
|
}
|
|
SyncCourseResp resp = new SyncCourseResp();
|
|
SyncCourseResp resp = new SyncCourseResp();
|
|
return resp;
|
|
return resp;
|