|
@@ -9,6 +9,8 @@ import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
import javax.xml.bind.JAXBElement;
|
|
|
|
|
@@ -299,16 +301,16 @@ public class InitPaperExpService {
|
|
|
if(paperDetailUnitExps != null && paperDetailUnitExps.size()>0){
|
|
|
for(int i = 0;i<paperDetailUnitExps.size();i++){
|
|
|
PaperDetailUnitExp paperDetailUnitExp = paperDetailUnitExps.get(i);
|
|
|
- //判断是否为套题
|
|
|
if(paperDetailUnitExp.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
|
|
|
List<Question> subQuestions = paperDetailUnitExp.getQuestion().getSubQuestions();
|
|
|
for(int j = 0;j<subQuestions.size();j++){
|
|
|
subQuestions.get(j).setNumber(number+j);
|
|
|
}
|
|
|
+ number += subQuestions.size();
|
|
|
}else {
|
|
|
paperDetailUnitExp.setNumber(number);
|
|
|
+ number++;
|
|
|
}
|
|
|
- number++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -657,16 +659,26 @@ public class InitPaperExpService {
|
|
|
if(tObj.getClass().equals(Text.class)){
|
|
|
Text text = (Text)tObj;
|
|
|
String str = text.getValue();
|
|
|
+ //1
|
|
|
str = str.replaceAll("###","______");
|
|
|
text.setValue(str);
|
|
|
- if(str.matches("##\\d{1,}##")){
|
|
|
- int curNum = num + index;
|
|
|
- text.setValue("___"+(curNum)+"___");
|
|
|
+ //2
|
|
|
+ Pattern pattern = Pattern.compile("##\\d{1,}##");
|
|
|
+ Matcher m = pattern.matcher(str);
|
|
|
+ while(m.find()){
|
|
|
+ int curNum = num + index;
|
|
|
+ String a = m.group();
|
|
|
+ str = str.replaceAll(a, "___"+(curNum)+"___");
|
|
|
+ text.setValue(str);
|
|
|
index++;
|
|
|
- }else if(str.startsWith("#") || str.equals("___")){
|
|
|
+ }
|
|
|
+ //3
|
|
|
+ if(str.startsWith("#") || str.equals("___")){
|
|
|
curMap.put(cur,str);
|
|
|
text.setValue("");
|
|
|
- }else if(str.matches("^\\d{1,}$")){
|
|
|
+ }
|
|
|
+ //4
|
|
|
+ if(str.matches("^\\d{1,}$")){
|
|
|
String preStr = curMap.get(cur - 1);
|
|
|
if(!StringUtils.isEmpty(preStr) && preStr.startsWith("#")){
|
|
|
int curNum = num + index;
|