|
@@ -4,6 +4,8 @@ import java.util.List;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
+import com.qmth.cqb.question.dao.QuesPkgPathRepo;
|
|
|
|
+import com.qmth.cqb.question.model.*;
|
|
import org.apache.commons.lang3.StringEscapeUtils;
|
|
import org.apache.commons.lang3.StringEscapeUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
|
|
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
|
|
@@ -25,10 +27,6 @@ import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
|
|
import com.qmth.cqb.base.dao.CourseRepo;
|
|
import com.qmth.cqb.base.dao.CourseRepo;
|
|
import com.qmth.cqb.question.dao.QuesRepo;
|
|
import com.qmth.cqb.question.dao.QuesRepo;
|
|
import com.qmth.cqb.question.dao.QuestionAudioRepo;
|
|
import com.qmth.cqb.question.dao.QuestionAudioRepo;
|
|
-import com.qmth.cqb.question.model.QuesOption;
|
|
|
|
-import com.qmth.cqb.question.model.Question;
|
|
|
|
-import com.qmth.cqb.question.model.QuestionAudio;
|
|
|
|
-import com.qmth.cqb.question.model.QuestionSearchCondition;
|
|
|
|
import com.qmth.cqb.question.service.QuesService;
|
|
import com.qmth.cqb.question.service.QuesService;
|
|
import com.qmth.cqb.question.service.QuestionAudioService;
|
|
import com.qmth.cqb.question.service.QuestionAudioService;
|
|
import com.qmth.cqb.utils.CommonUtils;
|
|
import com.qmth.cqb.utils.CommonUtils;
|
|
@@ -56,6 +54,9 @@ public class QuesServiceImpl implements QuesService{
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private CourseRepo courseRepo;
|
|
private CourseRepo courseRepo;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private QuesPkgPathRepo quesPkgPathRepo;
|
|
|
|
|
|
private static WordprocessingMLPackage wordMLPackage = null;
|
|
private static WordprocessingMLPackage wordMLPackage = null;
|
|
|
|
|
|
@@ -288,7 +289,7 @@ public class QuesServiceImpl implements QuesService{
|
|
question.setQuesBodyWord(null);
|
|
question.setQuesBodyWord(null);
|
|
question.setQuesAnswerWord(null);
|
|
question.setQuesAnswerWord(null);
|
|
question.setQuesAnswerAnalysisWord(null);
|
|
question.setQuesAnswerAnalysisWord(null);
|
|
- question.setQuesPkg(new byte[0]);
|
|
|
|
|
|
+// question.setQuesPkg(new byte[0]);
|
|
String newQuesBody = question.getQuesBody().replaceAll("<span>", "").replaceAll("</span>", "")
|
|
String newQuesBody = question.getQuesBody().replaceAll("<span>", "").replaceAll("</span>", "")
|
|
.replaceAll("###", "______");
|
|
.replaceAll("###", "______");
|
|
question.setQuesBody(newQuesBody);
|
|
question.setQuesBody(newQuesBody);
|
|
@@ -317,7 +318,10 @@ public class QuesServiceImpl implements QuesService{
|
|
updateQuesWordUnit(wordMLPackage, subQues);
|
|
updateQuesWordUnit(wordMLPackage, subQues);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- question.setQuesPkg(DocxProcessUtil.getPkgByte(wordMLPackage));
|
|
|
|
|
|
+ byte [] pkgByte = DocxProcessUtil.getPkgByte(wordMLPackage);
|
|
|
|
+ QuestionPkgPath quesPkgPath = quesPkgPathRepo.save(new QuestionPkgPath(pkgByte));
|
|
|
|
+ question.setQuesPkgPathId(quesPkgPath.getId());
|
|
|
|
+ pkgByte = null;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
@@ -347,7 +351,10 @@ public class QuesServiceImpl implements QuesService{
|
|
DocxProcessUtil.initTmpPackage(wordMLPackage);
|
|
DocxProcessUtil.initTmpPackage(wordMLPackage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- question.setQuesPkg(DocxProcessUtil.getPkgByte(wordMLPackage));
|
|
|
|
|
|
+ byte [] pkgByte = DocxProcessUtil.getPkgByte(wordMLPackage);
|
|
|
|
+ QuestionPkgPath quesPkgPath = quesPkgPathRepo.save(new QuestionPkgPath(pkgByte));
|
|
|
|
+ question.setQuesPkgPathId(quesPkgPath.getId());
|
|
|
|
+ pkgByte = null;
|
|
}
|
|
}
|
|
|
|
|
|
private String makeQuesAnswerWord(String quesAnswer){
|
|
private String makeQuesAnswerWord(String quesAnswer){
|