Browse Source

试卷结构分类添加,试题对象属性修改,导入时候添加试题属性

weiwenhai 7 years ago
parent
commit
d3232133c1

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

@@ -8,6 +8,10 @@ import org.omg.CORBA.PRIVATE_MEMBER;
  * @date  2017.12.11
  */
 public enum PaperStructType {
+	/**
+	 * 简易组卷
+	 */
+	SIMPLE("简易组卷"),
 
 	/**
 	 * 精确组卷

+ 14 - 6
cqb-paper/src/main/java/com/qmth/cqb/paper/service/ImportPaperService.java

@@ -780,6 +780,16 @@ public class ImportPaperService {
         question.setQuesProperties(quesProperties);
     }
 
+    /**
+     * 校验一级属性与二级属性,并保存到试题中
+     * @param firstProperty
+     * @param secondProperty
+     * @param importPaperCheck
+     * @param subQuesNum
+     * @param paper
+     * @param quesProperties
+     * @throws Exception
+     */
     private void checkProperty(String firstProperty, String secondProperty,
     		ImportPaperCheck importPaperCheck, int subQuesNum,Paper paper, List<QuesProperty> quesProperties) throws Exception{
 		//一级属性为空,二级属性有值
@@ -792,10 +802,10 @@ public class ImportPaperService {
 			//根据课程查询所有课程属性树
 			List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseId(Long.parseLong(paper.getCourse().getId()));
 			for(CourseProperty courseProperty:courseProperties){
-				//查询一级属性是否存在
 				Property propertyParent = new Property(firstProperty,0l,courseProperty.getId());
-				//存在一级属性
+				//查询一级属性是否存在
 				List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
+				//存在一级属性
 				if(propertieParents != null || propertieParents.size()>0){
 					for(Property proParent:propertieParents){
 						Property propertySon = new Property(secondProperty,proParent.getId(),courseProperty.getId());
@@ -804,10 +814,8 @@ public class ImportPaperService {
 						//存在二级属性
 						if(propertieSons!=null && propertieSons.size()>0){
 							for(Property proSon:propertieSons){
-								//根据二级查询一级
-								Property prParent = propertyRepo.findOne(proSon.getParentId());
 								//保存一级和二级属性
-								QuesProperty quesProperty = new QuesProperty(prParent, proSon);
+								QuesProperty quesProperty = new QuesProperty(proParent, proSon,courseProperty);
 								quesProperties.add(quesProperty);
 							}
 						}else{
@@ -840,7 +848,7 @@ public class ImportPaperService {
 				    		throw new PaperException(importPaperCheck.errorInfo);
 						}else {
 							//保存试题属性
-							QuesProperty quesProperty = new QuesProperty(proParent, null);
+							QuesProperty quesProperty = new QuesProperty(proParent, null,courseProperty);
 							quesProperties.add(quesProperty);
 						}
 					}

+ 2 - 1
cqb-question-resource/src/main/java/com/qmth/cqb/question/model/QuesProperty.java

@@ -17,9 +17,10 @@ public class QuesProperty implements Serializable{
 		
 	}
 	
-	public QuesProperty(Property firstProperty,Property secondProperty){
+	public QuesProperty(Property firstProperty,Property secondProperty,CourseProperty courseProperty){
 		this.firstProperty = firstProperty;
 		this.secondProperty = secondProperty;
+		this.coursePropertyName = courseProperty.getName();
 	}
 
 	public Property getFirstProperty() {