|
@@ -11,6 +11,8 @@ import java.util.Map;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
+import com.netflix.infix.lang.infix.antlr.EventFilterParser.boolean_expr_return;
|
|
|
|
+import com.netflix.infix.lang.infix.antlr.EventFilterParser.null_predicate_return;
|
|
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;
|
|
import com.qmth.cqb.question.dao.QuesPkgPathRepo;
|
|
import com.qmth.cqb.question.dao.QuesPkgPathRepo;
|
|
@@ -26,20 +28,26 @@ import org.docx4j.wml.P;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.data.domain.Example;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
|
+import com.qmth.cqb.paper.dao.CoursePropertyRepo;
|
|
import com.qmth.cqb.paper.dao.PaperDetailRepo;
|
|
import com.qmth.cqb.paper.dao.PaperDetailRepo;
|
|
import com.qmth.cqb.paper.dao.PaperDetailUnitRepo;
|
|
import com.qmth.cqb.paper.dao.PaperDetailUnitRepo;
|
|
import com.qmth.cqb.paper.dao.PaperRepo;
|
|
import com.qmth.cqb.paper.dao.PaperRepo;
|
|
|
|
+import com.qmth.cqb.paper.dao.PropertyRepo;
|
|
|
|
+import com.qmth.cqb.paper.model.CourseProperty;
|
|
import com.qmth.cqb.paper.model.ImportPaperCheck;
|
|
import com.qmth.cqb.paper.model.ImportPaperCheck;
|
|
import com.qmth.cqb.paper.model.ImportPaperMsg;
|
|
import com.qmth.cqb.paper.model.ImportPaperMsg;
|
|
import com.qmth.cqb.paper.model.Paper;
|
|
import com.qmth.cqb.paper.model.Paper;
|
|
import com.qmth.cqb.paper.model.PaperDetail;
|
|
import com.qmth.cqb.paper.model.PaperDetail;
|
|
import com.qmth.cqb.paper.model.PaperDetailUnit;
|
|
import com.qmth.cqb.paper.model.PaperDetailUnit;
|
|
|
|
+import com.qmth.cqb.paper.model.Property;
|
|
import com.qmth.cqb.question.dao.QuesRepo;
|
|
import com.qmth.cqb.question.dao.QuesRepo;
|
|
import com.qmth.cqb.question.model.QuesOption;
|
|
import com.qmth.cqb.question.model.QuesOption;
|
|
|
|
+import com.qmth.cqb.question.model.QuesProperty;
|
|
import com.qmth.cqb.question.model.Question;
|
|
import com.qmth.cqb.question.model.Question;
|
|
import com.qmth.cqb.question.model.QuestionType;
|
|
import com.qmth.cqb.question.model.QuestionType;
|
|
import com.qmth.cqb.question.service.QuesService;
|
|
import com.qmth.cqb.question.service.QuesService;
|
|
@@ -91,6 +99,12 @@ public class ImportPaperService {
|
|
@Autowired
|
|
@Autowired
|
|
QuesPkgPathRepo quesPkgPathRepo;
|
|
QuesPkgPathRepo quesPkgPathRepo;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ CoursePropertyRepo coursePropertyRepo;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ PropertyRepo propertyRepo;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取上传文件
|
|
* 获取上传文件
|
|
*
|
|
*
|
|
@@ -264,16 +278,16 @@ public class ImportPaperService {
|
|
tmpWordMlPackage);
|
|
tmpWordMlPackage);
|
|
// 处理尾信息
|
|
// 处理尾信息
|
|
processQuesTail(pList, importPaperCheck.index, subQuesNum, question, paperDetailUnit,
|
|
processQuesTail(pList, importPaperCheck.index, subQuesNum, question, paperDetailUnit,
|
|
- importPaperCheck, tmpWordMlPackage, false);
|
|
|
|
|
|
+ importPaperCheck, tmpWordMlPackage, false,paper);
|
|
// 处理选择题的option--chenken 20170425
|
|
// 处理选择题的option--chenken 20170425
|
|
processSelectOption(question);
|
|
processSelectOption(question);
|
|
} else if (importPaperCheck.quesType.equals(ImportPaperMsg.nestedQuestion_word)) {
|
|
} else if (importPaperCheck.quesType.equals(ImportPaperMsg.nestedQuestion_word)) {
|
|
// 处理套题
|
|
// 处理套题
|
|
- processNestedQues(pList, importPaperCheck.index,question, paperDetailUnit, importPaperCheck,tmpWordMlPackage);
|
|
|
|
|
|
+ processNestedQues(pList, importPaperCheck.index,question, paperDetailUnit, importPaperCheck,tmpWordMlPackage,paper);
|
|
} else {
|
|
} else {
|
|
// 处理其他题型
|
|
// 处理其他题型
|
|
processQuesBody(pList, importPaperCheck.index, subQuesNum,question, importPaperCheck, tmpWordMlPackage);
|
|
processQuesBody(pList, importPaperCheck.index, subQuesNum,question, importPaperCheck, tmpWordMlPackage);
|
|
- processQuesTail(pList, importPaperCheck.index, subQuesNum, question, paperDetailUnit,importPaperCheck, tmpWordMlPackage, false);
|
|
|
|
|
|
+ processQuesTail(pList, importPaperCheck.index, subQuesNum, question, paperDetailUnit,importPaperCheck, tmpWordMlPackage, false,paper);
|
|
}
|
|
}
|
|
// 设置WordMlPackage二进制数据
|
|
// 设置WordMlPackage二进制数据
|
|
byte[] pkgByte = getZipResource(wordMLPackage,question);
|
|
byte[] pkgByte = getZipResource(wordMLPackage,question);
|
|
@@ -652,11 +666,21 @@ public class ImportPaperService {
|
|
*/
|
|
*/
|
|
public void processQuesTail(List<Object> pList, int index, int subQuesNum, Question question,
|
|
public void processQuesTail(List<Object> pList, int index, int subQuesNum, Question question,
|
|
PaperDetailUnit paperDetailUnit, ImportPaperCheck importPaperCheck, WordprocessingMLPackage wordMLPackage,
|
|
PaperDetailUnit paperDetailUnit, ImportPaperCheck importPaperCheck, WordprocessingMLPackage wordMLPackage,
|
|
- boolean isNested) throws Exception {
|
|
|
|
|
|
+ boolean isNested,Paper paper) throws Exception {
|
|
|
|
|
|
StringBuilder answerWordML = new StringBuilder("");
|
|
StringBuilder answerWordML = new StringBuilder("");
|
|
StringBuilder answerHTML = new StringBuilder("");
|
|
StringBuilder answerHTML = new StringBuilder("");
|
|
- String quesScore = "";
|
|
|
|
|
|
+ String quesScore = null;
|
|
|
|
+ //定义一级属性
|
|
|
|
+ String firstProperty = null;
|
|
|
|
+ //定义二级级属性
|
|
|
|
+ String secondProperty = null;
|
|
|
|
+ //定义难度
|
|
|
|
+ Double difficulty = null;
|
|
|
|
+ //定义公开度
|
|
|
|
+ Boolean publicity = null;
|
|
|
|
+ //定义试题属性集合
|
|
|
|
+ List<QuesProperty> quesProperties = new ArrayList<QuesProperty>();
|
|
// Map<String, String> quesParams = new HashMap<String, String>();
|
|
// Map<String, String> quesParams = new HashMap<String, String>();
|
|
int i = 0;
|
|
int i = 0;
|
|
// 是否刚刚检测到答案内容
|
|
// 是否刚刚检测到答案内容
|
|
@@ -693,7 +717,40 @@ public class ImportPaperService {
|
|
// 检测到分数开始段落
|
|
// 检测到分数开始段落
|
|
quesScore = getContent(tmpText, ImportPaperMsg.subQuesScore_word);
|
|
quesScore = getContent(tmpText, ImportPaperMsg.subQuesScore_word);
|
|
answerStart = false;
|
|
answerStart = false;
|
|
- } else if (isHeader(tmpText) || tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
|
|
|
|
+ }
|
|
|
|
+ //-------------------------------------------------------------------------------------------------------
|
|
|
|
+ else if (tmpText.startsWith(ImportPaperMsg.first_property)) {
|
|
|
|
+ // 检测到一级属性开始段落
|
|
|
|
+ firstProperty = getContent(tmpText, ImportPaperMsg.first_property);
|
|
|
|
+ if(StringUtils.isBlank(firstProperty)){
|
|
|
|
+ firstProperty = "";
|
|
|
|
+ }
|
|
|
|
+ answerStart = false;
|
|
|
|
+ }
|
|
|
|
+ else if (tmpText.startsWith(ImportPaperMsg.second_property)) {
|
|
|
|
+ // 检测到二级属性开始段落
|
|
|
|
+ secondProperty = getContent(tmpText, ImportPaperMsg.second_property);
|
|
|
|
+ if(StringUtils.isBlank(secondProperty)){
|
|
|
|
+ secondProperty = "";
|
|
|
|
+ }
|
|
|
|
+ answerStart = false;
|
|
|
|
+ }
|
|
|
|
+ else if (tmpText.startsWith(ImportPaperMsg.difficulty)) {
|
|
|
|
+ // 检测到难度开始段落
|
|
|
|
+ String dif = getContent(tmpText, ImportPaperMsg.difficulty);
|
|
|
|
+ checkDiffculty(difficulty,dif,importPaperCheck,subQuesNum);
|
|
|
|
+ question.setDifficulty(difficulty);
|
|
|
|
+ answerStart = false;
|
|
|
|
+ }
|
|
|
|
+ else if (tmpText.startsWith(ImportPaperMsg.publicity)) {
|
|
|
|
+ // 检测到公安度开始段落
|
|
|
|
+ String pub = getContent(tmpText, ImportPaperMsg.publicity);
|
|
|
|
+ checkPublicity(publicity,pub,importPaperCheck,subQuesNum);
|
|
|
|
+ question.setPublicity(publicity);
|
|
|
|
+ answerStart = false;
|
|
|
|
+ }
|
|
|
|
+ //*******************************************************************************************************
|
|
|
|
+ else if (isHeader(tmpText) || tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
// 检测到其他特殊段落或下一题直接退出
|
|
// 检测到其他特殊段落或下一题直接退出
|
|
break;
|
|
break;
|
|
} else if (answerStart) {
|
|
} else if (answerStart) {
|
|
@@ -719,9 +776,113 @@ public class ImportPaperService {
|
|
if (!isNested && quesScore.matches("^\\d+(\\.\\d+)?$")) {
|
|
if (!isNested && quesScore.matches("^\\d+(\\.\\d+)?$")) {
|
|
paperDetailUnit.setScore(Double.parseDouble(quesScore));
|
|
paperDetailUnit.setScore(Double.parseDouble(quesScore));
|
|
}
|
|
}
|
|
|
|
+ //校验小题尾信息是否含有"一节属性","二级属性","难度","公开"
|
|
|
|
+ checkAttributeIsFull(firstProperty,secondProperty,difficulty,publicity,importPaperCheck,subQuesNum);
|
|
|
|
+ //试题一级属性与二级属性校验
|
|
|
|
+ checkProperty(firstProperty,secondProperty,importPaperCheck,subQuesNum,paper,quesProperties);
|
|
|
|
+ question.setQuesProperties(quesProperties);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
|
|
+ private void checkProperty(String firstProperty, String secondProperty,
|
|
|
|
+ ImportPaperCheck importPaperCheck, int subQuesNum,Paper paper, List<QuesProperty> quesProperties) throws Exception{
|
|
|
|
+ //一级属性为空,二级属性有值
|
|
|
|
+ if(StringUtils.isBlank(firstProperty) && StringUtils.isNotBlank(secondProperty)){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性值为空,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ //一级属性,二级属性都有值
|
|
|
|
+ else if(StringUtils.isNotBlank(firstProperty) && StringUtils.isNotBlank(secondProperty)){
|
|
|
|
+ //根据课程查询所有课程属性树
|
|
|
|
+ List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseId(Long.parseLong(paper.getCourse().getId()));
|
|
|
|
+ for(CourseProperty courseProperty:courseProperties){
|
|
|
|
+ //查询一级属性是否存在
|
|
|
|
+ Property propertyParent = new Property(firstProperty,0l,courseProperty.getId());
|
|
|
|
+ //存在一级属性
|
|
|
|
+ List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
|
|
+ if(propertieParents != null || propertieParents.size()>0){
|
|
|
|
+ for(Property proParent:propertieParents){
|
|
|
|
+ Property propertySon = new Property(secondProperty,proParent.getId(),courseProperty.getId());
|
|
|
|
+ //查询二级属性
|
|
|
|
+ List<Property> propertieSons = propertyRepo.findAll(Example.of(propertySon));
|
|
|
|
+ //存在二级属性
|
|
|
|
+ if(propertieSons!=null && propertieSons.size()>0){
|
|
|
|
+ for(Property proSon:propertieSons){
|
|
|
|
+ //根据二级查询一级
|
|
|
|
+ Property prParent = propertyRepo.findOne(proSon.getParentId());
|
|
|
|
+ //保存一级和二级属性
|
|
|
|
+ QuesProperty quesProperty = new QuesProperty(prParent, proSon);
|
|
|
|
+ quesProperties.add(quesProperty);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题二级属性值不存在,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性值不存在,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //一级属性有值,二级属性为空
|
|
|
|
+ else {
|
|
|
|
+ //根据课程查询所有课程属性树
|
|
|
|
+ List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseId(Long.parseLong(paper.getCourse().getId()));
|
|
|
|
+ for(CourseProperty courseProperty:courseProperties){
|
|
|
|
+ //查询一级属性
|
|
|
|
+ Property propertyParent = new Property(firstProperty,0l,courseProperty.getId());
|
|
|
|
+ List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
|
|
+ //存在一级属性
|
|
|
|
+ if(propertieParents!=null && propertieParents.size()>0){
|
|
|
|
+ for(Property proParent:propertieParents){
|
|
|
|
+ //根据一级属性查询二级属性
|
|
|
|
+ List<Property> proSons = propertyRepo.findByParentIdOrderByNumber(proParent.getId());
|
|
|
|
+ //存在二级属性,报错
|
|
|
|
+ if(proSons!=null && proSons.size()>0){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题二级属性值为空,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }else {
|
|
|
|
+ //保存试题属性
|
|
|
|
+ QuesProperty quesProperty = new QuesProperty(proParent, null);
|
|
|
|
+ quesProperties.add(quesProperty);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性值不存在,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 校验小题尾信息是否含有"一节属性","二级属性","难度","公开"
|
|
|
|
+ * @param firstProperty
|
|
|
|
+ * @param secondProperty
|
|
|
|
+ * @param difficulty
|
|
|
|
+ * @param publicity
|
|
|
|
+ */
|
|
|
|
+ private void checkAttributeIsFull(String firstProperty,String secondProperty, Double difficulty,
|
|
|
|
+ Boolean publicity,ImportPaperCheck importPaperCheck,int subQuesNum) throws Exception{
|
|
|
|
+ if(firstProperty == null){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性缺失,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ if(secondProperty == null){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题二级属性缺失,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ if(difficulty == null){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题难度缺失,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ if(publicity == null){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题公开性缺失,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 处理选择题option信息
|
|
* 处理选择题option信息
|
|
*
|
|
*
|
|
* @param question
|
|
* @param question
|
|
@@ -753,7 +914,7 @@ public class ImportPaperService {
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
public void processNestedQues(List<Object> pList, int index,Question question, PaperDetailUnit paperDetailUnit,
|
|
public void processNestedQues(List<Object> pList, int index,Question question, PaperDetailUnit paperDetailUnit,
|
|
- ImportPaperCheck importPaperCheck, WordprocessingMLPackage wordMLPackage) throws Exception {
|
|
|
|
|
|
+ ImportPaperCheck importPaperCheck, WordprocessingMLPackage wordMLPackage,Paper paper) throws Exception {
|
|
// 题型
|
|
// 题型
|
|
String nestedQuesType = "";
|
|
String nestedQuesType = "";
|
|
// 设置套题题干
|
|
// 设置套题题干
|
|
@@ -792,13 +953,13 @@ public class ImportPaperService {
|
|
// 处理选项
|
|
// 处理选项
|
|
processQuesOption(pList, importPaperCheck.index, subQuesNum, subQues, importPaperCheck,wordMLPackage);
|
|
processQuesOption(pList, importPaperCheck.index, subQuesNum, subQues, importPaperCheck,wordMLPackage);
|
|
// 处理尾信息
|
|
// 处理尾信息
|
|
- processQuesTail(pList, importPaperCheck.index, subQuesNum, subQues, paperDetailUnit,importPaperCheck, wordMLPackage, true);
|
|
|
|
|
|
+ processQuesTail(pList, importPaperCheck.index, subQuesNum, subQues, paperDetailUnit,importPaperCheck, wordMLPackage, true,paper);
|
|
// 处理选择题的option--chenken 20170426
|
|
// 处理选择题的option--chenken 20170426
|
|
processSelectOption(subQues);
|
|
processSelectOption(subQues);
|
|
} else {
|
|
} else {
|
|
// 处理其他题型
|
|
// 处理其他题型
|
|
processQuesBody(pList, importPaperCheck.index, subQuesNum, subQues, importPaperCheck, wordMLPackage);
|
|
processQuesBody(pList, importPaperCheck.index, subQuesNum, subQues, importPaperCheck, wordMLPackage);
|
|
- processQuesTail(pList, importPaperCheck.index, subQuesNum, subQues, paperDetailUnit,importPaperCheck, wordMLPackage, true);
|
|
|
|
|
|
+ processQuesTail(pList, importPaperCheck.index, subQuesNum, subQues, paperDetailUnit,importPaperCheck, wordMLPackage, true,paper);
|
|
}
|
|
}
|
|
subQuesList.add(subQues);
|
|
subQuesList.add(subQues);
|
|
i = importPaperCheck.index - 1;
|
|
i = importPaperCheck.index - 1;
|
|
@@ -1060,6 +1221,52 @@ public class ImportPaperService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 校验试题难度
|
|
|
|
+ * @param difficulty
|
|
|
|
+ * @param tmpText
|
|
|
|
+ * @param importPaperCheck
|
|
|
|
+ * @param subQuesNum
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ private void checkDiffculty(Double difficulty,String tmpText,ImportPaperCheck importPaperCheck,int subQuesNum)throws Exception{
|
|
|
|
+ if(StringUtils.isBlank(tmpText)){
|
|
|
|
+ //如果为空,默认难度0.5
|
|
|
|
+ difficulty = 0.5;
|
|
|
|
+ }else if(!isInteger(tmpText) || (Double.parseDouble(tmpText)<1) || (Double.parseDouble(tmpText)>10)){
|
|
|
|
+ //如果不是整数,或者在1到10之间,就报错
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,试题难度只能是1到10之间整数");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }else {
|
|
|
|
+ difficulty = Double.parseDouble(tmpText)%10;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 校验试题公开度
|
|
|
|
+ * @param publicity
|
|
|
|
+ * @param tmpText
|
|
|
|
+ * @param importPaperCheck
|
|
|
|
+ * @param subQuesNum
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ private void checkPublicity(Boolean publicity,String tmpText,ImportPaperCheck importPaperCheck,int subQuesNum)throws Exception{
|
|
|
|
+ if(StringUtils.isBlank(tmpText)){
|
|
|
|
+ //如果为空,默认是公开
|
|
|
|
+ publicity = true;
|
|
|
|
+ }else if(!tmpText.equals("公开") || !tmpText.equals("非公开")){
|
|
|
|
+ //如果不是公开和非公开,就报错
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,试题公开度只能是公开和非公开");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }else {
|
|
|
|
+ if(tmpText.equals("非公开")){
|
|
|
|
+ publicity = false;
|
|
|
|
+ }else {
|
|
|
|
+ publicity = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 校验客观题答案完整性
|
|
* 校验客观题答案完整性
|
|
@@ -1208,15 +1415,17 @@ public class ImportPaperService {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args){
|
|
public static void main(String[] args){
|
|
- try {
|
|
|
|
- File file = new File("/Users/songyue/Downloads/行政组织学A卷.docx");
|
|
|
|
- File outFile = new File("/Users/songyue/Downloads/行政组织学A1卷.docx");
|
|
|
|
- WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(file);
|
|
|
|
- DocxProcessUtil.initPkgImage(wordMLPackage);
|
|
|
|
- wordMLPackage.save(outFile);
|
|
|
|
- } catch (Docx4JException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }finally {
|
|
|
|
- }
|
|
|
|
|
|
+ String s1 = null;
|
|
|
|
+ String s2 = " ";
|
|
|
|
+ boolean b = false;
|
|
|
|
+ if(s2 == null){
|
|
|
|
+ b = true;
|
|
|
|
+ }
|
|
|
|
+ System.out.println(b);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean isInteger(String str) {
|
|
|
|
+ Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
|
|
|
|
+ return pattern.matcher(str).matches();
|
|
|
|
+ }
|
|
}
|
|
}
|