Browse Source

Merge branch 'dev0410' of https://git.oschina.net/songyue123456/comm-ques-bank into dev0410

chenken 7 years ago
parent
commit
287d69bed1

+ 1 - 1
cqb-comm-utils/pom.xml

@@ -201,7 +201,7 @@
             <artifactId>ansj_seg</artifactId>
             <artifactId>ansj_seg</artifactId>
             <version>5.1.1</version>
             <version>5.1.1</version>
         </dependency>
         </dependency>
-        
+
         <dependency>
         <dependency>
 		  <groupId>com.upyun</groupId>
 		  <groupId>com.upyun</groupId>
 		  <artifactId>java-sdk</artifactId>
 		  <artifactId>java-sdk</artifactId>

+ 152 - 8
cqb-comm-utils/src/main/java/com/qmth/cqb/utils/CommonUtils.java

@@ -1,8 +1,8 @@
 package com.qmth.cqb.utils;
 package com.qmth.cqb.utils;
 
 
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.*;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
@@ -13,6 +13,8 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 import java.util.stream.Stream;
 import java.util.stream.Stream;
 
 
+import com.qmth.cqb.utils.word.DocxProcessUtil;
+import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.dom4j.Attribute;
 import org.dom4j.Attribute;
 import org.dom4j.Document;
 import org.dom4j.Document;
@@ -21,6 +23,8 @@ import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.dom4j.Element;
 
 
 import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
 import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
 /**
  * Created by songyue on 16/12/27.
  * Created by songyue on 16/12/27.
@@ -36,6 +40,8 @@ public final class CommonUtils {
     public static final String PAPER_TITLE="中国石油大学";
     public static final String PAPER_TITLE="中国石油大学";
     public static final String PAPER_SUB_TITLE="网络教育";
     public static final String PAPER_SUB_TITLE="网络教育";
 
 
+    private static final Logger log = LoggerFactory.getLogger(CommonUtils.class);
+
     /**
     /**
      * 加载properties配置文件
      * 加载properties配置文件
      * 
      * 
@@ -50,7 +56,7 @@ public final class CommonUtils {
             BufferedReader bf = new BufferedReader(new InputStreamReader(inputStream));
             BufferedReader bf = new BufferedReader(new InputStreamReader(inputStream));
             properties.load(bf);
             properties.load(bf);
         } catch (Exception e) {
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("加载配置异常:",e.getMessage());
         }
         }
         return properties;
         return properties;
     }
     }
@@ -268,13 +274,151 @@ public final class CommonUtils {
 		}
 		}
 		return idValues;
 		return idValues;
     }
     }
-    
 
 
-    public static void main(String[] args) {
+    /**
+     * 保留两位小数
+     * @param number
+     * @return
+     */
+    public static double formatDouble(double number){
+        BigDecimal formatNumber = new BigDecimal(number);
+        return formatNumber.setScale(2, RoundingMode.HALF_UP).doubleValue();
+    }
+
+    /**
+     * 向下取整,可以取0.5
+     * @param number
+     * @return
+     */
+    public static double formatDoubleFloor(double number){
+        BigDecimal formatNumber = new BigDecimal(number);
+        double floorNumber = formatNumber.setScale(0, RoundingMode.FLOOR).doubleValue();
+        if(number >= floorNumber && number < floorNumber + 0.5){
+            return floorNumber;
+        }else{
+            return floorNumber + 0.5;
+        }
+    }
+
+    /**
+     * 补全html标签
+     * @param htmlStr
+     * @return
+     * @throws Exception
+     */
+    public static String repairHtmlStr(String htmlStr)throws Exception{
+        htmlStr = htmlStr.trim();
+        if(htmlStr.toLowerCase().contains("<!doctype html ")){
+            int index1 = htmlStr.toLowerCase().indexOf("<!doctype html ");
+            int index2 = htmlStr.indexOf('>',index1 + 1);
+            htmlStr = htmlStr.substring(0, index1) + htmlStr.substring(index2 + 1);
+        }
+        while(htmlStr.toLowerCase().contains("<br ")){
+            int index1 = htmlStr.toLowerCase().indexOf("<br ");
+            int index2 = htmlStr.toLowerCase().indexOf(">",index1 + 1);
+            htmlStr = htmlStr.substring(0, index1) + "<br/>" + htmlStr.substring(index2 + 1);
+        }
+        while(htmlStr.toLowerCase().endsWith("<br>") || htmlStr.toLowerCase().endsWith("<br/>")){
+            if(htmlStr.toLowerCase().endsWith("<br>")){
+                htmlStr = htmlStr.substring(0, htmlStr.length()-"<br>".length());
+            }else if(htmlStr.toLowerCase().endsWith("<br/>")){
+                htmlStr = htmlStr.substring(0, htmlStr.length()-"<br/>".length());
+            }
+        }
+        htmlStr = htmlStr.replace("<br>", "<br/>").replace("<BR>", "<br/>");
+
+        {//补全META标签
+            int imgIndex = indexOfRegex(htmlStr,"<((meta)|(META)) ");
+            while(imgIndex > 0){
+                int flag = htmlStr.indexOf(">", imgIndex);
+                if(htmlStr.charAt(flag - 1) != '/'){
+                    htmlStr = htmlStr.substring(0,flag) + "/" + htmlStr.substring(flag);
+                }
+                imgIndex = indexOfRegex(htmlStr,"<((meta)|(META)) ",flag);
+            }
+        }
+
+        {//补全img标签
+            int imgIndex = indexOfRegex(htmlStr,"<((img)|(IMG)) ");
+            while(imgIndex > 0){
+                int flag = htmlStr.indexOf(">", imgIndex);
+                if(htmlStr.charAt(flag - 1) != '/'){
+                    htmlStr = htmlStr.substring(0,flag) + "/" + htmlStr.substring(flag);
+                }
+                imgIndex = indexOfRegex(htmlStr,"<((img)|(IMG)) ",flag);
+            }
+        }
+        //添加body标签
+        if((htmlStr.toLowerCase().contains("<p") || htmlStr.toLowerCase().contains("<span"))
+                && !htmlStr.toLowerCase().contains("<body")){
+            htmlStr = "<body>"+htmlStr+"</body>";
+        }
+        return new String(htmlStr.getBytes("UTF-8"));
+    }
+
+    /**
+     * 从指定的位置开始查找第一个匹配正则表达式的字符串的位置
+     * @param str
+     * @param regex 正则表达式
+     * @param fromIndex 指定的起始位置
+     * @return
+     */
+    public static int indexOfRegex(String str,String regex,int fromIndex){
+        int index = indexOfRegex(str.substring(fromIndex),regex);
+        if(index < 0){
+            return -1;
+        }
+        return fromIndex + index;
+    }
+
+    /**
+     * 查找第一个匹配正则表达式的字符串的位置
+     * @param str
+     * @param regex 正则表达式
+     * @return
+     */
+    public static int indexOfRegex(String str,String regex){
+        Pattern p = Pattern.compile(regex);
+        Matcher m = p.matcher(str);
+        if(m.find()){
+            return m.start();
+        }else{
+            return -1;
+        }
+    }
+
+    /**
+     * 格式化html
+     * @param htmlStr
+     * @return
+     * @throws Exception
+     */
+    public static String formatHtml(String htmlStr)throws Exception{
+        if(StringUtils.isEmpty(htmlStr)){
+            return "";
+        }
+        htmlStr = repairHtmlStr(htmlStr);
+        htmlStr = StringEscapeUtils.unescapeHtml4(htmlStr);
+        return htmlStr;
+    }
+
+    /**
+     * 过滤非空格的空字符
+     * @param str
+     * @return
+     */
+    public static String trimNoBlankSpace(final String str){
+        if(str == null || str.length() == 0){
+            return "";
+        }
+        return str.replaceAll("[\\t\\r\\f]*","");
+    }
+
+    public static void main(String[] args) throws Exception{
         // QuesStructType quesStructType = getEnum(QuesStructType.class,"单选");
         // QuesStructType quesStructType = getEnum(QuesStructType.class,"单选");
         // System.out.println(quesStructType.getName());
         // System.out.println(quesStructType.getName());
         // System.out.println(characterToNumber("A"));
         // System.out.println(characterToNumber("A"));
-        System.out.println(toCHNum(111111));
-
+        System.out.println(formatDoubleFloor(3.61));
+        System.out.println(formatDoubleFloor(3.0));
     }
     }
 }
 }

+ 49 - 0
cqb-comm-utils/src/main/java/com/qmth/cqb/utils/enums/PaperStructType.java

@@ -0,0 +1,49 @@
+package com.qmth.cqb.utils.enums;
+
+import org.omg.CORBA.PRIVATE_MEMBER;
+
+/**
+ * @describle 试卷结构类型
+ * @author weiwenhai
+ * @date  2017.12.11
+ */
+public enum PaperStructType {
+
+	/**
+	 * 简易组卷
+	 */
+	SIMPLE("简易组卷"),
+
+	/**
+	 * 精确组卷
+	 */
+	EXACT("精确组卷"),
+	
+	/**
+	 * 蓝图组卷
+	 */
+	BLUEPRINT("蓝图组卷");
+	
+	private String name;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	private PaperStructType(String name){
+		this.name = name;
+	}
+	
+	public static PaperStructType strToEnum(String str){
+    	for(PaperStructType paperStructType:PaperStructType.values()){
+    		if(paperStructType.name().equals(str)){
+    			return paperStructType;
+    		}
+    	}
+    	return null;
+    }
+}

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

@@ -581,14 +581,8 @@ public final class DocxProcessUtil {
         namespaces.stream().forEach(namespace -> {
         namespaces.stream().forEach(namespace -> {
             root.remove(namespace);
             root.remove(namespace);
         });
         });
-        List<org.dom4j.Element> elements = root.elements();
-        elements.stream().forEach(element ->{
-        	if("w:bookmarkStart".equals(element.getQualifiedName())||
-                	"w:bookmarkEnd".equals(element.getQualifiedName())){
-        		root.remove(element);
-        	}
-        });
-        return root.asXML();
+        String returnXml = CommonUtils.trimNoBlankSpace(root.asXML());
+        return returnXml;
     }
     }
 
 
     /**
     /**
@@ -900,93 +894,17 @@ public final class DocxProcessUtil {
         XHTMLImporter.setHyperlinkStyle("Hyperlink");
         XHTMLImporter.setHyperlinkStyle("Hyperlink");
         String wordMl = "";
         String wordMl = "";
         wordMLPackage.getMainDocumentPart().getContent().addAll(
         wordMLPackage.getMainDocumentPart().getContent().addAll(
-                    XHTMLImporter.convert( repairHtmlStr(html), TEMP_FILE_IMP) );
+                    XHTMLImporter.convert(html, TEMP_FILE_IMP) );
+        //转换完后就初始化image
+        initPkgImage(wordMLPackage);
         // 获取word文档中所有段落
         // 获取word文档中所有段落
         List<Object> pList = getAllElementFromObject(wordMLPackage.getMainDocumentPart(), P.class);
         List<Object> pList = getAllElementFromObject(wordMLPackage.getMainDocumentPart(), P.class);
         for(Object p:pList){
         for(Object p:pList){
-            wordMl += XmlUtils.marshaltoString(p);
+            wordMl += formatPWordMl(XmlUtils.marshaltoString(p));
         }
         }
-//            wordMl = formatPWordMl(wordMl);
-        initPkgImage(wordMLPackage);
         return wordMl;
         return wordMl;
     }
     }
 
 
-    public static String repairHtmlStr(String htmlStr)throws Exception{
-        htmlStr = htmlStr.trim();
-        if(htmlStr.toLowerCase().contains("<!doctype html ")){
-            int index1 = htmlStr.toLowerCase().indexOf("<!doctype html ");
-            int index2 = htmlStr.indexOf('>',index1 + 1);
-            htmlStr = htmlStr.substring(0, index1) + htmlStr.substring(index2 + 1);
-        }
-        while(htmlStr.toLowerCase().contains("<br ")){
-            int index1 = htmlStr.toLowerCase().indexOf("<br ");
-            int index2 = htmlStr.toLowerCase().indexOf(">",index1 + 1);
-            htmlStr = htmlStr.substring(0, index1) + "<br/>" + htmlStr.substring(index2 + 1);
-        }
-        while(htmlStr.toLowerCase().endsWith("<br>") || htmlStr.toLowerCase().endsWith("<br/>")){
-            if(htmlStr.toLowerCase().endsWith("<br>")){
-                htmlStr = htmlStr.substring(0, htmlStr.length()-"<br>".length());
-            }else if(htmlStr.toLowerCase().endsWith("<br/>")){
-                htmlStr = htmlStr.substring(0, htmlStr.length()-"<br/>".length());
-            }
-        }
-        htmlStr = htmlStr.replace("<br>", "<br/>").replace("<BR>", "<br/>");
-
-        {//补全META标签
-            int imgIndex = indexOfRegex(htmlStr,"<((meta)|(META)) ");
-            while(imgIndex > 0){
-                int flag = htmlStr.indexOf(">", imgIndex);
-                if(htmlStr.charAt(flag - 1) != '/'){
-                    htmlStr = htmlStr.substring(0,flag) + "/" + htmlStr.substring(flag);
-                }
-                imgIndex = indexOfRegex(htmlStr,"<((meta)|(META)) ",flag);
-            }
-        }
-
-        {//补全img标签
-            int imgIndex = indexOfRegex(htmlStr,"<((img)|(IMG)) ");
-            while(imgIndex > 0){
-                int flag = htmlStr.indexOf(">", imgIndex);
-                if(htmlStr.charAt(flag - 1) != '/'){
-                    htmlStr = htmlStr.substring(0,flag) + "/" + htmlStr.substring(flag);
-                }
-                imgIndex = indexOfRegex(htmlStr,"<((img)|(IMG)) ",flag);
-            }
-        }
-        return new String(htmlStr.getBytes("UTF-8"));
-    }
-
-    /**
-     * 从指定的位置开始查找第一个匹配正则表达式的字符串的位置
-     * @param str
-     * @param regex 正则表达式
-     * @param fromIndex 指定的起始位置
-     * @return
-     */
-    public static int indexOfRegex(String str,String regex,int fromIndex){
-        int index = indexOfRegex(str.substring(fromIndex),regex);
-        if(index < 0){
-            return -1;
-        }
-        return fromIndex + index;
-    }
-
-    /**
-     * 查找第一个匹配正则表达式的字符串的位置
-     * @param str
-     * @param regex 正则表达式
-     * @return
-     */
-    public static int indexOfRegex(String str,String regex){
-        Pattern p = Pattern.compile(regex);
-        Matcher m = p.matcher(str);
-        if(m.find()){
-            return m.start();
-        }else{
-            return -1;
-        }
-    }
-
     public static byte[] getWordBytesByQuestion(WordprocessingMLPackage wordMLPackage, List<String> wordXmls) throws Exception {
     public static byte[] getWordBytesByQuestion(WordprocessingMLPackage wordMLPackage, List<String> wordXmls) throws Exception {
         RelationshipsPart mainRelationshipsPart = wordMLPackage.getMainDocumentPart().getRelationshipsPart();
         RelationshipsPart mainRelationshipsPart = wordMLPackage.getMainDocumentPart().getRelationshipsPart();
         // 获取总的资源文件存储
         // 获取总的资源文件存储

+ 36 - 4
cqb-gen-paper/src/main/java/com/qmth/cqb/genpaper/service/GenPaperService.java

@@ -1,5 +1,7 @@
 package com.qmth.cqb.genpaper.service;
 package com.qmth.cqb.genpaper.service;
 
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashMap;
@@ -10,6 +12,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 import java.util.UUID;
 import java.util.UUID;
 
 
+import com.qmth.cqb.utils.enums.PaperStructType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -129,7 +132,7 @@ public class GenPaperService {
             paper.setUnitCount(this.getTotalQuesNum(paperDetailunits));
             paper.setUnitCount(this.getTotalQuesNum(paperDetailunits));
             paper.setPaperType(PaperType.GENERATE);
             paper.setPaperType(PaperType.GENERATE);
             // 数据入库
             // 数据入库
-            paper = this.persistentPaper(paperDetailunits, paperDetails, paper);
+            paper = this.persistentPaper(PaperStructType.EXACT,paperDetailunits, paperDetails, paper);
             msg = "success";
             msg = "success";
             paperMsgMap.put("paper", paper);
             paperMsgMap.put("paper", paper);
             paperMsgMap.put("msg", msg);
             paperMsgMap.put("msg", msg);
@@ -146,7 +149,9 @@ public class GenPaperService {
     private boolean checkQuesType(UnitContext uc,Question question){
     private boolean checkQuesType(UnitContext uc,Question question){
         List<String> quesNames = uc.getUnitStruct().getQuesNames();
         List<String> quesNames = uc.getUnitStruct().getQuesNames();
         if(quesNames != null && quesNames.size() > 0){
         if(quesNames != null && quesNames.size() > 0){
-            if(quesNames.contains(question.getQuesName()) && !uc.finish() && (uc.getUnitStruct().getQuestionType() == question.getQuestionType())){
+            if(quesNames.contains(question.getQuesName())
+                    && !uc.finish()
+                    && (uc.getUnitStruct().getQuestionType() == question.getQuestionType())){
                 return true;
                 return true;
             }
             }
         }
         }
@@ -345,7 +350,7 @@ public class GenPaperService {
         }
         }
         Paper paper = this.constuctPaperByPaperDetails(details, genPaperDto);
         Paper paper = this.constuctPaperByPaperDetails(details, genPaperDto);
         paper.setUnitCount(this.getTotalQuesNum(saveUnits));// 设置小题数量,需统计subQuestion
         paper.setUnitCount(this.getTotalQuesNum(saveUnits));// 设置小题数量,需统计subQuestion
-        paper = this.persistentPaper(saveUnits, details, paper);
+        paper = this.persistentPaper(PaperStructType.SIMPLE,saveUnits, details, paper);
         return paper;
         return paper;
 
 
     }
     }
@@ -358,7 +363,10 @@ public class GenPaperService {
      * @param paper
      * @param paper
      * @return
      * @return
      */
      */
-    public Paper persistentPaper(List<PaperDetailUnit> selectedUnits, List<PaperDetail> details, Paper paper) {
+    public Paper persistentPaper(PaperStructType paperStructType,
+                                 List<PaperDetailUnit> selectedUnits,
+                                 List<PaperDetail> details,
+                                 Paper paper) {
         paper = paperRepo.save(paper);
         paper = paperRepo.save(paper);
         for (PaperDetail pd : details) {
         for (PaperDetail pd : details) {
             pd.setPaper(paper);
             pd.setPaper(paper);
@@ -377,6 +385,30 @@ public class GenPaperService {
         		index++;
         		index++;
         		PaperDetailUnit paperDetailUnit = paperDetailUnits.get(i);
         		PaperDetailUnit paperDetailUnit = paperDetailUnits.get(i);
         		paperDetailUnit.setNumber(index);
         		paperDetailUnit.setNumber(index);
+
+                //重新计算套题小题分
+                if(paperStructType != PaperStructType.SIMPLE){
+                    Question question = paperDetailUnit.getQuestion();
+                    if(question != null && question.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
+                        List<Question> subQuestions = question.getSubQuestions();
+                        List<Double> subScoreList = new ArrayList<>();
+                        if(subQuestions != null && subQuestions.size() > 0){
+                            int subQuesLen = subQuestions.size();
+                            double subTotalScore = paperDetailUnit.getScore();
+                            for(int j = 0;j < subQuesLen;j++){
+                                double avgScore = subTotalScore / subQuestions.size();
+                                //向下取整,包含0.5
+                                double formatScore = CommonUtils.formatDoubleFloor(avgScore);
+                                if(j == subQuesLen - 1){
+                                    subScoreList.add(subTotalScore - formatScore * j);
+                                }else{
+                                    subScoreList.add(formatScore);
+                                }
+                            }
+                            paperDetailUnit.setSubScoreListNew(subScoreList);
+                        }
+                    }
+                }
         	}
         	}
         	unitRepo.save(paperDetailUnits);
         	unitRepo.save(paperDetailUnits);
         }
         }

+ 6 - 2
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailUnit.java

@@ -201,10 +201,14 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
                 }
                 }
                 totalScore += score;
                 totalScore += score;
             }
             }
-            this.score = totalScore;
+            this.score = CommonUtils.formatDouble(totalScore);
         }
         }
     }
     }
 
 
+    public void setSubScoreListNew(List<Double> subScoreList) {
+        this.subScoreList = subScoreList;
+    }
+
 	@Override
 	@Override
     public int compareTo(PaperDetailUnit unit) {
     public int compareTo(PaperDetailUnit unit) {
         /*if (unit != null) {
         /*if (unit != null) {
@@ -258,6 +262,6 @@ public class PaperDetailUnit implements Serializable, Comparable<PaperDetailUnit
                 totalScore += score;
                 totalScore += score;
             }
             }
         }
         }
-        return totalScore;
+        return CommonUtils.formatDouble(totalScore);
     }
     }
 }
 }

+ 40 - 40
cqb-paper/src/main/java/com/qmth/cqb/paper/service/ExtractConfigFileService.java

@@ -1,40 +1,40 @@
-package com.qmth.cqb.paper.service;
-
-import javax.servlet.http.HttpServletResponse;
-
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-
-import com.qmth.cqb.paper.dto.ExportPaperInfoModel;
-import com.qmth.cqb.paper.model.ExtractConfig;
-
-/**
- * @author  	chenken
- * @date    	2017年7月31日 下午6:03:26
- * @company 	QMTH
- * @description 调卷规则--文件处理service
- */
-public interface ExtractConfigFileService {
-	
-	/**
-	 * 保存调卷规则,生成试卷文件
-	 * @param extractConfig
-	 * @param isbuildFile	1:生成试卷文件 0:不生成试卷文件
-	 * @param accessUser
-	 * @throws Exception
-	 */
-	public void saveExtractConfigAndBuildPaperFile(ExtractConfig extractConfig,Integer isbuildFile,AccessUser accessUser)  throws Exception;
-	
-	/**
-	 * 导出考试下的试卷信息  校验
-	 * @param exportModel
-	 * @param response
-	 * @throws Exception
-	 */
-	public void exportExamPaperInfoCheck(ExportPaperInfoModel exportModel,HttpServletResponse response)  throws Exception ;
-	/**
-	 * 导出考试下的试卷信息
-	 * @param exportModel
-	 */
-	public void exportExamPaperInfo(ExportPaperInfoModel exportModel,HttpServletResponse response)  throws Exception ;
-}
-
+package com.qmth.cqb.paper.service;
+
+import javax.servlet.http.HttpServletResponse;
+
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+
+import com.qmth.cqb.paper.dto.ExportPaperInfoModel;
+import com.qmth.cqb.paper.model.ExtractConfig;
+
+/**
+ * @author  	chenken
+ * @date    	2017年7月31日 下午6:03:26
+ * @company 	QMTH
+ * @description 调卷规则--文件处理service
+ */
+public interface ExtractConfigFileService {
+	
+	/**
+	 * 保存调卷规则,生成试卷文件
+	 * @param extractConfig
+	 * @param isbuildFile	1:生成试卷文件 0:不生成试卷文件
+	 * @param accessUser
+	 * @throws Exception
+	 */
+	public void saveExtractConfigAndBuildPaperFile(ExtractConfig extractConfig,Integer isbuildFile,AccessUser accessUser)  throws Exception;
+	
+	/**
+	 * 导出考试下的试卷信息  校验
+	 * @param exportModel
+	 * @param response
+	 * @throws Exception
+	 */
+	public void exportExamPaperInfoCheck(ExportPaperInfoModel exportModel,HttpServletResponse response)  throws Exception ;
+	/**
+	 * 导出考试下的试卷信息
+	 * @param exportModel
+	 */
+	public void exportExamPaperInfo(ExportPaperInfoModel exportModel,HttpServletResponse response,String loginName)  throws Exception ;
+}
+

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

@@ -780,6 +780,7 @@ public class ImportPaperService {
                     throw new PaperException(importPaperCheck.errorInfo);
                     throw new PaperException(importPaperCheck.errorInfo);
                 }
                 }
                 subQues = new Question();
                 subQues = new Question();
+                subQues.setId(UUID.randomUUID().toString());
                 subQues.setQuestionType(getQuesStructType(nestedQuesType));
                 subQues.setQuestionType(getQuesStructType(nestedQuesType));
                 if (StringUtils.isNumeric(importPaperCheck.getQuesScore())) {
                 if (StringUtils.isNumeric(importPaperCheck.getQuesScore())) {
                     subQues.setScore(Double.parseDouble(importPaperCheck.getQuesScore()));
                     subQues.setScore(Double.parseDouble(importPaperCheck.getQuesScore()));

+ 43 - 32
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/ExportPaperAbstractService.java

@@ -234,23 +234,24 @@ public abstract class ExportPaperAbstractService {
 	
 	
 	/**
 	/**
 	 * 下载试卷
 	 * 下载试卷
-	 * @param id
-	 * @param response
+	 * @param paperId
+	 * @param zipFileName
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public abstract void downloadPaper(String paperId,String zipFileName)throws Exception;
 	public abstract void downloadPaper(String paperId,String zipFileName)throws Exception;
 	/**
 	/**
 	 * 下载答案
 	 * 下载答案
 	 * @param paperId
 	 * @param paperId
-	 * @param response
+	 * @param zipFileName
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public abstract void downloadPaperAnswer(String paperId,String zipFileName)throws Exception;
 	public abstract void downloadPaperAnswer(String paperId,String zipFileName)throws Exception;
 	/**
 	/**
 	 * 上传试卷相关文件
 	 * 上传试卷相关文件
-	 * @param orgName
-	 * @param examName
+	 * @param extractConfig
 	 * @param paperId
 	 * @param paperId
+	 * @param exportStructure
+	 * @param accessUser
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
     public abstract void uploadFile(ExtractConfig extractConfig,String paperId,ExportStructure exportStructure,AccessUser accessUser)  throws Exception;
     public abstract void uploadFile(ExtractConfig extractConfig,String paperId,ExportStructure exportStructure,AccessUser accessUser)  throws Exception;
@@ -424,7 +425,6 @@ public abstract class ExportPaperAbstractService {
     /**
     /**
 	 * 给小题选项进行排序
 	 * 给小题选项进行排序
 	 * @param paperDetails
 	 * @param paperDetails
-	 * @param startIndxt
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
 	public void setUnitExpNumber(List<PaperDetailExp> paperDetails) throws Exception {
 	public void setUnitExpNumber(List<PaperDetailExp> paperDetails) throws Exception {
@@ -478,17 +478,17 @@ public abstract class ExportPaperAbstractService {
         List<Object> pList = body.getContent();
         List<Object> pList = body.getContent();
         int index = 0;
         int index = 0;
         for(Object pObj:pList){
         for(Object pObj:pList){
-            if(index < pList.size()-1){
-                break;
+            if(index == pList.size()-1){
+				P p = (P) pObj;
+				List<Object> pContent = p.getContent();
+				R run = new R();
+				Text text = new Text();
+				text.setValue("("+scores+"分)");
+				run.getContent().add(text);
+				pContent.add(run);
+
             }
             }
-            P p = (P) pObj;
-            List<Object> pContent = p.getContent();
-            R run = new R();
-            Text text = new Text();
-            text.setValue("("+scores+"分)");
-            run.getContent().add(text);
-            pContent.add(run);
-            index++;
+			index++;
         }
         }
         StringBuffer pWordMl = new StringBuffer();
         StringBuffer pWordMl = new StringBuffer();
         for(Object pObj:pList){
         for(Object pObj:pList){
@@ -519,8 +519,10 @@ public abstract class ExportPaperAbstractService {
     				//判断小题是否为套题
     				//判断小题是否为套题
     				if(paperDetailUnit.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
     				if(paperDetailUnit.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
     					List<Question> subQuestions = paperDetailUnit.getQuestion().getSubQuestions();
     					List<Question> subQuestions = paperDetailUnit.getQuestion().getSubQuestions();
-    					for(Question subQuestion:subQuestions){
-    						String questionBodyWord = appendScoreToQuestionBody(subQuestion.getQuesBodyWord(),subQuestion.getScore());
+    					for(int i = 0;i < subQuestions.size();i++){
+    						Question subQuestion = subQuestions.get(i);
+							double subScore = paperDetailUnit.getSubScoreList().get(i);
+    						String questionBodyWord = appendScoreToQuestionBody(subQuestion.getQuesBodyWord(),subScore);
     						subQuestion.setQuesBodyWord(questionBodyWord);
     						subQuestion.setQuesBodyWord(questionBodyWord);
     					}
     					}
     				}else {
     				}else {
@@ -631,14 +633,14 @@ public abstract class ExportPaperAbstractService {
 		for (PaperDetailUnitExp unitExp : paperDetailUnitExps) {
 		for (PaperDetailUnitExp unitExp : paperDetailUnitExps) {
 			//判断套路
 			//判断套路
 			if(unitExp.getQuestionType()==QuesStructType.NESTED_ANSWER_QUESTION){
 			if(unitExp.getQuestionType()==QuesStructType.NESTED_ANSWER_QUESTION){
-				List<Question> subQuestions = unitExp.getQuestion().getSubQuestions();
-				for(Question subQuestion:subQuestions){
-					scoreSet.add(subQuestion.getScore());
-				}
-				/*List<Double> subScoreList =  unitExp.getSubScoreList();
+//				List<Question> subQuestions = unitExp.getQuestion().getSubQuestions();
+//				for(Question subQuestion:subQuestions){
+//					scoreSet.add(subQuestion.getScore());
+//				}
+				List<Double> subScoreList =  unitExp.getSubScoreList();
 				for(Double score:subScoreList){
 				for(Double score:subScoreList){
 					scoreSet.add(score);
 					scoreSet.add(score);
-				}*/
+				}
 			}else{
 			}else{
 				scoreSet.add(unitExp.getScore());
 				scoreSet.add(unitExp.getScore());
 			}
 			}
@@ -652,8 +654,8 @@ public abstract class ExportPaperAbstractService {
    	
    	
     /**
     /**
      * 创建机考文件,并打包上传至又拍云
      * 创建机考文件,并打包上传至又拍云
-     * @param paperId
-     * @param currNum
+     * @param extractConfig
+     * @param accessUser
      * @throws IOException 
      * @throws IOException 
      */
      */
     protected void uploadComputerTestFile(ExtractConfig extractConfig,AccessUser accessUser) throws IOException{
     protected void uploadComputerTestFile(ExtractConfig extractConfig,AccessUser accessUser) throws IOException{
@@ -733,7 +735,11 @@ public abstract class ExportPaperAbstractService {
 		}
 		}
     }
     }
     
     
-    private void getBodyAndOptionAudioFile(ComputerTestQuestion computerTestQuestion,Sections bodySections,String jsonDirectoryPath,ComputerTestPaper computerTestPaper,String examId){
+    private void getBodyAndOptionAudioFile(ComputerTestQuestion computerTestQuestion,
+										   Sections bodySections,
+										   String jsonDirectoryPath,
+										   ComputerTestPaper computerTestPaper,
+										   String examId){
     	List<Section> sectionList = bodySections.getSections();
     	List<Section> sectionList = bodySections.getSections();
 		for(Section section:sectionList){
 		for(Section section:sectionList){
 			List<Block> blocks = section.getBlocks();
 			List<Block> blocks = section.getBlocks();
@@ -762,13 +768,19 @@ public abstract class ExportPaperAbstractService {
     
     
 	/**
 	/**
      * 生成试卷或答案Word,上传至又拍云
      * 生成试卷或答案Word,上传至又拍云
-     * @param orgName
-     * @param dataMap
+     * @param paperExp
      * @param extractConfig
      * @param extractConfig
-     * @param paperId
      * @param accessUser
      * @param accessUser
+     * @param currNum
+     * @param template
+	 * @param examFileType
      */
      */
-    protected void uploadPaperOrAnswerFile(PaperExp paperExp,ExtractConfig extractConfig,AccessUser accessUser,String currNum,Template template,ExamFileType examFileType){
+    protected void uploadPaperOrAnswerFile(PaperExp paperExp,
+										   ExtractConfig extractConfig,
+										   AccessUser accessUser,
+										   String currNum,
+										   Template template,
+										   ExamFileType examFileType){
     	String paperfileName = currNum+examFileType.name()+DOCX_SUFFIX;
     	String paperfileName = currNum+examFileType.name()+DOCX_SUFFIX;
     	try {
     	try {
 			DocxProcessUtil.exportWord(paperExp,paperfileName,template);
 			DocxProcessUtil.exportWord(paperExp,paperfileName,template);
@@ -1029,7 +1041,6 @@ public abstract class ExportPaperAbstractService {
 	/**
 	/**
      * 检查客观题数量是否小于试卷结构导出设置的数量
      * 检查客观题数量是否小于试卷结构导出设置的数量
      * @param paperExp
      * @param paperExp
-     * @param objectiveDetails
      * @param questionTypeNums
      * @param questionTypeNums
      * @return
      * @return
      */
      */

+ 1 - 8
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/InitPaperExpService.java

@@ -257,14 +257,7 @@ public  class InitPaperExpService {
 			Double totalScore = 0.0;
 			Double totalScore = 0.0;
 			//所有小题分数相加,得到大题分数
 			//所有小题分数相加,得到大题分数
 			for(PaperDetailUnitExp paperDetailUnitExp:paperDetailUnitExps){
 			for(PaperDetailUnitExp paperDetailUnitExp:paperDetailUnitExps){
-				if(paperDetailUnitExp.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
-					List<Question> subQuestions = paperDetailUnitExp.getQuestion().getSubQuestions();
-					for(Question question:subQuestions){
-						totalScore += question.getScore();
-					}
-				}else{
-					totalScore += paperDetailUnitExp.getScore();
-				}
+				totalScore += paperDetailUnitExp.getScore();
 			}
 			}
 			paperDetailExp.setScore(totalScore);
 			paperDetailExp.setScore(totalScore);
 		}
 		}

+ 10 - 8
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/ExtractConfigFileServiceImpl.java

@@ -171,11 +171,13 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
 	}
 	}
 
 
 	@Override
 	@Override
-	public void exportExamPaperInfo(ExportPaperInfoModel exportModel,HttpServletResponse response) throws Exception {
+	public void exportExamPaperInfo(ExportPaperInfoModel exportModel,HttpServletResponse response,String loginName) throws Exception {
+		String downloadDir = downloadDirectory + loginName;
+		String downZipDir = zipDirectory + loginName;
 		//创建试卷和压缩文件 文件夹
 		//创建试卷和压缩文件 文件夹
-		FileDisposeUtil.createDirectory(downloadDirectory);
+		FileDisposeUtil.createDirectory(downloadDir);
 		//创建压缩文件的文件夹
 		//创建压缩文件的文件夹
-		FileDisposeUtil.createDirectory(zipDirectory);
+		FileDisposeUtil.createDirectory(downZipDir);
 		ExportStructure exportStructure = exportStructureService.findStructureByExamId(exportModel.getExamId()+"");
 		ExportStructure exportStructure = exportStructureService.findStructureByExamId(exportModel.getExamId()+"");
 		if(exportStructure==null){
 		if(exportStructure==null){
 			exportStructure = new ExportStructure();
 			exportStructure = new ExportStructure();
@@ -196,7 +198,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
 			for(int i = 0;i<examFiles.size();i++){
 			for(int i = 0;i<examFiles.size();i++){
 				ExamFile examFile = examFiles.get(i);
 				ExamFile examFile = examFiles.get(i);
 				UpYun upyun = new UpYun(bucketName,userName,password);
 				UpYun upyun = new UpYun(bucketName,userName,password);
-				File file = new File(downloadDirectory+File.separator+examFile.getFileName());
+				File file = new File(downloadDir+File.separator+examFile.getFileName());
 				upyun.readFile(examFile.getFilePath(), file);
 				upyun.readFile(examFile.getFilePath(), file);
 				
 				
 				if(examFile.getExamFileType()==ExamFileType.PAPER){
 				if(examFile.getExamFileType()==ExamFileType.PAPER){
@@ -219,12 +221,12 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
 		//创建压缩文件名称
 		//创建压缩文件名称
 		String zipFileName = exportModel.getExamId();
 		String zipFileName = exportModel.getExamId();
 		//将downloadDirectory文件夹压缩成zip文件,存放到zipDirectory文件夹中
 		//将downloadDirectory文件夹压缩成zip文件,存放到zipDirectory文件夹中
-		FileDisposeUtil.fileToZip(downloadDirectory,zipDirectory,zipFileName);
+		FileDisposeUtil.fileToZip(downloadDir,downZipDir,zipFileName);
 		//下载zip文件到客户端
 		//下载zip文件到客户端
-		FileDisposeUtil.downloadFile(zipFileName+".zip",zipDirectory+File.separator+zipFileName+".zip",response);
+		FileDisposeUtil.downloadFile(zipFileName+".zip",downZipDir+File.separator+zipFileName+".zip",response);
 		//删除文件夹
 		//删除文件夹
-		FileUtils.deleteQuietly(new File(downloadDirectory));
-		FileUtils.deleteQuietly(new File(zipDirectory));
+		FileUtils.deleteQuietly(new File(downloadDir));
+		FileUtils.deleteQuietly(new File(downZipDir));
 	}
 	}
 	
 	
 	/**
 	/**

+ 4 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/ExtractConfigServiceImpl.java

@@ -475,6 +475,8 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 							subQuesDtos.get(m).setQuesAnswer(subQuesList.get(m).getQuesAnswer());
 							subQuesDtos.get(m).setQuesAnswer(subQuesList.get(m).getQuesAnswer());
 						}
 						}
                         subQuesDtos.get(m).setNumber(m + 1);
                         subQuesDtos.get(m).setNumber(m + 1);
+						//套题分数从小题类中取值
+						subQuesDtos.get(m).setScore(paperDetailUnit.getSubScoreList().get(m));
                     }
                     }
                     unitDto.setSubQuestions(subQuesDtos);
                     unitDto.setSubQuestions(subQuesDtos);
                 }
                 }
@@ -524,6 +526,8 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
                 subQuesDtos.get(m).setQuesOptions(quesOptionDtos);
                 subQuesDtos.get(m).setQuesOptions(quesOptionDtos);
                 subQuesDtos.get(m).setQuesAnswer(subQuesList.get(m).getQuesAnswer());
                 subQuesDtos.get(m).setQuesAnswer(subQuesList.get(m).getQuesAnswer());
                 subQuesDtos.get(m).setNumber(m + 1);
                 subQuesDtos.get(m).setNumber(m + 1);
+				//套题分数从小题类中取值
+				subQuesDtos.get(m).setScore(paperDetailUnit.getSubScoreList().get(m));
                 dto.setSubQuestions(subQuesDtos);
                 dto.setSubQuestions(subQuesDtos);
             }
             }
         }
         }

+ 21 - 2
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperServiceImpl.java

@@ -4,6 +4,8 @@ import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -567,8 +569,6 @@ public class PaperServiceImpl implements PaperService{
                             for (Question subQues : subQuesList) {
                             for (Question subQues : subQuesList) {
                                 Map<String, String> params = new HashMap<String, String>();
                                 Map<String, String> params = new HashMap<String, String>();
                                 params.put("number", String.valueOf(++index));
                                 params.put("number", String.valueOf(++index));
-                                double score = paperDetailUnit.getScore()% subQuesList.size();
-                                subQues.setScore(Double.parseDouble(df.format(score)));
                                 subQues.setQuesParams(params);
                                 subQues.setQuesParams(params);
                                 quesService.formatQuesUnit(subQues);
                                 quesService.formatQuesUnit(subQues);
                             }
                             }
@@ -580,6 +580,8 @@ public class PaperServiceImpl implements PaperService{
             }
             }
         }
         }
     }
     }
+    
+   
 
 
     /**
     /**
      * 格式化查询条件
      * 格式化查询条件
@@ -629,6 +631,7 @@ public class PaperServiceImpl implements PaperService{
             unit.setNumber(i+1);
             unit.setNumber(i+1);
         }
         }
         paperDetailUnitRepo.save(paperDetailUnitAll);
         paperDetailUnitRepo.save(paperDetailUnitAll);
+        totalScore = CommonUtils.formatDouble(totalScore);
         return totalScore;
         return totalScore;
 	}
 	}
 
 
@@ -658,6 +661,7 @@ public class PaperServiceImpl implements PaperService{
                     }
                     }
                 }
                 }
                 count = paperDetailUnits.size() + nestQusNum;
                 count = paperDetailUnits.size() + nestQusNum;
+                score = CommonUtils.formatDouble(score);
                 paperDetail.setScore(score);
                 paperDetail.setScore(score);
                 paperDetail.setUnitCount(count);
                 paperDetail.setUnitCount(count);
                 allQuesCount += count;
                 allQuesCount += count;
@@ -783,6 +787,18 @@ public class PaperServiceImpl implements PaperService{
         for (Question ques : questions) {
         for (Question ques : questions) {
             PaperDetailUnit pdu = new PaperDetailUnit(paper,paperDetail,ques);
             PaperDetailUnit pdu = new PaperDetailUnit(paper,paperDetail,ques);
             pdu.setNumber(paperDetailUnit.getNumber());//设置为大题中最大的number
             pdu.setNumber(paperDetailUnit.getNumber());//设置为大题中最大的number
+            pdu.setScore(paperDetailUnit.getScore());
+            //处理套题
+            if(pdu.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION){
+                List<Question> subQuestions = ques.getSubQuestions();
+                List<Double> subScoreList = new ArrayList<>();
+                if(subQuestions != null && subQuestions.size() > 0){
+                    for(Question subQuestion:subQuestions){
+                        subScoreList.add(CommonUtils.formatDouble(pdu.getScore()/subQuestions.size()));
+                    }
+                }
+                pdu.setSubScoreListNew(subScoreList);
+            }
             saveUnits.add(pdu);
             saveUnits.add(pdu);
         }
         }
         paperDetailUnitRepo.save(saveUnits);
         paperDetailUnitRepo.save(saveUnits);
@@ -1120,5 +1136,8 @@ public class PaperServiceImpl implements PaperService{
 			quesRepo.save(question);
 			quesRepo.save(question);
 		}
 		}
     }
     }
+    
+   
+    
 }
 }
 
 

+ 8 - 6
cqb-paper/src/main/java/com/qmth/cqb/paper/web/ExtractConfigController.java

@@ -161,12 +161,13 @@ public class ExtractConfigController {
 	}
 	}
 	
 	
 	@ApiOperation(value = "导出单张考试试卷、答案、试卷结构", notes = "导出单张考试试卷、答案、试卷结构")
 	@ApiOperation(value = "导出单张考试试卷、答案、试卷结构", notes = "导出单张考试试卷、答案、试卷结构")
-	@GetMapping(value = "/exportSingleExamPaperInfo/{exportWay}/{examId}/{courseId}/{exportContentList}")
+	@GetMapping(value = "/exportSingleExamPaperInfo/{exportWay}/{examId}/{courseId}/{exportContentList}/{loginName}")
 	public void exportSingleExamPaperInfo(HttpServletResponse response,
 	public void exportSingleExamPaperInfo(HttpServletResponse response,
 											@PathVariable String exportWay,
 											@PathVariable String exportWay,
 											@PathVariable String examId,
 											@PathVariable String examId,
 											@PathVariable String courseId,
 											@PathVariable String courseId,
-											@PathVariable String exportContentList){
+											@PathVariable String exportContentList,
+											@PathVariable String loginName){
 		ExportPaperInfoModel exportModel = new ExportPaperInfoModel();
 		ExportPaperInfoModel exportModel = new ExportPaperInfoModel();
 		exportModel.setExportWay(ExportWay.strToEnum(exportWay));
 		exportModel.setExportWay(ExportWay.strToEnum(exportWay));
 		exportModel.setExamId(examId);
 		exportModel.setExamId(examId);
@@ -178,7 +179,7 @@ public class ExtractConfigController {
 		}
 		}
 		exportModel.setExportContentList(list);
 		exportModel.setExportContentList(list);
 		try {
 		try {
-			extractConfigFileService.exportExamPaperInfo(exportModel,response);
+			extractConfigFileService.exportExamPaperInfo(exportModel,response,loginName);
 		} catch (Exception e) {
 		} catch (Exception e) {
 			e.printStackTrace();
 			e.printStackTrace();
 		}
 		}
@@ -203,11 +204,12 @@ public class ExtractConfigController {
 	
 	
 	
 	
 	@ApiOperation(value = "导出整个考试下所有 课程的试卷、答案、试卷结构", notes = "导出整个考试下所有 课程的试卷、答案、试卷结构")
 	@ApiOperation(value = "导出整个考试下所有 课程的试卷、答案、试卷结构", notes = "导出整个考试下所有 课程的试卷、答案、试卷结构")
-	@GetMapping(value = "/exportBatchExamPaperInfo/{exportWay}/{examId}/{exportContentList}")
+	@GetMapping(value = "/exportBatchExamPaperInfo/{exportWay}/{examId}/{exportContentList}/{loginName}")
 	public void exportBatchExamPaperInfo(HttpServletResponse response,
 	public void exportBatchExamPaperInfo(HttpServletResponse response,
 											@PathVariable String exportWay,
 											@PathVariable String exportWay,
 											@PathVariable String examId,
 											@PathVariable String examId,
-											@PathVariable String exportContentList){
+											@PathVariable String exportContentList,
+											@PathVariable String loginName){
 		ExportPaperInfoModel exportModel = new ExportPaperInfoModel();
 		ExportPaperInfoModel exportModel = new ExportPaperInfoModel();
 		exportModel.setExportWay(ExportWay.strToEnum(exportWay));
 		exportModel.setExportWay(ExportWay.strToEnum(exportWay));
 		exportModel.setExamId(examId);
 		exportModel.setExamId(examId);
@@ -218,7 +220,7 @@ public class ExtractConfigController {
 		}
 		}
 		exportModel.setExportContentList(list);
 		exportModel.setExportContentList(list);
 		try {
 		try {
-			extractConfigFileService.exportExamPaperInfo(exportModel,response);
+			extractConfigFileService.exportExamPaperInfo(exportModel,response,loginName);
 		} catch (Exception e) {
 		} catch (Exception e) {
 			e.printStackTrace();
 			e.printStackTrace();
 		}
 		}

+ 166 - 166
cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperStructController.java

@@ -1,166 +1,166 @@
-package com.qmth.cqb.paper.web;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.servlet.http.HttpServletRequest;
-
-import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
-import com.qmth.cqb.paper.dto.QuesNameDto;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import com.qmth.cqb.paper.dao.PaperStructRepo;
-import com.qmth.cqb.paper.model.PaperStruct;
-import com.qmth.cqb.paper.model.PaperStructSearchInfo;
-import com.qmth.cqb.paper.service.PaperStructService;
-
-import cn.com.qmth.examcloud.common.uac.annotation.Uac;
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-import cn.com.qmth.examcloud.common.uac.enums.RoleMeta;
-import cn.com.qmth.examcloud.common.uac.enums.UacPolicy;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * Created by songyue on 16/12/28.
- */
-@RestController
-@RequestMapping("${api_cqb}/")
-public class PaperStructController {
-
-    @Autowired
-    PaperStructService paperStructService;
-
-    @Autowired
-    PaperStructRepo paperStructRepo;
-
-    /**
-     * 获取所有试卷结构
-     * @param
-     * @return
-     */
-    @ApiOperation(value = "获取试卷结构带分页", notes = "获取试卷结构带分页")
-    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
-    @GetMapping(value = "/paperStruct/{curPage}/{pageSize}")
-    public ResponseEntity getPaperStructs(HttpServletRequest request,
-                                          @ModelAttribute PaperStructSearchInfo searchInfo,
-                                          @PathVariable int curPage,
-                                          @PathVariable int pageSize) {
-        AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-        if(accessUser != null){
-            searchInfo.setOrgId(accessUser.getRootOrgId().toString());
-        }
-        Page<PaperStruct> paperStructs= paperStructService.getPaperStructs(searchInfo, curPage, pageSize);
-        return new ResponseEntity(paperStructs, HttpStatus.OK);
-    }
-
-    /**
-     * 获取所有试卷结构
-     * @param
-     * @return
-     */
-    @ApiOperation(value = "获取试卷结构不带分页", notes = "获取试卷结构不带分页")
-    @GetMapping(value = "/paperStruct")
-    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
-    public ResponseEntity getPaperStructs(HttpServletRequest request,@ModelAttribute PaperStructSearchInfo searchInfo) {
-        AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-        if(accessUser != null){
-            searchInfo.setOrgId(accessUser.getRootOrgId().toString());
-        }
-        List<PaperStruct> paperStructs = paperStructService.getPaperStructs(searchInfo);
-        return new ResponseEntity(paperStructs, HttpStatus.OK);
-    }
-
-    /**
-     * 根据id获取试卷结构
-     * 
-     * @param
-     * @return
-     */
-    @ApiOperation(value = "获取试卷结构", notes = "获取试卷结构")
-    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
-    @GetMapping(value = "/paperStruct/{id}")
-    public ResponseEntity getPaperStructById(@PathVariable String id) {
-        return new ResponseEntity(paperStructRepo.findOne(id), HttpStatus.OK);
-    }
-
-    /**
-     * 更新试卷结构
-     * 
-     * @param
-     * @return
-     */
-    @ApiOperation(value = "更新试卷结构", notes = "更新试卷结构")
-    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
-    @PutMapping(value = "/paperStruct")
-    public ResponseEntity updatePaperStruct(HttpServletRequest request, @RequestBody PaperStruct ps) {
-        AccessUser user = (AccessUser) request.getAttribute("accessUser");
-        PaperStruct paperStruct = paperStructService.save(ps, user);
-        if (paperStruct == null) {
-            return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
-        } else {
-            return new ResponseEntity(paperStruct, HttpStatus.OK);
-        }
-
-    }
-
-    /**
-     * 新增试卷结构
-     * 
-     * @param ps
-     * @return
-     */
-    @ApiOperation(value = "新增试卷结构", notes = "新增试卷结构")
-    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
-    @PostMapping(value = "/paperStruct")
-    public ResponseEntity addPaperStruct(HttpServletRequest request, @RequestBody PaperStruct ps) {
-        AccessUser user = (AccessUser) request.getAttribute("accessUser");
-        PaperStruct paperStructTemp = paperStructService.checkNameUnique(ps.getName(), user.getRootOrgId().toString());
-        if (paperStructTemp != null) {
-            return new ResponseEntity("试卷结构名称重复,请重新命名!", HttpStatus.INTERNAL_SERVER_ERROR);
-        } else {
-            PaperStruct paperStruct = paperStructService.save(ps, user);
-            return new ResponseEntity(paperStruct, HttpStatus.OK);
-        }
-    }
-
-    /**
-     * 删除试卷结构
-     * 
-     * @param ids
-     * @return
-     */
-    @ApiOperation(value = "删除试卷结构", notes = "删除试卷结构")
-    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
-    @DeleteMapping(value = "/paperStruct/{ids}")
-    public ResponseEntity removePaperStruct(@PathVariable String ids) {
-        List<String> paperList = Stream.of(ids.split(",")).collect(Collectors.toList());
-        paperStructRepo.delete(paperStructRepo.findAll(paperList));
-        return new ResponseEntity(HttpStatus.OK);
-    }
-
-    /**
-     * 根据题型获取来源大题
-     *
-     * @param
-     * @return
-     */
-    @ApiOperation(value = "获取来源大题", notes = "获取来源大题")
-    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
-    @GetMapping(value = "/paperStruct/quesNames")
-    public ResponseEntity getPaperStructById(HttpServletRequest request,
-                                             @RequestParam(required = false) String courseNo,
-                                             @RequestParam QuesStructType quesType) {
-        List<QuesNameDto> quesNameDtos = new ArrayList<>();
-        AccessUser user = (AccessUser) request.getAttribute("accessUser");
-        if(user != null){
-            quesNameDtos = paperStructService.getQuesNameList(user.getOrgId().toString(),courseNo,quesType);
-        }
-        return new ResponseEntity(quesNameDtos, HttpStatus.OK);
-    }
-}
+package com.qmth.cqb.paper.web;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import javax.servlet.http.HttpServletRequest;
+
+import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
+import com.qmth.cqb.paper.dto.QuesNameDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import com.qmth.cqb.paper.dao.PaperStructRepo;
+import com.qmth.cqb.paper.model.PaperStruct;
+import com.qmth.cqb.paper.model.PaperStructSearchInfo;
+import com.qmth.cqb.paper.service.PaperStructService;
+
+import cn.com.qmth.examcloud.common.uac.annotation.Uac;
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+import cn.com.qmth.examcloud.common.uac.enums.RoleMeta;
+import cn.com.qmth.examcloud.common.uac.enums.UacPolicy;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * Created by songyue on 16/12/28.
+ */
+@RestController
+@RequestMapping("${api_cqb}/")
+public class PaperStructController {
+
+    @Autowired
+    PaperStructService paperStructService;
+
+    @Autowired
+    PaperStructRepo paperStructRepo;
+
+    /**
+     * 获取所有试卷结构
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "获取试卷结构带分页", notes = "获取试卷结构带分页")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    @GetMapping(value = "/paperStruct/{curPage}/{pageSize}")
+    public ResponseEntity getPaperStructs(HttpServletRequest request,
+                                          @ModelAttribute PaperStructSearchInfo searchInfo,
+                                          @PathVariable int curPage,
+                                          @PathVariable int pageSize) {
+        AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+        if(accessUser != null){
+            searchInfo.setOrgId(accessUser.getRootOrgId().toString());
+        }
+        Page<PaperStruct> paperStructs= paperStructService.getPaperStructs(searchInfo, curPage, pageSize);
+        return new ResponseEntity(paperStructs, HttpStatus.OK);
+    }
+
+    /**
+     * 获取所有试卷结构
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "获取试卷结构不带分页", notes = "获取试卷结构不带分页")
+    @GetMapping(value = "/paperStruct")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    public ResponseEntity getPaperStructs(HttpServletRequest request,@ModelAttribute PaperStructSearchInfo searchInfo) {
+        AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+        if(accessUser != null){
+            searchInfo.setOrgId(accessUser.getRootOrgId().toString());
+        }
+        List<PaperStruct> paperStructs = paperStructService.getPaperStructs(searchInfo);
+        return new ResponseEntity(paperStructs, HttpStatus.OK);
+    }
+
+    /**
+     * 根据id获取试卷结构
+     * 
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "获取试卷结构", notes = "获取试卷结构")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    @GetMapping(value = "/paperStruct/{id}")
+    public ResponseEntity getPaperStructById(@PathVariable String id) {
+        return new ResponseEntity(paperStructRepo.findOne(id), HttpStatus.OK);
+    }
+
+    /**
+     * 更新试卷结构
+     * 
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "更新试卷结构", notes = "更新试卷结构")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    @PutMapping(value = "/paperStruct")
+    public ResponseEntity updatePaperStruct(HttpServletRequest request, @RequestBody PaperStruct ps) {
+        AccessUser user = (AccessUser) request.getAttribute("accessUser");
+        PaperStruct paperStruct = paperStructService.save(ps, user);
+        if (paperStruct == null) {
+            return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
+        } else {
+            return new ResponseEntity(paperStruct, HttpStatus.OK);
+        }
+
+    }
+
+    /**
+     * 新增试卷结构
+     * 
+     * @param ps
+     * @return
+     */
+    @ApiOperation(value = "新增试卷结构", notes = "新增试卷结构")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    @PostMapping(value = "/paperStruct")
+    public ResponseEntity addPaperStruct(HttpServletRequest request, @RequestBody PaperStruct ps) {
+        AccessUser user = (AccessUser) request.getAttribute("accessUser");
+        PaperStruct paperStructTemp = paperStructService.checkNameUnique(ps.getName(), user.getRootOrgId().toString());
+        if (paperStructTemp != null) {
+            return new ResponseEntity("试卷结构名称重复,请重新命名!", HttpStatus.INTERNAL_SERVER_ERROR);
+        } else {
+            PaperStruct paperStruct = paperStructService.save(ps, user);
+            return new ResponseEntity(paperStruct, HttpStatus.OK);
+        }
+    }
+
+    /**
+     * 删除试卷结构
+     * 
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "删除试卷结构", notes = "删除试卷结构")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    @DeleteMapping(value = "/paperStruct/{ids}")
+    public ResponseEntity removePaperStruct(@PathVariable String ids) {
+        List<String> paperList = Stream.of(ids.split(",")).collect(Collectors.toList());
+        paperStructRepo.delete(paperStructRepo.findAll(paperList));
+        return new ResponseEntity(HttpStatus.OK);
+    }
+
+    /**
+     * 根据题型获取来源大题
+     *
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "获取来源大题", notes = "获取来源大题")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    @GetMapping(value = "/paperStruct/quesNames")
+    public ResponseEntity getPaperStructById(HttpServletRequest request,
+                                             @RequestParam(required = false) String courseNo,
+                                             @RequestParam QuesStructType quesType) {
+        List<QuesNameDto> quesNameDtos = new ArrayList<>();
+        AccessUser user = (AccessUser) request.getAttribute("accessUser");
+        if(user != null){
+            quesNameDtos = paperStructService.getQuesNameList(user.getOrgId().toString(),courseNo,quesType);
+        }
+        return new ResponseEntity(quesNameDtos, HttpStatus.OK);
+    }
+}

+ 14 - 17
cqb-question-resource/src/main/java/com/qmth/cqb/question/service/impl/QuesServiceImpl.java

@@ -8,6 +8,7 @@ import com.qmth.cqb.question.dao.QuesPkgPathRepo;
 import com.qmth.cqb.question.model.*;
 import com.qmth.cqb.question.model.*;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.docx4j.Docx4J;
 import org.docx4j.openpackaging.exceptions.InvalidFormatException;
 import org.docx4j.openpackaging.exceptions.InvalidFormatException;
 import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
 import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -289,7 +290,6 @@ public class QuesServiceImpl implements QuesService{
             question.setQuesBodyWord(null);
             question.setQuesBodyWord(null);
             question.setQuesAnswerWord(null);
             question.setQuesAnswerWord(null);
             question.setQuesAnswerAnalysisWord(null);
             question.setQuesAnswerAnalysisWord(null);
-//            question.setQuesPkg(new byte[0]);
             String newQuesBody = question.getQuesBody().replaceAll("<span>", "").replaceAll("</span>", "")
             String newQuesBody = question.getQuesBody().replaceAll("<span>", "").replaceAll("</span>", "")
                     .replaceAll("###", "______");
                     .replaceAll("###", "______");
             question.setQuesBody(newQuesBody);
             question.setQuesBody(newQuesBody);
@@ -308,9 +308,12 @@ public class QuesServiceImpl implements QuesService{
      */
      */
     public void updateQuesWord(Question question) {
     public void updateQuesWord(Question question) {
         try {
         try {
-        	if(wordMLPackage==null){
+        	if(wordMLPackage == null){
         		wordMLPackage = WordprocessingMLPackage.createPackage();
         		wordMLPackage = WordprocessingMLPackage.createPackage();
-        	}
+        	}else{
+                DocxProcessUtil.initTmpPackage(wordMLPackage);
+        	    wordMLPackage.getRelationshipsPart().remove();
+            }
             updateQuesWordUnit(wordMLPackage, question);
             updateQuesWordUnit(wordMLPackage, question);
             List<Question> subQuesList = question.getSubQuestions();
             List<Question> subQuesList = question.getSubQuestions();
             if (subQuesList != null && subQuesList.size() > 0) {
             if (subQuesList != null && subQuesList.size() > 0) {
@@ -319,25 +322,25 @@ public class QuesServiceImpl implements QuesService{
                 }
                 }
             }
             }
             byte [] pkgByte = DocxProcessUtil.getPkgByte(wordMLPackage);
             byte [] pkgByte = DocxProcessUtil.getPkgByte(wordMLPackage);
-            QuestionPkgPath quesPkgPath = quesPkgPathRepo.save(new QuestionPkgPath(pkgByte));
-            question.setQuesPkgPathId(quesPkgPath.getId());
+            QuestionPkgPath quesPkgPath = quesPkgPathRepo.findFirstById(question.getQuesPkgPathId());
+            quesPkgPath.setQuesPkg(pkgByte);
+            quesPkgPathRepo.save(quesPkgPath);
             pkgByte = null;
             pkgByte = null;
-            quesPkgPath.setQuesPkg(null);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
     }
     }
 
 
     public void updateQuesWordUnit(WordprocessingMLPackage wordMLPackage, Question question) throws Exception {
     public void updateQuesWordUnit(WordprocessingMLPackage wordMLPackage, Question question) throws Exception {
-        String quesBody = StringEscapeUtils.unescapeHtml4(question.getQuesBody());
-        String quesAnswer = StringEscapeUtils.unescapeHtml4(question.getQuesAnswer());
+        String quesBody = question.getQuesBody();
+        String quesAnswer = question.getQuesAnswer();
         if(!StringUtils.isEmpty(quesBody)){
         if(!StringUtils.isEmpty(quesBody)){
-            question.setQuesBodyWord(DocxProcessUtil.html2Docx(wordMLPackage, quesBody));
+            question.setQuesBodyWord(DocxProcessUtil.html2Docx(wordMLPackage, CommonUtils.formatHtml(quesBody)));
         }
         }
         if(!StringUtils.isEmpty(quesAnswer)
         if(!StringUtils.isEmpty(quesAnswer)
                 && (question.getQuestionType() == QuesStructType.FILL_BLANK_QUESTION
                 && (question.getQuestionType() == QuesStructType.FILL_BLANK_QUESTION
                 || question.getQuestionType() == QuesStructType.TEXT_ANSWER_QUESTION)){
                 || question.getQuestionType() == QuesStructType.TEXT_ANSWER_QUESTION)){
-            question.setQuesAnswerWord(DocxProcessUtil.html2Docx(wordMLPackage, quesAnswer));
+            question.setQuesAnswerWord(DocxProcessUtil.html2Docx(wordMLPackage, CommonUtils.formatHtml(quesAnswer)));
         }
         }
         if(!StringUtils.isEmpty(quesAnswer)&& 
         if(!StringUtils.isEmpty(quesAnswer)&& 
         		(question.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION
         		(question.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION
@@ -348,15 +351,9 @@ public class QuesServiceImpl implements QuesService{
         if (quesOptions != null && quesOptions.size() > 0) {
         if (quesOptions != null && quesOptions.size() > 0) {
             for (QuesOption quesOption : quesOptions) {
             for (QuesOption quesOption : quesOptions) {
                 quesOption.setOptionBodyWord(DocxProcessUtil.html2Docx(wordMLPackage,
                 quesOption.setOptionBodyWord(DocxProcessUtil.html2Docx(wordMLPackage,
-                        StringEscapeUtils.unescapeHtml4(quesOption.getOptionBody())));
-                DocxProcessUtil.initTmpPackage(wordMLPackage);
+                        CommonUtils.formatHtml(quesOption.getOptionBody())));
             }
             }
         }
         }
-        byte [] pkgByte = DocxProcessUtil.getPkgByte(wordMLPackage);
-        QuestionPkgPath quesPkgPath = quesPkgPathRepo.save(new QuestionPkgPath(pkgByte));
-        question.setQuesPkgPathId(quesPkgPath.getId());
-        pkgByte = null;
-        quesPkgPath.setQuesPkg(null);
     }
     }
     
     
     private String makeQuesAnswerWord(String quesAnswer){
     private String makeQuesAnswerWord(String quesAnswer){

+ 30 - 3
cqb-starter/src/main/resources/application-prac.properties

@@ -1,10 +1,37 @@
-spring.data.mongodb.uri=mongodb://root:Qmth87863577@dds-wz93448b802ba2241.mongodb.rds.aliyuncs.com:3717/?authSource=admin&authMechanism=SCRAM-SHA-1
-spring.data.mongodb.database=comm-ques-bank
+#spring.data.mongodb.uri=mongodb://root:Qmth87863577@119.23.127.95:3717/?authSource=admin&authMechanism=SCRAM-SHA-1
+spring.data.mongodb.uri=mongodb://localhost:27017/comm-ques-bank
 spring.data.mongodb.grid-fs-database=comm-ques-bank
 spring.data.mongodb.grid-fs-database=comm-ques-bank
+spring.data.mongodb.database=comm-ques-bank
 eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
 eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
 spring.application.name=ExamCloud-service-question
 spring.application.name=ExamCloud-service-question
 
 
 spring.redis.host=127.0.0.1
 spring.redis.host=127.0.0.1
 spring.redis.port=6379
 spring.redis.port=6379
 
 
-server.tomcat.max-threads=2000
+upyun.bucketName=exam-cloud-test
+upyun.userName=examcloud
+upyun.password=examcloud123456
+upyun.uploadUrl=/comm-ques-bank/dev/exam-paper-file/
+upyun.audio.uploadUrl=/comm-ques-bank/dev/audio/
+upyun.audio.maxsize=5
+upyun.downloadUrl=http://exam-cloud-test.b0.upaiyun.com
+upyun.downloadDirectory=paperDirectory
+upyun.zipDirectory=paperZipDirectory
+upyun.radioType=mp3,wma
+
+
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/exam_cloud_test?useUnicode=true&characterEncoding=UTF-8
+spring.datasource.username=root
+spring.datasource.password=root
+spring.datasource.validation-query=SELECT 1 FROM DUAL
+spring.datasource.test-on-borrow=true
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.jpa.show-sql=false
+spring.jpa.hibernate.ddl-auto=update
+
+
+spring.rabbitmq.host=127.0.0.1
+spring.rabbitmq.port=5672
+spring.rabbitmq.username=examcloud
+spring.rabbitmq.password=examcloud
+spring.rabbitmq.listener.acknowledgeMode=MANUAL