Procházet zdrojové kódy

just format code styles.

deason před 6 roky
rodič
revize
c14ee6c2e1

+ 561 - 567
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/temp/DdExcelService.java

@@ -1,16 +1,15 @@
 package cn.com.qmth.examcloud.core.questions.service.temp;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
+import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
+import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
+import cn.com.qmth.examcloud.core.questions.dao.*;
+import cn.com.qmth.examcloud.core.questions.dao.entity.*;
+import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PaperDetailUnitStructDto;
+import cn.com.qmth.examcloud.core.questions.service.PaperDetailUnitService;
+import cn.com.qmth.examcloud.core.questions.service.temp.vo.DdExcelDto;
+import cn.com.qmth.examcloud.core.questions.service.temp.vo.DdPaperDto;
+import cn.com.qmth.examcloud.core.questions.service.temp.vo.DdPaperStructDto;
+import cn.com.qmth.examcloud.core.questions.service.temp.vo.SubQuestionDto;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -21,417 +20,410 @@ import org.springframework.data.mongodb.core.query.Criteria;
 import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Service;
 
-import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
-import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
-import cn.com.qmth.examcloud.core.questions.dao.PaperDetailRepo;
-import cn.com.qmth.examcloud.core.questions.dao.PaperDetailUnitRepo;
-import cn.com.qmth.examcloud.core.questions.dao.PaperRepo;
-import cn.com.qmth.examcloud.core.questions.dao.QuesTypeNameRepo;
-import cn.com.qmth.examcloud.core.questions.dao.entity.Course;
-import cn.com.qmth.examcloud.core.questions.dao.entity.ExamPaper;
-import cn.com.qmth.examcloud.core.questions.dao.entity.ExtractConfig;
-import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
-import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetail;
-import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailStruct;
-import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
-import cn.com.qmth.examcloud.core.questions.dao.entity.PaperStruct;
-import cn.com.qmth.examcloud.core.questions.dao.entity.QuesTypeName;
-import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
-import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PaperDetailUnitStructDto;
-import cn.com.qmth.examcloud.core.questions.dao.QuesRepo;
-import cn.com.qmth.examcloud.core.questions.service.PaperDetailUnitService;
-import cn.com.qmth.examcloud.core.questions.service.temp.vo.DdExcelDto;
-import cn.com.qmth.examcloud.core.questions.service.temp.vo.DdPaperDto;
-import cn.com.qmth.examcloud.core.questions.service.temp.vo.DdPaperStructDto;
-import cn.com.qmth.examcloud.core.questions.service.temp.vo.SubQuestionDto;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.*;
 
 @Service("ddExcelService")
 public class DdExcelService {
-	
-	@Autowired
-	private QuesRepo quesRepo;
-	
-	@Autowired
+    private final String exportExcelPath = "D:/exportExcel.xlsx";
+    private final String xianExcelPath = "D:/xianExcelNew.xlsx";
+
+    private final String paperExcelPath = "D:/paperExcel.xlsx";
+    private final String paperExcelPathNew = "D:/paperExcelNew.xlsx";
+
+    private final String quesExcelPath = "D:/quesExcel.xlsx";
+    private final String quesExcelPathNew = "D:/quesExcelNew.xlsx";
+
+    private final String paperStructExcelPath = "D:/paperStructExcel.xlsx";
+    private final String paperStructExcelPathNew = "D:/paperStructExcelNew.xlsx";
+
+    @Autowired
+    private QuesRepo quesRepo;
+
+    @Autowired
     PaperDetailUnitService paperDetailUnitService;
-	
-	@Autowired
+
+    @Autowired
     PaperDetailUnitRepo paperDetailUnitRepo;
-	
-	@Autowired
-	PaperRepo paperRepo;
-
-	@Autowired
-	private QuesTypeNameRepo quesTypeRepo;
-	
-	@Autowired
+
+    @Autowired
+    PaperRepo paperRepo;
+
+    @Autowired
+    private QuesTypeNameRepo quesTypeRepo;
+
+    @Autowired
     MongoTemplate mongoTemplate;
-	
-	@Autowired
-	PaperDetailRepo paperDetailRepo;
-
-	public void insertQueryName(String orgId){
-		//查询所有课程
-		long startCourseTime = System.currentTimeMillis();
-		//List<Course> courses = courseRepo.findByOrgId(orgId);
-		List<Course> courses = new ArrayList<Course>();
-		long endCourseTime = System.currentTimeMillis();
-		System.out.println("查询课程耗时:"+ (endCourseTime - startCourseTime) +"ms");
-		if(courses != null && courses.size()>0){
-			int i = 1;
-			int j = 1;
-			for(Course course : courses){
-				//根据课程查询试卷
-				long startPaperTime = System.currentTimeMillis();
-				List<Paper> papers = paperRepo.findByCourseNoAndOrgId(course.getCode(), orgId);
-				long endPaperTime = System.currentTimeMillis();
-				System.out.println("查询第"+i+"个课程下所有试卷耗时耗时:"+ (endPaperTime - startPaperTime) +"ms,课程代码为:"+course.getCode());
-				if(papers != null && papers.size()>0){
-					//生成所有试卷的试题集合
-					List<PaperDetailUnit> allUnits = new ArrayList<PaperDetailUnit>();
-					for(Paper paper:papers){
-						//根据试卷查询paperDetailUnits
-						long startUnitTime = System.currentTimeMillis();
-						List<PaperDetailUnit> paperDetailUnits = paperDetailUnitRepo.findByPaper(paper);
-						long endUnitTime = System.currentTimeMillis();
-						System.out.println("查询"+paper.getName()+"个试卷下所有试题耗时耗时:"+ (endUnitTime - startUnitTime) +"ms");
-						if(paperDetailUnits != null && paperDetailUnits.size()>0){
-							for(PaperDetailUnit unit:paperDetailUnits){
-								allUnits.add(unit);
-							}
-						}
-					}
-					System.out.println("开始生成对象...总题数量:"+allUnits.size());
-					//生成需要保存的大题来源集合
-					List<QuesTypeName> quesTypeNames = new ArrayList<QuesTypeName>();
-					Map<QuesStructType, List<String>> map = buildQuesTypeName(allUnits);
-					for(Map.Entry<QuesStructType, List<String>> entry : map.entrySet()){
-						QuesTypeName quesTypeName = new QuesTypeName();
-		                quesTypeName.setOrgId(orgId);
-		                quesTypeName.setCourseNo(course.getCode());
-		                quesTypeName.setQuestionType(entry.getKey());
-		                quesTypeName.setQuesNames(entry.getValue());
-		                quesTypeNames.add(quesTypeName);
-		                System.out.println("生成完第"+j+"个对象");
-		                j++;
-					}
-					long endTime = System.currentTimeMillis();
-					System.out.println("所有试题耗时耗时:"+ (endTime - endPaperTime) +"ms");
-					quesTypeRepo.save(quesTypeNames);
-					long ends = System.currentTimeMillis();
-					System.out.println("第"+i+"个课程保存所有来源大题耗时:"+ (ends - endTime) +"ms");
-				}
-				i++;
-			}
-			System.out.println("对象生成完");
-		}
-	}
-	
-	//quesTypeRepo.save(quesTypeNames);
-	public Map<QuesStructType, List<String>> buildQuesTypeName(List<PaperDetailUnit> paperDetailUnits){
-		Map<QuesStructType, List<String>> map = new HashMap<QuesStructType, List<String>>();
-		for(PaperDetailUnit paperDetailUnit:paperDetailUnits){
-			String name = paperDetailUnit.getPaperDetail().getName();
-			QuesStructType questionType = paperDetailUnit.getQuestion().getQuestionType();
-			List<String> names = map.get(questionType);
-			if(names == null){
-				List<String> nameList = new ArrayList<String>();
-				nameList.add(name);
-				map.put(questionType, nameList);
-			}else {
-				if(names.contains(name)){
-					continue;
-				}else {
-					names.add(name);
-					map.put(questionType, names);
-				}
-			}
-		}
-		return map;
-	}
-	
-	@SuppressWarnings("resource")
-	public void exporExcel(String orgId) throws Exception{
-		//导出Excel集合
-		List<DdExcelDto> ddExcelDtos = new ArrayList<DdExcelDto>();
-		//查询所有课程
-		long startCourseTime = System.currentTimeMillis();
-		//List<Course> courses = courseRepo.findByOrgId(orgId);
-		List<Course> courses = new ArrayList<Course>();
-		long endCourseTime = System.currentTimeMillis();
-		System.out.println("查询课程耗时:"+ (endCourseTime - startCourseTime) +"ms");
-		if(courses != null && courses.size()>0){
-			int i = 0;
-			for(Course course : courses){
-				//查询该课程下的所有question
-				long startQuestionTime = System.currentTimeMillis();
-				List<Question> questions = quesRepo.findByCourseAndOrgId(course, orgId);
-				long endQuestionTime = System.currentTimeMillis();
-				System.out.println("查询第"+ i + "个课程试题耗时:"+ (endQuestionTime - startQuestionTime) +"ms");
-				List<String> oIds = new ArrayList<String>();
-		    	for (Question question : questions) {
-		    		oIds.add(question.getId());
-		    	}
-				//根据question查询paperDetailUnit
-		    	long startUnitTime = System.currentTimeMillis();
-				List<PaperDetailUnit> oDetailUnits = paperDetailUnitService.findByDDQuestionsAndPaperType(oIds, PaperType.IMPORT,questions);
-				long endUnitTime = System.currentTimeMillis();
-				System.out.println("查询第"+ i + "个课程试题耗时:"+ (endUnitTime - startUnitTime) +"ms");
-				Map<String, Long> map = new HashMap<String, Long>();
-				if(oDetailUnits != null && oDetailUnits.size()>0){
-					for(PaperDetailUnit unit:oDetailUnits){
-						//大题名称
-						String quesName = unit.getPaperDetail().getName();
-						if(map.get(quesName) == null){
-							map.put(quesName, 1L);
-						}else {
-							Long number = map.get(quesName);
-							number++;
-							map.put(quesName, number);
-						}
-					}
-				}
-				DdExcelDto ddExcelDto = new DdExcelDto(course.getName(), course.getCode(), map);
-				ddExcelDtos.add(ddExcelDto);
-				System.out.println("已经处理完:" + i + "个课程...");
-				i++;
-			}
-		}
-		Map<String, Long> otherMap = new HashMap<String, Long>();
-		//生成Excel对象
-		File ddExcelFile = new File("H:\\ddExcelDto.xlsx");
-		Workbook workBook = new XSSFWorkbook(ddExcelFile);
-		//获取第一个工作页
+
+    @Autowired
+    PaperDetailRepo paperDetailRepo;
+
+    public void insertQueryName(String orgId) {
+        //查询所有课程
+        long startCourseTime = System.currentTimeMillis();
+        //List<Course> courses = courseRepo.findByOrgId(orgId);
+        List<Course> courses = new ArrayList<Course>();
+        long endCourseTime = System.currentTimeMillis();
+        System.out.println("查询课程耗时:" + (endCourseTime - startCourseTime) + "ms");
+        if (courses != null && courses.size() > 0) {
+            int i = 1;
+            int j = 1;
+            for (Course course : courses) {
+                //根据课程查询试卷
+                long startPaperTime = System.currentTimeMillis();
+                List<Paper> papers = paperRepo.findByCourseNoAndOrgId(course.getCode(), orgId);
+                long endPaperTime = System.currentTimeMillis();
+                System.out.println("查询第" + i + "个课程下所有试卷耗时耗时:" + (endPaperTime - startPaperTime) + "ms,课程代码为:" + course.getCode());
+                if (papers != null && papers.size() > 0) {
+                    //生成所有试卷的试题集合
+                    List<PaperDetailUnit> allUnits = new ArrayList<>();
+                    for (Paper paper : papers) {
+                        //根据试卷查询paperDetailUnits
+                        long startUnitTime = System.currentTimeMillis();
+                        List<PaperDetailUnit> paperDetailUnits = paperDetailUnitRepo.findByPaper(paper);
+                        long endUnitTime = System.currentTimeMillis();
+                        System.out.println("查询" + paper.getName() + "个试卷下所有试题耗时耗时:" + (endUnitTime - startUnitTime) + "ms");
+                        if (paperDetailUnits != null && paperDetailUnits.size() > 0) {
+                            for (PaperDetailUnit unit : paperDetailUnits) {
+                                allUnits.add(unit);
+                            }
+                        }
+                    }
+                    System.out.println("开始生成对象...总题数量:" + allUnits.size());
+                    //生成需要保存的大题来源集合
+                    List<QuesTypeName> quesTypeNames = new ArrayList<>();
+                    Map<QuesStructType, List<String>> map = buildQuesTypeName(allUnits);
+                    for (Map.Entry<QuesStructType, List<String>> entry : map.entrySet()) {
+                        QuesTypeName quesTypeName = new QuesTypeName();
+                        quesTypeName.setOrgId(orgId);
+                        quesTypeName.setCourseNo(course.getCode());
+                        quesTypeName.setQuestionType(entry.getKey());
+                        quesTypeName.setQuesNames(entry.getValue());
+                        quesTypeNames.add(quesTypeName);
+                        System.out.println("生成完第" + j + "个对象");
+                        j++;
+                    }
+                    long endTime = System.currentTimeMillis();
+                    System.out.println("所有试题耗时耗时:" + (endTime - endPaperTime) + "ms");
+                    quesTypeRepo.save(quesTypeNames);
+                    long ends = System.currentTimeMillis();
+                    System.out.println("第" + i + "个课程保存所有来源大题耗时:" + (ends - endTime) + "ms");
+                }
+                i++;
+            }
+            System.out.println("对象生成完");
+        }
+    }
+
+    //quesTypeRepo.save(quesTypeNames);
+    public Map<QuesStructType, List<String>> buildQuesTypeName(List<PaperDetailUnit> paperDetailUnits) {
+        Map<QuesStructType, List<String>> map = new HashMap<>();
+        for (PaperDetailUnit paperDetailUnit : paperDetailUnits) {
+            String name = paperDetailUnit.getPaperDetail().getName();
+            QuesStructType questionType = paperDetailUnit.getQuestion().getQuestionType();
+            List<String> names = map.get(questionType);
+            if (names == null) {
+                List<String> nameList = new ArrayList<>();
+                nameList.add(name);
+                map.put(questionType, nameList);
+            } else {
+                if (names.contains(name)) {
+                    continue;
+                } else {
+                    names.add(name);
+                    map.put(questionType, names);
+                }
+            }
+        }
+        return map;
+    }
+
+    @SuppressWarnings("resource")
+    public void exporExcel(String orgId) throws Exception {
+        //导出Excel集合
+        List<DdExcelDto> ddExcelDtos = new ArrayList<DdExcelDto>();
+        //查询所有课程
+        long startCourseTime = System.currentTimeMillis();
+        //List<Course> courses = courseRepo.findByOrgId(orgId);
+        List<Course> courses = new ArrayList<Course>();
+        long endCourseTime = System.currentTimeMillis();
+        System.out.println("查询课程耗时:" + (endCourseTime - startCourseTime) + "ms");
+        if (courses != null && courses.size() > 0) {
+            int i = 0;
+            for (Course course : courses) {
+                //查询该课程下的所有question
+                long startQuestionTime = System.currentTimeMillis();
+                List<Question> questions = quesRepo.findByCourseAndOrgId(course, orgId);
+                long endQuestionTime = System.currentTimeMillis();
+                System.out.println("查询第" + i + "个课程试题耗时:" + (endQuestionTime - startQuestionTime) + "ms");
+                List<String> oIds = new ArrayList<String>();
+                for (Question question : questions) {
+                    oIds.add(question.getId());
+                }
+                //根据question查询paperDetailUnit
+                long startUnitTime = System.currentTimeMillis();
+                List<PaperDetailUnit> oDetailUnits = paperDetailUnitService.findByDDQuestionsAndPaperType(oIds, PaperType.IMPORT, questions);
+                long endUnitTime = System.currentTimeMillis();
+                System.out.println("查询第" + i + "个课程试题耗时:" + (endUnitTime - startUnitTime) + "ms");
+                Map<String, Long> map = new HashMap<String, Long>();
+                if (oDetailUnits != null && oDetailUnits.size() > 0) {
+                    for (PaperDetailUnit unit : oDetailUnits) {
+                        //大题名称
+                        String quesName = unit.getPaperDetail().getName();
+                        if (map.get(quesName) == null) {
+                            map.put(quesName, 1L);
+                        } else {
+                            Long number = map.get(quesName);
+                            number++;
+                            map.put(quesName, number);
+                        }
+                    }
+                }
+                DdExcelDto ddExcelDto = new DdExcelDto(course.getName(), course.getCode(), map);
+                ddExcelDtos.add(ddExcelDto);
+                System.out.println("已经处理完:" + i + "个课程...");
+                i++;
+            }
+        }
+        Map<String, Long> otherMap = new HashMap<String, Long>();
+        //生成Excel对象
+        File ddExcelFile = new File(exportExcelPath);
+        Workbook workBook = new XSSFWorkbook(ddExcelFile);
+        //获取第一个工作页
         Sheet sheet = workBook.getSheetAt(0);
         System.out.println(sheet.getSheetName());
         //向Excle中写入数据,从第2行开始
-        for(int i = 0;i<ddExcelDtos.size();i++){
-        	//创建一行:从第1行开始,跳过表头
-            Row row = sheet.createRow(i+1);
+        for (int i = 0; i < ddExcelDtos.size(); i++) {
+            //创建一行:从第1行开始,跳过表头
+            Row row = sheet.createRow(i + 1);
             DdExcelDto ddExcelDto = ddExcelDtos.get(i);
             //每列赋值
             row.createCell(0).setCellValue(ddExcelDto.getCourseName());
             row.createCell(1).setCellValue(ddExcelDto.getCourseCode());
-            if(ddExcelDto.getMap() != null && ddExcelDto.getMap().size()>0){
-            	if(ddExcelDto.getMap().get("单选题") == null){
-            		row.createCell(2).setCellValue(0);
-            	}else {
-            		row.createCell(2).setCellValue(ddExcelDto.getMap().get("单选题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("多选题") == null){
-            		row.createCell(3).setCellValue(0);
-            	}else {
-            		row.createCell(3).setCellValue(ddExcelDto.getMap().get("多选题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("填空题") == null){
-            		row.createCell(4).setCellValue(0);
-            	}else {
-            		row.createCell(4).setCellValue(ddExcelDto.getMap().get("填空题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("选词填空") == null){
-            		row.createCell(5).setCellValue(0);
-            	}else {
-            		row.createCell(5).setCellValue(ddExcelDto.getMap().get("选词填空"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("完型填空") == null){
-            		row.createCell(6).setCellValue(0);
-            	}else {
-            		row.createCell(6).setCellValue(ddExcelDto.getMap().get("完型填空"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("判断题") == null){
-            		row.createCell(7).setCellValue(0);
-            	}else {
-            		row.createCell(7).setCellValue(ddExcelDto.getMap().get("判断题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("阅读理解") == null){
-            		row.createCell(8).setCellValue(0);
-            	}else {
-            		row.createCell(8).setCellValue(ddExcelDto.getMap().get("阅读理解"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("问答题") == null){
-            		row.createCell(9).setCellValue(0);
-            	}else {
-            		row.createCell(9).setCellValue(ddExcelDto.getMap().get("问答题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("名词解释") == null){
-            		row.createCell(10).setCellValue(0);
-            	}else {
-            		row.createCell(10).setCellValue(ddExcelDto.getMap().get("名词解释"));
-				}
-            	
-            	//额外大题名称
-            	if(ddExcelDto.getMap().get("案例分析") == null){
-            		row.createCell(11).setCellValue(0);
-            	}else {
-            		row.createCell(11).setCellValue(ddExcelDto.getMap().get("案例分析"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("作文题") == null){
-            		row.createCell(12).setCellValue(0);
-            	}else {
-            		row.createCell(12).setCellValue(ddExcelDto.getMap().get("作文题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("交际英语") == null){
-            		row.createCell(13).setCellValue(0);
-            	}else {
-            		row.createCell(13).setCellValue(ddExcelDto.getMap().get("交际英语"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("简答题") == null){
-            		row.createCell(14).setCellValue(0);
-            	}else {
-            		row.createCell(14).setCellValue(ddExcelDto.getMap().get("简答题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("一、单选题") == null){
-            		row.createCell(15).setCellValue(0);
-            	}else {
-            		row.createCell(15).setCellValue(ddExcelDto.getMap().get("一、单选题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("名称解释") == null){
-            		row.createCell(16).setCellValue(0);
-            	}else {
-            		row.createCell(16).setCellValue(ddExcelDto.getMap().get("名称解释"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("综合题") == null){
-            		row.createCell(17).setCellValue(0);
-            	}else {
-            		row.createCell(17).setCellValue(ddExcelDto.getMap().get("综合题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("设计题") == null){
-            		row.createCell(18).setCellValue(0);
-            	}else {
-            		row.createCell(18).setCellValue(ddExcelDto.getMap().get("设计题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("二、名词解释") == null){
-            		row.createCell(19).setCellValue(0);
-            	}else {
-            		row.createCell(19).setCellValue(ddExcelDto.getMap().get("二、名词解释"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("分析题") == null){
-            		row.createCell(20).setCellValue(0);
-            	}else {
-            		row.createCell(20).setCellValue(ddExcelDto.getMap().get("分析题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("英汉翻译") == null){
-            		row.createCell(21).setCellValue(0);
-            	}else {
-            		row.createCell(21).setCellValue(ddExcelDto.getMap().get("英汉翻译"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("作文") == null){
-            		row.createCell(22).setCellValue(0);
-            	}else {
-            		row.createCell(22).setCellValue(ddExcelDto.getMap().get("作文"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("二、计算题") == null){
-            		row.createCell(23).setCellValue(0);
-            	}else {
-            		row.createCell(23).setCellValue(ddExcelDto.getMap().get("二、计算题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("作图题") == null){
-            		row.createCell(24).setCellValue(0);
-            	}else {
-            		row.createCell(24).setCellValue(ddExcelDto.getMap().get("作图题"));
-				}
-
-            	if(ddExcelDto.getMap().get("论述题") == null){
-            		row.createCell(25).setCellValue(0);
-            	}else {
-            		row.createCell(25).setCellValue(ddExcelDto.getMap().get("论述题"));
-				}
-
-            	if(ddExcelDto.getMap().get("三、计算题") == null){
-            		row.createCell(26).setCellValue(0);
-            	}else {
-            		row.createCell(26).setCellValue(ddExcelDto.getMap().get("三、计算题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("计算题") == null){
-            		row.createCell(27).setCellValue(0);
-            	}else {
-            		row.createCell(27).setCellValue(ddExcelDto.getMap().get("计算题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("算法设计题") == null){
-            		row.createCell(28).setCellValue(0);
-            	}else {
-            		row.createCell(28).setCellValue(ddExcelDto.getMap().get("算法设计题"));
-				}
-            	
-            	if(ddExcelDto.getMap().get("翻译题") == null){
-            		row.createCell(29).setCellValue(0);
-            	}else {
-            		row.createCell(29).setCellValue(ddExcelDto.getMap().get("翻译题"));
-				}
-                
-            }else {
-				System.out.println("kong"+ddExcelDto.getCourseName());
-			}
+            if (ddExcelDto.getMap() != null && ddExcelDto.getMap().size() > 0) {
+                if (ddExcelDto.getMap().get("单选题") == null) {
+                    row.createCell(2).setCellValue(0);
+                } else {
+                    row.createCell(2).setCellValue(ddExcelDto.getMap().get("单选题"));
+                }
+
+                if (ddExcelDto.getMap().get("多选题") == null) {
+                    row.createCell(3).setCellValue(0);
+                } else {
+                    row.createCell(3).setCellValue(ddExcelDto.getMap().get("多选题"));
+                }
+
+                if (ddExcelDto.getMap().get("填空题") == null) {
+                    row.createCell(4).setCellValue(0);
+                } else {
+                    row.createCell(4).setCellValue(ddExcelDto.getMap().get("填空题"));
+                }
+
+                if (ddExcelDto.getMap().get("选词填空") == null) {
+                    row.createCell(5).setCellValue(0);
+                } else {
+                    row.createCell(5).setCellValue(ddExcelDto.getMap().get("选词填空"));
+                }
+
+                if (ddExcelDto.getMap().get("完型填空") == null) {
+                    row.createCell(6).setCellValue(0);
+                } else {
+                    row.createCell(6).setCellValue(ddExcelDto.getMap().get("完型填空"));
+                }
+
+                if (ddExcelDto.getMap().get("判断题") == null) {
+                    row.createCell(7).setCellValue(0);
+                } else {
+                    row.createCell(7).setCellValue(ddExcelDto.getMap().get("判断题"));
+                }
+
+                if (ddExcelDto.getMap().get("阅读理解") == null) {
+                    row.createCell(8).setCellValue(0);
+                } else {
+                    row.createCell(8).setCellValue(ddExcelDto.getMap().get("阅读理解"));
+                }
+
+                if (ddExcelDto.getMap().get("问答题") == null) {
+                    row.createCell(9).setCellValue(0);
+                } else {
+                    row.createCell(9).setCellValue(ddExcelDto.getMap().get("问答题"));
+                }
+
+                if (ddExcelDto.getMap().get("名词解释") == null) {
+                    row.createCell(10).setCellValue(0);
+                } else {
+                    row.createCell(10).setCellValue(ddExcelDto.getMap().get("名词解释"));
+                }
+
+                //额外大题名称
+                if (ddExcelDto.getMap().get("案例分析") == null) {
+                    row.createCell(11).setCellValue(0);
+                } else {
+                    row.createCell(11).setCellValue(ddExcelDto.getMap().get("案例分析"));
+                }
+
+                if (ddExcelDto.getMap().get("作文题") == null) {
+                    row.createCell(12).setCellValue(0);
+                } else {
+                    row.createCell(12).setCellValue(ddExcelDto.getMap().get("作文题"));
+                }
+
+                if (ddExcelDto.getMap().get("交际英语") == null) {
+                    row.createCell(13).setCellValue(0);
+                } else {
+                    row.createCell(13).setCellValue(ddExcelDto.getMap().get("交际英语"));
+                }
+
+                if (ddExcelDto.getMap().get("简答题") == null) {
+                    row.createCell(14).setCellValue(0);
+                } else {
+                    row.createCell(14).setCellValue(ddExcelDto.getMap().get("简答题"));
+                }
+
+                if (ddExcelDto.getMap().get("一、单选题") == null) {
+                    row.createCell(15).setCellValue(0);
+                } else {
+                    row.createCell(15).setCellValue(ddExcelDto.getMap().get("一、单选题"));
+                }
+
+                if (ddExcelDto.getMap().get("名称解释") == null) {
+                    row.createCell(16).setCellValue(0);
+                } else {
+                    row.createCell(16).setCellValue(ddExcelDto.getMap().get("名称解释"));
+                }
+
+                if (ddExcelDto.getMap().get("综合题") == null) {
+                    row.createCell(17).setCellValue(0);
+                } else {
+                    row.createCell(17).setCellValue(ddExcelDto.getMap().get("综合题"));
+                }
+
+                if (ddExcelDto.getMap().get("设计题") == null) {
+                    row.createCell(18).setCellValue(0);
+                } else {
+                    row.createCell(18).setCellValue(ddExcelDto.getMap().get("设计题"));
+                }
+
+                if (ddExcelDto.getMap().get("二、名词解释") == null) {
+                    row.createCell(19).setCellValue(0);
+                } else {
+                    row.createCell(19).setCellValue(ddExcelDto.getMap().get("二、名词解释"));
+                }
+
+                if (ddExcelDto.getMap().get("分析题") == null) {
+                    row.createCell(20).setCellValue(0);
+                } else {
+                    row.createCell(20).setCellValue(ddExcelDto.getMap().get("分析题"));
+                }
+
+                if (ddExcelDto.getMap().get("英汉翻译") == null) {
+                    row.createCell(21).setCellValue(0);
+                } else {
+                    row.createCell(21).setCellValue(ddExcelDto.getMap().get("英汉翻译"));
+                }
+
+                if (ddExcelDto.getMap().get("作文") == null) {
+                    row.createCell(22).setCellValue(0);
+                } else {
+                    row.createCell(22).setCellValue(ddExcelDto.getMap().get("作文"));
+                }
+
+                if (ddExcelDto.getMap().get("二、计算题") == null) {
+                    row.createCell(23).setCellValue(0);
+                } else {
+                    row.createCell(23).setCellValue(ddExcelDto.getMap().get("二、计算题"));
+                }
+
+                if (ddExcelDto.getMap().get("作图题") == null) {
+                    row.createCell(24).setCellValue(0);
+                } else {
+                    row.createCell(24).setCellValue(ddExcelDto.getMap().get("作图题"));
+                }
+
+                if (ddExcelDto.getMap().get("论述题") == null) {
+                    row.createCell(25).setCellValue(0);
+                } else {
+                    row.createCell(25).setCellValue(ddExcelDto.getMap().get("论述题"));
+                }
+
+                if (ddExcelDto.getMap().get("三、计算题") == null) {
+                    row.createCell(26).setCellValue(0);
+                } else {
+                    row.createCell(26).setCellValue(ddExcelDto.getMap().get("三、计算题"));
+                }
+
+                if (ddExcelDto.getMap().get("计算题") == null) {
+                    row.createCell(27).setCellValue(0);
+                } else {
+                    row.createCell(27).setCellValue(ddExcelDto.getMap().get("计算题"));
+                }
+
+                if (ddExcelDto.getMap().get("算法设计题") == null) {
+                    row.createCell(28).setCellValue(0);
+                } else {
+                    row.createCell(28).setCellValue(ddExcelDto.getMap().get("算法设计题"));
+                }
+
+                if (ddExcelDto.getMap().get("翻译题") == null) {
+                    row.createCell(29).setCellValue(0);
+                } else {
+                    row.createCell(29).setCellValue(ddExcelDto.getMap().get("翻译题"));
+                }
+
+            } else {
+                System.out.println("kong" + ddExcelDto.getCourseName());
+            }
         }
-        File file = new File("H:\\xianExcelDtoNew.xlsx");
+        File file = new File(xianExcelPath);
         OutputStream out = new FileOutputStream(file);
         workBook.write(out);
         out.close();
         System.out.println("结束...");
         System.out.println(otherMap);
-	}
-	
-	/**
-	 * 导出试卷详情
-	 * @param orgId
-	 * @throws Exception
-	 */
-	@SuppressWarnings("resource")
-	public void exportPaperExcel(String orgId) throws Exception {
-		System.out.println("开始导出试卷具体信息。。。。");
-		//导出Excel对象集合
-		List<DdPaperDto> excelDtoList = new ArrayList<DdPaperDto>();
-		//根据课程查询试卷
-	    Query query = new Query();
+    }
+
+    /**
+     * 导出试卷详情
+     *
+     * @param orgId
+     * @throws Exception
+     */
+    @SuppressWarnings("resource")
+    public void exportPaperExcel(String orgId) throws Exception {
+        System.out.println("开始导出试卷具体信息。。。。");
+        //导出Excel对象集合
+        List<DdPaperDto> excelDtoList = new ArrayList<DdPaperDto>();
+        //根据课程查询试卷
+        Query query = new Query();
         query.addCriteria(Criteria.where("orgId").is(orgId));
         query.addCriteria(Criteria.where("paperType").is(PaperType.IMPORT));
         List<Paper> paperList = this.mongoTemplate.find(query, Paper.class);
-        if(paperList != null && paperList.size()>0){
-        	int j = 1;
-        	for(Paper paper : paperList){
-        		//查询大题集合
-        		List<PaperDetail> details = paperDetailRepo.findByPaperOrderByNumber(paper);
-        		if(details != null && details.size()>0){
-        			for(PaperDetail detail:details){
-        				DdPaperDto ddPaperDto = new DdPaperDto();
-	        			ddPaperDto.setCode(paper.getCourse().getCode());
-	        			ddPaperDto.setDetailName(detail.getName());
-	        			ddPaperDto.setName(paper.getCourse().getName());
-	        			ddPaperDto.setNumber(detail.getUnitCount());
-	        			ddPaperDto.setPaperName(paper.getName());
-	        			excelDtoList.add(ddPaperDto);
-        			}
-        		}
-        		System.out.println("处理完第"+ j + "套试卷。。。");
-        		j++;
-        	}
+        if (paperList != null && paperList.size() > 0) {
+            int j = 1;
+            for (Paper paper : paperList) {
+                //查询大题集合
+                List<PaperDetail> details = paperDetailRepo.findByPaperOrderByNumber(paper);
+                if (details != null && details.size() > 0) {
+                    for (PaperDetail detail : details) {
+                        DdPaperDto ddPaperDto = new DdPaperDto();
+                        ddPaperDto.setCode(paper.getCourse().getCode());
+                        ddPaperDto.setDetailName(detail.getName());
+                        ddPaperDto.setName(paper.getCourse().getName());
+                        ddPaperDto.setNumber(detail.getUnitCount());
+                        ddPaperDto.setPaperName(paper.getName());
+                        excelDtoList.add(ddPaperDto);
+                    }
+                }
+                System.out.println("处理完第" + j + "套试卷。。。");
+                j++;
+            }
         }
-		//查询所有课程
-		//List<Course> courses = courseRepo.findByOrgId(orgId);
-		//List<Course> courses = new ArrayList<Course>();
-		//System.out.println("查询课程总数:"+ courses.size());
+        //查询所有课程
+        //List<Course> courses = courseRepo.findByOrgId(orgId);
+        //List<Course> courses = new ArrayList<Course>();
+        //System.out.println("查询课程总数:"+ courses.size());
 		/*if(courses != null && courses.size()>0){
 			int i = 1;
 			for(Course course : courses){
@@ -467,15 +459,15 @@ public class DdExcelService {
         		i++;
 			}
 		}*/
-		//生成Excel对象
-		File ddExcelFile = new File("H:\\ddPaperDto.xlsx");
-		Workbook workBook = new XSSFWorkbook(ddExcelFile);
-		//获取第一个工作页
+        //生成Excel对象
+        File ddExcelFile = new File(paperExcelPath);
+        Workbook workBook = new XSSFWorkbook(ddExcelFile);
+        //获取第一个工作页
         Sheet sheet = workBook.getSheetAt(0);
         //向Excle中写入数据,从第2行开始
-        for(int i = 0;i<excelDtoList.size();i++){
-        	//创建一行:从第1行开始,跳过表头
-            Row row = sheet.createRow(i+1);
+        for (int i = 0; i < excelDtoList.size(); i++) {
+            //创建一行:从第1行开始,跳过表头
+            Row row = sheet.createRow(i + 1);
             DdPaperDto excelDto = excelDtoList.get(i);
             //每列赋值
             row.createCell(0).setCellValue(excelDto.getCode());
@@ -484,74 +476,75 @@ public class DdExcelService {
             row.createCell(3).setCellValue(excelDto.getDetailName());
             row.createCell(4).setCellValue(excelDto.getNumber());
         }
-        File file = new File("H:\\ddPaperDtoNew.xlsx");
+        File file = new File(paperExcelPathNew);
         OutputStream out = new FileOutputStream(file);
         workBook.write(out);
         out.close();
         System.out.println("结束...");
-	}
-	
-	/**
-	 * 导出试卷结构
-	 * @param orgId
-	 * @throws Exception
-	 */
-	@SuppressWarnings("resource")
-	public void exportPaperStructExcel(String orgId) throws Exception{
-		System.out.println("开始导出试卷结构");
-		//导出Excel对象集合
-		List<DdPaperStructDto> excelDtoList = new ArrayList<DdPaperStructDto>();
-		//查询所有课程
-		//List<Course> courses = courseRepo.findByOrgId(orgId);
-		List<Course> courses = new ArrayList<Course>();
-		System.out.println("查询课程总数:"+ courses.size());
-		if(courses != null && courses.size()>0){
-			int i = 1;
-			for(Course course : courses){
-				Query query = new Query();
-		        query.addCriteria(Criteria.where("orgId").is(orgId));
-		        query.addCriteria(Criteria.where("type").is("EXACT"));
-		        query.addCriteria(Criteria.where("courseNo").is(course.getCode()));
-		        List<PaperStruct> paperStructList = this.mongoTemplate.find(query, PaperStruct.class);
-		        System.out.println(course.getCode() + "课程下的试卷结构数量:" + paperStructList.size());
-		        if(paperStructList != null && paperStructList.size()>0){
-		        	for(PaperStruct paperStruct:paperStructList){
-		        		//得到大题集合
-		        		List<PaperDetailStruct> paperDetailStructs = paperStruct.getPaperDetailStructs();
-		        		if(paperDetailStructs != null && paperDetailStructs.size()>0){
-		        			for(PaperDetailStruct paperDetailStruct:paperDetailStructs){
-		        				//得到大题下的小题集合
-		        				List<PaperDetailUnitStructDto> unitStructs = paperDetailStruct.getUnitStructs();
-		        				if(unitStructs != null && unitStructs.size()>0){
-		        					for(PaperDetailUnitStructDto unitStructDto:unitStructs){
-		        						DdPaperStructDto excelDto = new DdPaperStructDto();
-		        						excelDto.setCode(paperStruct.getCourseNo());
-		        						excelDto.setDetailName(paperDetailStruct.getName());
-		        						excelDto.setName(course.getName());
-		        						excelDto.setNumber(unitStructDto.getCount());
-		        						excelDto.setQuesNames(unitStructDto.getQuesNames().toString());
-		        						excelDto.setQuesType(unitStructDto.getQuestionType().getName());
-		        						excelDtoList.add(excelDto);
-		        					}
-		        				}
-		        			}
-		        		}
-		        	}
-		        }
-		        System.out.println("处理完第:" + i + "个课程。");
-		        System.out.println("生成对象个数:" + excelDtoList.size());
-		        i++;
-			}
-		}
-		//生成Excel对象
-		File ddExcelFile = new File("H:\\ddPaperStructDto.xlsx");
-		Workbook workBook = new XSSFWorkbook(ddExcelFile);
-		//获取第一个工作页
+    }
+
+    /**
+     * 导出试卷结构
+     *
+     * @param orgId
+     * @throws Exception
+     */
+    @SuppressWarnings("resource")
+    public void exportPaperStructExcel(String orgId) throws Exception {
+        System.out.println("开始导出试卷结构");
+        //导出Excel对象集合
+        List<DdPaperStructDto> excelDtoList = new ArrayList<>();
+        //查询所有课程
+        //List<Course> courses = courseRepo.findByOrgId(orgId);
+        List<Course> courses = new ArrayList<Course>();
+        System.out.println("查询课程总数:" + courses.size());
+        if (courses != null && courses.size() > 0) {
+            int i = 1;
+            for (Course course : courses) {
+                Query query = new Query();
+                query.addCriteria(Criteria.where("orgId").is(orgId));
+                query.addCriteria(Criteria.where("type").is("EXACT"));
+                query.addCriteria(Criteria.where("courseNo").is(course.getCode()));
+                List<PaperStruct> paperStructList = this.mongoTemplate.find(query, PaperStruct.class);
+                System.out.println(course.getCode() + "课程下的试卷结构数量:" + paperStructList.size());
+                if (paperStructList != null && paperStructList.size() > 0) {
+                    for (PaperStruct paperStruct : paperStructList) {
+                        //得到大题集合
+                        List<PaperDetailStruct> paperDetailStructs = paperStruct.getPaperDetailStructs();
+                        if (paperDetailStructs != null && paperDetailStructs.size() > 0) {
+                            for (PaperDetailStruct paperDetailStruct : paperDetailStructs) {
+                                //得到大题下的小题集合
+                                List<PaperDetailUnitStructDto> unitStructs = paperDetailStruct.getUnitStructs();
+                                if (unitStructs != null && unitStructs.size() > 0) {
+                                    for (PaperDetailUnitStructDto unitStructDto : unitStructs) {
+                                        DdPaperStructDto excelDto = new DdPaperStructDto();
+                                        excelDto.setCode(paperStruct.getCourseNo());
+                                        excelDto.setDetailName(paperDetailStruct.getName());
+                                        excelDto.setName(course.getName());
+                                        excelDto.setNumber(unitStructDto.getCount());
+                                        excelDto.setQuesNames(unitStructDto.getQuesNames().toString());
+                                        excelDto.setQuesType(unitStructDto.getQuestionType().getName());
+                                        excelDtoList.add(excelDto);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+                System.out.println("处理完第:" + i + "个课程。");
+                System.out.println("生成对象个数:" + excelDtoList.size());
+                i++;
+            }
+        }
+        //生成Excel对象
+        File ddExcelFile = new File(paperStructExcelPath);
+        Workbook workBook = new XSSFWorkbook(ddExcelFile);
+        //获取第一个工作页
         Sheet sheet = workBook.getSheetAt(0);
         //向Excle中写入数据,从第2行开始
-        for(int i = 0;i<excelDtoList.size();i++){
-        	//创建一行:从第1行开始,跳过表头
-            Row row = sheet.createRow(i+1);
+        for (int i = 0; i < excelDtoList.size(); i++) {
+            //创建一行:从第1行开始,跳过表头
+            Row row = sheet.createRow(i + 1);
             DdPaperStructDto excelDto = excelDtoList.get(i);
             //每列赋值
             row.createCell(0).setCellValue(excelDto.getCode());
@@ -561,115 +554,116 @@ public class DdExcelService {
             row.createCell(4).setCellValue(excelDto.getNumber());
             row.createCell(5).setCellValue(excelDto.getQuesType());
         }
-        File file = new File("H:\\ddPaperStructDtoNew.xlsx");
+        File file = new File(paperStructExcelPathNew);
         OutputStream out = new FileOutputStream(file);
         workBook.write(out);
         out.close();
         System.out.println("结束...");
-	}
-	
-	/**
-	 * 给定考试和课程集合,查询所有试卷中的主观题,导出一个Excel(课程名称,课程代码,试卷名称,试卷id,试题题干)
-	 * @param orgId
-	 * @param examId
-	 * @param codes
-	 * @throws Exception
-	 */
-	@SuppressWarnings("resource")
-	public void exportSubQues(String orgId,Long examId,List<String> codes) throws Exception{
-		List<SubQuestionDto> dtos = new ArrayList<SubQuestionDto>();
+    }
+
+    /**
+     * 给定考试和课程集合,查询所有试卷中的主观题,导出一个Excel(课程名称,课程代码,试卷名称,试卷id,试题题干)
+     *
+     * @param orgId
+     * @param examId
+     * @param codes
+     * @throws Exception
+     */
+    @SuppressWarnings("resource")
+    public void exportSubQues(String orgId, Long examId, List<String> codes) throws Exception {
+        List<SubQuestionDto> dtos = new ArrayList<SubQuestionDto>();
         int j = 1;
-        for(String code:codes){
-        	Query query = new Query();
-    		query.addCriteria(Criteria.where("orgId").is(orgId));
+        for (String code : codes) {
+            Query query = new Query();
+            query.addCriteria(Criteria.where("orgId").is(orgId));
             query.addCriteria(Criteria.where("examId").is(examId));
-        	System.out.println("开始处理第"+j+"个调卷规则。。。。。。。");
-        	query.addCriteria(Criteria.where("courseCode").is(code));
+            System.out.println("开始处理第" + j + "个调卷规则。。。。。。。");
+            query.addCriteria(Criteria.where("courseCode").is(code));
             ExtractConfig tempConfig = this.mongoTemplate.findOne(query, ExtractConfig.class);
             //定义试卷集合
             Set<String> ids = new HashSet<String>();
             //获取试卷
-        	List<ExamPaper> examPaperList = tempConfig.getExamPaperList();
-        	System.out.println("原试卷数量:"+examPaperList.size());
-        	for(ExamPaper examPaper:examPaperList){
-        		ids.add(examPaper.getPaper().getId());
-        	}
-        	System.out.println("去重后的试卷数量:"+ids.size());
-        	//循环去重后的试卷
-        	for(String id:ids){
-        		Paper basePaper = paperRepo.findOne(id);
-        		//根据试卷查询所有小题
-        		List<PaperDetailUnit> allPaperDetailUnits = paperDetailUnitRepo.findByPaper(basePaper);
-        		//循环所有小题,寻找主观题
-        		for(PaperDetailUnit paperDetailUnit:allPaperDetailUnits){
-        			Question question = paperDetailUnit.getQuestion();
-        			//填空或问答
-        			if(question.getQuestionType()==QuesStructType.FILL_BLANK_QUESTION
-        					||question.getQuestionType()==QuesStructType.TEXT_ANSWER_QUESTION){
-        				String body = question.getQuesBody();
-        				String clearBody = body.replace("<p>", "").replace("</p>", "").replace("<span>", "").replace("</span>", "").replace("###", "___");
-        				String answer = question.getQuesAnswer();
-        				String clearAnswer = answer.replace("<p>", "").replace("</p>", "").replace("<span>", "").replace("</span>", "");
-        				SubQuestionDto dto = new SubQuestionDto();
-        				dto.setAnswer(answer);
-        				dto.setBody(body);
-        				dto.setClearAnswer(clearAnswer);
-        				dto.setClearBody(clearBody);
-        				dto.setCourseCode(tempConfig.getCourseCode());
-        				dto.setCourseName(tempConfig.getCourseName());
-        				dto.setNumber(paperDetailUnit.getNumber());
-        				dto.setPaperId(basePaper.getId());
-        				dto.setPaperName(basePaper.getName());
-        				dto.setScore(paperDetailUnit.getScore());
-        				dtos.add(dto);
-        			}
-        		}
-        	}
-        	j++;
+            List<ExamPaper> examPaperList = tempConfig.getExamPaperList();
+            System.out.println("原试卷数量:" + examPaperList.size());
+            for (ExamPaper examPaper : examPaperList) {
+                ids.add(examPaper.getPaper().getId());
+            }
+            System.out.println("去重后的试卷数量:" + ids.size());
+            //循环去重后的试卷
+            for (String id : ids) {
+                Paper basePaper = paperRepo.findOne(id);
+                //根据试卷查询所有小题
+                List<PaperDetailUnit> allPaperDetailUnits = paperDetailUnitRepo.findByPaper(basePaper);
+                //循环所有小题,寻找主观题
+                for (PaperDetailUnit paperDetailUnit : allPaperDetailUnits) {
+                    Question question = paperDetailUnit.getQuestion();
+                    //填空或问答
+                    if (question.getQuestionType() == QuesStructType.FILL_BLANK_QUESTION
+                            || question.getQuestionType() == QuesStructType.TEXT_ANSWER_QUESTION) {
+                        String body = question.getQuesBody();
+                        String clearBody = body.replace("<p>", "").replace("</p>", "").replace("<span>", "").replace("</span>", "").replace("###", "___");
+                        String answer = question.getQuesAnswer();
+                        String clearAnswer = answer.replace("<p>", "").replace("</p>", "").replace("<span>", "").replace("</span>", "");
+                        SubQuestionDto dto = new SubQuestionDto();
+                        dto.setAnswer(answer);
+                        dto.setBody(body);
+                        dto.setClearAnswer(clearAnswer);
+                        dto.setClearBody(clearBody);
+                        dto.setCourseCode(tempConfig.getCourseCode());
+                        dto.setCourseName(tempConfig.getCourseName());
+                        dto.setNumber(paperDetailUnit.getNumber());
+                        dto.setPaperId(basePaper.getId());
+                        dto.setPaperName(basePaper.getName());
+                        dto.setScore(paperDetailUnit.getScore());
+                        dtos.add(dto);
+                    }
+                }
+            }
+            j++;
         }
-        
+
         //生成Excel对象
-		File ddExcelFile = new File("D:\\subQuesDto.xlsx");
-		Workbook workBook = new XSSFWorkbook(ddExcelFile);
-		//获取第一个工作页
-		  Sheet sheet = workBook.getSheetAt(0);
-		  //向Excle中写入数据,从第2行开始
-		  for(int i = 0;i<dtos.size();i++){
-		  	  //创建一行:从第1行开始,跳过表头
-			  Row row = sheet.createRow(i+1);
-			  SubQuestionDto dto = dtos.get(i);
-			  //每列赋值
-		      row.createCell(0).setCellValue(dto.getCourseCode());
-		      row.createCell(1).setCellValue(dto.getCourseName());
-		      row.createCell(2).setCellValue(dto.getPaperId());
-		      row.createCell(3).setCellValue(dto.getPaperName());
-		      row.createCell(4).setCellValue(dto.getNumber());
-		      row.createCell(5).setCellValue(dto.getBody());
-		      row.createCell(6).setCellValue(dto.getClearBody());
-		      if(dto.getAnswer().length()<32767){
-		    	  row.createCell(7).setCellValue(dto.getAnswer());
-		      }
-		      if(dto.getClearAnswer().length()<32767){
-		    	  row.createCell(8).setCellValue(dto.getClearAnswer());
-		      }
-		      row.createCell(9).setCellValue(dto.getScore());
-		  }
-		  File file = new File("D:\\subQuesDtoNew.xlsx");
-		  OutputStream out = new FileOutputStream(file);
-		  workBook.write(out);
-		  out.close();
-		  System.out.println("结束...");
-	}
-	
-	
-	public static void main(String[] args){
-//		File ddExcelFile = new File("H:\\ddExcelDto.xlsx");
-		List<String> ss = new ArrayList<String>();
-		ss.add("单选");
-		ss.add("单选题");
-		ss.add("选择题");
-		System.out.println(ss);
-		System.out.println(ss.toString());
-	}
-	
+        File ddExcelFile = new File(quesExcelPath);
+        Workbook workBook = new XSSFWorkbook(ddExcelFile);
+        //获取第一个工作页
+        Sheet sheet = workBook.getSheetAt(0);
+        //向Excle中写入数据,从第2行开始
+        for (int i = 0; i < dtos.size(); i++) {
+            //创建一行:从第1行开始,跳过表头
+            Row row = sheet.createRow(i + 1);
+            SubQuestionDto dto = dtos.get(i);
+            //每列赋值
+            row.createCell(0).setCellValue(dto.getCourseCode());
+            row.createCell(1).setCellValue(dto.getCourseName());
+            row.createCell(2).setCellValue(dto.getPaperId());
+            row.createCell(3).setCellValue(dto.getPaperName());
+            row.createCell(4).setCellValue(dto.getNumber());
+            row.createCell(5).setCellValue(dto.getBody());
+            row.createCell(6).setCellValue(dto.getClearBody());
+            if (dto.getAnswer().length() < 32767) {
+                row.createCell(7).setCellValue(dto.getAnswer());
+            }
+            if (dto.getClearAnswer().length() < 32767) {
+                row.createCell(8).setCellValue(dto.getClearAnswer());
+            }
+            row.createCell(9).setCellValue(dto.getScore());
+        }
+        File file = new File(quesExcelPathNew);
+        OutputStream out = new FileOutputStream(file);
+        workBook.write(out);
+        out.close();
+        System.out.println("结束...");
+    }
+
+
+    public static void main(String[] args) {
+//		File ddExcelFile = new File(exportExcelPath);
+        List<String> ss = new ArrayList<String>();
+        ss.add("单选");
+        ss.add("单选题");
+        ss.add("选择题");
+        System.out.println(ss);
+        System.out.println(ss.toString());
+    }
+
 }