Forráskód Böngészése

完成蓝图试卷结构

weiwenhai 7 éve
szülő
commit
9cfe8a0fb3
26 módosított fájl, 1984 hozzáadás és 1443 törlés
  1. 33 0
      cqb-comm-utils/src/main/java/com/qmth/cqb/utils/enums/GenPaperType.java
  2. 44 0
      cqb-comm-utils/src/main/java/com/qmth/cqb/utils/enums/PaperStructType.java
  3. 125 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dto/CoursePropertyNumberDto.java
  4. 127 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/CoursePropertyNumber.java
  5. 233 114
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailStruct.java
  6. 198 139
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperStruct.java
  7. 76 65
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperStructSearchInfo.java
  8. 4 7
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/ImportPaperService.java
  9. 67 36
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperStructService.java
  10. 2 2
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperDetailInfoStructBlueprintServiceImpl.java
  11. 166 166
      cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperStructController.java
  12. 0 5
      cqb-question-resource/pom.xml
  13. 50 50
      cqb-question-resource/src/main/java/com/qmth/cqb/question/assemble/PropertyAssembler.java
  14. 26 26
      cqb-question-resource/src/main/java/com/qmth/cqb/question/dao/CoursePropertyRepo.java
  15. 23 23
      cqb-question-resource/src/main/java/com/qmth/cqb/question/dao/PropertyRepo.java
  16. 60 60
      cqb-question-resource/src/main/java/com/qmth/cqb/question/dto/CoursePropertyDto.java
  17. 95 95
      cqb-question-resource/src/main/java/com/qmth/cqb/question/dto/PropertyDto.java
  18. 99 99
      cqb-question-resource/src/main/java/com/qmth/cqb/question/model/CourseProperty.java
  19. 2 2
      cqb-question-resource/src/main/java/com/qmth/cqb/question/model/Property.java
  20. 1 1
      cqb-question-resource/src/main/java/com/qmth/cqb/question/model/QuesProperty.java
  21. 59 59
      cqb-question-resource/src/main/java/com/qmth/cqb/question/service/CoursePropertyService.java
  22. 58 58
      cqb-question-resource/src/main/java/com/qmth/cqb/question/service/PropertyService.java
  23. 103 103
      cqb-question-resource/src/main/java/com/qmth/cqb/question/service/impl/CoursePropertyServiceImpl.java
  24. 122 122
      cqb-question-resource/src/main/java/com/qmth/cqb/question/service/impl/PropertyServiceImpl.java
  25. 118 118
      cqb-question-resource/src/main/java/com/qmth/cqb/question/web/CoursePropertyController.java
  26. 93 93
      cqb-question-resource/src/main/java/com/qmth/cqb/question/web/PropertyController.java

+ 33 - 0
cqb-comm-utils/src/main/java/com/qmth/cqb/utils/enums/GenPaperType.java

@@ -0,0 +1,33 @@
+package com.qmth.cqb.utils.enums;
+
+public enum GenPaperType {
+
+	/**
+	 * 细节组卷
+	 */
+	SPECIFIC("细节"),
+	
+	/**
+	 * 宏观
+	 */
+	ENSEMBLE("宏观"),
+	
+	/**
+	 * 普通组卷
+	 */
+	COMMON("普通组卷");
+	
+	private String name;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	private GenPaperType(String name){
+		this.name = name;
+	}
+}

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

@@ -0,0 +1,44 @@
+package com.qmth.cqb.utils.enums;
+
+import org.omg.CORBA.PRIVATE_MEMBER;
+
+/**
+ * @describle 试卷结构类型
+ * @author weiwenhai
+ * @date  2017.12.11
+ */
+public enum PaperStructType {
+
+	/**
+	 * 精确组卷
+	 */
+	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;
+    }
+}

+ 125 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dto/CoursePropertyNumberDto.java

@@ -0,0 +1,125 @@
+package com.qmth.cqb.paper.dto;
+
+public class CoursePropertyNumberDto {
+
+	private Long id; 
+	
+	private Long propertyId;
+	
+	private Long propertyParentId;
+	
+	private String propertyName;
+	
+	private Integer number;
+	
+	private Integer publicSimple; //公开简单
+	
+	private Integer publicMedium; //公开中等
+	
+	private Integer publicDifficulty; //公开困难
+	
+	private Integer noPublicSimple; //非公开简单
+	
+	private Integer noPublicMedium; //非公开中等
+	
+	private Integer noPublicDifficulty; //非公开困难
+	
+	private Boolean disable; //是否显示
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getPropertyId() {
+		return propertyId;
+	}
+
+	public void setPropertyId(Long propertyId) {
+		this.propertyId = propertyId;
+	}
+
+	public Long getPropertyParentId() {
+		return propertyParentId;
+	}
+
+	public void setPropertyParentId(Long propertyParentId) {
+		this.propertyParentId = propertyParentId;
+	}
+
+	public String getPropertyName() {
+		return propertyName;
+	}
+
+	public void setPropertyName(String propertyName) {
+		this.propertyName = propertyName;
+	}
+
+	public Integer getNumber() {
+		return number;
+	}
+
+	public void setNumber(Integer number) {
+		this.number = number;
+	}
+
+	public Integer getPublicSimple() {
+		return publicSimple;
+	}
+
+	public void setPublicSimple(Integer publicSimple) {
+		this.publicSimple = publicSimple;
+	}
+
+	public Integer getPublicMedium() {
+		return publicMedium;
+	}
+
+	public void setPublicMedium(Integer publicMedium) {
+		this.publicMedium = publicMedium;
+	}
+
+	public Integer getPublicDifficulty() {
+		return publicDifficulty;
+	}
+
+	public void setPublicDifficulty(Integer publicDifficulty) {
+		this.publicDifficulty = publicDifficulty;
+	}
+
+	public Integer getNoPublicSimple() {
+		return noPublicSimple;
+	}
+
+	public void setNoPublicSimple(Integer noPublicSimple) {
+		this.noPublicSimple = noPublicSimple;
+	}
+
+	public Integer getNoPublicMedium() {
+		return noPublicMedium;
+	}
+
+	public void setNoPublicMedium(Integer noPublicMedium) {
+		this.noPublicMedium = noPublicMedium;
+	}
+
+	public Integer getNoPublicDifficulty() {
+		return noPublicDifficulty;
+	}
+
+	public void setNoPublicDifficulty(Integer noPublicDifficulty) {
+		this.noPublicDifficulty = noPublicDifficulty;
+	}
+
+	public Boolean getDisable() {
+		return disable;
+	}
+
+	public void setDisable(Boolean disable) {
+		this.disable = disable;
+	}
+	
+}

+ 127 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/model/CoursePropertyNumber.java

@@ -0,0 +1,127 @@
+package com.qmth.cqb.paper.model;
+
+public class CoursePropertyNumber {
+	
+	private Long id; 
+	
+	private Long propertyId;
+	
+	private Long propertyParentId;
+	
+	private String propertyName;
+	
+	private Integer number;
+	
+	private Double score; //每题分数
+	
+	private Integer publicSimple; //公开简单
+	
+	private Integer publicMedium; //公开中等
+	
+	private Integer publicDifficulty; //公开困难
+	
+	private Integer noPublicSimple; //非公开简单
+	
+	private Integer noPublicMedium; //非公开中等
+	
+	private Integer noPublicDifficulty; //非公开困难
+	
+	private Boolean disable; //是否显示
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getPropertyId() {
+		return propertyId;
+	}
+
+	public void setPropertyId(Long propertyId) {
+		this.propertyId = propertyId;
+	}
+
+	public Long getPropertyParentId() {
+		return propertyParentId;
+	}
+
+	public void setPropertyParentId(Long propertyParentId) {
+		this.propertyParentId = propertyParentId;
+	}
+
+	public String getPropertyName() {
+		return propertyName;
+	}
+
+	public void setPropertyName(String propertyName) {
+		this.propertyName = propertyName;
+	}
+
+	public Integer getNumber() {
+		return number;
+	}
+
+	public void setNumber(Integer number) {
+		this.number = number;
+	}
+
+	public Integer getPublicSimple() {
+		return publicSimple;
+	}
+
+	public void setPublicSimple(Integer publicSimple) {
+		this.publicSimple = publicSimple;
+	}
+
+	public Integer getPublicMedium() {
+		return publicMedium;
+	}
+
+	public void setPublicMedium(Integer publicMedium) {
+		this.publicMedium = publicMedium;
+	}
+
+	public Integer getPublicDifficulty() {
+		return publicDifficulty;
+	}
+
+	public void setPublicDifficulty(Integer publicDifficulty) {
+		this.publicDifficulty = publicDifficulty;
+	}
+
+	public Integer getNoPublicSimple() {
+		return noPublicSimple;
+	}
+
+	public void setNoPublicSimple(Integer noPublicSimple) {
+		this.noPublicSimple = noPublicSimple;
+	}
+
+	public Integer getNoPublicMedium() {
+		return noPublicMedium;
+	}
+
+	public void setNoPublicMedium(Integer noPublicMedium) {
+		this.noPublicMedium = noPublicMedium;
+	}
+
+	public Integer getNoPublicDifficulty() {
+		return noPublicDifficulty;
+	}
+
+	public void setNoPublicDifficulty(Integer noPublicDifficulty) {
+		this.noPublicDifficulty = noPublicDifficulty;
+	}
+
+	public Boolean getDisable() {
+		return disable;
+	}
+
+	public void setDisable(Boolean disable) {
+		this.disable = disable;
+	}
+	
+}

+ 233 - 114
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailStruct.java

@@ -1,114 +1,233 @@
-package com.qmth.cqb.paper.model;
-
-import com.qmth.cqb.paper.dto.PaperDetailUnitStructDto;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.List;
-
-/**
- * 试卷结构明细
- * Created by songyue on 16/12/28.
- */
-
-public class PaperDetailStruct implements Serializable{
-	
-	private static final long serialVersionUID = -1102384643351847702L;
-
-	private String id;
-	
-	private Integer number;//大题序号
-	
-	private String name;//大题名称
-	
-	private List<PaperDetailUnitStruct> paperDetailUnitStructs;//小题明细
-
-	private List<PaperDetailUnitStructDto> unitStructs;//题目类型统计
-
-	private Double totalScore;//大题总分
-	
-	private Map params;//大题参数
-
-	private String remark;
-
-	private Integer detailCount;
-
-	public static long getSerialVersionUID() {
-		return serialVersionUID;
-	}
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public Integer getNumber() {
-		return number;
-	}
-
-	public void setNumber(Integer number) {
-		this.number = number;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public List<PaperDetailUnitStruct> getPaperDetailUnitStructs() {
-		return paperDetailUnitStructs;
-	}
-
-	public void setPaperDetailUnitStructs(List<PaperDetailUnitStruct> paperDetailUnitStructs) {
-		this.paperDetailUnitStructs = paperDetailUnitStructs;
-	}
-
-	public List<PaperDetailUnitStructDto> getUnitStructs() {
-		return unitStructs;
-	}
-
-	public void setUnitStructs(List<PaperDetailUnitStructDto> unitStructs) {
-		this.unitStructs = unitStructs;
-	}
-
-	public Double getTotalScore() {
-		return totalScore;
-	}
-
-	public void setTotalScore(Double totalScore) {
-		this.totalScore = totalScore;
-	}
-
-	public Map getParams() {
-		return params;
-	}
-
-	public void setParams(Map params) {
-		this.params = params;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-	public Integer getDetailCount() {
-		return detailCount;
-	}
-
-	public void setDetailCount(Integer detailCount) {
-		this.detailCount = detailCount;
-	}
-
-	public PaperDetailStruct() {
-	}
-}
+package com.qmth.cqb.paper.model;
+
+import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
+
+import com.qmth.cqb.paper.dto.CoursePropertyNumberDto;
+import com.qmth.cqb.paper.dto.PaperDetailUnitStructDto;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * 试卷结构明细
+ * Created by songyue on 16/12/28.
+ */
+
+public class PaperDetailStruct implements Serializable{
+	
+	private static final long serialVersionUID = -1102384643351847702L;
+
+	private String id;
+	
+	private Integer number;//大题序号
+	
+	private String name;//大题名称
+	
+	private List<PaperDetailUnitStruct> paperDetailUnitStructs;//小题明细
+
+	private List<PaperDetailUnitStructDto> unitStructs;//题目类型统计
+
+	private Double totalScore;//大题总分
+	
+	private Map params;//大题参数
+
+	private String remark;
+
+	private Integer detailCount; //小题总数
+	
+	/**
+	 * 蓝图结构字段
+	 */
+	private QuesStructType questionType; //题型
+	
+	private Double score; //小题分数
+	
+	private List<String> quesNames;//来源大题
+	
+	private Integer publicSimpleCount; //公开简单总数
+	
+	private Integer publicMediumCount; //公开简单总数
+	
+	private Integer publicDifficultyCount; //公开简单总数
+	
+	private Integer noPublicSimpleCount; //公开简单总数
+	
+	private Integer noPublicMediumCount; //公开简单总数
+	
+	private Integer noPublicDifficultyCount; //公开简单总数  coursePropertyNumberDtos
+	
+	private List<CoursePropertyNumberDto> coursePropertyNumberDtos;
+	
+	private List<CoursePropertyNumber> coursePropertyNumbers;
+
+	public static long getSerialVersionUID() {
+		return serialVersionUID;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public Integer getNumber() {
+		return number;
+	}
+
+	public void setNumber(Integer number) {
+		this.number = number;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public List<PaperDetailUnitStruct> getPaperDetailUnitStructs() {
+		return paperDetailUnitStructs;
+	}
+
+	public void setPaperDetailUnitStructs(List<PaperDetailUnitStruct> paperDetailUnitStructs) {
+		this.paperDetailUnitStructs = paperDetailUnitStructs;
+	}
+
+	public List<PaperDetailUnitStructDto> getUnitStructs() {
+		return unitStructs;
+	}
+
+	public void setUnitStructs(List<PaperDetailUnitStructDto> unitStructs) {
+		this.unitStructs = unitStructs;
+	}
+
+	public Double getTotalScore() {
+		return totalScore;
+	}
+
+	public void setTotalScore(Double totalScore) {
+		this.totalScore = totalScore;
+	}
+
+	public Map getParams() {
+		return params;
+	}
+
+	public void setParams(Map params) {
+		this.params = params;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Integer getDetailCount() {
+		return detailCount;
+	}
+
+	public void setDetailCount(Integer detailCount) {
+		this.detailCount = detailCount;
+	}
+
+	public PaperDetailStruct() {
+	}
+
+	public QuesStructType getQuestionType() {
+		return questionType;
+	}
+
+	public void setQuestionType(QuesStructType questionType) {
+		this.questionType = questionType;
+	}
+
+	public Double getScore() {
+		return score;
+	}
+
+	public void setScore(Double score) {
+		this.score = score;
+	}
+
+	public List<String> getQuesNames() {
+		return quesNames;
+	}
+
+	public void setQuesNames(List<String> quesNames) {
+		this.quesNames = quesNames;
+	}
+
+	public Integer getPublicSimpleCount() {
+		return publicSimpleCount;
+	}
+
+	public void setPublicSimpleCount(Integer publicSimpleCount) {
+		this.publicSimpleCount = publicSimpleCount;
+	}
+
+	public Integer getPublicMediumCount() {
+		return publicMediumCount;
+	}
+
+	public void setPublicMediumCount(Integer publicMediumCount) {
+		this.publicMediumCount = publicMediumCount;
+	}
+
+	public Integer getPublicDifficultyCount() {
+		return publicDifficultyCount;
+	}
+
+	public void setPublicDifficultyCount(Integer publicDifficultyCount) {
+		this.publicDifficultyCount = publicDifficultyCount;
+	}
+
+	public Integer getNoPublicSimpleCount() {
+		return noPublicSimpleCount;
+	}
+
+	public void setNoPublicSimpleCount(Integer noPublicSimpleCount) {
+		this.noPublicSimpleCount = noPublicSimpleCount;
+	}
+
+	public Integer getNoPublicMediumCount() {
+		return noPublicMediumCount;
+	}
+
+	public void setNoPublicMediumCount(Integer noPublicMediumCount) {
+		this.noPublicMediumCount = noPublicMediumCount;
+	}
+
+	public Integer getNoPublicDifficultyCount() {
+		return noPublicDifficultyCount;
+	}
+
+	public void setNoPublicDifficultyCount(Integer noPublicDifficultyCount) {
+		this.noPublicDifficultyCount = noPublicDifficultyCount;
+	}
+
+	public List<CoursePropertyNumberDto> getCoursePropertyNumberDtos() {
+		return coursePropertyNumberDtos;
+	}
+
+	public void setCoursePropertyNumberDtos(
+			List<CoursePropertyNumberDto> coursePropertyNumberDtos) {
+		this.coursePropertyNumberDtos = coursePropertyNumberDtos;
+	}
+
+	public List<CoursePropertyNumber> getCoursePropertyNumbers() {
+		return coursePropertyNumbers;
+	}
+
+	public void setCoursePropertyNumbers(
+			List<CoursePropertyNumber> coursePropertyNumbers) {
+		this.coursePropertyNumbers = coursePropertyNumbers;
+	}
+
+}

+ 198 - 139
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperStruct.java

@@ -1,139 +1,198 @@
-package com.qmth.cqb.paper.model;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.data.annotation.Id;
-import org.springframework.data.mongodb.core.index.Indexed;
-
-import com.qmth.cqb.utils.CommonUtils;
-
-/**
- * 试卷结构 Created by songyue on 16/12/28.
- */
-
-public class PaperStruct implements Serializable {
-
-    private static final long serialVersionUID = 6380530617488717881L;
-
-    @Id
-    private String id;
-
-    @Indexed(unique = true)
-    private String name;// 试卷结构名称
-
-    private Double totalScore;// 总分
-
-    private Integer detailCount;// 大题数量
-
-    private Integer detailUnitCount;//小题数量
-
-    private Map params;
-
-    private List<PaperDetailStruct> paperDetailStructs;// 大题
-
-    private String creator;// 创建人id
-
-    private String createTime;// 创建时间
-
-    private String orgId;// 机构ID
-
-    private String courseNo;
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Double getTotalScore() {
-        return totalScore;
-    }
-
-    public void setTotalScore(Double totalScore) {
-        this.totalScore = totalScore;
-    }
-
-    public Integer getDetailCount() {
-        return detailCount;
-    }
-
-    public void setDetailCount(Integer detailCount) {
-        this.detailCount = detailCount;
-    }
-
-    public Map getParams() {
-        return params;
-    }
-
-    public void setParams(Map params) {
-        this.params = params;
-    }
-
-    public List<PaperDetailStruct> getPaperDetailStructs() {
-        return paperDetailStructs;
-    }
-
-    public void setPaperDetailStructs(List<PaperDetailStruct> paperDetailStructs) {
-        this.paperDetailStructs = paperDetailStructs;
-    }
-
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-
-    public String getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(String createTime) {
-        this.createTime = createTime;
-    }
-
-    public PaperStruct() {
-        this.createTime = CommonUtils.getCurDateTime();
-    }
-
-    public String getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(String orgId) {
-        this.orgId = orgId;
-    }
-
-    public String getCourseNo() {
-        return courseNo;
-    }
-
-    public void setCourseNo(String courseNo) {
-        this.courseNo = courseNo;
-    }
-
-    public Integer getDetailUnitCount() {
-        return detailUnitCount;
-    }
-
-    public void setDetailUnitCount(Integer detailUnitCount) {
-        this.detailUnitCount = detailUnitCount;
-    }
-}
+package com.qmth.cqb.paper.model;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.index.Indexed;
+
+import com.qmth.cqb.utils.CommonUtils;
+import com.qmth.cqb.utils.enums.GenPaperType;
+import com.qmth.cqb.utils.enums.PaperStructType;
+
+/**
+ * 试卷结构 Created by songyue on 16/12/28.
+ */
+
+public class PaperStruct implements Serializable {
+
+    private static final long serialVersionUID = 6380530617488717881L;
+
+    @Id
+    private String id;
+
+    @Indexed(unique = true)
+    private String name;// 试卷结构名称
+
+    private Double totalScore;// 总分
+
+    private Integer detailCount;// 大题数量
+
+    private Integer detailUnitCount;//小题数量
+
+    private Map params;
+
+    private List<PaperDetailStruct> paperDetailStructs;// 大题
+
+    private String creator;// 创建人id
+
+    private String createTime;// 创建时间
+
+    private String orgId;// 机构ID
+
+    private String courseNo;
+    
+    /**
+     * 试卷结构类型  :  精确组卷    蓝图组卷
+     */
+    private PaperStructType paperStrucType;
+    
+    private String type;
+    
+    /**
+     * 组卷类型     : 精细组卷      宏观组卷
+     */
+    private GenPaperType genPaperType;
+    
+    private Long coursePropertyId; //课程属性id
+    
+    private Double difficulty; //难度
+    
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Double getTotalScore() {
+        return totalScore;
+    }
+
+    public void setTotalScore(Double totalScore) {
+        this.totalScore = totalScore;
+    }
+
+    public Integer getDetailCount() {
+        return detailCount;
+    }
+
+    public void setDetailCount(Integer detailCount) {
+        this.detailCount = detailCount;
+    }
+
+    public Map getParams() {
+        return params;
+    }
+
+    public void setParams(Map params) {
+        this.params = params;
+    }
+
+    public List<PaperDetailStruct> getPaperDetailStructs() {
+        return paperDetailStructs;
+    }
+
+    public void setPaperDetailStructs(List<PaperDetailStruct> paperDetailStructs) {
+        this.paperDetailStructs = paperDetailStructs;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public PaperStruct() {
+        this.createTime = CommonUtils.getCurDateTime();
+    }
+
+    public String getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(String orgId) {
+        this.orgId = orgId;
+    }
+
+    public String getCourseNo() {
+        return courseNo;
+    }
+
+    public void setCourseNo(String courseNo) {
+        this.courseNo = courseNo;
+    }
+
+    public Integer getDetailUnitCount() {
+        return detailUnitCount;
+    }
+
+    public void setDetailUnitCount(Integer detailUnitCount) {
+        this.detailUnitCount = detailUnitCount;
+    }
+
+	public GenPaperType getGenPaperType() {
+		return genPaperType;
+	}
+
+	public void setGenPaperType(GenPaperType genPaperType) {
+		this.genPaperType = genPaperType;
+	}
+
+	public PaperStructType getPaperStrucType() {
+		return paperStrucType;
+	}
+
+	public void setPaperStrucType(PaperStructType paperStrucType) {
+		this.paperStrucType = paperStrucType;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public Long getCoursePropertyId() {
+		return coursePropertyId;
+	}
+
+	public void setCoursePropertyId(Long coursePropertyId) {
+		this.coursePropertyId = coursePropertyId;
+	}
+
+	public Double getDifficulty() {
+		return difficulty;
+	}
+
+	public void setDifficulty(Double difficulty) {
+		this.difficulty = difficulty;
+	}
+	
+}

+ 76 - 65
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperStructSearchInfo.java

@@ -1,65 +1,76 @@
-package com.qmth.cqb.paper.model;
-
-import java.io.Serializable;
-
-/**
- * Created by songyue on 17/3/27.
- */
-public class PaperStructSearchInfo implements Serializable {
-
-    private static final long serialVersionUID = 5282899855557734214L;
-
-    private String name;
-
-    private String creator;
-
-    private String createtime;
-
-    private String orgId;
-
-    private String courseNo;
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-
-    public String getCreatetime() {
-        return createtime;
-    }
-
-    public void setCreatetime(String createtime) {
-        this.createtime = createtime;
-    }
-
-    public String getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(String orgId) {
-        this.orgId = orgId;
-    }
-
-    public String getCourseNo() {
-        return courseNo;
-    }
-
-    public void setCourseNo(String courseNo) {
-        this.courseNo = courseNo;
-    }
-}
+package com.qmth.cqb.paper.model;
+
+import java.io.Serializable;
+
+/**
+ * Created by songyue on 17/3/27.
+ */
+public class PaperStructSearchInfo implements Serializable {
+
+    private static final long serialVersionUID = 5282899855557734214L;
+
+    private String name;
+
+    private String creator;
+
+    private String createtime;
+
+    private String orgId;
+
+    private String courseNo;
+    
+    private String type;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getCreatetime() {
+        return createtime;
+    }
+
+    public void setCreatetime(String createtime) {
+        this.createtime = createtime;
+    }
+
+    public String getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(String orgId) {
+        this.orgId = orgId;
+    }
+
+    public String getCourseNo() {
+        return courseNo;
+    }
+
+    public void setCourseNo(String courseNo) {
+        this.courseNo = courseNo;
+    }
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+    
+}

+ 4 - 7
cqb-paper/src/main/java/com/qmth/cqb/paper/service/ImportPaperService.java

@@ -11,10 +11,10 @@ import java.util.Map;
 import java.util.UUID;
 import java.util.regex.Pattern;
 
-import com.netflix.infix.lang.infix.antlr.EventFilterParser.boolean_expr_return;
-import com.netflix.infix.lang.infix.antlr.EventFilterParser.null_predicate_return;
 import com.qmth.cqb.base.dao.CourseRepo;
 import com.qmth.cqb.base.model.Course;
+import com.qmth.cqb.question.dao.CoursePropertyRepo;
+import com.qmth.cqb.question.dao.PropertyRepo;
 import com.qmth.cqb.question.dao.QuesPkgPathRepo;
 import com.qmth.cqb.question.model.QuestionPkgPath;
 
@@ -22,7 +22,6 @@ import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.docx4j.openpackaging.exceptions.Docx4JException;
 import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
 import org.docx4j.wml.P;
 import org.slf4j.Logger;
@@ -33,19 +32,17 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
 import com.google.gson.Gson;
-import com.qmth.cqb.paper.dao.CoursePropertyRepo;
 import com.qmth.cqb.paper.dao.PaperDetailRepo;
 import com.qmth.cqb.paper.dao.PaperDetailUnitRepo;
 import com.qmth.cqb.paper.dao.PaperRepo;
-import com.qmth.cqb.paper.dao.PropertyRepo;
-import com.qmth.cqb.paper.model.CourseProperty;
 import com.qmth.cqb.paper.model.ImportPaperCheck;
 import com.qmth.cqb.paper.model.ImportPaperMsg;
 import com.qmth.cqb.paper.model.Paper;
 import com.qmth.cqb.paper.model.PaperDetail;
 import com.qmth.cqb.paper.model.PaperDetailUnit;
-import com.qmth.cqb.paper.model.Property;
 import com.qmth.cqb.question.dao.QuesRepo;
+import com.qmth.cqb.question.model.CourseProperty;
+import com.qmth.cqb.question.model.Property;
 import com.qmth.cqb.question.model.QuesOption;
 import com.qmth.cqb.question.model.QuesProperty;
 import com.qmth.cqb.question.model.Question;

+ 67 - 36
cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperStructService.java

@@ -1,6 +1,5 @@
 package com.qmth.cqb.paper.service;
 
-import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -9,6 +8,7 @@ import java.util.stream.Collectors;
 import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
 
 import com.qmth.cqb.paper.dao.QuesTypeNameRepo;
+import com.qmth.cqb.paper.dto.CoursePropertyNumberDto;
 import com.qmth.cqb.paper.dto.QuesNameDto;
 import com.qmth.cqb.paper.model.*;
 
@@ -22,12 +22,10 @@ import org.springframework.stereotype.Service;
 
 import com.qmth.cqb.paper.dao.PaperStructRepo;
 import com.qmth.cqb.paper.dto.PaperDetailUnitStructDto;
-import com.qmth.cqb.utils.BeanCopierUtil;
 import com.qmth.cqb.utils.CommonUtils;
+import com.qmth.cqb.utils.enums.PaperStructType;
 
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
-import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.exact;
 
 /**
  * Created by songyue on 16/12/28.
@@ -66,19 +64,27 @@ public class PaperStructService {
     	//create by weiwenhai
     	Query query = new Query();
         query.addCriteria(Criteria.where("orgId").is(searchInfo.getOrgId()));
+        query.addCriteria(Criteria.where("type").is(searchInfo.getType()));
         if(StringUtils.isNotBlank(searchInfo.getName())){
         	query.addCriteria(Criteria.where("name").regex(".*?\\" +searchInfo.getName() + ".*"));
         }
         if(StringUtils.isNotBlank(searchInfo.getCreator())){
         	query.addCriteria(Criteria.where("creator").regex(".*?\\" +searchInfo.getCreator() + ".*"));
         }
-        if(StringUtils.isNotBlank(searchInfo.getCourseNo())){
-        	if(!searchInfo.getCourseNo().equals("ALL")){
-        		query.addCriteria(Criteria.where("courseNo").is(searchInfo.getCourseNo()));
-        	}
-        }else{
-        	query.addCriteria(Criteria.where("courseNo").is(""));
-        }
+        //判断试卷结构
+        if(searchInfo.getType().equals("EXACT")){
+        	if(StringUtils.isNotBlank(searchInfo.getCourseNo())){
+            	if(!searchInfo.getCourseNo().equals("ALL")){
+            		query.addCriteria(Criteria.where("courseNo").is(searchInfo.getCourseNo()));
+            	}
+            }else{
+            	query.addCriteria(Criteria.where("courseNo").is(""));
+            }
+        }else {
+        	if(StringUtils.isNotBlank(searchInfo.getCourseNo())){
+            	query.addCriteria(Criteria.where("courseNo").is(searchInfo.getCourseNo()));
+            }
+		}
         long count = this.mongoTemplate.count(query, PaperStruct.class);
         query.with(new Sort(new Sort.Order(Sort.Direction.DESC,"createTime")));
         query.limit(pageSize);
@@ -128,7 +134,7 @@ public class PaperStructService {
             PaperStruct oldPaperStruct = paperStructRepo.findOne(paperStruct.getId());
             PaperStruct rps = null;
             if (oldPaperStruct != null && !paperStruct.getName().equals(oldPaperStruct.getName())) {// 那么就是更新操作
-                rps = this.checkNameUnique(paperStruct.getName(), user.getRootOrgId().toString());
+                rps = this.checkNameUnique(paperStruct.getName(), user.getRootOrgId().toString(),oldPaperStruct.getType());
             }
             if (rps != null) {
                 return null;
@@ -136,40 +142,66 @@ public class PaperStructService {
         }
         List<PaperDetailStruct> paperDetailStructs = paperStruct.getPaperDetailStructs();
         int number = 0;
-        for (PaperDetailStruct paperDetailStruct : paperDetailStructs) {
-            List oldStructs = paperDetailStruct.getPaperDetailUnitStructs();
-            if (oldStructs != null && oldStructs.size() > 0) {
-                oldStructs.clear();
-            }
-            List<PaperDetailUnitStruct> unitStructs = new ArrayList<PaperDetailUnitStruct>();
-
-            for (PaperDetailUnitStructDto unitStructDto : paperDetailStruct.getUnitStructs()) {
-                for (int i = 0; i < unitStructDto.getCount(); i++) {
-                    ++number;
-                    PaperDetailUnitStruct unitStruct = new PaperDetailUnitStruct();
-                    unitStruct.setScore(unitStructDto.getScore());
-                    unitStruct.setId(String.valueOf(number));
-                    unitStruct.setNumber(number);
-                    unitStruct.setQuestionType(unitStructDto.getQuestionType());
-                    unitStruct.setQuesNames(unitStructDto.getQuesNames());
-                    unitStructs.add(unitStruct);
+        //新增精确试卷结构
+        if(paperStruct.getType().equals("EXACT")){
+            for (PaperDetailStruct paperDetailStruct : paperDetailStructs) {
+                List oldStructs = paperDetailStruct.getPaperDetailUnitStructs();
+                if (oldStructs != null && oldStructs.size() > 0) {
+                    oldStructs.clear();
+                }
+                List<PaperDetailUnitStruct> unitStructs = new ArrayList<PaperDetailUnitStruct>();
+                for (PaperDetailUnitStructDto unitStructDto : paperDetailStruct.getUnitStructs()) {
+                    for (int i = 0; i < unitStructDto.getCount(); i++) {
+                        ++number;
+                        PaperDetailUnitStruct unitStruct = new PaperDetailUnitStruct();
+                        unitStruct.setScore(unitStructDto.getScore());
+                        unitStruct.setId(String.valueOf(number));
+                        unitStruct.setNumber(number);
+                        unitStruct.setQuestionType(unitStructDto.getQuestionType());
+                        unitStruct.setQuesNames(unitStructDto.getQuesNames());
+                        unitStructs.add(unitStruct);
+                    }
                 }
+                paperDetailStruct.setPaperDetailUnitStructs(unitStructs);
             }
-            paperDetailStruct.setPaperDetailUnitStructs(unitStructs);
-        }
-        paperStruct.setDetailCount(paperDetailStructs.size());
-        paperStruct.setDetailUnitCount(paperDetailStructs.stream().mapToInt(PaperDetailStruct::getDetailCount).sum());
+            paperStruct.setPaperStrucType(PaperStructType.EXACT);
+            paperStruct.setDetailUnitCount(paperDetailStructs.stream().mapToInt(PaperDetailStruct::getDetailCount).sum());
+        }else {
+			//新增蓝图试卷结构
+        	paperStruct.setPaperStrucType(PaperStructType.BLUEPRINT);
+        	//计算试卷结构难度
+			Double difficulty = getDifficulty(paperDetailStructs);
+			paperStruct.setDifficulty(difficulty);
+		}
         paperStruct.setOrgId(user.getRootOrgId().toString());
         paperStruct.setCreator(user.getName());
         paperStruct.setCreateTime(CommonUtils.getCurDateTime());
+        paperStruct.setDetailCount(paperDetailStructs.size());
         return paperStructRepo.save(paperStruct);
     }
-
-    public PaperStruct checkNameUnique(String name, String orgId) {
+    
+    public Double getDifficulty(List<PaperDetailStruct> paperDetailStructs) {
+		if(paperDetailStructs != null && paperDetailStructs.size() >0){
+			Integer simpleCount = 0;
+			Integer mediumCount = 0;
+			Integer difficultyCount = 0;
+			for(PaperDetailStruct paperDetailStruct:paperDetailStructs){
+				simpleCount = paperDetailStruct.getPublicSimpleCount() + paperDetailStruct.getNoPublicSimpleCount();
+				mediumCount = paperDetailStruct.getPublicMediumCount() + paperDetailStruct.getNoPublicMediumCount();
+				difficultyCount = paperDetailStruct.getPublicDifficultyCount() + paperDetailStruct.getNoPublicDifficultyCount();
+			}
+			Double difficulty = ((simpleCount * 0.8) + (mediumCount * 0.5) + (difficultyCount * 0.2))/(simpleCount + mediumCount + difficultyCount);
+			return difficulty;
+		}
+		return (double)0;
+	}
+
+    public PaperStruct checkNameUnique(String name, String orgId, String type) {
         PaperStruct paperTemp = new PaperStruct();
         paperTemp.setCreateTime(null);
         paperTemp.setName(name.trim());
         paperTemp.setOrgId(orgId);
+        paperTemp.setType(type);
         PaperStruct paperStruct = paperStructRepo.findOne(Example.of(paperTemp));
         return paperStruct;
     }
@@ -184,7 +216,6 @@ public class PaperStructService {
         } else {
             quesTypeNames = quesTypeNameRepo.findQuesName(orgId, courseNo, quesType);
         }
-
         quesNameList = quesTypeNames.stream()
                 .map(QuesTypeName::getQuesNames)
                 .flatMap(Collection::stream)

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

@@ -13,14 +13,14 @@ import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
 import com.qmth.cqb.paper.dao.PaperDetailInfoStructBlueprintRepo;
 import com.qmth.cqb.paper.dao.PaperDetailInfoUnitStructBlueprintRepo;
 import com.qmth.cqb.paper.dao.PaperDetailStructBlueprintRepo;
-import com.qmth.cqb.paper.dao.PropertyRepo;
 import com.qmth.cqb.paper.dto.PaperDetailInfoStructBlueprintDto;
 import com.qmth.cqb.paper.dto.PaperDetailInfoUnitStructBlueprintDto;
 import com.qmth.cqb.paper.model.PaperDetailInfoStructBlueprint;
 import com.qmth.cqb.paper.model.PaperDetailInfoUnitStructBlueprint;
 import com.qmth.cqb.paper.model.PaperDetailStructBlueprint;
-import com.qmth.cqb.paper.model.Property;
 import com.qmth.cqb.paper.service.PaperDetailInfoStructBlueprintService;
+import com.qmth.cqb.question.dao.PropertyRepo;
+import com.qmth.cqb.question.model.Property;
 import com.qmth.cqb.utils.enums.PropertyDifficulty;
 
 /**

+ 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(),ps.getType());
+        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);
+    }
+}

+ 0 - 5
cqb-question-resource/pom.xml

@@ -26,10 +26,5 @@
             <artifactId>cqb-base</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>com.qmth.cqb</groupId>
-            <artifactId>cqb-paper</artifactId>
-            <version>${project.version}</version>
-        </dependency>
     </dependencies>
 </project>

+ 50 - 50
cqb-paper/src/main/java/com/qmth/cqb/paper/assemble/PropertyAssembler.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/assemble/PropertyAssembler.java

@@ -1,50 +1,50 @@
-package com.qmth.cqb.paper.assemble;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.stereotype.Component;
-
-import com.qmth.cqb.paper.dto.PropertyDto;
-import com.qmth.cqb.paper.model.Property;
-
-@Component
-public class PropertyAssembler {
-
-	/**
-	 * 得到父节点对象
-	 * @param propertyDto
-	 * @return
-	 */
-	public Property toProperty(PropertyDto propertyDto){
-		Property property = null;
-		if(propertyDto != null){
-			property = new Property();
-			property.setId(propertyDto.getId());
-			property.setCoursePropertyId(propertyDto.getCoursePropertyId());
-			property.setName(propertyDto.getName());
-			property.setParentId(propertyDto.getCoursePropertyId());
-			property.setRemark(propertyDto.getRemark());
-		}
-		return property;
-	}
-	
-	/**
-	 * 得到子类节点对象
-	 * @param propertyDto
-	 * @return
-	 */
-	public List<Property> toPropertySon(PropertyDto propertyDto){
-		Property property = null;
-		List<PropertyDto> propertyDtos = propertyDto.getPropertyDtos();
-		if(propertyDtos != null && propertyDtos.size()>0){
-			List<Property> properties = new ArrayList<Property>();
-			for(PropertyDto propertyDto2:propertyDtos){
-				property = toProperty(propertyDto2);
-				properties.add(property);
-			}
-			return properties;
-		}
-		return null;
-	}
-}
+package com.qmth.cqb.question.assemble;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.cqb.question.dto.PropertyDto;
+import com.qmth.cqb.question.model.Property;
+
+@Component
+public class PropertyAssembler {
+
+	/**
+	 * 得到父节点对象
+	 * @param propertyDto
+	 * @return
+	 */
+	public Property toProperty(PropertyDto propertyDto){
+		Property property = null;
+		if(propertyDto != null){
+			property = new Property();
+			property.setId(propertyDto.getId());
+			property.setCoursePropertyId(propertyDto.getCoursePropertyId());
+			property.setName(propertyDto.getName());
+			property.setParentId(propertyDto.getCoursePropertyId());
+			property.setRemark(propertyDto.getRemark());
+		}
+		return property;
+	}
+	
+	/**
+	 * 得到子类节点对象
+	 * @param propertyDto
+	 * @return
+	 */
+	public List<Property> toPropertySon(PropertyDto propertyDto){
+		Property property = null;
+		List<PropertyDto> propertyDtos = propertyDto.getPropertyDtos();
+		if(propertyDtos != null && propertyDtos.size()>0){
+			List<Property> properties = new ArrayList<Property>();
+			for(PropertyDto propertyDto2:propertyDtos){
+				property = toProperty(propertyDto2);
+				properties.add(property);
+			}
+			return properties;
+		}
+		return null;
+	}
+}

+ 26 - 26
cqb-paper/src/main/java/com/qmth/cqb/paper/dao/CoursePropertyRepo.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/dao/CoursePropertyRepo.java

@@ -1,26 +1,26 @@
-package com.qmth.cqb.paper.dao;
-
-import java.util.List;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.repository.query.QueryByExampleExecutor;
-
-import com.qmth.cqb.paper.model.CourseProperty;
-/**
- * @describle 课程属性repo
- * @author weiwenhai
- * @date   2017.11.2
- */
-public interface CoursePropertyRepo extends JpaRepository<CourseProperty, Long>,QueryByExampleExecutor<CourseProperty>,JpaSpecificationExecutor<CourseProperty>{
-	
-	//查询所有课程属性
-	List<CourseProperty> findByOrgId(Long orgId);
-	
-	//根据属性名查询
-	CourseProperty findByNameAndOrgId(String name, Long orgId);
-	
-	//根据课程id查询
-	List<CourseProperty> findByCourseId(Long courseId);
-
-}
+package com.qmth.cqb.question.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import com.qmth.cqb.question.model.CourseProperty;
+/**
+ * @describle 课程属性repo
+ * @author weiwenhai
+ * @date   2017.11.2
+ */
+public interface CoursePropertyRepo extends JpaRepository<CourseProperty, Long>,QueryByExampleExecutor<CourseProperty>,JpaSpecificationExecutor<CourseProperty>{
+	
+	//查询所有课程属性
+	List<CourseProperty> findByOrgId(Long orgId);
+	
+	//根据属性名查询
+	CourseProperty findByNameAndOrgId(String name, Long orgId);
+	
+	//根据课程id查询
+	List<CourseProperty> findByCourseId(Long courseId);
+
+}

+ 23 - 23
cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PropertyRepo.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/dao/PropertyRepo.java

@@ -1,23 +1,23 @@
-package com.qmth.cqb.paper.dao;
-
-import java.util.List;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.repository.query.QueryByExampleExecutor;
-
-import com.qmth.cqb.paper.model.Property;
-/**
- * @describle 课程属性repo
- * @author weiwenhai
- * @date   2017.11.6
- */
-public interface PropertyRepo extends JpaRepository<Property, Long>, QueryByExampleExecutor<Property> ,JpaSpecificationExecutor<Property>{
-	
-	//查询所有节点
-	List<Property> findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(Long orgId, Long coursePropertyId, Long parentId);
-	
-	//查询子节点
-	List<Property> findByParentIdOrderByNumber(Long parentId);
-
-}
+package com.qmth.cqb.question.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import com.qmth.cqb.question.model.Property;
+/**
+ * @describle 课程属性repo
+ * @author weiwenhai
+ * @date   2017.11.6
+ */
+public interface PropertyRepo extends JpaRepository<Property, Long>, QueryByExampleExecutor<Property> ,JpaSpecificationExecutor<Property>{
+	
+	//查询所有节点
+	List<Property> findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(Long orgId, Long coursePropertyId, Long parentId);
+	
+	//查询子节点
+	List<Property> findByParentIdOrderByNumber(Long parentId);
+
+}

+ 60 - 60
cqb-paper/src/main/java/com/qmth/cqb/paper/dto/CoursePropertyDto.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/dto/CoursePropertyDto.java

@@ -1,60 +1,60 @@
-package com.qmth.cqb.paper.dto;
-
-/**
- * @describle 课程属性Dto
- * @author weiwenhai
- * @date   2017.11.2
- */
-public class CoursePropertyDto {
-
-	private Long id;
-	
-	private String name;
-	
-	private Long courseId;
-	
-	private Long orgId;
-	
-	private String enable;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Long getCourseId() {
-		return courseId;
-	}
-
-	public void setCourseId(Long courseId) {
-		this.courseId = courseId;
-	}
-
-	public Long getOrgId() {
-		return orgId;
-	}
-
-	public void setOrgId(Long orgId) {
-		this.orgId = orgId;
-	}
-
-	public String getEnable() {
-		return enable;
-	}
-
-	public void setEnable(String enable) {
-		this.enable = enable;
-	}
-	
-}
+package com.qmth.cqb.question.dto;
+
+/**
+ * @describle 课程属性Dto
+ * @author weiwenhai
+ * @date   2017.11.2
+ */
+public class CoursePropertyDto {
+
+	private Long id;
+	
+	private String name;
+	
+	private Long courseId;
+	
+	private Long orgId;
+	
+	private String enable;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Long getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Long courseId) {
+		this.courseId = courseId;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public String getEnable() {
+		return enable;
+	}
+
+	public void setEnable(String enable) {
+		this.enable = enable;
+	}
+	
+}

+ 95 - 95
cqb-paper/src/main/java/com/qmth/cqb/paper/dto/PropertyDto.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/dto/PropertyDto.java

@@ -1,95 +1,95 @@
-package com.qmth.cqb.paper.dto;
-
-import java.util.List;
-
-import com.qmth.cqb.paper.model.Property;
-
-/**
- * @describle 属性Dto
- * @author weiwenhai
- * @date   2017.11.6
- */
-public class PropertyDto {
-
-	private Long id;
-	
-	private Long coursePropertyId;
-	
-	private String name;
-	
-	private Integer number;
-	
-	private Long parentId;
-	
-	private String remark;
-	
-	private List<PropertyDto> propertyDtos;
-	
-	public PropertyDto(){}
-	
-	public PropertyDto(Property property){
-		this.id = property.getId();
-		this.coursePropertyId = property.getCoursePropertyId();
-		this.name = property.getName();
-		this.number = property.getNumber();
-		this.remark = property.getRemark();
-		this.parentId = property.getParentId();
-	}
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public Long getCoursePropertyId() {
-		return coursePropertyId;
-	}
-
-	public void setCoursePropertyId(Long coursePropertyId) {
-		this.coursePropertyId = coursePropertyId;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Integer getNumber() {
-		return number;
-	}
-
-	public void setNumber(Integer number) {
-		this.number = number;
-	}
-
-	public Long getParentId() {
-		return parentId;
-	}
-
-	public void setParentId(Long parentId) {
-		this.parentId = parentId;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-	public List<PropertyDto> getPropertyDtos() {
-		return propertyDtos;
-	}
-
-	public void setPropertyDtos(List<PropertyDto> propertyDtos) {
-		this.propertyDtos = propertyDtos;
-	}
-
-}
+package com.qmth.cqb.question.dto;
+
+import java.util.List;
+
+import com.qmth.cqb.question.model.Property;
+
+/**
+ * @describle 属性Dto
+ * @author weiwenhai
+ * @date   2017.11.6
+ */
+public class PropertyDto {
+
+	private Long id;
+	
+	private Long coursePropertyId;
+	
+	private String name;
+	
+	private Integer number;
+	
+	private Long parentId;
+	
+	private String remark;
+	
+	private List<PropertyDto> propertyDtos;
+	
+	public PropertyDto(){}
+	
+	public PropertyDto(Property property){
+		this.id = property.getId();
+		this.coursePropertyId = property.getCoursePropertyId();
+		this.name = property.getName();
+		this.number = property.getNumber();
+		this.remark = property.getRemark();
+		this.parentId = property.getParentId();
+	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getCoursePropertyId() {
+		return coursePropertyId;
+	}
+
+	public void setCoursePropertyId(Long coursePropertyId) {
+		this.coursePropertyId = coursePropertyId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Integer getNumber() {
+		return number;
+	}
+
+	public void setNumber(Integer number) {
+		this.number = number;
+	}
+
+	public Long getParentId() {
+		return parentId;
+	}
+
+	public void setParentId(Long parentId) {
+		this.parentId = parentId;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public List<PropertyDto> getPropertyDtos() {
+		return propertyDtos;
+	}
+
+	public void setPropertyDtos(List<PropertyDto> propertyDtos) {
+		this.propertyDtos = propertyDtos;
+	}
+
+}

+ 99 - 99
cqb-paper/src/main/java/com/qmth/cqb/paper/model/CourseProperty.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/model/CourseProperty.java

@@ -1,99 +1,99 @@
-package com.qmth.cqb.paper.model;
-
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-
-import com.qmth.cqb.paper.dto.CoursePropertyDto;
-
-/**
- * @describle 课程属性
- * @author weiwenhai
- * @date   2017.11.2
- */
-@Entity
-@Table(name ="ecs_ques_course_property")
-public class CourseProperty implements Serializable{
-
-	private static final long serialVersionUID = 3370756666063937765L;
-
-	@Id
-	@GeneratedValue
-	private Long id;
-	
-	@NotNull
-	private String name;
-	
-	@NotNull
-	private Long courseId;
-	
-	@NotNull
-	private Long orgId;
-	
-	private Boolean enable;
-
-	public CourseProperty(){}
-	
-	public CourseProperty(CoursePropertyDto coursePropertyDto){
-		this.id = coursePropertyDto.getId();
-		this.name = coursePropertyDto.getName();
-		this.courseId = coursePropertyDto.getCourseId();
-		this.orgId = coursePropertyDto.getOrgId();
-		if(coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("0")){
-			this.enable = false;
-		}else if(coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("1")){
-			this.enable = true;
-		}else {
-			this.enable = null;
-		}
-	}
-	
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Long getCourseId() {
-		return courseId;
-	}
-
-	public void setCourseId(Long courseId) {
-		this.courseId = courseId;
-	}
-
-	public Long getOrgId() {
-		return orgId;
-	}
-
-	public void setOrgId(Long orgId) {
-		this.orgId = orgId;
-	}
-
-	public static long getSerialversionuid() {
-		return serialVersionUID;
-	}
-
-	public Boolean getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Boolean enable) {
-		this.enable = enable;
-	}
-	
-}
+package com.qmth.cqb.question.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+
+import com.qmth.cqb.question.dto.CoursePropertyDto;
+
+/**
+ * @describle 课程属性
+ * @author weiwenhai
+ * @date   2017.11.2
+ */
+@Entity
+@Table(name ="ecs_ques_course_property")
+public class CourseProperty implements Serializable{
+
+	private static final long serialVersionUID = 3370756666063937765L;
+
+	@Id
+	@GeneratedValue
+	private Long id;
+	
+	@NotNull
+	private String name;
+	
+	@NotNull
+	private Long courseId;
+	
+	@NotNull
+	private Long orgId;
+	
+	private Boolean enable;
+
+	public CourseProperty(){}
+	
+	public CourseProperty(CoursePropertyDto coursePropertyDto){
+		this.id = coursePropertyDto.getId();
+		this.name = coursePropertyDto.getName();
+		this.courseId = coursePropertyDto.getCourseId();
+		this.orgId = coursePropertyDto.getOrgId();
+		if(coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("0")){
+			this.enable = false;
+		}else if(coursePropertyDto.getEnable() != null && coursePropertyDto.getEnable().equals("1")){
+			this.enable = true;
+		}else {
+			this.enable = null;
+		}
+	}
+	
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Long getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Long courseId) {
+		this.courseId = courseId;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+
+	public Boolean getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Boolean enable) {
+		this.enable = enable;
+	}
+	
+}

+ 2 - 2
cqb-paper/src/main/java/com/qmth/cqb/paper/model/Property.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/model/Property.java

@@ -1,4 +1,4 @@
-package com.qmth.cqb.paper.model;
+package com.qmth.cqb.question.model;
 
 import java.io.Serializable;
 
@@ -8,7 +8,7 @@ import javax.persistence.Id;
 import javax.persistence.Table;
 import javax.validation.constraints.NotNull;
 
-import com.qmth.cqb.paper.dto.PropertyDto;
+import com.qmth.cqb.question.dto.PropertyDto;
 /**
  * @describle  属性 
  * @author weiwenhai

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

@@ -2,7 +2,7 @@ package com.qmth.cqb.question.model;
 
 import java.io.Serializable;
 
-import com.qmth.cqb.paper.model.Property;
+import com.qmth.cqb.question.model.Property;
 public class QuesProperty implements Serializable{
 
 	private static final long serialVersionUID = -2303143377325064933L;

+ 59 - 59
cqb-paper/src/main/java/com/qmth/cqb/paper/service/CoursePropertyService.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/service/CoursePropertyService.java

@@ -1,59 +1,59 @@
-package com.qmth.cqb.paper.service;
-
-import java.util.List;
-
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-
-import com.qmth.cqb.paper.dto.CoursePropertyDto;
-import com.qmth.cqb.paper.model.CourseProperty;
-
-/**
- * @describle 课程属性 coursePropertyService
- * @author weiwenhai
- * @date   2017.11.2
- */
-public interface CoursePropertyService {
-
-	/**
-	 * 查询所有课程属性
-	 * @param orgId
-	 * @return
-	 */
-	public List<CourseProperty> findAllByOrgId(Long orgId);
-	
-	/**
-	 * 查询所有课程属性带分页
-	 * @param coursePropertyDto
-	 * @param pageable
-	 * @return
-	 */
-	public Page<CourseProperty> findAllByOrg(CoursePropertyDto coursePropertyDto, Pageable pageable);
-	
-	/**
-	 * 保存课程属性
-	 * @param coursePropertyDto
-	 */
-	public void saveCourseProperty(CoursePropertyDto coursePropertyDto) throws Exception;
-	
-	/**
-	 * 启用
-	 * @param id
-	 * @param orgId
-	 */
-	public void openCourseProperty(Long id, Long orgId);
-	
-	/**
-	 * 禁用
-	 * @param id
-	 * @param orgId
-	 */
-	public void closeCourseProperty(Long id ,Long orgId);
-	
-	/**
-	 * 根据课程id查询所有课程属性
-	 * @param courseId
-	 * @return
-	 */
-	public List<CourseProperty> findAllByCourseId(Long courseId);
-}
+package com.qmth.cqb.question.service;
+
+import java.util.List;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import com.qmth.cqb.question.dto.CoursePropertyDto;
+import com.qmth.cqb.question.model.CourseProperty;
+
+/**
+ * @describle 课程属性 coursePropertyService
+ * @author weiwenhai
+ * @date   2017.11.2
+ */
+public interface CoursePropertyService {
+
+	/**
+	 * 查询所有课程属性
+	 * @param orgId
+	 * @return
+	 */
+	public List<CourseProperty> findAllByOrgId(Long orgId);
+	
+	/**
+	 * 查询所有课程属性带分页
+	 * @param coursePropertyDto
+	 * @param pageable
+	 * @return
+	 */
+	public Page<CourseProperty> findAllByOrg(CoursePropertyDto coursePropertyDto, Pageable pageable);
+	
+	/**
+	 * 保存课程属性
+	 * @param coursePropertyDto
+	 */
+	public void saveCourseProperty(CoursePropertyDto coursePropertyDto) throws Exception;
+	
+	/**
+	 * 启用
+	 * @param id
+	 * @param orgId
+	 */
+	public void openCourseProperty(Long id, Long orgId);
+	
+	/**
+	 * 禁用
+	 * @param id
+	 * @param orgId
+	 */
+	public void closeCourseProperty(Long id ,Long orgId);
+	
+	/**
+	 * 根据课程id查询所有课程属性
+	 * @param courseId
+	 * @return
+	 */
+	public List<CourseProperty> findAllByCourseId(Long courseId);
+}

+ 58 - 58
cqb-paper/src/main/java/com/qmth/cqb/paper/service/PropertyService.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/service/PropertyService.java

@@ -1,58 +1,58 @@
-package com.qmth.cqb.paper.service;
-
-import java.util.List;
-
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-
-import com.qmth.cqb.paper.dto.PropertyDto;
-import com.qmth.cqb.paper.model.Property;
-
-/**
- * @describle 属性service
- * @author    weiwenhai
- * @date      2017.11.6
- */
-public interface PropertyService {
-
-	/**
-	 * 保存属性
-	 * @param propertyDtos
-	 */
-	public void saveProperty(List<PropertyDto> propertyDtos, AccessUser user);
-	
-	/**
-	 * 查询属性
-	 * @param coursePropertyId
-	 * @param user
-	 * @return
-	 */
-	public List<PropertyDto> propertyDtos(Long coursePropertyId, AccessUser user);
-	
-	/**
-	 * 新增属性
-	 * @param property
-	 * @param user
-	 */
-	public void saveProperty(Property property, AccessUser user);
-	
-	/**
-	 * 删除属性
-	 * @param propertyId
-	 */
-	public void deleteProperty(Long propertyId, Long coursePropertyId, AccessUser user);
-	
-	/**
-	 * 查询所有属性
-	 * @param coursePropertyId
-	 * @param user
-	 * @return
-	 */
-	public List<Property> findAll(Long coursePropertyId, AccessUser user);
-	
-	/**
-	 * 查询某个树下的子节点
-	 * @param property
-	 * @return
-	 */
-	public List<Property> findPropertySons(Property property);
-}
+package com.qmth.cqb.question.service;
+
+import java.util.List;
+
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+
+import com.qmth.cqb.question.dto.PropertyDto;
+import com.qmth.cqb.question.model.Property;
+
+/**
+ * @describle 属性service
+ * @author    weiwenhai
+ * @date      2017.11.6
+ */
+public interface PropertyService {
+
+	/**
+	 * 保存属性
+	 * @param propertyDtos
+	 */
+	public void saveProperty(List<PropertyDto> propertyDtos, AccessUser user);
+	
+	/**
+	 * 查询属性
+	 * @param coursePropertyId
+	 * @param user
+	 * @return
+	 */
+	public List<PropertyDto> propertyDtos(Long coursePropertyId, AccessUser user);
+	
+	/**
+	 * 新增属性
+	 * @param property
+	 * @param user
+	 */
+	public void saveProperty(Property property, AccessUser user);
+	
+	/**
+	 * 删除属性
+	 * @param propertyId
+	 */
+	public void deleteProperty(Long propertyId, Long coursePropertyId, AccessUser user);
+	
+	/**
+	 * 查询所有属性
+	 * @param coursePropertyId
+	 * @param user
+	 * @return
+	 */
+	public List<Property> findAll(Long coursePropertyId, AccessUser user);
+	
+	/**
+	 * 查询某个树下的子节点
+	 * @param property
+	 * @return
+	 */
+	public List<Property> findPropertySons(Property property);
+}

+ 103 - 103
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/CoursePropertyServiceImpl.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/service/impl/CoursePropertyServiceImpl.java

@@ -1,103 +1,103 @@
-package com.qmth.cqb.paper.service.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.persistence.criteria.Subquery;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-
-
-
-
-
-
-import com.qmth.cqb.paper.dao.CoursePropertyRepo;
-import com.qmth.cqb.paper.dto.CoursePropertyDto;
-import com.qmth.cqb.paper.model.CourseProperty;
-import com.qmth.cqb.paper.service.CoursePropertyService;
-
-/**
- * @describle 课程属性 coursePropertyServiceImpl
- * @author weiwenhai
- * @date   2017.11.2
- */
-@Service("coursePropertyService")
-public class CoursePropertyServiceImpl implements CoursePropertyService{
-	
-	@Autowired
-	private CoursePropertyRepo coursePropertyRepo;
-
-	@Override
-	public List<CourseProperty> findAllByOrgId(Long orgId) {
-		List<CourseProperty> courseProperties = coursePropertyRepo.findByOrgId(orgId);
-		return courseProperties;
-	}
-
-	@Override
-	public void saveCourseProperty(CoursePropertyDto coursePropertyDto) throws Exception {
-		coursePropertyDto.setEnable("1");
-		CourseProperty courseProperty = coursePropertyRepo.findByNameAndOrgId(coursePropertyDto.getName(), coursePropertyDto.getOrgId());
-		if(courseProperty != null){
-			throw new Exception("课程属性名已经存在");
-		}
-		courseProperty = new CourseProperty(coursePropertyDto);
-		coursePropertyRepo.save(courseProperty);
-	}
-
-	@Override
-	public Page<CourseProperty> findAllByOrg(CoursePropertyDto coursePropertyDto, Pageable pageable) {
-		Specification<CourseProperty> specification = getSpecification(coursePropertyDto);
-		Page<CourseProperty> coursePropertyies = coursePropertyRepo.findAll(specification, pageable);
-		return coursePropertyies;
-	}
-
-	private Specification<CourseProperty> getSpecification(CoursePropertyDto coursePropertyDto) {
-		CourseProperty courseProperty = new CourseProperty(coursePropertyDto);
-		Specification<CourseProperty> specification = (root, query, cb) -> {
-		    List<Predicate> predicates = new ArrayList<>();
-		    if(!StringUtils.isEmpty(courseProperty.getOrgId())){
-		    	predicates.add(cb.equal(root.get("orgId"),courseProperty.getOrgId()));
-		    }
-		    if(!StringUtils.isEmpty(courseProperty.getName())){
-		    	predicates.add(cb.like(root.get("name"),"%"+courseProperty.getName()+"%"));
-		    }
-		    if(!StringUtils.isEmpty(courseProperty.getCourseId())){
-		    	predicates.add(cb.equal(root.get("courseId"),courseProperty.getCourseId()));
-		    }
-		    if(!StringUtils.isEmpty(courseProperty.getEnable())){
-		    	predicates.add(cb.equal(root.get("enable"),courseProperty.getEnable()));
-		    }
-		    return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-		return specification;
-	}
-
-	@Override
-	public void openCourseProperty(Long id, Long orgId) {
-		CourseProperty courseProperty = coursePropertyRepo.findOne(id);
-		courseProperty.setEnable(true);
-		coursePropertyRepo.save(courseProperty);
-	}
-
-	@Override
-	public void closeCourseProperty(Long id, Long orgId) {
-		CourseProperty courseProperty = coursePropertyRepo.findOne(id);
-		courseProperty.setEnable(false);
-		coursePropertyRepo.save(courseProperty);
-	}
-
-	@Override
-	public List<CourseProperty> findAllByCourseId(Long courseId) {
-		List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseId(courseId);
-		return courseProperties;
-	}
-}
+package com.qmth.cqb.question.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.persistence.criteria.Subquery;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+
+
+
+
+
+
+import com.qmth.cqb.question.dao.CoursePropertyRepo;
+import com.qmth.cqb.question.dto.CoursePropertyDto;
+import com.qmth.cqb.question.model.CourseProperty;
+import com.qmth.cqb.question.service.CoursePropertyService;
+
+/**
+ * @describle 课程属性 coursePropertyServiceImpl
+ * @author weiwenhai
+ * @date   2017.11.2
+ */
+@Service("coursePropertyService")
+public class CoursePropertyServiceImpl implements CoursePropertyService{
+	
+	@Autowired
+	private CoursePropertyRepo coursePropertyRepo;
+
+	@Override
+	public List<CourseProperty> findAllByOrgId(Long orgId) {
+		List<CourseProperty> courseProperties = coursePropertyRepo.findByOrgId(orgId);
+		return courseProperties;
+	}
+
+	@Override
+	public void saveCourseProperty(CoursePropertyDto coursePropertyDto) throws Exception {
+		coursePropertyDto.setEnable("1");
+		CourseProperty courseProperty = coursePropertyRepo.findByNameAndOrgId(coursePropertyDto.getName(), coursePropertyDto.getOrgId());
+		if(courseProperty != null){
+			throw new Exception("课程属性名已经存在");
+		}
+		courseProperty = new CourseProperty(coursePropertyDto);
+		coursePropertyRepo.save(courseProperty);
+	}
+
+	@Override
+	public Page<CourseProperty> findAllByOrg(CoursePropertyDto coursePropertyDto, Pageable pageable) {
+		Specification<CourseProperty> specification = getSpecification(coursePropertyDto);
+		Page<CourseProperty> coursePropertyies = coursePropertyRepo.findAll(specification, pageable);
+		return coursePropertyies;
+	}
+
+	private Specification<CourseProperty> getSpecification(CoursePropertyDto coursePropertyDto) {
+		CourseProperty courseProperty = new CourseProperty(coursePropertyDto);
+		Specification<CourseProperty> specification = (root, query, cb) -> {
+		    List<Predicate> predicates = new ArrayList<>();
+		    if(!StringUtils.isEmpty(courseProperty.getOrgId())){
+		    	predicates.add(cb.equal(root.get("orgId"),courseProperty.getOrgId()));
+		    }
+		    if(!StringUtils.isEmpty(courseProperty.getName())){
+		    	predicates.add(cb.like(root.get("name"),"%"+courseProperty.getName()+"%"));
+		    }
+		    if(!StringUtils.isEmpty(courseProperty.getCourseId())){
+		    	predicates.add(cb.equal(root.get("courseId"),courseProperty.getCourseId()));
+		    }
+		    if(!StringUtils.isEmpty(courseProperty.getEnable())){
+		    	predicates.add(cb.equal(root.get("enable"),courseProperty.getEnable()));
+		    }
+		    return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+		};
+		return specification;
+	}
+
+	@Override
+	public void openCourseProperty(Long id, Long orgId) {
+		CourseProperty courseProperty = coursePropertyRepo.findOne(id);
+		courseProperty.setEnable(true);
+		coursePropertyRepo.save(courseProperty);
+	}
+
+	@Override
+	public void closeCourseProperty(Long id, Long orgId) {
+		CourseProperty courseProperty = coursePropertyRepo.findOne(id);
+		courseProperty.setEnable(false);
+		coursePropertyRepo.save(courseProperty);
+	}
+
+	@Override
+	public List<CourseProperty> findAllByCourseId(Long courseId) {
+		List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseId(courseId);
+		return courseProperties;
+	}
+}

+ 122 - 122
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PropertyServiceImpl.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/service/impl/PropertyServiceImpl.java

@@ -1,122 +1,122 @@
-package com.qmth.cqb.paper.service.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-
-import com.qmth.cqb.paper.assemble.PropertyAssembler;
-import com.qmth.cqb.paper.dao.PropertyRepo;
-import com.qmth.cqb.paper.dto.PropertyDto;
-import com.qmth.cqb.paper.model.Property;
-import com.qmth.cqb.paper.service.PropertyService;
-/**
- * @describle 课程属性 coursePropertyServiceImpl
- * @author weiwenhai
- * @date   2017.11.8
- */
-@Service("propertyService")
-public class PropertyServiceImpl implements PropertyService{
-	
-	@Autowired
-	private PropertyRepo propertyRepo;
-
-	@Override
-	public void saveProperty(List<PropertyDto> propertyDtos, AccessUser user) {
-		PropertyAssembler propertyAssembler = new PropertyAssembler();
-		for(int i=0;i<propertyDtos.size();i++){
-			//取到父类节点对象
-			Property property = propertyAssembler.toProperty(propertyDtos.get(i));
-			property.setNumber(i+1);
-			property.setOrgId(user.getRootOrgId());
-			property = propertyRepo.save(property);
-			List<Property> properties = propertyAssembler.toPropertySon(propertyDtos.get(i));
-			if(properties != null && properties.size()>0){
-				for(int j=0;j<properties.size();j++){
-					properties.get(j).setParentId(property.getId());
-					properties.get(j).setNumber(j+1);
-				}
-				propertyRepo.save(properties);
-			}
-		}
-	}
-
-	@Override
-	public List<PropertyDto> propertyDtos(Long coursePropertyId, AccessUser user) {
-		List<PropertyDto> propertyDtos = new ArrayList<PropertyDto>();
-		//查询所有父节点对象
-		List<Property> propertieParents = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, 0l);
-		if(propertieParents != null && propertieParents.size()>0){
-			for(Property property:propertieParents){
-				PropertyDto propertyDtoParent = new PropertyDto(property);
-				//查询所有子节点对象
-				List<Property> propertiesSons = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, property.getId());
-				if(propertiesSons != null && propertiesSons.size()>0){
-					List<PropertyDto> propertyDtosSons = new ArrayList<PropertyDto>();
-					for(Property property2:propertiesSons){
-						PropertyDto propertyDto2 = new PropertyDto(property2);
-						propertyDtosSons.add(propertyDto2);
-					}
-					propertyDtoParent.setPropertyDtos(propertyDtosSons);
-				}
-				propertyDtos.add(propertyDtoParent);
-			}
-		}
-		return propertyDtos;
-	}
-
-	@Override
-	public void saveProperty(Property property, AccessUser user) {
-		if(property.getId() == null){
-			Integer number = 0;
-			List<Property> propertieParents = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), property.getCoursePropertyId(), property.getParentId());
-			if(propertieParents != null && propertieParents.size()>0){
-				number = propertieParents.get(propertieParents.size()-1).getNumber();
-			}
-			property.setNumber(number+1);
-		}
-		property.setOrgId(user.getRootOrgId());
-		propertyRepo.save(property);
-	}
-
-	@Override
-	public void deleteProperty(Long propertyId, Long coursePropertyId, AccessUser user) {
-		//查询子节点对象
-		List<Property> properties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, propertyId);
-		if(properties != null && properties.size()>0){
-			for(Property property:properties){
-				propertyRepo.delete(property);
-			}
-		}
-		propertyRepo.delete(propertyId);
-	}
-
-	@Override
-	public List<Property> findAll(Long coursePropertyId, AccessUser user) {
-		List<PropertyDto> propertyDtos = propertyDtos(coursePropertyId, user);
-		List<Property> properties = new ArrayList<Property>();
-		if(propertyDtos != null && propertyDtos.size() >0){
-			for(PropertyDto propertyDto:propertyDtos){
-				Property property = new Property(propertyDto);
-				properties.add(property);
-				if(propertyDto.getPropertyDtos() != null && propertyDto.getPropertyDtos().size() > 0){
-					for(PropertyDto propertyDtoSon:propertyDto.getPropertyDtos()){
-						Property propertySon = new Property(propertyDtoSon);
-						properties.add(propertySon);
-					}
-				}
-			}
-		}
-		return properties;
-	}
-
-	@Override
-	public List<Property> findPropertySons(Property property) {
-		List<Property> properySonsList = propertyRepo.findByParentIdOrderByNumber(property.getId());
-		return properySonsList;
-	}
-
-}
+package com.qmth.cqb.question.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+
+import com.qmth.cqb.question.assemble.PropertyAssembler;
+import com.qmth.cqb.question.dao.PropertyRepo;
+import com.qmth.cqb.question.dto.PropertyDto;
+import com.qmth.cqb.question.model.Property;
+import com.qmth.cqb.question.service.PropertyService;
+/**
+ * @describle 课程属性 coursePropertyServiceImpl
+ * @author weiwenhai
+ * @date   2017.11.8
+ */
+@Service("propertyService")
+public class PropertyServiceImpl implements PropertyService{
+	
+	@Autowired
+	private PropertyRepo propertyRepo;
+
+	@Override
+	public void saveProperty(List<PropertyDto> propertyDtos, AccessUser user) {
+		PropertyAssembler propertyAssembler = new PropertyAssembler();
+		for(int i=0;i<propertyDtos.size();i++){
+			//取到父类节点对象
+			Property property = propertyAssembler.toProperty(propertyDtos.get(i));
+			property.setNumber(i+1);
+			property.setOrgId(user.getRootOrgId());
+			property = propertyRepo.save(property);
+			List<Property> properties = propertyAssembler.toPropertySon(propertyDtos.get(i));
+			if(properties != null && properties.size()>0){
+				for(int j=0;j<properties.size();j++){
+					properties.get(j).setParentId(property.getId());
+					properties.get(j).setNumber(j+1);
+				}
+				propertyRepo.save(properties);
+			}
+		}
+	}
+
+	@Override
+	public List<PropertyDto> propertyDtos(Long coursePropertyId, AccessUser user) {
+		List<PropertyDto> propertyDtos = new ArrayList<PropertyDto>();
+		//查询所有父节点对象
+		List<Property> propertieParents = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, 0l);
+		if(propertieParents != null && propertieParents.size()>0){
+			for(Property property:propertieParents){
+				PropertyDto propertyDtoParent = new PropertyDto(property);
+				//查询所有子节点对象
+				List<Property> propertiesSons = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, property.getId());
+				if(propertiesSons != null && propertiesSons.size()>0){
+					List<PropertyDto> propertyDtosSons = new ArrayList<PropertyDto>();
+					for(Property property2:propertiesSons){
+						PropertyDto propertyDto2 = new PropertyDto(property2);
+						propertyDtosSons.add(propertyDto2);
+					}
+					propertyDtoParent.setPropertyDtos(propertyDtosSons);
+				}
+				propertyDtos.add(propertyDtoParent);
+			}
+		}
+		return propertyDtos;
+	}
+
+	@Override
+	public void saveProperty(Property property, AccessUser user) {
+		if(property.getId() == null){
+			Integer number = 0;
+			List<Property> propertieParents = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), property.getCoursePropertyId(), property.getParentId());
+			if(propertieParents != null && propertieParents.size()>0){
+				number = propertieParents.get(propertieParents.size()-1).getNumber();
+			}
+			property.setNumber(number+1);
+		}
+		property.setOrgId(user.getRootOrgId());
+		propertyRepo.save(property);
+	}
+
+	@Override
+	public void deleteProperty(Long propertyId, Long coursePropertyId, AccessUser user) {
+		//查询子节点对象
+		List<Property> properties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, propertyId);
+		if(properties != null && properties.size()>0){
+			for(Property property:properties){
+				propertyRepo.delete(property);
+			}
+		}
+		propertyRepo.delete(propertyId);
+	}
+
+	@Override
+	public List<Property> findAll(Long coursePropertyId, AccessUser user) {
+		List<PropertyDto> propertyDtos = propertyDtos(coursePropertyId, user);
+		List<Property> properties = new ArrayList<Property>();
+		if(propertyDtos != null && propertyDtos.size() >0){
+			for(PropertyDto propertyDto:propertyDtos){
+				Property property = new Property(propertyDto);
+				properties.add(property);
+				if(propertyDto.getPropertyDtos() != null && propertyDto.getPropertyDtos().size() > 0){
+					for(PropertyDto propertyDtoSon:propertyDto.getPropertyDtos()){
+						Property propertySon = new Property(propertyDtoSon);
+						properties.add(propertySon);
+					}
+				}
+			}
+		}
+		return properties;
+	}
+
+	@Override
+	public List<Property> findPropertySons(Property property) {
+		List<Property> properySonsList = propertyRepo.findByParentIdOrderByNumber(property.getId());
+		return properySonsList;
+	}
+
+}

+ 118 - 118
cqb-paper/src/main/java/com/qmth/cqb/paper/web/CoursePropertyController.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/web/CoursePropertyController.java

@@ -1,118 +1,118 @@
-package com.qmth.cqb.paper.web;
-
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
-import io.swagger.annotations.ApiOperation;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-
-import com.qmth.cqb.paper.dto.CoursePropertyDto;
-import com.qmth.cqb.paper.model.CourseProperty;
-import com.qmth.cqb.paper.service.CoursePropertyService;
-
-/**
- * @describle 课程属性  coursePropertyController
- * @author weiwenhai
- * @date   2017.11.2
- */
-@Controller
-@RequestMapping("${api_cqb}/")
-public class CoursePropertyController {
-
-	@Autowired
-	private CoursePropertyService coursePropertyService;
-	
-	@ApiOperation(value="根据orgId查询所有课程属性", notes="不带分页")
-	@GetMapping(value="/courseProperty/all")
-	public ResponseEntity<Object> findAllByOrg(HttpServletRequest request){
-		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
-		if(accessUser != null){
-			List<CourseProperty> courseProperties = coursePropertyService.findAllByOrgId(accessUser.getRootOrgId());
-			return new ResponseEntity<Object>(courseProperties,HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-	
-	@ApiOperation(value="根据orgId查询所有课程属性", notes="带分页")
-	@GetMapping(value="/courseProperty/all/{curPage}/{pageSize}")
-	public ResponseEntity<Object> findAllByOrgId(@ModelAttribute CoursePropertyDto coursePropertyDto,
-												 @PathVariable Integer curPage,
-												 @PathVariable Integer pageSize,
-												 HttpServletRequest request){
-		 AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-		 if(accessUser == null){
-			 return new ResponseEntity(HttpStatus.NOT_FOUND);
-		 }
-		 coursePropertyDto.setOrgId(accessUser.getRootOrgId());
-		 Page<CourseProperty> coursePropertiesPage = coursePropertyService.findAllByOrg(coursePropertyDto, new PageRequest(curPage - 1,pageSize));
-		 return new ResponseEntity<Object>(coursePropertiesPage,HttpStatus.OK);
-	}
-	
-	@ApiOperation(value="新增课程属性" ,notes="新增课程属性")
-	@PostMapping(value="/courseProperty/save")
-	public ResponseEntity<Object> saveCourseProperty(HttpServletRequest request,@RequestBody CoursePropertyDto coursePropertyDto){
-		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
-		if(accessUser != null){
-			try {
-				coursePropertyDto.setOrgId(accessUser.getRootOrgId());
-				coursePropertyService.saveCourseProperty(coursePropertyDto);
-			} catch (Exception e) {
-				return new ResponseEntity<Object>(HttpStatus.INTERNAL_SERVER_ERROR);
-			}
-			return new ResponseEntity<Object>(HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-	
-	@ApiOperation(value="启用", notes="启用")
-	@PutMapping(value="/courseProperty/open/{id}")
-	public ResponseEntity<Object> openCourseProperty(HttpServletRequest request, @PathVariable Long id){
-		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-		if(accessUser != null){
-			coursePropertyService.openCourseProperty(id, accessUser.getRootOrgId());
-			return new ResponseEntity<Object>(HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-	
-	@ApiOperation(value="禁用", notes="禁用")
-	@PutMapping(value="/courseProperty/close/{id}")
-	public ResponseEntity<Object> closeCourseProperty(HttpServletRequest request, @PathVariable Long id){
-		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-		if(accessUser != null){
-			coursePropertyService.closeCourseProperty(id, accessUser.getRootOrgId());
-			return new ResponseEntity<Object>(HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-	
-	@ApiOperation(value="根据courseId查询所有课程属性", notes="不带分页")
-	@GetMapping(value="/courseProperty/all/{courseId}")
-	public ResponseEntity<Object> findAllByCourseId(HttpServletRequest request,@PathVariable Long courseId){
-		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-		if(accessUser != null){
-			List<CourseProperty> courseProperties = coursePropertyService.findAllByCourseId(courseId);
-			return new ResponseEntity<Object>(courseProperties,HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-}
+package com.qmth.cqb.question.web;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+
+import com.qmth.cqb.question.dto.CoursePropertyDto;
+import com.qmth.cqb.question.model.CourseProperty;
+import com.qmth.cqb.question.service.CoursePropertyService;
+
+/**
+ * @describle 课程属性  coursePropertyController
+ * @author weiwenhai
+ * @date   2017.11.2
+ */
+@Controller
+@RequestMapping("${api_cqb}/")
+public class CoursePropertyController {
+
+	@Autowired
+	private CoursePropertyService coursePropertyService;
+	
+	@ApiOperation(value="根据orgId查询所有课程属性", notes="不带分页")
+	@GetMapping(value="/courseProperty/all")
+	public ResponseEntity<Object> findAllByOrg(HttpServletRequest request){
+		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
+		if(accessUser != null){
+			List<CourseProperty> courseProperties = coursePropertyService.findAllByOrgId(accessUser.getRootOrgId());
+			return new ResponseEntity<Object>(courseProperties,HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="根据orgId查询所有课程属性", notes="带分页")
+	@GetMapping(value="/courseProperty/all/{curPage}/{pageSize}")
+	public ResponseEntity<Object> findAllByOrgId(@ModelAttribute CoursePropertyDto coursePropertyDto,
+												 @PathVariable Integer curPage,
+												 @PathVariable Integer pageSize,
+												 HttpServletRequest request){
+		 AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		 if(accessUser == null){
+			 return new ResponseEntity(HttpStatus.NOT_FOUND);
+		 }
+		 coursePropertyDto.setOrgId(accessUser.getRootOrgId());
+		 Page<CourseProperty> coursePropertiesPage = coursePropertyService.findAllByOrg(coursePropertyDto, new PageRequest(curPage - 1,pageSize));
+		 return new ResponseEntity<Object>(coursePropertiesPage,HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="新增课程属性" ,notes="新增课程属性")
+	@PostMapping(value="/courseProperty/save")
+	public ResponseEntity<Object> saveCourseProperty(HttpServletRequest request,@RequestBody CoursePropertyDto coursePropertyDto){
+		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
+		if(accessUser != null){
+			try {
+				coursePropertyDto.setOrgId(accessUser.getRootOrgId());
+				coursePropertyService.saveCourseProperty(coursePropertyDto);
+			} catch (Exception e) {
+				return new ResponseEntity<Object>(HttpStatus.INTERNAL_SERVER_ERROR);
+			}
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="启用", notes="启用")
+	@PutMapping(value="/courseProperty/open/{id}")
+	public ResponseEntity<Object> openCourseProperty(HttpServletRequest request, @PathVariable Long id){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser != null){
+			coursePropertyService.openCourseProperty(id, accessUser.getRootOrgId());
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="禁用", notes="禁用")
+	@PutMapping(value="/courseProperty/close/{id}")
+	public ResponseEntity<Object> closeCourseProperty(HttpServletRequest request, @PathVariable Long id){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser != null){
+			coursePropertyService.closeCourseProperty(id, accessUser.getRootOrgId());
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="根据courseId查询所有课程属性", notes="不带分页")
+	@GetMapping(value="/courseProperty/all/{courseId}")
+	public ResponseEntity<Object> findAllByCourseId(HttpServletRequest request,@PathVariable Long courseId){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser != null){
+			List<CourseProperty> courseProperties = coursePropertyService.findAllByCourseId(courseId);
+			return new ResponseEntity<Object>(courseProperties,HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+}

+ 93 - 93
cqb-paper/src/main/java/com/qmth/cqb/paper/web/PropertyController.java → cqb-question-resource/src/main/java/com/qmth/cqb/question/web/PropertyController.java

@@ -1,93 +1,93 @@
-package com.qmth.cqb.paper.web;
-
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
-import io.swagger.annotations.ApiOperation;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
-
-import com.qmth.cqb.paper.dto.PropertyDto;
-import com.qmth.cqb.paper.model.Property;
-import com.qmth.cqb.paper.service.PropertyService;
-
-/**
- * @describle 属性 PropertyController
- * @author weiwenhai
- * @date   2017.11.8
- */
-@Controller
-@RequestMapping("${api_cqb}/")
-public class PropertyController {
-
-	@Autowired
-	private PropertyService propertyService;
-	
-	@ApiOperation(value="新增属性", notes="新增属性")
-	@PostMapping(value="/property/save")
-	public ResponseEntity<Object> saveProperty(HttpServletRequest request, @RequestBody Property property){
-		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
-		if(accessUser != null){
-			propertyService.saveProperty(property, accessUser);
-			return new ResponseEntity<Object>(HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-	
-	@ApiOperation(value="查询所有属性dto", notes="树形结构")
-	@GetMapping(value="/property/all/{coursePropertyId}")
-	public ResponseEntity<Object> findAllProperty(HttpServletRequest request, @PathVariable String coursePropertyId){
-		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
-		 if(accessUser == null){
-			 return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-		 }
-		 List<PropertyDto> propertyDtos = propertyService.propertyDtos(Long.parseLong(coursePropertyId), accessUser);
-		return new ResponseEntity<Object>(propertyDtos,HttpStatus.OK);
-	}
-	
-	@ApiOperation(value="更新属性", notes="更新属性")
-	@PutMapping(value="/property/save")
-	public ResponseEntity<Object> updateProperty(HttpServletRequest request, @RequestBody Property property){
-		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
-		if(accessUser != null){
-			propertyService.saveProperty(property, accessUser);
-			return new ResponseEntity<Object>(HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-	
-	@ApiOperation(value="删除属性", notes="删除属性")
-	@DeleteMapping(value="/property/delete/{propertyId}/{coursePropertyId}")
-	public ResponseEntity<Object> deleteProperty(HttpServletRequest request, @PathVariable Long propertyId, @PathVariable Long coursePropertyId){
-		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
-		if(accessUser != null){
-			propertyService.deleteProperty(propertyId, coursePropertyId, accessUser);
-			return new ResponseEntity<Object>(HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-	
-	@ApiOperation(value="查询所有属性", notes="查询所有属性")
-	@GetMapping(value="/property/{coursePropertyId}")
-	public ResponseEntity<Object> findAll(HttpServletRequest request, @PathVariable String coursePropertyId){
-		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
-		if(accessUser != null){
-			List<Property> properties = propertyService.findAll(Long.parseLong(coursePropertyId), accessUser);
-			return new ResponseEntity<Object>(properties,HttpStatus.OK);
-		}
-		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
-	}
-}
+package com.qmth.cqb.question.web;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+
+import com.qmth.cqb.question.dto.PropertyDto;
+import com.qmth.cqb.question.model.Property;
+import com.qmth.cqb.question.service.PropertyService;
+
+/**
+ * @describle 属性 PropertyController
+ * @author weiwenhai
+ * @date   2017.11.8
+ */
+@Controller
+@RequestMapping("${api_cqb}/")
+public class PropertyController {
+
+	@Autowired
+	private PropertyService propertyService;
+	
+	@ApiOperation(value="新增属性", notes="新增属性")
+	@PostMapping(value="/property/save")
+	public ResponseEntity<Object> saveProperty(HttpServletRequest request, @RequestBody Property property){
+		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
+		if(accessUser != null){
+			propertyService.saveProperty(property, accessUser);
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="查询所有属性dto", notes="树形结构")
+	@GetMapping(value="/property/all/{coursePropertyId}")
+	public ResponseEntity<Object> findAllProperty(HttpServletRequest request, @PathVariable String coursePropertyId){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		 if(accessUser == null){
+			 return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		 }
+		 List<PropertyDto> propertyDtos = propertyService.propertyDtos(Long.parseLong(coursePropertyId), accessUser);
+		return new ResponseEntity<Object>(propertyDtos,HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="更新属性", notes="更新属性")
+	@PutMapping(value="/property/save")
+	public ResponseEntity<Object> updateProperty(HttpServletRequest request, @RequestBody Property property){
+		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
+		if(accessUser != null){
+			propertyService.saveProperty(property, accessUser);
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="删除属性", notes="删除属性")
+	@DeleteMapping(value="/property/delete/{propertyId}/{coursePropertyId}")
+	public ResponseEntity<Object> deleteProperty(HttpServletRequest request, @PathVariable Long propertyId, @PathVariable Long coursePropertyId){
+		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
+		if(accessUser != null){
+			propertyService.deleteProperty(propertyId, coursePropertyId, accessUser);
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="查询所有属性", notes="查询所有属性")
+	@GetMapping(value="/property/{coursePropertyId}")
+	public ResponseEntity<Object> findAll(HttpServletRequest request, @PathVariable String coursePropertyId){
+		AccessUser accessUser = (AccessUser)request.getAttribute("accessUser");
+		if(accessUser != null){
+			List<Property> properties = propertyService.findAll(Long.parseLong(coursePropertyId), accessUser);
+			return new ResponseEntity<Object>(properties,HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+}