|
@@ -994,20 +994,21 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
//获取选项
|
|
//获取选项
|
|
List<QuesOptionDto> quesOptionDtos = paperDetailUnitDto.getQuesOptions();
|
|
List<QuesOptionDto> quesOptionDtos = paperDetailUnitDto.getQuesOptions();
|
|
//添加题干
|
|
//添加题干
|
|
- body = startWithP(paperDetailUnitDto.getQuesBody(), paperDetailUnitDto.getNumber());
|
|
|
|
|
|
+ body = startWithP(paperDetailUnitDto.getQuesBody(), paperDetailUnitDto.getNumber(),false);
|
|
answerHtml.append(body);
|
|
answerHtml.append(body);
|
|
//添加选项
|
|
//添加选项
|
|
for(QuesOptionDto quesOptionDto:quesOptionDtos){
|
|
for(QuesOptionDto quesOptionDto:quesOptionDtos){
|
|
- option = startWithP(quesOptionDto.getOptionBody(),Integer.parseInt(quesOptionDto.getNumber()));
|
|
|
|
|
|
+ option = startWithP(quesOptionDto.getOptionBody(),Integer.parseInt(quesOptionDto.getNumber()),true);
|
|
answerHtml.append(option);
|
|
answerHtml.append(option);
|
|
}
|
|
}
|
|
- answer = startWithP(paperDetailUnitDto.getAnswer(), -1);
|
|
|
|
|
|
+ answer = startWithP(paperDetailUnitDto.getAnswer(), -1,false);
|
|
answerHtml.append(answer);
|
|
answerHtml.append(answer);
|
|
}
|
|
}
|
|
//7.如果为套题
|
|
//7.如果为套题
|
|
else if(paperDetailUnitDto.getSubQuestions()!=null && paperDetailUnitDto.getSubQuestions().size()>0){
|
|
else if(paperDetailUnitDto.getSubQuestions()!=null && paperDetailUnitDto.getSubQuestions().size()>0){
|
|
//添加主题干
|
|
//添加主题干
|
|
- String BigBody = startWithP(paperDetailUnitDto.getQuesBody(),-1);
|
|
|
|
|
|
+ String BigBody = startWithP(paperDetailUnitDto.getQuesBody(),-1,false);
|
|
|
|
+ answerHtml.append(BigBody);
|
|
List<SubQuestionDto> subQuestionDtos = paperDetailUnitDto.getSubQuestions();
|
|
List<SubQuestionDto> subQuestionDtos = paperDetailUnitDto.getSubQuestions();
|
|
for(SubQuestionDto subQuestionDto:subQuestionDtos){
|
|
for(SubQuestionDto subQuestionDto:subQuestionDtos){
|
|
//如果子题为单选或者多选
|
|
//如果子题为单选或者多选
|
|
@@ -1015,30 +1016,30 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
//获取选项
|
|
//获取选项
|
|
List<QuesOptionDto> quesOptionDtos = subQuestionDto.getQuesOptions();
|
|
List<QuesOptionDto> quesOptionDtos = subQuestionDto.getQuesOptions();
|
|
//添加题干
|
|
//添加题干
|
|
- body = startWithP(subQuestionDto.getQuesBody(), subQuestionDto.getNumber());
|
|
|
|
|
|
+ body = startWithP(subQuestionDto.getQuesBody(), subQuestionDto.getNumber(),false);
|
|
answerHtml.append(body);
|
|
answerHtml.append(body);
|
|
//添加选项
|
|
//添加选项
|
|
for(QuesOptionDto quesOptionDto:quesOptionDtos){
|
|
for(QuesOptionDto quesOptionDto:quesOptionDtos){
|
|
- option = startWithP(quesOptionDto.getOptionBody(),Integer.parseInt(quesOptionDto.getNumber()));
|
|
|
|
|
|
+ option = startWithP(quesOptionDto.getOptionBody(),Integer.parseInt(quesOptionDto.getNumber()),true);
|
|
answerHtml.append(option);
|
|
answerHtml.append(option);
|
|
}
|
|
}
|
|
- answer = startWithP(subQuestionDto.getQuesAnswer(), -1);
|
|
|
|
|
|
+ answer = startWithP(subQuestionDto.getQuesAnswer(), -1,false);
|
|
answerHtml.append(answer);
|
|
answerHtml.append(answer);
|
|
}else {
|
|
}else {
|
|
//添加题干
|
|
//添加题干
|
|
- body = startWithP(subQuestionDto.getQuesBody(), subQuestionDto.getNumber());
|
|
|
|
|
|
+ body = startWithP(subQuestionDto.getQuesBody(), subQuestionDto.getNumber(),false);
|
|
answerHtml.append(body);
|
|
answerHtml.append(body);
|
|
//添加答案
|
|
//添加答案
|
|
- answer = startWithP(subQuestionDto.getQuesAnswer(), -1);
|
|
|
|
|
|
+ answer = startWithP(subQuestionDto.getQuesAnswer(), -1,false);
|
|
answerHtml.append(answer);
|
|
answerHtml.append(answer);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
//添加题干
|
|
//添加题干
|
|
- body = startWithP(paperDetailUnitDto.getQuesBody(), paperDetailUnitDto.getNumber());
|
|
|
|
|
|
+ body = startWithP(paperDetailUnitDto.getQuesBody(), paperDetailUnitDto.getNumber(),false);
|
|
answerHtml.append(body);
|
|
answerHtml.append(body);
|
|
//添加答案
|
|
//添加答案
|
|
- answer = startWithP(paperDetailUnitDto.getAnswer(), -1);
|
|
|
|
|
|
+ answer = startWithP(paperDetailUnitDto.getAnswer(), -1,false);
|
|
answerHtml.append(answer);
|
|
answerHtml.append(answer);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1046,18 +1047,26 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
return answerHtml.toString();
|
|
return answerHtml.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- public String startWithP(String s,Integer number){
|
|
|
|
|
|
+ public String startWithP(String s,Integer number,boolean option){
|
|
if(number == -1){
|
|
if(number == -1){
|
|
if(s.startsWith("<p>")){
|
|
if(s.startsWith("<p>")){
|
|
s = s.replaceAll("<p>","<p style=\"margin-left:40px;\">").replaceFirst("<p style=\"margin-left:40px;\">", "<p style=\"margin-left:20px;\">" + "答案:");
|
|
s = s.replaceAll("<p>","<p style=\"margin-left:40px;\">").replaceFirst("<p style=\"margin-left:40px;\">", "<p style=\"margin-left:20px;\">" + "答案:");
|
|
}else{
|
|
}else{
|
|
- s = "<p style=\"margin-left:20px;backgroud-color:red;\">" + "答案:" + s + "</p>";
|
|
|
|
|
|
+ s = "<p style=\"margin-left:20px;color:red;\">" + "答案:" + s + "</p>";
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
- if(s.startsWith("<p>")){
|
|
|
|
- s = s.replaceAll("<p>","<p style=\"margin-left:40px;\">").replaceFirst("<p style=\"margin-left:40px;\">", "<p style=\"margin-left:20px;\">" + CommonUtils.getOptionNum(number) + ".");
|
|
|
|
- }else{
|
|
|
|
- s = "<p style=\"margin-left:20px;\">" + CommonUtils.getOptionNum(number) + "." + s + "</p>";
|
|
|
|
|
|
+ if(option){
|
|
|
|
+ if(s.startsWith("<p>")){
|
|
|
|
+ s = s.replaceAll("<p>","<p style=\"margin-left:40px;\">").replaceFirst("<p style=\"margin-left:40px;\">", "<p style=\"margin-left:20px;\">" + CommonUtils.getOptionNum(number) + ".");
|
|
|
|
+ }else{
|
|
|
|
+ s = "<p style=\"margin-left:20px;\">" + number + "." + s + "</p>";
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if(s.startsWith("<p>")){
|
|
|
|
+ s = s.replaceAll("<p>","<p style=\"margin-left:40px;\">").replaceFirst("<p style=\"margin-left:40px;\">", "<p style=\"margin-left:20px;\">" + CommonUtils.getOptionNum(number) + ".");
|
|
|
|
+ }else{
|
|
|
|
+ s = "<p style=\"margin-left:20px;\">" + number + "." + s + "</p>";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return s;
|
|
return s;
|