Эх сурвалжийг харах

修改 导出 试卷文件BUG

chenken 8 жил өмнө
parent
commit
f3e6b01c2f
26 өөрчлөгдсөн 204 нэмэгдсэн , 266 устгасан
  1. 15 2
      cqb-comm-utils/src/main/java/com/qmth/cqb/utils/FileDisposeUtil.java
  2. 2 2
      cqb-comm-utils/src/main/java/com/qmth/cqb/utils/word/DocxProcessUtil.java
  3. 6 6
      cqb-comm-utils/src/main/resources/dzkd_answer_template.ftl
  4. 10 10
      cqb-comm-utils/src/main/resources/dzkd_paper_template.ftl
  5. 6 6
      cqb-comm-utils/src/main/resources/hzkj_answer_template.ftl
  6. 11 11
      cqb-comm-utils/src/main/resources/hzkj_paper_template.ftl
  7. 6 6
      cqb-comm-utils/src/main/resources/sddx_answer_template.ftl
  8. 11 11
      cqb-comm-utils/src/main/resources/sddx_paper_template.ftl
  9. 6 6
      cqb-comm-utils/src/main/resources/sxsf_answer_template.ftl
  10. 11 11
      cqb-comm-utils/src/main/resources/sxsf_paper_template.ftl
  11. 6 6
      cqb-comm-utils/src/main/resources/tjdx_answer_template.ftl
  12. 11 11
      cqb-comm-utils/src/main/resources/tjdx_paper_template.ftl
  13. 1 2
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/ExportStructure.java
  14. 2 4
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/ExportStructureService.java
  15. 1 1
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/ExtractConfigService.java
  16. 8 19
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/DzkdExportPaperService.java
  17. 8 17
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/ExportPaperAbstractService.java
  18. 7 20
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/HzkjExportPaperService.java
  19. 7 12
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/SddxExportPaperService.java
  20. 32 37
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/SxsfExportPaperService.java
  21. 2 3
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/SydxExportPaperService.java
  22. 7 11
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/TjdxExportPaperService.java
  23. 5 11
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/ExportStructureServiceImpl.java
  24. 16 31
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/ExtractConfigServiceImpl.java
  25. 4 6
      cqb-paper/src/main/java/com/qmth/cqb/paper/web/ExportStructureController.java
  26. 3 4
      cqb-paper/src/main/java/com/qmth/cqb/paper/web/ExtractConfigController.java

+ 15 - 2
cqb-comm-utils/src/main/java/com/qmth/cqb/utils/FileDisposeUtil.java

@@ -153,6 +153,7 @@ public class FileDisposeUtil {
 							while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {
 								zos.write(bufs, 0, read);
 							}
+							zos.flush();
 						}
 						flag = true;
 					}
@@ -165,10 +166,22 @@ public class FileDisposeUtil {
 				throw new RuntimeException(e);
 			} finally {
 				try {
-					if (null != bis)
+					if (null != bis){
 						bis.close();
-					if (null != zos)
+						bis = null;
+					}
+					if (null != fis){
+						fis.close();
+						fis = null;
+					}
+					if (null != zos){
 						zos.close();
+						zos = null;
+					}
+					if (null != fos){
+						fos.close();
+						fos = null;
+					}
 				} catch (IOException e) {
 					e.printStackTrace();
 					throw new RuntimeException(e);

+ 2 - 2
cqb-comm-utils/src/main/java/com/qmth/cqb/utils/word/DocxProcessUtil.java

@@ -681,14 +681,14 @@ public final class DocxProcessUtil {
      * @param dataMap
      * @param fileName   fileName需要带后缀
      */
-    public static void exportWord(Map dataMap, String fileName,Template template)throws Exception {
+    public static void exportWord(Object dataModel, String fileName,Template template)throws Exception {
         Writer out = null;
         // 输出文件
         File outFile = new File(TEMP_FILE_EXP+fileName);
         // 将模板和数据模型合并生成文件
         out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), ENCODING));
         // 生成文件
-        template.process(dataMap, out);
+        template.process(dataModel, out);
         out.flush();
         IOUtils.closeQuietly(out);
     }

+ 6 - 6
cqb-comm-utils/src/main/resources/dzkd_answer_template.ftl

@@ -109,7 +109,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseName}</w:t>
+							<w:t>${courseName}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -125,7 +125,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseLevel}</w:t>
+							<w:t>${courseLevel}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -157,8 +157,8 @@
 						</w:pPr>
 					</w:p>
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -251,8 +251,8 @@
 						</w:r>
 					</w:p>
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 10 - 10
cqb-comm-utils/src/main/resources/dzkd_paper_template.ftl

@@ -783,8 +783,8 @@
    <w:sz w:val="24"/>
    <w:u w:val="single"/>
    </w:rPr></w:pPr>
-   <w:bookmarkStart w:id="0" w:name="_GoBack"/><w:r><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t>考试时间</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve">  90</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>分钟</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve">   </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t xml:space="preserve">  </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t>课程</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="00D87C35" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="00B6458D"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>${paper.courseName}</w:t></w:r>
-   <w:r w:rsidR="0015368E" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>(</w:t></w:r><w:r w:rsidR="0015368E" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>${paper.courseLevel}</w:t></w:r><w:r w:rsidR="0015368E" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>)</w:t></w:r>
+   <w:bookmarkStart w:id="0" w:name="_GoBack"/><w:r><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t>考试时间</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve">  90</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>分钟</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve">   </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t xml:space="preserve">  </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t>课程</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="00D87C35" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="00B6458D"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>${courseName}</w:t></w:r>
+   <w:r w:rsidR="0015368E" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>(</w:t></w:r><w:r w:rsidR="0015368E" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>${courseLevel}</w:t></w:r><w:r w:rsidR="0015368E" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>)</w:t></w:r>
    <w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:color w:val="000000"/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve">      </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t>考试方式</w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve">  </w:t></w:r><w:r w:rsidR="0015368E" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:color w:val="FF0000"/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t>闭卷</w:t></w:r>
    <w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:ascii="宋体" w:hint="eastAsia"/><w:b/><w:color w:val="000000"/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve"> </w:t></w:r><w:r w:rsidR="005E06FB" w:rsidRPr="00D948E2"><w:rPr><w:rFonts w:hint="eastAsia"/><w:b/><w:sz w:val="24"/><w:u w:val="single"/></w:rPr><w:t xml:space="preserve">  </w:t></w:r></w:p>
    <w:bookmarkEnd w:id="0"/>
@@ -902,7 +902,7 @@
 							</w:rPr>
 						</w:pPr>
 					</w:p>
-					<#if paper.objectiveScore != 0>
+					<#if objectiveScore != 0>
 					<w:p w:rsidP="004072CF" w:rsidR="00BC611E" w:rsidRDefault="00F3740E" w:rsidRPr="004072CF">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -939,7 +939,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.objectiveScore} </w:t>
+							<w:t xml:space="preserve">${objectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -963,8 +963,8 @@
 						</w:pPr>
 					</w:p>
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -1039,7 +1039,7 @@
                     </#list>
                     </#if>
                     
-                    <#if paper.subjectiveScore != 0>
+                    <#if subjectiveScore != 0>
 					<w:p w:rsidP="001A590C" w:rsidR="001A590C" w:rsidRDefault="001A590C">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -1103,7 +1103,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.subjectiveScore} </w:t>
+							<w:t xml:space="preserve">${subjectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -1135,8 +1135,8 @@
 						</w:r>
 					</w:p>
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 6 - 6
cqb-comm-utils/src/main/resources/hzkj_answer_template.ftl

@@ -94,7 +94,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseName}</w:t>
+							<w:t>${courseName}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -110,7 +110,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseLevel}</w:t>
+							<w:t>${courseLevel}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -132,8 +132,8 @@
 						</w:pPr>
 					</w:p>
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -226,8 +226,8 @@
 						</w:r>
 					</w:p>
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 11 - 11
cqb-comm-utils/src/main/resources/hzkj_paper_template.ftl

@@ -649,7 +649,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseLevel}</w:t>
+										<w:t>${courseLevel}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -712,7 +712,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseName}</w:t>
+										<w:t>${courseName}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -776,7 +776,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseNo}</w:t>
+										<w:t>${courseNo}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -918,7 +918,7 @@
 							<w:t xml:space="preserve"/>
 						</w:r>
 					</w:p>
-					<#if paper.objectiveScore != 0>
+					<#if objectiveScore != 0>
 					<w:p w:rsidP="004072CF" w:rsidR="00BC611E" w:rsidRDefault="00F3740E" w:rsidRPr="004072CF">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -966,7 +966,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.objectiveScore} </w:t>
+							<w:t xml:space="preserve">${objectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -991,8 +991,8 @@
 					</w:p>
 					
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -1066,7 +1066,7 @@
                     </#if>
 					
 					
-					<#if paper.subjectiveScore != 0>
+					<#if subjectiveScore != 0>
 					<w:p w:rsidP="001A590C" w:rsidR="001A590C" w:rsidRDefault="001A590C">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -1130,7 +1130,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.subjectiveScore} </w:t>
+							<w:t xml:space="preserve">${subjectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -1163,8 +1163,8 @@
 					</w:p>
 					
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 6 - 6
cqb-comm-utils/src/main/resources/sddx_answer_template.ftl

@@ -94,7 +94,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseName}</w:t>
+							<w:t>${courseName}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -110,7 +110,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseLevel}</w:t>
+							<w:t>${courseLevel}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -132,8 +132,8 @@
 						</w:pPr>
 					</w:p>
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -226,8 +226,8 @@
 						</w:r>
 					</w:p>
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 11 - 11
cqb-comm-utils/src/main/resources/sddx_paper_template.ftl

@@ -649,7 +649,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseLevel}</w:t>
+										<w:t>${courseLevel}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -712,7 +712,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseName}</w:t>
+										<w:t>${courseName}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -776,7 +776,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseNo}</w:t>
+										<w:t>${courseNo}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -918,7 +918,7 @@
 							<w:t xml:space="preserve"/>
 						</w:r>
 					</w:p>
-					<#if paper.objectiveScore != 0>
+					<#if objectiveScore != 0>
 					<w:p w:rsidP="004072CF" w:rsidR="00BC611E" w:rsidRDefault="00F3740E" w:rsidRPr="004072CF">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -966,7 +966,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.objectiveScore} </w:t>
+							<w:t xml:space="preserve">${objectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -991,8 +991,8 @@
 					</w:p>
 					
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -1066,7 +1066,7 @@
                     </#if>
 					
 					
-					<#if paper.subjectiveScore != 0>
+					<#if subjectiveScore != 0>
 					<w:p w:rsidP="001A590C" w:rsidR="001A590C" w:rsidRDefault="001A590C">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -1130,7 +1130,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.subjectiveScore} </w:t>
+							<w:t xml:space="preserve">${subjectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -1163,8 +1163,8 @@
 					</w:p>
 					
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 6 - 6
cqb-comm-utils/src/main/resources/sxsf_answer_template.ftl

@@ -94,7 +94,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseName}</w:t>
+							<w:t>${courseName}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -110,7 +110,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseLevel}</w:t>
+							<w:t>${courseLevel}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -132,8 +132,8 @@
 						</w:pPr>
 					</w:p>
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -226,8 +226,8 @@
 						</w:r>
 					</w:p>
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 11 - 11
cqb-comm-utils/src/main/resources/sxsf_paper_template.ftl

@@ -649,7 +649,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseLevel}</w:t>
+										<w:t>${courseLevel}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -712,7 +712,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseName}</w:t>
+										<w:t>${courseName}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -776,7 +776,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseNo}</w:t>
+										<w:t>${courseNo}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -918,7 +918,7 @@
 							<w:t xml:space="preserve"/>
 						</w:r>
 					</w:p>
-					<#if paper.objectiveScore != 0>
+					<#if objectiveScore != 0>
 					<w:p w:rsidP="004072CF" w:rsidR="00BC611E" w:rsidRDefault="00F3740E" w:rsidRPr="004072CF">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -966,7 +966,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.objectiveScore} </w:t>
+							<w:t xml:space="preserve">${objectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -991,8 +991,8 @@
 					</w:p>
 					
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -1066,7 +1066,7 @@
                     </#if>
 					
 					
-					<#if paper.subjectiveScore != 0>
+					<#if subjectiveScore != 0>
 					<w:p w:rsidP="001A590C" w:rsidR="001A590C" w:rsidRDefault="001A590C">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -1130,7 +1130,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.subjectiveScore} </w:t>
+							<w:t xml:space="preserve">${subjectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -1163,8 +1163,8 @@
 					</w:p>
 					
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 6 - 6
cqb-comm-utils/src/main/resources/tjdx_answer_template.ftl

@@ -94,7 +94,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseName}</w:t>
+							<w:t>${courseName}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -110,7 +110,7 @@
 								<w:b/>
 								<w:sz w:val="24"/>
 							</w:rPr>
-							<w:t>${paper.courseLevel}</w:t>
+							<w:t>${courseLevel}</w:t>
 						</w:r>
 						<w:r w:rsidR="0015368E" w:rsidRPr="0081215B">
 							<w:rPr>
@@ -132,8 +132,8 @@
 						</w:pPr>
 					</w:p>
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -226,8 +226,8 @@
 						</w:r>
 					</w:p>
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 11 - 11
cqb-comm-utils/src/main/resources/tjdx_paper_template.ftl

@@ -649,7 +649,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseLevel}</w:t>
+										<w:t>${courseLevel}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -712,7 +712,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseName}</w:t>
+										<w:t>${courseName}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -776,7 +776,7 @@
 											<w:sz w:val="24"/>
 											<w:u w:val="single"/>
 										</w:rPr>
-										<w:t>${paper.courseNo}</w:t>
+										<w:t>${courseNo}</w:t>
 									</w:r>
 									<w:r w:rsidRPr="003907C3">
 										<w:rPr>
@@ -918,7 +918,7 @@
 							<w:t xml:space="preserve"/>
 						</w:r>
 					</w:p>
-					<#if paper.objectiveScore != 0>
+					<#if objectiveScore != 0>
 					<w:p w:rsidP="004072CF" w:rsidR="00BC611E" w:rsidRDefault="00F3740E" w:rsidRPr="004072CF">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -966,7 +966,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.objectiveScore} </w:t>
+							<w:t xml:space="preserve">${objectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -991,8 +991,8 @@
 					</w:p>
 					
 					<!--循环客观题-->
-				    <#if paper.objectiveDetails?exists>
-                    <#list paper.objectiveDetails as paperDetail>
+				    <#if objectiveDetails?exists>
+                    <#list objectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>
@@ -1066,7 +1066,7 @@
                     </#if>
 					
 					
-					<#if paper.subjectiveScore != 0>
+					<#if subjectiveScore != 0>
 					<w:p w:rsidP="001A590C" w:rsidR="001A590C" w:rsidRDefault="001A590C">
 						<w:pPr>
 							<w:spacing w:line="400" w:lineRule="exact"/>
@@ -1130,7 +1130,7 @@
 								<w:sz w:val="28"/>
 								<w:szCs w:val="28"/>
 							</w:rPr>
-							<w:t xml:space="preserve">${paper.subjectiveScore} </w:t>
+							<w:t xml:space="preserve">${subjectiveScore} </w:t>
 						</w:r>
 						<w:r w:rsidRPr="004072CF">
 							<w:rPr>
@@ -1163,8 +1163,8 @@
 					</w:p>
 					
 					<!--循环主观题-->
-					<#if paper.subjectiveDetails?exists>
-                    <#list paper.subjectiveDetails as paperDetail>
+					<#if subjectiveDetails?exists>
+                    <#list subjectiveDetails as paperDetail>
 					<w:p w:rsidP="004D3783" w:rsidR="00687CD1" w:rsidRDefault="004D3783" w:rsidRPr="006E2D68">
 						<w:r>
 							<w:rPr>

+ 1 - 2
cqb-paper/src/main/java/com/qmth/cqb/paper/model/ExportStructure.java

@@ -65,9 +65,8 @@ public class ExportStructure implements Serializable{
     	this.examType = examType;
     }
     
-    public ExportStructure(String examId,ExamType examType){
+    public ExportStructure(String examId){
     	this.examId = examId;
-    	this.examType = examType;
     }
     
     public ExportStructure(ExportPaperInfoModel exportModel){

+ 2 - 4
cqb-paper/src/main/java/com/qmth/cqb/paper/service/ExportStructureService.java

@@ -1,11 +1,9 @@
 package com.qmth.cqb.paper.service;
 
 import java.util.List;
-import java.util.Map;
 
 import org.springframework.data.domain.Page;
 
-import cn.com.qmth.examcloud.common.dto.em.enums.ExamType;
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
 
 import com.qmth.cqb.paper.model.ExportStructure;
@@ -38,14 +36,14 @@ public interface ExportStructureService {
 	 */
 	public Page<ExportStructure> findPageByExportStructure(ExportStructure exportStructure,int curPage,int pageSize);
 	/**
-	 * 根据考试类型和考试ID查询结构
+	 * 根据考试ID查询结构
 	 * 如果结构存在、判断结构设置是否完整
 	 * 是否完整是指 客观题题数是否都设置过了
 	 * @param examId
 	 * @param examType
 	 * @return
 	 */
-	public Map<String,Object> findStructureByExamIdAndExamType(String examId,ExamType examType);
+	public ExportStructure findStructureByExamId(String examId);
 	
 	/**
 	 * 根据考试类型查询考试id

+ 1 - 1
cqb-paper/src/main/java/com/qmth/cqb/paper/service/ExtractConfigService.java

@@ -40,7 +40,7 @@ public interface ExtractConfigService {
 	 * @param orgName		机构名称
 	 * @throws Exception
 	 */
-	public Map<String, Object> saveExtractConfig(ExtractConfig extractConfig,String orgName,AccessUser accessUser) throws Exception;
+	public void saveExtractConfig(ExtractConfig extractConfig,String orgName,AccessUser accessUser) throws Exception;
 	/**
 	 * 按照设定调卷规则生成一套试卷
 	 * 1.根据extractConfigId取出调卷规则

+ 8 - 19
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/DzkdExportPaperService.java

@@ -35,13 +35,13 @@ public class DzkdExportPaperService extends ExportPaperAbstractService{
      */
     @Override
     public void downloadPaper(String id, HttpServletResponse response) throws Exception {
-        Map<String,Object> dataMap = initExportPaper(id);
+    	PaperExp paperExp = initExportPaper(id);
         List<String> fileList = new ArrayList<String>();
-        if (dataMap.get("fileName") != null) {
-        	String paperfileName = (String) dataMap.get("fileName")+DOCX_SUFFIX;
-            String answerFileName = (String) dataMap.get("fileName")+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
-            DocxProcessUtil.exportWord(dataMap, paperfileName,DZKD_TEMPLATE_PAPER);
-            DocxProcessUtil.exportWord(dataMap,answerFileName,DZKD_TEMPLATE_ANSWER);
+        if (paperExp!=null) {
+        	String paperfileName = paperExp.getName()+DOCX_SUFFIX;
+            String answerFileName = paperExp.getName()+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
+            DocxProcessUtil.exportWord(paperExp,paperfileName,DZKD_TEMPLATE_PAPER);
+            DocxProcessUtil.exportWord(paperExp,answerFileName,DZKD_TEMPLATE_ANSWER);
             DocxProcessUtil.processImage(paperfileName,getPkgList(id));
             DocxProcessUtil.processImage(answerFileName,getPkgList(id));
             fileList.add(paperfileName);
@@ -56,9 +56,7 @@ public class DzkdExportPaperService extends ExportPaperAbstractService{
 	 * @return
 	 */
     @Override
-    public Map<String,Object> initExportPaper(String paperId) throws Exception {
-		// 创建返回Map
-		Map<String,Object> returnMap = new HashMap<String,Object>();
+    public PaperExp initExportPaper(String paperId) throws Exception {
 		// 获取paper
 		Paper paper = paperRepo.findOne(paperId);
 		paperService.formatPaper(paper, null);
@@ -128,16 +126,7 @@ public class DzkdExportPaperService extends ExportPaperAbstractService{
 			setUnitExpNumber(subjectiveDetails, objetcUnitSum);
 			appendScoreToQuestionBody(subjectiveDetails);
 		}
-		returnMap.put("paper", paperExp);
-		returnMap.put("fileName", paperExp.getName());
-
-		return returnMap;
-	}
-
-	@Override
-	public void uploadFile(ExtractConfig extractConfig,String paperId,AccessUser accessUser,Map<String,Object> exportStructureMap) throws Exception {
-		// TODO Auto-generated method stub
-		
+		return paperExp;
 	}
 
 }

+ 8 - 17
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/ExportPaperAbstractService.java

@@ -34,7 +34,7 @@ import com.qmth.cqb.paper.dao.PaperRepo;
 import com.qmth.cqb.paper.dto.PaperDetailExp;
 import com.qmth.cqb.paper.dto.PaperDetailUnitExp;
 import com.qmth.cqb.paper.dto.PaperExp;
-import com.qmth.cqb.paper.model.ExamFile;
+import com.qmth.cqb.paper.model.ExportStructure;
 import com.qmth.cqb.paper.model.ExtractConfig;
 import com.qmth.cqb.paper.model.Paper;
 import com.qmth.cqb.paper.model.PaperDetail;
@@ -46,7 +46,6 @@ import com.qmth.cqb.question.model.QuesOption;
 import com.qmth.cqb.question.model.Question;
 import com.qmth.cqb.utils.BeanCopierUtil;
 import com.qmth.cqb.utils.CommonUtils;
-import com.qmth.cqb.utils.enums.ExamFileType;
 import com.qmth.cqb.utils.exception.PaperException;
 import com.qmth.cqb.utils.word.DocxProcessUtil;
 
@@ -178,7 +177,9 @@ public abstract class ExportPaperAbstractService {
 	 * @param paperId
 	 * @throws Exception
 	 */
-    public abstract void uploadFile(ExtractConfig extractConfig,String paperId,AccessUser accessUser,Map<String,Object> exportStructureMap) throws Exception;
+    public void uploadFile(ExtractConfig extractConfig,String paperId,ExportStructure exportStructure,AccessUser accessUser)  throws Exception{
+    	
+    }
 	
 	/**
 	 * 初始化导出试卷DTO
@@ -186,9 +187,7 @@ public abstract class ExportPaperAbstractService {
 	 * @param id
 	 * @return
 	 */
-	public Map<String,Object> initExportPaper(String paperId) throws Exception {
-		// 创建返回Map
-		Map<String,Object> returnMap = new HashMap<String,Object>();
+	public PaperExp initExportPaper(String paperId) throws Exception {
 		// 获取paper
 		Paper paper = paperRepo.findOne(paperId);
 		paperService.formatPaper(paper, null);
@@ -259,10 +258,7 @@ public abstract class ExportPaperAbstractService {
 			setUnitExpNumber(subjectiveDetails, objetcUnitSum);
 			appendScoreToQuestionBody(subjectiveDetails);
 		}
-		returnMap.put("paper", paperExp);
-		returnMap.put("fileName", paperExp.getName());
-
-		return returnMap;
+		return paperExp;
 	}
 
 	protected void setExpTitle(PaperDetailExp paperDetailExp) {
@@ -380,13 +376,8 @@ public abstract class ExportPaperAbstractService {
                             if(tObj.getClass().equals(Text.class)){
                                 Text text = (Text)tObj;
                                 String str = text.getValue().trim();
-                                if(str.equals("###")){
-                                    text.setValue("______");
-                                }else if(str.equals("(###)")){
-                                	text.setValue("(______)");
-                                }else if(str.equals("(###)")){
-                                	text.setValue("(______)");
-                                }else if(str.matches("##\\d{1,}##")){
+                                str.replaceAll("###","______");
+                                if(str.matches("##\\d{1,}##")){
                                     int curNum = num + index;
                                     text.setValue("___"+(curNum)+"___");
                                     index++;

+ 7 - 20
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/HzkjExportPaperService.java

@@ -1,21 +1,13 @@
 package com.qmth.cqb.paper.service.export;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 import javax.servlet.http.HttpServletResponse;
 
-import main.java.com.UpYun;
-
 import org.springframework.stereotype.Service;
 
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-
-import com.qmth.cqb.paper.model.ExamFile;
-import com.qmth.cqb.paper.model.ExtractConfig;
-import com.qmth.cqb.utils.CommonUtils;
+import com.qmth.cqb.paper.dto.PaperExp;
 import com.qmth.cqb.utils.enums.ExamFileType;
 import com.qmth.cqb.utils.word.DocxProcessUtil;
 
@@ -33,13 +25,13 @@ public class HzkjExportPaperService extends ExportPaperAbstractService {
 	
     @Override
     public void downloadPaper(String paperId, HttpServletResponse response) throws Exception {
-        Map<String,Object> dataMap = initExportPaper(paperId);
+    	PaperExp paperExp = initExportPaper(paperId);
         List<String> fileList = new ArrayList<String>();
-        if (dataMap.get("fileName") != null) {
-        	String paperfileName = (String) dataMap.get("fileName")+DOCX_SUFFIX;
-            String answerFileName = (String) dataMap.get("fileName")+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
-            DocxProcessUtil.exportWord(dataMap, paperfileName,HZKJ_TEMPLATE_PAPER);
-            DocxProcessUtil.exportWord(dataMap,answerFileName,HZKJ_TEMPLATE_ANSWER);
+        if (paperExp != null) {
+        	String paperfileName = paperExp.getName()+DOCX_SUFFIX;
+            String answerFileName = paperExp.getName()+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
+            DocxProcessUtil.exportWord(paperExp, paperfileName,HZKJ_TEMPLATE_PAPER);
+            DocxProcessUtil.exportWord(paperExp,answerFileName,HZKJ_TEMPLATE_ANSWER);
             DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
             DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
             fileList.add(paperfileName);
@@ -48,10 +40,5 @@ public class HzkjExportPaperService extends ExportPaperAbstractService {
         }
     }
 
-    @Override
-    public void uploadFile(ExtractConfig extractConfig,String paperId,AccessUser accessUser,Map<String,Object> exportStructureMap) throws Exception{
-    	
-    }
-    
 }
 

+ 7 - 12
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/SddxExportPaperService.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
 
+import com.qmth.cqb.paper.dto.PaperExp;
 import com.qmth.cqb.paper.model.ExamFile;
 import com.qmth.cqb.paper.model.ExtractConfig;
 import com.qmth.cqb.utils.CommonUtils;
@@ -33,13 +34,13 @@ public class SddxExportPaperService extends ExportPaperAbstractService {
 	
     @Override
     public void downloadPaper(String paperId, HttpServletResponse response) throws Exception {
-        Map<String,Object> dataMap = initExportPaper(paperId);
+    	PaperExp paperExp = initExportPaper(paperId);
         List<String> fileList = new ArrayList<String>();
-        if (dataMap.get("fileName") != null) {
-        	String paperfileName = (String) dataMap.get("fileName")+DOCX_SUFFIX;
-            String answerFileName = (String) dataMap.get("fileName")+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
-            DocxProcessUtil.exportWord(dataMap, paperfileName,SDDX_TEMPLATE_PAPER);
-            DocxProcessUtil.exportWord(dataMap,answerFileName,SDDX_TEMPLATE_ANSWER);
+        if (paperExp != null) {
+        	String paperfileName = paperExp.getName()+DOCX_SUFFIX;
+            String answerFileName = paperExp.getName()+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
+            DocxProcessUtil.exportWord(paperExp, paperfileName,SDDX_TEMPLATE_PAPER);
+            DocxProcessUtil.exportWord(paperExp,answerFileName,SDDX_TEMPLATE_ANSWER);
             DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
             DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
             fileList.add(paperfileName);
@@ -48,10 +49,4 @@ public class SddxExportPaperService extends ExportPaperAbstractService {
         }
     }
 
-    @Override
-    public void uploadFile(ExtractConfig extractConfig,String paperId,AccessUser accessUser,Map<String,Object> exportStructureMap) throws Exception{
-    	
-    }
-    
 }
-

+ 32 - 37
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/SxsfExportPaperService.java

@@ -7,7 +7,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -57,13 +56,13 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
 	
     @Override
     public void downloadPaper(String paperId, HttpServletResponse response) throws Exception {
-        Map<String,Object> dataMap = initExportPaper(paperId);
+    	PaperExp paperExp = initExportPaper(paperId);
         List<String> fileList = new ArrayList<String>();
-        if (dataMap.get("fileName") != null) {
-            String paperfileName = (String) dataMap.get("fileName")+DOCX_SUFFIX;
-            String answerFileName = (String) dataMap.get("fileName")+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
-            DocxProcessUtil.exportWord(dataMap, paperfileName,SXSF_TEMPLATE_PAPER);
-            DocxProcessUtil.exportWord(dataMap,answerFileName,SXSF_TEMPLATE_ANSWER);
+        if (paperExp!= null) {
+            String paperfileName = paperExp.getName()+DOCX_SUFFIX;
+            String answerFileName = paperExp.getName()+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
+            DocxProcessUtil.exportWord(paperExp, paperfileName,SXSF_TEMPLATE_PAPER);
+            DocxProcessUtil.exportWord(paperExp,answerFileName,SXSF_TEMPLATE_ANSWER);
             DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
             DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
             fileList.add(paperfileName);
@@ -73,34 +72,32 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
     }
 
     @Override
-    public void uploadFile(ExtractConfig extractConfig,String paperId,AccessUser accessUser,Map<String,Object> exportStructureMap) throws Exception{
-    	Map<String,Object> dataMap = initExportPaper(paperId);
-        if (dataMap.get("fileName") != null) {
+    public void uploadFile(ExtractConfig extractConfig,String paperId,ExportStructure exportStructure,AccessUser accessUser) throws Exception{
+    	PaperExp paperExp = initExportPaper(paperId);
+        if (paperExp!=null) {
         	String currNum = CommonUtils.getCurNum();
-    		ExportStructure exportStructure = (ExportStructure) exportStructureMap.get("exportStructure");
-    		List<QuestionTypeNum> questionTypeNums = new ArrayList<QuestionTypeNum>();
-    		if(exportStructure!=null){
-    			questionTypeNums = exportStructure.getQuestionTypeNums();
-    		}
-    		PaperExp paperExp = (PaperExp) dataMap.get("paper");
         	List<PaperDetailExp> objectiveDetails = paperExp.getObjectiveDetails();
-        	//检查客观题的数量是否大于试卷导出设置中的客观题数量
-        	if(questionTypeNums.size()>0){
-        		checkObjectiveDetailsNum(paperExp,objectiveDetails,questionTypeNums);
-        	}
         	if(exportStructure==null||exportStructure.getExportType()==ExportType.NORMAL){
+        		List<QuestionTypeNum> questionTypeNums = new ArrayList<QuestionTypeNum>();
+        		if(exportStructure!=null){
+        			questionTypeNums = exportStructure.getQuestionTypeNums();
+        		}
+        		//检查客观题的数量是否大于试卷导出设置中的客观题数量
+            	if(questionTypeNums.size()>0){
+            		checkObjectiveDetailsNum(paperExp,objectiveDetails,questionTypeNums);
+            	}
 	    		//上传试卷
-	        	uploadPaperWord(dataMap,extractConfig,paperId,accessUser,currNum);
+	        	uploadPaperWord(paperExp,extractConfig,paperId,accessUser,currNum);
 	        	//上传答案
-	        	uploadAnswerWord(dataMap,extractConfig,paperId,accessUser,currNum);
+	        	uploadAnswerWord(paperExp,extractConfig,paperId,accessUser,currNum);
+	        	//上传试卷结构
+	        	if(questionTypeNums.size()>0){
+	        		uploadPaperStructure(paperExp,extractConfig,paperId,accessUser,currNum,questionTypeNums);
+	        	}
         	}else if(exportStructure.getExportType()==ExportType.ONLINE){
         		//上传机考JSON文件
         		uploadComputerTestFile(extractConfig,currNum);
         	}
-        	//上传试卷结构
-        	if(questionTypeNums.size()>0){
-        		uploadPaperStructure(dataMap,extractConfig,paperId,accessUser,currNum,questionTypeNums);
-        	}
         }
     }
     
@@ -112,10 +109,10 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
      * @param paperId
      * @param accessUser
      */
-    private void uploadPaperWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
+    private void uploadPaperWord(PaperExp paperExp,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
     	String paperfileName = currNum+ExamFileType.PAPER.name()+DOCX_SUFFIX;
     	try {
-			DocxProcessUtil.exportWord(dataMap,paperfileName,SXSF_TEMPLATE_PAPER);
+			DocxProcessUtil.exportWord(paperExp,paperfileName,SXSF_TEMPLATE_PAPER);
 			DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
 			File paperFile  = new File(TEMP_FILE_EXP+paperfileName);
 			String paperFilePath = uploadUrl+paperfileName;
@@ -136,10 +133,10 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
      * @param paperId
      * @param accessUser
      */
-    private void uploadAnswerWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
+    private void uploadAnswerWord(PaperExp paperExp,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
     	String answerFileName = currNum+ExamFileType.ANSWER.name()+DOCX_SUFFIX;
     	try {
-    		DocxProcessUtil.exportWord(dataMap,answerFileName,SXSF_TEMPLATE_ANSWER);
+    		DocxProcessUtil.exportWord(paperExp,answerFileName,SXSF_TEMPLATE_ANSWER);
     		DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
     		File answerFile  = new File(TEMP_FILE_EXP+answerFileName);
     		String answerFilePath = uploadUrl+answerFileName;
@@ -155,9 +152,9 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
     /**
      * 生成试卷结构,上传至又拍云
      */
-    private void uploadPaperStructure(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum,List<QuestionTypeNum> questionTypeNums) {
-    	exportObjectiveQuestionStructures(dataMap,extractConfig,accessUser,currNum,questionTypeNums);
-    	exportSubjectiveQuestionStructures(dataMap,extractConfig,accessUser,currNum);
+    private void uploadPaperStructure(PaperExp paperExp,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum,List<QuestionTypeNum> questionTypeNums) {
+    	exportObjectiveQuestionStructures(paperExp,extractConfig,accessUser,currNum,questionTypeNums);
+    	exportSubjectiveQuestionStructures(paperExp,extractConfig,accessUser,currNum);
 	}
     
     /**
@@ -165,9 +162,8 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
      * @param paperExp
      * @return
      */
-    private void exportObjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum,List<QuestionTypeNum> questionTypeNums){
+    private void exportObjectiveQuestionStructures(PaperExp paperExp,ExtractConfig extractConfig,AccessUser accessUser,String currNum,List<QuestionTypeNum> questionTypeNums){
     	String objectiveFilename = currNum+ExamFileType.PAPER_STRUCTURE_OBJECTIVE.name()+EXCEL_SUFFIX;
-    	PaperExp paperExp = (PaperExp) dataMap.get("paper");
     	List<PaperDetailExp> objectiveDetails = paperExp.getObjectiveDetails();
     	//根据试卷结构导出设置中的数量补齐客观题
     	fillObjectiveQuestions(objectiveDetails,questionTypeNums);
@@ -257,9 +253,8 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
      * @param paperExp
      * @return
      */
-    private void exportSubjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum){
+    private void exportSubjectiveQuestionStructures(PaperExp paperExp,ExtractConfig extractConfig,AccessUser accessUser,String currNum){
     	String subjectiveFileName = currNum+ExamFileType.PAPER_STRUCTURE_SUBJECTIVE.name()+EXCEL_SUFFIX;
-    	PaperExp paperExp = (PaperExp) dataMap.get("paper");
     	List<PaperDetailExp> subjectiveDetails = paperExp.getSubjectiveDetails();
     	List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
     	for(PaperDetailExp paperDetailExp:subjectiveDetails){

+ 2 - 3
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/SydxExportPaperService.java

@@ -120,8 +120,7 @@ public class SydxExportPaperService{
         for(int i = 0; i < paperDetailExps.size(); i++){
             PaperDetailExp paperDetailExp = paperDetailExps.get(i);
             paperDetailExp.setTitle(getDetailTitle(paperDetailExp));
-            List<PaperDetailUnit> paperDetailUnits =
-                    paperDetailUnitRepo.findByPaperDetail(paperDetails.get(i));
+            List<PaperDetailUnit> paperDetailUnits =paperDetailUnitRepo.findByPaperDetail(paperDetails.get(i));
 
             setAnswerWord(paperDetailUnits);
 
@@ -278,7 +277,7 @@ public class SydxExportPaperService{
     	List<String> fileNames = new ArrayList<String>();
         Map<String,Object> dataMap = initExportPaper(id);
         if (dataMap.get("fileName") != null) {
-            String fileName = (String) dataMap.get("fileName");
+            String fileName = (String) dataMap.get("fileName")+".docx";
             DocxProcessUtil.exportWord(dataMap, fileName,SYDX_TEMPLATE_NORMAL);
             DocxProcessUtil.processImage(fileName, getPkgList(id));
             fileNames.add(fileName);

+ 7 - 11
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/TjdxExportPaperService.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
 
+import com.qmth.cqb.paper.dto.PaperExp;
 import com.qmth.cqb.paper.model.ExamFile;
 import com.qmth.cqb.paper.model.ExtractConfig;
 import com.qmth.cqb.utils.CommonUtils;
@@ -33,13 +34,13 @@ public class TjdxExportPaperService extends ExportPaperAbstractService {
 	
     @Override
     public void downloadPaper(String paperId, HttpServletResponse response) throws Exception {
-        Map<String,Object> dataMap = initExportPaper(paperId);
+    	PaperExp paperExp = initExportPaper(paperId);
         List<String> fileList = new ArrayList<String>();
-        if (dataMap.get("fileName") != null) {
-        	String paperfileName = (String) dataMap.get("fileName")+DOCX_SUFFIX;
-            String answerFileName = (String) dataMap.get("fileName")+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
-            DocxProcessUtil.exportWord(dataMap, paperfileName,TJDX_TEMPLATE_PAPER);
-            DocxProcessUtil.exportWord(dataMap,answerFileName,TJDX_TEMPLATE_ANSWER);
+        if (paperExp!= null) {
+        	String paperfileName = paperExp.getName()+DOCX_SUFFIX;
+            String answerFileName = paperExp.getName()+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
+            DocxProcessUtil.exportWord(paperExp, paperfileName,TJDX_TEMPLATE_PAPER);
+            DocxProcessUtil.exportWord(paperExp,answerFileName,TJDX_TEMPLATE_ANSWER);
             DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
             DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
             fileList.add(paperfileName);
@@ -47,11 +48,6 @@ public class TjdxExportPaperService extends ExportPaperAbstractService {
             DocxProcessUtil.processDownload(fileList, response);
         }
     }
-
-    @Override
-    public void uploadFile(ExtractConfig extractConfig,String paperId,AccessUser accessUser,Map<String,Object> exportStructureMap) throws Exception{
-    	
-    }
     
 }
 

+ 5 - 11
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/ExportStructureServiceImpl.java

@@ -2,9 +2,7 @@ package com.qmth.cqb.paper.service.impl;
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import main.java.com.UpYun;
 
@@ -96,25 +94,21 @@ public class ExportStructureServiceImpl implements ExportStructureService {
 	}
 
 	@Override
-	public Map<String, Object> findStructureByExamIdAndExamType(String examId,ExamType examType) {
-		Map<String, Object> returnMap = new HashMap<String, Object>();
-		ExportStructure exportStructure = findByExportStructure(new ExportStructure(examId,examType));
+	public ExportStructure findStructureByExamId(String examId) {
+		ExportStructure exportStructure = findByExportStructure(new ExportStructure(examId));
 		if(exportStructure==null){
-			returnMap.put("returnMsg", "no_structure");
-			return returnMap;
+			return null;
 		}
 		if(exportStructure.getExportType()==ExportType.NORMAL){
 			List<QuestionTypeNum> questionTypeNums = exportStructure.getQuestionTypeNums();
 			for(QuestionTypeNum questionTypeNum:questionTypeNums){
 				if(questionTypeNum.getQuantity()==null){
 					//结构设置不完整
-					returnMap.put("returnMsg", "structure_imperfect");
-					return returnMap;
+					throw new RuntimeException("试卷结构导出设置不完整");
 				}
 			}
 		}
-		returnMap.put("exportStructure",exportStructure);
-		return returnMap;
+		return exportStructure;
 	}
 
 	@Override

+ 16 - 31
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/ExtractConfigServiceImpl.java

@@ -31,7 +31,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.Assert;
 
 import cn.com.qmth.examcloud.common.dto.core.ExamCourseDto;
-import cn.com.qmth.examcloud.common.dto.em.enums.ExamType;
 import cn.com.qmth.examcloud.common.dto.question.PaperDetailDto;
 import cn.com.qmth.examcloud.common.dto.question.PaperDetailUnitDto;
 import cn.com.qmth.examcloud.common.dto.question.PaperDto;
@@ -164,18 +163,9 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 	}
 
 	@Override
-	public Map<String, Object> saveExtractConfig(ExtractConfig extractConfig,String orgName,AccessUser accessUser) throws Exception {
-		Map<String, Object> returnMap = exportStructureService.findStructureByExamIdAndExamType(extractConfig.getExamId()+"",ExamType.strToEnum(extractConfig.getExamType()));
-		//试卷导出结构设置不完整
-		if("structure_imperfect".equals(returnMap.get("returnMsg"))){
-			return returnMap;
-		}
-		if(extractConfig.getScrambling_the_question_order()==null){
-			extractConfig.setScrambling_the_question_order((short) 0);
-		}
-		if(extractConfig.getScrambling_the_option_order()==null){
-			extractConfig.setScrambling_the_option_order((short) 0);
-		}
+	public void saveExtractConfig(ExtractConfig extractConfig,String orgName,AccessUser accessUser) throws Exception {
+		//查询试卷导出设置
+		ExportStructure exportStructure = exportStructureService.findStructureByExamId(extractConfig.getExamId()+"");
 		List<ExamPaper> examPapers = extractConfig.getExamPaperList();
 		for(int i=0;i<examPapers.size();i++){
 			ExamPaper examPaper = examPapers.get(i);
@@ -192,16 +182,14 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 		Iterator<Entry<String,String>> iterator = entry.iterator();
 		while(iterator.hasNext()){
 			String paperId = iterator.next().getValue();
-			uploadPaperFile(extractConfig,paperId,accessUser,returnMap);
+			uploadPaperFile(extractConfig,paperId,exportStructure,accessUser);
 		}
-		returnMap.put("returnMsg", "success");
-		return returnMap;
 	}
 
-	private void uploadPaperFile(ExtractConfig extractConfig,String paperId,AccessUser accessUser,Map<String,Object> exportStructureMap) throws Exception {
+	private void uploadPaperFile(ExtractConfig extractConfig,String paperId,ExportStructure exportStructure,AccessUser accessUser) throws Exception {
 		ExportServiceManage esm = exportServiceManageRepo.findByOrgName("陕西师范大学");
     	ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById(esm.getExportServiceName());
-    	exportPaperAbstractService.uploadFile(extractConfig,paperId,accessUser,exportStructureMap);
+    	exportPaperAbstractService.uploadFile(extractConfig,paperId,exportStructure,accessUser);
 	}
 
 	@Override
@@ -682,8 +670,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
     
     @Override
 	public void exportExamPaperInfoCheck(ExportPaperInfoModel exportModel,HttpServletResponse response) throws Exception {
-    	Map<String, Object> exportStructureMap = exportStructureService.findStructureByExamIdAndExamType(exportModel.getExamId()+"",exportModel.getExamType());
-		ExportStructure exportStructure = (ExportStructure) exportStructureMap.get("exportStructure");
+    	ExportStructure exportStructure = exportStructureService.findStructureByExamId(exportModel.getExamId()+"");
 		//如果是批量导出
 		if(exportModel.getExportWay()==ExportWay.BATCH){
 			if(exportStructure==null){
@@ -702,8 +689,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 		FileDisposeUtil.createDirectory(zipDirectory);
 		//如果是批量导出,首先检查该考试下的所有课程是否都制定了调卷规则
 		List<String> paperIds = new ArrayList<String>();
-		Map<String, Object> exportStructureMap = exportStructureService.findStructureByExamIdAndExamType(exportModel.getExamId()+"",exportModel.getExamType());
-		ExportStructure exportStructure = (ExportStructure) exportStructureMap.get("exportStructure");
+		ExportStructure exportStructure = exportStructureService.findStructureByExamId(exportModel.getExamId()+"");
 		//如果是批量导出
 		if(exportModel.getExportWay()==ExportWay.BATCH){
 			if(exportStructure==null){
@@ -722,13 +708,13 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 			for(ExamFile examFile:examFiles){
 				FileDisposeUtil.saveUrlAs(downloadUrl+examFile.getFilePath(),downloadDirectory+File.separator+examFile.getFileName());
 			}
-			//创建压缩文件名称
-			String zipFileName = CommonUtils.getCurNum();
-			//将downloadDirectory文件夹压缩成zip文件,存放到zipDirectory文件夹中
-			FileDisposeUtil.fileToZip(downloadDirectory,zipDirectory,zipFileName);
-			//下载zip文件到客户端
-			FileDisposeUtil.downloadFile(zipFileName+".zip",zipDirectory+File.separator+zipFileName+".zip",response);
 		}
+		//创建压缩文件名称
+		String zipFileName = CommonUtils.getCurNum();
+		//将downloadDirectory文件夹压缩成zip文件,存放到zipDirectory文件夹中
+		FileDisposeUtil.fileToZip(downloadDirectory,zipDirectory,zipFileName);
+		//下载zip文件到客户端
+		FileDisposeUtil.downloadFile(zipFileName+".zip",zipDirectory+File.separator+zipFileName+".zip",response);
 	}
 	
 	/**
@@ -746,7 +732,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 			extractConfig = findConfig(extractConfig);
 			Map<String,String> finishedPaperIdMap = extractConfig.getFinishedPaperIdMap();
 			if(extractConfig==null||finishedPaperIdMap==null){
-				throw new RuntimeException("该考试下的课程没有全部制定调卷规则或考试文件没有生成,不能批量导出");
+				throw new RuntimeException("该考试下的课程“"+extractConfig.getCourseName()+"”没有制定调卷规则或考试文件没有生成,不能批量导出");
 			}
 			Set<Entry<String,String>> entry = finishedPaperIdMap.entrySet();
 			Iterator<Entry<String,String>> iterator = entry.iterator();
@@ -766,8 +752,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 		List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
 		
 		for(String paperId:paperIds){
-			Map<String,Object> dataMap = sxsfExportPaperService.initExportPaper(paperId);
-			PaperExp paperExp = (PaperExp) dataMap.get("paper");
+			PaperExp paperExp = sxsfExportPaperService.initExportPaper(paperId);
 			List<PaperDetailExp> objectiveDetails = paperExp.getObjectiveDetails();
 			//根据设置补齐客观题
 			sxsfExportPaperService.fillObjectiveQuestions(objectiveDetails, questionTypeNums);

+ 4 - 6
cqb-paper/src/main/java/com/qmth/cqb/paper/web/ExportStructureController.java

@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
-import cn.com.qmth.examcloud.common.dto.em.enums.ExamType;
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
 
 import com.qmth.cqb.paper.model.ExportStructure;
@@ -65,11 +64,10 @@ public class ExportStructureController {
 		}
 	}
 	
-	@ApiOperation(value="根据考试类型和考试名称查询导出结构",notes="根据考试类型和考试名称查询导出结构")
-	@GetMapping(value="/findExportStructureByExamTypeAndExamId/{examType}/{examId}")
-	public ResponseEntity findExportStructureByExamTypeAndExamId(@PathVariable String examType,
-																 @PathVariable String examId){
-		ExportStructure exportStructure = exportStructureService.findByExportStructure(new ExportStructure(examId,ExamType.strToEnum(examType)));
+	@ApiOperation(value="根据考试ID查询导出结构",notes="根据考试ID查询导出结构")
+	@GetMapping(value="/findExportStructure/{examId}")
+	public ResponseEntity findExportStructureByExamTypeAndExamId(@PathVariable String examId){
+		ExportStructure exportStructure = exportStructureService.findByExportStructure(new ExportStructure(examId));
 		return new ResponseEntity(exportStructure,HttpStatus.OK);
 	}
 	

+ 3 - 4
cqb-paper/src/main/java/com/qmth/cqb/paper/web/ExtractConfigController.java

@@ -32,7 +32,6 @@ import cn.com.qmth.examcloud.common.util.ErrorMsg;
 
 import com.qmth.cqb.paper.dto.ExportPaperInfoModel;
 import com.qmth.cqb.paper.model.ExtractConfig;
-import com.qmth.cqb.paper.rpc.ExamCourseClient;
 import com.qmth.cqb.paper.service.ExtractConfigService;
 import com.qmth.cqb.utils.enums.ExportWay;
 
@@ -67,7 +66,6 @@ public class ExtractConfigController {
 		}
 	}
 	
-	
 	@ApiOperation(value = "根据考试ID和课程ID获取调卷规则", notes = "根据考试ID和课程ID获取调卷规则")
     @GetMapping(value = "/extractConfig/{examId}/{courseCode}")
 	public ResponseEntity<ExtractConfig> findExtractConfig(@PathVariable Long examId,@PathVariable String courseCode){
@@ -93,9 +91,10 @@ public class ExtractConfigController {
 		try{
 			AccessUser user = (AccessUser) request.getAttribute("accessUser");
 			extractConfig.setOrgId(user.getRootOrgId()+"");
-			Map<String,Object> returnMap = extractConfigService.saveExtractConfig(extractConfig,orgName,user);
-			return new ResponseEntity<Object>(returnMap,HttpStatus.OK);
+			extractConfigService.saveExtractConfig(extractConfig,orgName,user);
+			return new ResponseEntity<Object>(HttpStatus.OK);
 		}catch(Exception e){
+			e.printStackTrace();
 			return new ResponseEntity<Object>(new ErrorMsg(e.getMessage()),HttpStatus.INTERNAL_SERVER_ERROR);
 		}
 	}