|
@@ -5,7 +5,6 @@ import java.io.File;
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.math.RoundingMode;
|
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -1232,7 +1231,60 @@ public class PaperServiceImpl implements PaperService{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> getPaperPDF(String paperId) {
|
|
|
|
+ PaperExp paperExp = getPaperDto(paperId);
|
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
+ map.put("courseName", paperExp.getCourseName());
|
|
|
|
+ map.put("courseNo", paperExp.getCourseNo());
|
|
|
|
+ List<String> htmlList = new ArrayList<String>();
|
|
|
|
+ if(paperExp.getPaperDetails() != null && paperExp.getPaperDetails().size()>0){
|
|
|
|
+ for(PaperDetailExp paperDetail:paperExp.getPaperDetails()){
|
|
|
|
+ //添加大题标题
|
|
|
|
+ if(StringUtils.isBlank(paperDetail.getTitle())){
|
|
|
|
+ htmlList.add("<p>"+paperDetail.getCnNum()+"、"+paperDetail.getName()+"</p>");
|
|
|
|
+ }else {
|
|
|
|
+ htmlList.add("<p>"+paperDetail.getCnNum()+"、"+paperDetail.getName()+paperDetail.getTitle()+"</p>");
|
|
|
|
+ }
|
|
|
|
+ if(paperDetail.getPaperDetailUnits() != null && paperDetail.getPaperDetailUnits().size()>0){
|
|
|
|
+ for(PaperDetailUnitExp paperDetailUnitExp:paperDetail.getPaperDetailUnits()){
|
|
|
|
+ Question question = paperDetailUnitExp.getQuestion();
|
|
|
|
+ //添加题干
|
|
|
|
+ String questionBody = CommonUtils.deleteHtmlP(paperDetailUnitExp.getNumber()+"."+question.getQuesBody()+"("+paperDetailUnitExp.getScore()+"分)");
|
|
|
|
+ htmlList.add("<p>"+questionBody+"</p>");
|
|
|
|
+ //判断是否为选择题
|
|
|
|
+ if(paperDetailUnitExp.getQuestionType()==QuesStructType.SINGLE_ANSWER_QUESTION || paperDetailUnitExp.getQuestionType()==QuesStructType.MULTIPLE_ANSWER_QUESTION){
|
|
|
|
+ for(QuesOption quesOption:question.getQuesOptions()){
|
|
|
|
+ //添加选项
|
|
|
|
+ String questionOption = CommonUtils.deleteHtmlP(CommonUtils.getOptionNum(Integer.parseInt(quesOption.getNumber())-1)+"."+quesOption.getOptionBody());
|
|
|
|
+ htmlList.add("<p>"+questionOption+"</p>");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //判断是否为套题
|
|
|
|
+ if(paperDetailUnitExp.getQuestionType()==QuesStructType.NESTED_ANSWER_QUESTION){
|
|
|
|
+ //得到子题
|
|
|
|
+ List<Question> subQuestions = question.getSubQuestions();
|
|
|
|
+ for(Question subQuestion:subQuestions){
|
|
|
|
+ //添加子题题干
|
|
|
|
+ String subQuestionBody = CommonUtils.deleteHtmlP(subQuestion.getQuesParams().get("number")+"."+subQuestion.getQuesBody()+"("+subQuestion.getScore()+"分)");
|
|
|
|
+ htmlList.add("<p>"+subQuestionBody+"</p>");
|
|
|
|
+ //判断是否为选择题
|
|
|
|
+ if(subQuestion.getQuestionType()==QuesStructType.SINGLE_ANSWER_QUESTION || subQuestion.getQuestionType()==QuesStructType.BOOL_ANSWER_QUESTION){
|
|
|
|
+ for(QuesOption quesOption:subQuestion.getQuesOptions()){
|
|
|
|
+ //添加选项
|
|
|
|
+ String questionOption = CommonUtils.deleteHtmlP(CommonUtils.getOptionNum(Integer.parseInt(quesOption.getNumber())-1)+"."+quesOption.getOptionBody());
|
|
|
|
+ htmlList.add("<p>"+questionOption+"</p>");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ map.put("htmlList", htmlList);
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|