|
@@ -24,6 +24,7 @@ import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.base.Model;
|
|
import cn.com.qmth.examcloud.core.questions.base.converter.utils.FileUtil;
|
|
import cn.com.qmth.examcloud.core.questions.base.converter.utils.FileUtil;
|
|
import cn.com.qmth.examcloud.core.questions.base.enums.PaperStatus;
|
|
import cn.com.qmth.examcloud.core.questions.base.enums.PaperStatus;
|
|
import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
|
|
import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
|
|
@@ -42,6 +43,7 @@ import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetail;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Property;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Property;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.QuesOption;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.QuesOption;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.entity.QuesProperty;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.QuesTypeName;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.QuesTypeName;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
import cn.com.qmth.examcloud.core.questions.service.PaperService;
|
|
import cn.com.qmth.examcloud.core.questions.service.PaperService;
|
|
@@ -190,6 +192,10 @@ public class YunkaiService {
|
|
c.setName(res.getCourseBean().getName());
|
|
c.setName(res.getCourseBean().getName());
|
|
c.setOrgId(res.getCourseBean().getRootOrgId().toString());
|
|
c.setOrgId(res.getCourseBean().getRootOrgId().toString());
|
|
p.setCourse(c);
|
|
p.setCourse(c);
|
|
|
|
+ List<CourseProperty> cps=coursePropertyRepo.findByOrgIdAndCourseCodeAndEnable(p.getRootOrgId(),p.getCourseCode(), true);
|
|
|
|
+ if(CollectionUtils.isNotEmpty(cps)) {
|
|
|
|
+ p.setCourseProperty(cps.get(0));
|
|
|
|
+ }
|
|
for (File paperFile : files) {
|
|
for (File paperFile : files) {
|
|
KdPaper kpaper = JSONObject.parseObject(FileUtil.readFileContent(paperFile), KdPaper.class);
|
|
KdPaper kpaper = JSONObject.parseObject(FileUtil.readFileContent(paperFile), KdPaper.class);
|
|
kpaper.setCourseCode(p.getCourseCode());
|
|
kpaper.setCourseCode(p.getCourseCode());
|
|
@@ -319,16 +325,43 @@ public class YunkaiService {
|
|
question.setCourse(p.getCourse());
|
|
question.setCourse(p.getCourse());
|
|
question.setOrgId(p.getRootOrgId().toString());
|
|
question.setOrgId(p.getRootOrgId().toString());
|
|
question.setHasAudio(false);
|
|
question.setHasAudio(false);
|
|
- question.setDifficulty(que.getDifficulty().getDesc());
|
|
|
|
- question.setDifficultyDegree(que.getDifficulty().getType());
|
|
|
|
|
|
+ if(que.getDifficulty()==null) {
|
|
|
|
+ question.setDifficulty("易");
|
|
|
|
+ question.setDifficultyDegree(0.5);
|
|
|
|
+ }else {
|
|
|
|
+ question.setDifficulty(que.getDifficulty().getDesc());
|
|
|
|
+ question.setDifficultyDegree(que.getDifficulty().getType());
|
|
|
|
+ }
|
|
question.setPublicity(true);
|
|
question.setPublicity(true);
|
|
question.setCreationBy(p.getUser().getUserId());
|
|
question.setCreationBy(p.getUser().getUserId());
|
|
question.setCreationDate(new Date());
|
|
question.setCreationDate(new Date());
|
|
question.setCreateTime(getCurDateTime());
|
|
question.setCreateTime(getCurDateTime());
|
|
// 按试题分类初始化题干,答案,选项
|
|
// 按试题分类初始化题干,答案,选项
|
|
initQuestionInfo(question, que);
|
|
initQuestionInfo(question, que);
|
|
|
|
+ initQuestionProp(question, que,p);
|
|
return question;
|
|
return question;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void initQuestionProp(Question question, KdQuestion que,YunkaiImportPaperParam p) {
|
|
|
|
+ if(CollectionUtils.isEmpty(que.getPropIds())) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<QuesProperty> quesProperties=new ArrayList<>();
|
|
|
|
+ for(Long id:que.getPropIds()) {
|
|
|
|
+ Property prop=propertyRepo.findByCoursePropertyIdAndFromId(p.getCourseProperty().getId(),id.toString());
|
|
|
|
+ QuesProperty qp=new QuesProperty();
|
|
|
|
+ quesProperties.add(qp);
|
|
|
|
+ qp.setCoursePropertyName(p.getCourseProperty().getName());
|
|
|
|
+ if("0".equals(prop.getParentId())) {
|
|
|
|
+ qp.setFirstProperty(prop);
|
|
|
|
+ }else {
|
|
|
|
+ Property fprop = Model.of(propertyRepo.findById(prop.getParentId()));
|
|
|
|
+ qp.setFirstProperty(fprop);
|
|
|
|
+ qp.setSecondProperty(prop);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ question.setQuesProperties(quesProperties);
|
|
|
|
+ }
|
|
|
|
|
|
private void initQuestionInfo(Question question, KdQuestion que) {
|
|
private void initQuestionInfo(Question question, KdQuestion que) {
|
|
// 单选题
|
|
// 单选题
|