|
@@ -75,6 +75,7 @@ import cn.com.qmth.examcloud.core.questions.dao.ExamPaperRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperDetailRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperDetailUnitRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperRepo;
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.PropertyRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.QuesBakRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.QuesRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Course;
|
|
@@ -83,6 +84,7 @@ import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
|
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.PaperSearchInfo;
|
|
|
+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.QuesProperty;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
@@ -126,7 +128,8 @@ import cn.com.qmth.examcloud.web.support.SpringContextHolder;
|
|
|
public class PaperServiceImpl implements PaperService {
|
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(PaperServiceImpl.class);
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private PropertyRepo propertyRepo;
|
|
|
@Autowired
|
|
|
PaperRepo paperRepo;
|
|
|
|
|
@@ -710,6 +713,12 @@ public class PaperServiceImpl implements PaperService {
|
|
|
for (PaperDetailUnit paperDetailUnit : paperDetailUnits) {
|
|
|
PaperDetailUnitExp paperDetailUnitExp = new PaperDetailUnitExp();
|
|
|
BeanUtils.copyProperties(paperDetailUnit, paperDetailUnitExp);
|
|
|
+ fillProperty(paperDetailUnitExp.getQuestion());
|
|
|
+ if(!CollectionUtils.isEmpty(paperDetailUnitExp.getQuestion().getSubQuestions())) {
|
|
|
+ for(Question subque:paperDetailUnitExp.getQuestion().getSubQuestions()) {
|
|
|
+ fillProperty(subque);
|
|
|
+ }
|
|
|
+ }
|
|
|
paperDetailUnitExps.add(paperDetailUnitExp);
|
|
|
}
|
|
|
// 选择题,套题下选择题 选项顺序重新排列
|
|
@@ -1805,7 +1814,6 @@ public class PaperServiceImpl implements PaperService {
|
|
|
throw new StatusException("500", "第" + mainNum + "大题没有小题");
|
|
|
}
|
|
|
if (paperDetail != null && paperDetail.getPaperDetailUnits() != null && paperDetail.getPaperDetailUnits().size() > 0) {
|
|
|
- int minNum = 1;
|
|
|
for (PaperDetailUnitExp paperDetailUnit : paperDetail.getPaperDetailUnits()) {
|
|
|
Question question = paperDetailUnit.getQuestion();
|
|
|
question.setDifficultyDegree(question.getDifficultyDegree() * 10);
|
|
@@ -1830,7 +1838,8 @@ public class PaperServiceImpl implements PaperService {
|
|
|
//给小题设置序号
|
|
|
// question.setQuesBodyWord(setSubQuesNum(question.getQuesBodyWord(), minNum++));
|
|
|
// question.setQuesAnswerWord(setAnswerNum(question.getQuesAnswerWord()));
|
|
|
- if (paperDetail.getFirstScore() == null) {
|
|
|
+ fillProperty(question);
|
|
|
+ if (paperDetail.getFirstScore() == null) {
|
|
|
if (question.getScore() == null) {
|
|
|
paperDetail.setFirstScore(0d);
|
|
|
} else {
|
|
@@ -1841,7 +1850,6 @@ public class PaperServiceImpl implements PaperService {
|
|
|
List<Question> subQuesList = question.getSubQuestions();
|
|
|
// 套题小题设置序号
|
|
|
if (subQuesList != null && subQuesList.size() > 0) {
|
|
|
- int index = 1;
|
|
|
for (Question subQues : subQuesList) {
|
|
|
subQues.setDifficultyDegree(subQues.getDifficultyDegree() * 10);
|
|
|
// subQues.setQuesBodyWord(setSubQuesNum(subQues.getQuesBodyWord(), index++));
|
|
@@ -1853,14 +1861,7 @@ public class PaperServiceImpl implements PaperService {
|
|
|
paperDetail.setFirstScore(subQues.getScore());
|
|
|
}
|
|
|
}
|
|
|
- List<QuesOption> subOptionList = subQues.getQuesOptions();
|
|
|
- if (subOptionList != null && subOptionList.size() > 0) {
|
|
|
- int sub_index = 0;
|
|
|
- for (QuesOption quesOption : subOptionList) {
|
|
|
- // quesOption.setOptionBodyWord(setOptionNum(quesOption.getOptionBodyWord(), getOptionNum(sub_index)));
|
|
|
- sub_index++;
|
|
|
- }
|
|
|
- }
|
|
|
+ fillProperty(subQues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1869,9 +1870,11 @@ public class PaperServiceImpl implements PaperService {
|
|
|
QuesProperty quesProperty = quesProperties.get(0);
|
|
|
if (quesProperty.getFirstProperty() != null) {
|
|
|
paperDetailUnit.setFirstName(quesProperty.getFirstProperty().getName());
|
|
|
+ paperDetailUnit.setFirstCode(quesProperty.getFirstProperty().getCode());
|
|
|
}
|
|
|
if (quesProperty.getSecondProperty() != null) {
|
|
|
paperDetailUnit.setSecondName(quesProperty.getSecondProperty().getName());
|
|
|
+ paperDetailUnit.setSecondCode(quesProperty.getSecondProperty().getCode());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1879,6 +1882,33 @@ public class PaperServiceImpl implements PaperService {
|
|
|
}
|
|
|
return paperExp;
|
|
|
}
|
|
|
+
|
|
|
+ private void fillProperty(Question question) {
|
|
|
+ List<QuesProperty> ret=new ArrayList<>();
|
|
|
+ List<QuesProperty> quesProperties = question.getQuesProperties();
|
|
|
+ if (quesProperties != null && quesProperties.size() > 0) {
|
|
|
+ for(QuesProperty quesProperty:quesProperties) {
|
|
|
+ if (quesProperty.getFirstProperty() != null
|
|
|
+ && quesProperty.getFirstProperty().getId() != null) {
|
|
|
+ Property curProperty = Model.of(propertyRepo.findById(quesProperty.getFirstProperty().getId()));
|
|
|
+ if(curProperty==null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ quesProperty.setFirstProperty(curProperty);
|
|
|
+ }
|
|
|
+ if (quesProperty.getSecondProperty() != null
|
|
|
+ && quesProperty.getSecondProperty().getId() != null) {
|
|
|
+ Property curProperty = Model.of(propertyRepo.findById(quesProperty.getSecondProperty().getId()));
|
|
|
+ if(curProperty==null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ quesProperty.setSecondProperty(curProperty);
|
|
|
+ }
|
|
|
+ ret.add(quesProperty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ question.setQuesProperties(ret);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 设置题号
|