|
@@ -14,6 +14,7 @@ import java.util.UUID;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -33,6 +34,7 @@ import com.qmth.themis.business.templete.TaskImportCommon;
|
|
import com.qmth.themis.business.templete.TaskImportTemplete;
|
|
import com.qmth.themis.business.templete.TaskImportTemplete;
|
|
import com.qmth.themis.business.util.JacksonUtil;
|
|
import com.qmth.themis.business.util.JacksonUtil;
|
|
import com.qmth.themis.business.util.OssUtil;
|
|
import com.qmth.themis.business.util.OssUtil;
|
|
|
|
+import com.qmth.themis.common.contanst.Constants;
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.util.FileUtil;
|
|
import com.qmth.themis.common.util.FileUtil;
|
|
@@ -136,9 +138,16 @@ public class TaskExamPaperImportTemplete implements TaskImportTemplete {
|
|
if (audioPlayCount != null) {
|
|
if (audioPlayCount != null) {
|
|
course.setAudioPlayCount(audioPlayCount);
|
|
course.setAudioPlayCount(audioPlayCount);
|
|
}
|
|
}
|
|
- if (objectiveShuffle != null || optionShuffle != null || audioPlayCount != null) {
|
|
|
|
- teExamCourseService.saveOrUpdate(course);
|
|
|
|
|
|
+ List<TEExamPaper> list=teExamPaperService.findByExamIdAndCourseCode(teExam.getId(), courseCode);
|
|
|
|
+ int hasAnswer=1;
|
|
|
|
+ for(TEExamPaper p:list) {
|
|
|
|
+ if(StringUtils.isBlank(p.getAnswerPath())) {
|
|
|
|
+ hasAnswer=0;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ course.setHasAnswer(hasAnswer);
|
|
|
|
+ teExamCourseService.saveOrUpdate(course);
|
|
}
|
|
}
|
|
|
|
|
|
private void disposePaperDir(String rootDir, TEExam teExam, TEExamCourse course, File paperDir,
|
|
private void disposePaperDir(String rootDir, TEExam teExam, TEExamCourse course, File paperDir,
|
|
@@ -168,6 +177,7 @@ public class TaskExamPaperImportTemplete implements TaskImportTemplete {
|
|
paper = new TEExamPaper();
|
|
paper = new TEExamPaper();
|
|
Long createId = (Long) map.get("createId");
|
|
Long createId = (Long) map.get("createId");
|
|
JSONObject paperJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
|
|
JSONObject paperJson = JSONObject.parseObject(FileUtil.readFileContent(paperFile));
|
|
|
|
+ paper.setId(Constants.idGen.next());
|
|
paper.setName(paperJson.getString("name"));
|
|
paper.setName(paperJson.getString("name"));
|
|
paper.setTotalScore(paperJson.getDouble("totalScore"));
|
|
paper.setTotalScore(paperJson.getDouble("totalScore"));
|
|
paper.setDecryptSecret(RandomStringUtils.randomAlphanumeric(16));
|
|
paper.setDecryptSecret(RandomStringUtils.randomAlphanumeric(16));
|