|
@@ -23,6 +23,7 @@ import cn.com.qmth.examcloud.core.questions.service.export.ExportPaperAbstractSe
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
import main.java.com.UpYun;
|
|
import main.java.com.UpYun;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -433,10 +434,6 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取图片里面的路径,长度,宽度
|
|
* 获取图片里面的路径,长度,宽度
|
|
- *
|
|
|
|
- * @param s
|
|
|
|
- * @param str
|
|
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
private List<String> getImg(String s, String str) {
|
|
private List<String> getImg(String s, String str) {
|
|
String regex;
|
|
String regex;
|
|
@@ -533,93 +530,116 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void downQuestionDistribute(String courseNo, HttpServletResponse response) throws IOException {
|
|
|
|
|
|
+ public void downQuestionDistribute(String courseCode, HttpServletResponse response) throws IOException {
|
|
|
|
+ //生成导出Excle的list集合
|
|
|
|
+ List<QuestionDistributeDto> questionDistributes = this.downQuestionDistribute(courseCode);
|
|
|
|
+
|
|
|
|
+ final String fileName = courseCode + "试题分布.xlsx";
|
|
|
|
+ final String filePath = TEMP_FILE_EXP + File.separator + fileName;
|
|
|
|
+
|
|
|
|
+ //生成Excel导出
|
|
|
|
+ File tempFile = this.writeExcel(questionDistributes, filePath);
|
|
|
|
+ FileDisposeUtil.downloadFile(fileName, filePath, response);
|
|
|
|
+ FileUtils.deleteQuietly(tempFile);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void downQuestionDistributes(List<Course> courses) throws IOException {
|
|
|
|
+ if (CollectionUtils.isEmpty(courses)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (Course course : courses) {
|
|
|
|
+ List<QuestionDistributeDto> questionDistributes = this.downQuestionDistribute(course.getCode());
|
|
|
|
+ final String fileName = course.getCode() + "试题分布.xlsx";
|
|
|
|
+ final String filePath = TEMP_FILE_EXP + File.separator + fileName;
|
|
|
|
+ this.writeExcel(questionDistributes, filePath);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<QuestionDistributeDto> downQuestionDistribute(String courseCode) {
|
|
//1.生成导出Excle的list集合
|
|
//1.生成导出Excle的list集合
|
|
- List<QuestionDistributeDto> questionDistributeDtos = new ArrayList<QuestionDistributeDto>();
|
|
|
|
- //2.根据课程code查询课程属性集合
|
|
|
|
- List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCodeAndEnable(courseNo, true);
|
|
|
|
- //3.遍历课程属性集合,根据课程属性查询一级
|
|
|
|
- if (courseProperties != null && courseProperties.size() > 0) {
|
|
|
|
- for (CourseProperty courseProperty : courseProperties) {
|
|
|
|
- List<Property> parentProperties = propertyService.findPropertyParents(courseProperty.getId(), courseProperty.getOrgId());
|
|
|
|
- if (parentProperties != null && parentProperties.size() > 0) {
|
|
|
|
- for (Property parentProperty : parentProperties) {
|
|
|
|
- List<Property> sonProperties = propertyService.findPropertySons(parentProperty.getId());
|
|
|
|
- if (sonProperties != null && sonProperties.size() > 0) {
|
|
|
|
- for (Property sonProperty : sonProperties) {
|
|
|
|
- //单选题集合
|
|
|
|
- List<Question> sinList = questionList(courseNo, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
|
|
- //多选题集合
|
|
|
|
- List<Question> mulList = questionList(courseNo, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
|
|
- //判断题集合
|
|
|
|
- List<Question> bolList = questionList(courseNo, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
|
|
|
|
+ List<QuestionDistributeDto> questionDistributes = new ArrayList<>();
|
|
|
|
|
|
- List<Question> fillList = null;
|
|
|
|
- //fillList = questionList(courseNo, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, sonProperty);
|
|
|
|
- List<Question> textList = null;
|
|
|
|
- //textList = questionList(courseNo, courseProperty, QuesStructType.TEXT_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
|
|
|
|
+ //2.根据课程code查询课程属性集合
|
|
|
|
+ List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCodeAndEnable(courseCode, true);
|
|
|
|
+ if (CollectionUtils.isEmpty(courseProperties)) {
|
|
|
|
+ return questionDistributes;
|
|
|
|
+ }
|
|
|
|
|
|
- //计算所有题型数量
|
|
|
|
- Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
|
|
- QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), sonProperty.getName(), map);
|
|
|
|
- questionDistributeDtos.add(questionDistributeDto);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- //一级属性不为空,二级属性为空
|
|
|
|
|
|
+ //3.遍历课程属性集合,根据课程属性查询一级
|
|
|
|
+ for (CourseProperty courseProperty : courseProperties) {
|
|
|
|
+ List<Property> parentProperties = propertyService.findPropertyParents(courseProperty.getId(), courseProperty.getOrgId());
|
|
|
|
+ if (parentProperties != null && parentProperties.size() > 0) {
|
|
|
|
+ for (Property parentProperty : parentProperties) {
|
|
|
|
+ List<Property> sonProperties = propertyService.findPropertySons(parentProperty.getId());
|
|
|
|
+ if (sonProperties != null && sonProperties.size() > 0) {
|
|
|
|
+ for (Property sonProperty : sonProperties) {
|
|
//单选题集合
|
|
//单选题集合
|
|
- List<Question> sinList = questionList(courseNo, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
|
|
+ List<Question> sinList = questionList(courseCode, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
//多选题集合
|
|
//多选题集合
|
|
- List<Question> mulList = questionList(courseNo, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
|
|
+ List<Question> mulList = questionList(courseCode, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
//判断题集合
|
|
//判断题集合
|
|
- List<Question> bolList = questionList(courseNo, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
|
|
+ List<Question> bolList = questionList(courseCode, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
|
|
|
|
List<Question> fillList = null;
|
|
List<Question> fillList = null;
|
|
- //fillList = questionList(courseNo, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, null);
|
|
|
|
|
|
+ //fillList = questionList(courseCode, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, sonProperty);
|
|
List<Question> textList = null;
|
|
List<Question> textList = null;
|
|
- //textList = questionList(courseNo, courseProperty, QuesStructType.TEXT_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
|
|
+ //textList = questionList(courseCode, courseProperty, QuesStructType.TEXT_ANSWER_QUESTION, parentProperty, sonProperty);
|
|
|
|
|
|
//计算所有题型数量
|
|
//计算所有题型数量
|
|
Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
- QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), null, map);
|
|
|
|
- questionDistributeDtos.add(questionDistributeDto);
|
|
|
|
|
|
+ QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), sonProperty.getName(), map);
|
|
|
|
+ questionDistributes.add(questionDistributeDto);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //一级属性不为空,二级属性为空
|
|
|
|
+ //单选题集合
|
|
|
|
+ List<Question> sinList = questionList(courseCode, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
+ //多选题集合
|
|
|
|
+ List<Question> mulList = questionList(courseCode, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
+ //判断题集合
|
|
|
|
+ List<Question> bolList = questionList(courseCode, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
+
|
|
|
|
+ List<Question> fillList = null;
|
|
|
|
+ //fillList = questionList(courseCode, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, null);
|
|
|
|
+ List<Question> textList = null;
|
|
|
|
+ //textList = questionList(courseCode, courseProperty, QuesStructType.TEXT_ANSWER_QUESTION, parentProperty, null);
|
|
|
|
+
|
|
|
|
+ //计算所有题型数量
|
|
|
|
+ Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
|
|
+ QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), null, map);
|
|
|
|
+ questionDistributes.add(questionDistributeDto);
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- //一级属性为空
|
|
|
|
- QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), null, null, null);
|
|
|
|
- questionDistributeDtos.add(questionDistributeDto);
|
|
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //一级属性为空
|
|
|
|
+ QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), null, null, null);
|
|
|
|
+ questionDistributes.add(questionDistributeDto);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //生成Excel导出
|
|
|
|
- writeExcel(questionDistributeDtos, 21, courseNo, response);
|
|
|
|
|
|
+
|
|
|
|
+ return questionDistributes;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 数据源 questionDistributeDtos
|
|
|
|
- * Excel列数 cloumnCount
|
|
|
|
- *
|
|
|
|
- * @param questionDistributeDtos
|
|
|
|
- * @param cloumnCount
|
|
|
|
- * @throws IOException
|
|
|
|
- */
|
|
|
|
@SuppressWarnings("resource")
|
|
@SuppressWarnings("resource")
|
|
- private void writeExcel(List<QuestionDistributeDto> questionDistributeDtos, int cloumnCount, String courseNo, HttpServletResponse response) throws IOException {
|
|
|
|
|
|
+ private File writeExcel(List<QuestionDistributeDto> questionDistributes, String filePath) throws IOException {
|
|
//读取Excel模板
|
|
//读取Excel模板
|
|
InputStream in = this.getClass().getResourceAsStream("/quesDistinct.xlsx");
|
|
InputStream in = this.getClass().getResourceAsStream("/quesDistinct.xlsx");
|
|
//InputStream in = this.getClass().getResourceAsStream("/quesDistinctAll.xlsx");
|
|
//InputStream in = this.getClass().getResourceAsStream("/quesDistinctAll.xlsx");
|
|
|
|
|
|
- Workbook workBook = new XSSFWorkbook(in);
|
|
|
|
- //System.out.println(workBook.getAllNames());
|
|
|
|
//获取第一个工作页
|
|
//获取第一个工作页
|
|
|
|
+ Workbook workBook = new XSSFWorkbook(in);
|
|
Sheet sheet = workBook.getSheetAt(0);
|
|
Sheet sheet = workBook.getSheetAt(0);
|
|
- System.out.println(sheet.getSheetName());
|
|
|
|
|
|
+
|
|
//往Excel中写入数据,从第5行开始
|
|
//往Excel中写入数据,从第5行开始
|
|
- for (int i = 0; i < questionDistributeDtos.size(); i++) {
|
|
|
|
|
|
+ for (int i = 0; i < questionDistributes.size(); i++) {
|
|
//创建一行:从第五行开始,跳过表头
|
|
//创建一行:从第五行开始,跳过表头
|
|
Row row = sheet.createRow(i + 4);
|
|
Row row = sheet.createRow(i + 4);
|
|
|
|
+
|
|
//获取这行的记录
|
|
//获取这行的记录
|
|
- QuestionDistributeDto questionDistributeDto = questionDistributeDtos.get(i);
|
|
|
|
|
|
+ QuestionDistributeDto questionDistributeDto = questionDistributes.get(i);
|
|
|
|
+
|
|
//每列赋值
|
|
//每列赋值
|
|
row.createCell(0).setCellValue(questionDistributeDto.getCoursePropertyName());
|
|
row.createCell(0).setCellValue(questionDistributeDto.getCoursePropertyName());
|
|
row.createCell(1).setCellValue(questionDistributeDto.getFirstPropertyName());
|
|
row.createCell(1).setCellValue(questionDistributeDto.getFirstPropertyName());
|
|
@@ -637,12 +657,12 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- File file = new File(TEMP_FILE_EXP + File.separator + "试题分布.xlsx");
|
|
|
|
|
|
+
|
|
|
|
+ File file = new File(filePath);
|
|
OutputStream out = new FileOutputStream(file);
|
|
OutputStream out = new FileOutputStream(file);
|
|
workBook.write(out);
|
|
workBook.write(out);
|
|
out.close();
|
|
out.close();
|
|
- FileDisposeUtil.downloadFile(courseNo + "试题分布.xlsx", TEMP_FILE_EXP + File.separator + "试题分布.xlsx", response);
|
|
|
|
- FileUtils.deleteQuietly(file);
|
|
|
|
|
|
+ return file;
|
|
}
|
|
}
|
|
|
|
|
|
private Map<Long, Long> countQuesType(List<Question> sinList, List<Question> mulList, List<Question> bolList, List<Question> fillList, List<Question> textList) {
|
|
private Map<Long, Long> countQuesType(List<Question> sinList, List<Question> mulList, List<Question> bolList, List<Question> fillList, List<Question> textList) {
|
|
@@ -811,27 +831,32 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void downQuestionDistributeByPapers(String paperIds, HttpServletResponse response) throws IOException {
|
|
public void downQuestionDistributeByPapers(String paperIds, HttpServletResponse response) throws IOException {
|
|
- List<QuestionDistributeDto> questionDistributeDtos = new ArrayList<QuestionDistributeDto>();
|
|
|
|
|
|
+ List<QuestionDistributeDto> questionDistributes = new ArrayList<>();
|
|
|
|
+
|
|
//定义课程集合
|
|
//定义课程集合
|
|
- List<String> courseNos = new ArrayList<String>();
|
|
|
|
|
|
+ List<String> courseCodes = new ArrayList<>();
|
|
|
|
+
|
|
//定义试题集合
|
|
//定义试题集合
|
|
- List<Question> questions = new ArrayList<Question>();
|
|
|
|
- // 查询试卷集合
|
|
|
|
|
|
+ List<Question> questions = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ //查询试卷集合
|
|
String[] paperIdArray = paperIds.split(",");
|
|
String[] paperIdArray = paperIds.split(",");
|
|
for (int i = 0; i < paperIdArray.length; i++) {
|
|
for (int i = 0; i < paperIdArray.length; i++) {
|
|
Paper basePaper = Model.of(paperRepo.findById(paperIdArray[i]));
|
|
Paper basePaper = Model.of(paperRepo.findById(paperIdArray[i]));
|
|
- courseNos.add(basePaper.getCourse().getCode());
|
|
|
|
|
|
+ courseCodes.add(basePaper.getCourse().getCode());
|
|
//将小题全部取出来,只取一次,减少对数据库的查询
|
|
//将小题全部取出来,只取一次,减少对数据库的查询
|
|
List<PaperDetailUnit> allPaperDetailUnits = paperDetailUnitRepo.findByPaper(basePaper);
|
|
List<PaperDetailUnit> allPaperDetailUnits = paperDetailUnitRepo.findByPaper(basePaper);
|
|
for (PaperDetailUnit unit : allPaperDetailUnits) {
|
|
for (PaperDetailUnit unit : allPaperDetailUnits) {
|
|
- if (unit.getQuestionType().equals(QuesStructType.SINGLE_ANSWER_QUESTION) || unit.getQuestionType().equals(QuesStructType.MULTIPLE_ANSWER_QUESTION) || unit.getQuestionType().equals(QuesStructType.BOOL_ANSWER_QUESTION)) {
|
|
|
|
|
|
+ if (unit.getQuestionType().equals(QuesStructType.SINGLE_ANSWER_QUESTION) || unit.getQuestionType().equals(QuesStructType.MULTIPLE_ANSWER_QUESTION)
|
|
|
|
+ || unit.getQuestionType().equals(QuesStructType.BOOL_ANSWER_QUESTION)) {
|
|
questions.add(unit.getQuestion());
|
|
questions.add(unit.getQuestion());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
//根据课程code查询课程属性集合
|
|
//根据课程code查询课程属性集合
|
|
- for (String courseNo : courseNos) {
|
|
|
|
- List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCodeAndEnable(courseNo, true);
|
|
|
|
|
|
+ for (String courseCode : courseCodes) {
|
|
|
|
+ List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCodeAndEnable(courseCode, true);
|
|
//遍历课程属性集合,根据课程属性查询一级
|
|
//遍历课程属性集合,根据课程属性查询一级
|
|
if (courseProperties != null && courseProperties.size() > 0) {
|
|
if (courseProperties != null && courseProperties.size() > 0) {
|
|
for (CourseProperty courseProperty : courseProperties) {
|
|
for (CourseProperty courseProperty : courseProperties) {
|
|
@@ -842,11 +867,11 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
if (sonProperties != null && sonProperties.size() > 0) {
|
|
if (sonProperties != null && sonProperties.size() > 0) {
|
|
for (Property sonProperty : sonProperties) {
|
|
for (Property sonProperty : sonProperties) {
|
|
//单选题集合
|
|
//单选题集合
|
|
- List<Question> sinList = questionList2(courseNo, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, sonProperty, questions);
|
|
|
|
|
|
+ List<Question> sinList = questionList2(courseCode, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, sonProperty, questions);
|
|
//多选题集合
|
|
//多选题集合
|
|
- List<Question> mulList = questionList2(courseNo, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, sonProperty, questions);
|
|
|
|
|
|
+ List<Question> mulList = questionList2(courseCode, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, sonProperty, questions);
|
|
//判断题集合
|
|
//判断题集合
|
|
- List<Question> bolList = questionList2(courseNo, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, sonProperty, questions);
|
|
|
|
|
|
+ List<Question> bolList = questionList2(courseCode, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, sonProperty, questions);
|
|
|
|
|
|
List<Question> fillList = null;
|
|
List<Question> fillList = null;
|
|
//fillList = questionList2(courseNo, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, sonProperty, questions);
|
|
//fillList = questionList2(courseNo, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, sonProperty, questions);
|
|
@@ -856,16 +881,16 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
//计算所有题型数量
|
|
//计算所有题型数量
|
|
Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), sonProperty.getName(), map);
|
|
QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), sonProperty.getName(), map);
|
|
- questionDistributeDtos.add(questionDistributeDto);
|
|
|
|
|
|
+ questionDistributes.add(questionDistributeDto);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//一级属性不为空,二级属性为空
|
|
//一级属性不为空,二级属性为空
|
|
//单选题集合
|
|
//单选题集合
|
|
- List<Question> sinList = questionList2(courseNo, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, null, questions);
|
|
|
|
|
|
+ List<Question> sinList = questionList2(courseCode, courseProperty, QuesStructType.SINGLE_ANSWER_QUESTION, parentProperty, null, questions);
|
|
//多选题集合
|
|
//多选题集合
|
|
- List<Question> mulList = questionList2(courseNo, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, null, questions);
|
|
|
|
|
|
+ List<Question> mulList = questionList2(courseCode, courseProperty, QuesStructType.MULTIPLE_ANSWER_QUESTION, parentProperty, null, questions);
|
|
//判断题集合
|
|
//判断题集合
|
|
- List<Question> bolList = questionList2(courseNo, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, null, questions);
|
|
|
|
|
|
+ List<Question> bolList = questionList2(courseCode, courseProperty, QuesStructType.BOOL_ANSWER_QUESTION, parentProperty, null, questions);
|
|
|
|
|
|
List<Question> fillList = null;
|
|
List<Question> fillList = null;
|
|
//fillList = questionList2(courseNo, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, null, questions);
|
|
//fillList = questionList2(courseNo, courseProperty, QuesStructType.FILL_BLANK_QUESTION, parentProperty, null, questions);
|
|
@@ -875,19 +900,25 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
//计算所有题型数量
|
|
//计算所有题型数量
|
|
Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
Map<Long, Long> map = countQuesType(sinList, mulList, bolList, fillList, textList);
|
|
QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), null, map);
|
|
QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), parentProperty.getName(), null, map);
|
|
- questionDistributeDtos.add(questionDistributeDto);
|
|
|
|
|
|
+ questionDistributes.add(questionDistributeDto);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//一级属性为空
|
|
//一级属性为空
|
|
QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), null, null, null);
|
|
QuestionDistributeDto questionDistributeDto = new QuestionDistributeDto(courseProperty.getName(), null, null, null);
|
|
- questionDistributeDtos.add(questionDistributeDto);
|
|
|
|
|
|
+ questionDistributes.add(questionDistributeDto);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ final String fileName = System.currentTimeMillis() + "试题分布.xlsx";
|
|
|
|
+ final String filePath = TEMP_FILE_EXP + File.separator + fileName;
|
|
|
|
+
|
|
//生成Excel导出
|
|
//生成Excel导出
|
|
- writeExcel(questionDistributeDtos, 21, new Date().toString(), response);
|
|
|
|
|
|
+ File tempFile = this.writeExcel(questionDistributes, filePath);
|
|
|
|
+ FileDisposeUtil.downloadFile(fileName, filePath, response);
|
|
|
|
+ FileUtils.deleteQuietly(tempFile);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-}
|
|
|
|
|
|
+}
|