|
@@ -13,6 +13,8 @@ import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
import com.qmth.cqb.base.dao.CourseRepo;
|
|
import com.qmth.cqb.base.dao.CourseRepo;
|
|
import com.qmth.cqb.base.model.Course;
|
|
import com.qmth.cqb.base.model.Course;
|
|
@@ -206,6 +208,8 @@ public class ImportPaperService {
|
|
*/
|
|
*/
|
|
|
|
|
|
public Paper processImportPaper(Paper paper,AccessUser user,File file) throws Exception {
|
|
public Paper processImportPaper(Paper paper,AccessUser user,File file) throws Exception {
|
|
|
|
+ //得到前台的课程代码
|
|
|
|
+ String courseNo = paper.getCourseNo();
|
|
WordprocessingMLPackage wordMLPackage;
|
|
WordprocessingMLPackage wordMLPackage;
|
|
WordprocessingMLPackage tmpWordMlPackage;
|
|
WordprocessingMLPackage tmpWordMlPackage;
|
|
//WordprocessingMLPackage writePkg;
|
|
//WordprocessingMLPackage writePkg;
|
|
@@ -241,7 +245,7 @@ public class ImportPaperService {
|
|
continue;
|
|
continue;
|
|
} else if (isMainQuesHeader(pText)) {
|
|
} else if (isMainQuesHeader(pText)) {
|
|
// 处理大题头信息
|
|
// 处理大题头信息
|
|
- processMainQuesHeader(pList, importPaperCheck.index, importPaperCheck);
|
|
|
|
|
|
+ processMainQuesHeader(pList, importPaperCheck.index, importPaperCheck,courseNo);
|
|
// 校验大题头信息
|
|
// 校验大题头信息
|
|
if (!checkQuesHeader(importPaperCheck)) {
|
|
if (!checkQuesHeader(importPaperCheck)) {
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
@@ -477,7 +481,7 @@ public class ImportPaperService {
|
|
* @param importPaperCheck
|
|
* @param importPaperCheck
|
|
* @throws PaperException
|
|
* @throws PaperException
|
|
*/
|
|
*/
|
|
- public void processMainQuesHeader(List<Object> pList, int index, ImportPaperCheck importPaperCheck) throws PaperException {
|
|
|
|
|
|
+ public void processMainQuesHeader(List<Object> pList, int index, ImportPaperCheck importPaperCheck,String courseNo) throws PaperException {
|
|
int i = 0;
|
|
int i = 0;
|
|
for (i = index; i < pList.size(); i++) {
|
|
for (i = index; i < pList.size(); i++) {
|
|
P pHeader = (P) pList.get(i);
|
|
P pHeader = (P) pList.get(i);
|
|
@@ -489,6 +493,17 @@ public class ImportPaperService {
|
|
importPaperCheck.setErrorInfo("[试题分类]的下一题头应该是[题型],当前读到的信息为:“" +nextTmpText+"”,请检查word中格式问题");
|
|
importPaperCheck.setErrorInfo("[试题分类]的下一题头应该是[题型],当前读到的信息为:“" +nextTmpText+"”,请检查word中格式问题");
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
}
|
|
}
|
|
|
|
+ List<String> paperList = Stream.of(tmpText.split("_")).collect(Collectors.toList());
|
|
|
|
+ //获取[试题分类]中的课程代码
|
|
|
|
+ String impCourseCode = paperList.get(1);
|
|
|
|
+ if(StringUtils.isBlank(impCourseCode)){
|
|
|
|
+ importPaperCheck.setErrorInfo("[试题分类]中没有课程代码,当前读到的信息为:“" +tmpText+"”,请检查word中格式问题");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ if(!courseNo.equals(impCourseCode)){
|
|
|
|
+ importPaperCheck.setErrorInfo("[试题分类]中的课程代码与指定的课程代码不一样,当前读到的信息为:“" +tmpText+"”,请检查word中格式问题");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
importPaperCheck.setQuesGroup(getContent(tmpText,ImportPaperMsg.questionClassify_word));
|
|
importPaperCheck.setQuesGroup(getContent(tmpText,ImportPaperMsg.questionClassify_word));
|
|
} else if (tmpText.startsWith(ImportPaperMsg.questionType_word)) {
|
|
} else if (tmpText.startsWith(ImportPaperMsg.questionType_word)) {
|
|
if(!nextTmpText.startsWith(ImportPaperMsg.questionName_word)){
|
|
if(!nextTmpText.startsWith(ImportPaperMsg.questionName_word)){
|