|
@@ -470,54 +470,37 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
|
|
|
*/
|
|
|
private void appendAudioFlag(DefaultQuestion defaultQuestion, String examId, String courseCode, String groupCode,
|
|
|
Question question) {
|
|
|
- if (question.getHasAudio() != null && question.getHasAudio() == true) {
|
|
|
- // 1.判断questionDto是否含有音频,如果有添加音频播放次数
|
|
|
- AudioTimeConfig audioTimeConfig = Model.of(audioTimeConfigRepo
|
|
|
- .findOne(Example.of(new AudioTimeConfig(examId, courseCode, groupCode, question.getId()))));
|
|
|
- if (audioTimeConfig != null) {
|
|
|
- // 2.1 取到题干,给a标签添加url
|
|
|
- String quesBody = null;
|
|
|
- if (StringUtils.isNotBlank(defaultQuestion.getMasterVersion().getBody())) {
|
|
|
- // 套题
|
|
|
- quesBody = defaultQuestion.getMasterVersion().getBody();
|
|
|
- defaultQuestion.getMasterVersion().setBody(buildBody(quesBody, audioTimeConfig.getPlayTime()));
|
|
|
- } else {
|
|
|
- DefaultQuestionUnit defaultQuestionUnit = (DefaultQuestionUnit) defaultQuestion.getMasterVersion()
|
|
|
- .getQuestionUnitList().get(0);
|
|
|
- quesBody = defaultQuestionUnit.getBody();
|
|
|
- defaultQuestionUnit.setBody(buildBody(quesBody, audioTimeConfig.getPlayTime()));
|
|
|
- if (defaultQuestionUnit.getQuestionType() == QuestionType.SINGLE_CHOICE
|
|
|
- || defaultQuestionUnit.getQuestionType() == QuestionType.MULTIPLE_CHOICE) {
|
|
|
- List<DefaultQuestionOption> questionOptionList = defaultQuestionUnit.getQuestionOptionList();
|
|
|
- if (questionOptionList != null && questionOptionList.size() > 0) {
|
|
|
- for (int i = 0; i < questionOptionList.size(); i++) {
|
|
|
- DefaultQuestionOption defaultQuestionOption = questionOptionList.get(i);
|
|
|
- defaultQuestionOption.setBody(
|
|
|
- buildBody(defaultQuestionOption.getBody(), audioTimeConfig.getPlayTime()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- String quesBody = null;
|
|
|
- if (StringUtils.isNotBlank(defaultQuestion.getMasterVersion().getBody())) {
|
|
|
- // 套题
|
|
|
- quesBody = defaultQuestion.getMasterVersion().getBody();
|
|
|
- defaultQuestion.getMasterVersion().setBody(buildBody(quesBody, null));
|
|
|
- } else {
|
|
|
- DefaultQuestionUnit defaultQuestionUnit = (DefaultQuestionUnit) defaultQuestion.getMasterVersion()
|
|
|
- .getQuestionUnitList().get(0);
|
|
|
- quesBody = defaultQuestionUnit.getBody();
|
|
|
- defaultQuestionUnit.setBody(buildBody(quesBody, null));
|
|
|
- if (defaultQuestionUnit.getQuestionType() == QuestionType.SINGLE_CHOICE
|
|
|
- || defaultQuestionUnit.getQuestionType() == QuestionType.MULTIPLE_CHOICE) {
|
|
|
- List<DefaultQuestionOption> questionOptionList = defaultQuestionUnit.getQuestionOptionList();
|
|
|
- if (questionOptionList != null && questionOptionList.size() > 0) {
|
|
|
- for (int i = 0; i < questionOptionList.size(); i++) {
|
|
|
- DefaultQuestionOption defaultQuestionOption = questionOptionList.get(i);
|
|
|
- defaultQuestionOption.setBody(buildBody(defaultQuestionOption.getBody(), null));
|
|
|
- }
|
|
|
- }
|
|
|
+ if (question.getHasAudio() == null || !question.getHasAudio()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断questionDto是否含有音频,如果有添加音频播放次数
|
|
|
+ Example<AudioTimeConfig> query = Example.of(new AudioTimeConfig(examId, courseCode, groupCode, question.getId()));
|
|
|
+ AudioTimeConfig audioTimeConfig = Model.of(audioTimeConfigRepo.findOne(query));
|
|
|
+
|
|
|
+ Integer playTime = null;
|
|
|
+ if (audioTimeConfig != null) {
|
|
|
+ playTime = audioTimeConfig.getPlayTime();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取到题干,给a标签添加url
|
|
|
+ DefaultQuestionStructure quesStructure = defaultQuestion.getMasterVersion();
|
|
|
+ if (StringUtils.isNotBlank(quesStructure.getBody())) {
|
|
|
+ // 套题
|
|
|
+ String quesBody = quesStructure.getBody();
|
|
|
+ quesStructure.setBody(buildBody(quesBody, playTime));
|
|
|
+ } else {
|
|
|
+ DefaultQuestionUnit defaultQuestionUnit = quesStructure.getQuestionUnitList().get(0);
|
|
|
+ String quesBody = defaultQuestionUnit.getBody();
|
|
|
+ defaultQuestionUnit.setBody(buildBody(quesBody, playTime));
|
|
|
+
|
|
|
+ if (defaultQuestionUnit.getQuestionType() == QuestionType.SINGLE_CHOICE
|
|
|
+ || defaultQuestionUnit.getQuestionType() == QuestionType.MULTIPLE_CHOICE) {
|
|
|
+ List<DefaultQuestionOption> questionOptionList = defaultQuestionUnit.getQuestionOptionList();
|
|
|
+ if (questionOptionList != null && !questionOptionList.isEmpty()) {
|
|
|
+ for (int i = 0; i < questionOptionList.size(); i++) {
|
|
|
+ DefaultQuestionOption defaultQuestionOption = questionOptionList.get(i);
|
|
|
+ defaultQuestionOption.setBody(buildBody(defaultQuestionOption.getBody(), playTime));
|
|
|
}
|
|
|
}
|
|
|
}
|