소스 검색

蓝图试卷结构

weiwenhai 7 년 전
부모
커밋
3d40c44db1
26개의 변경된 파일2106개의 추가작업 그리고 11개의 파일을 삭제
  1. 20 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperDetailInfoStructBlueprintRepo.java
  2. 27 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperDetailInfoUnitStructBlueprintRepo.java
  3. 21 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperDetailStructBlueprintRepo.java
  4. 2 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperRepo.java
  5. 18 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperStructBlueprintRepo.java
  6. 174 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dto/PaperDetailInfoStructBlueprintDto.java
  7. 120 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dto/PaperDetailInfoUnitStructBlueprintDto.java
  8. 98 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/dto/PaperStructBlueprintDto.java
  9. 184 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailInfoStructBlueprint.java
  10. 113 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailInfoUnitStructBlueprint.java
  11. 109 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailStructBlueprint.java
  12. 188 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperStructBlueprint.java
  13. 26 10
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/ImportPaperService.java
  14. 44 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperDetailInfoStructBlueprintService.java
  15. 33 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperDetailInfoUnitStructBlueprintService.java
  16. 41 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperDetailStructBlueprintService.java
  17. 51 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperStructBlueprintService.java
  18. 1 1
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/ExportPaperServiceImpl.java
  19. 314 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperDetailInfoStructBlueprintServiceImpl.java
  20. 42 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperDetailInfoUnitStructBlueprintServiceImpl.java
  21. 74 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperDetailStructBlueprintServiceImpl.java
  22. 131 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperStructBlueprintServiceImpl.java
  23. 20 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/web/ImportPaperController.java
  24. 55 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperDetailInfoStructBlueprintController.java
  25. 95 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperDetailStructBlueprintController.java
  26. 105 0
      cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperStructBlueprintController.java

+ 20 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperDetailInfoStructBlueprintRepo.java

@@ -0,0 +1,20 @@
+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.PaperDetailInfoStructBlueprint;
+
+/**
+ * @describle 蓝图试卷结构大题详情repo
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+public interface PaperDetailInfoStructBlueprintRepo extends JpaRepository<PaperDetailInfoStructBlueprint, Long>,QueryByExampleExecutor<PaperDetailInfoStructBlueprint>,JpaSpecificationExecutor<PaperDetailInfoStructBlueprint>{
+
+	PaperDetailInfoStructBlueprint findByPaperDetailStructBlueprintId(Long paperDetailStructBlueprintId);
+	
+}

+ 27 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperDetailInfoUnitStructBlueprintRepo.java

@@ -0,0 +1,27 @@
+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.jpa.repository.Query;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import com.qmth.cqb.paper.model.PaperDetailInfoUnitStructBlueprint;
+
+/**
+ * @describle 蓝图试卷结构大题详情属性数量repo
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+public interface PaperDetailInfoUnitStructBlueprintRepo extends JpaRepository<PaperDetailInfoUnitStructBlueprint, Long>,QueryByExampleExecutor<PaperDetailInfoUnitStructBlueprint>,JpaSpecificationExecutor<PaperDetailInfoUnitStructBlueprint>{
+
+	@Query("select s from PaperDetailInfoUnitStructBlueprint s where s.paperDetailInfoStructBlueprintId =?1 and s.paperDetailStructBlueprintId = ?2 group by s.propertyId order by s.id")
+	List<PaperDetailInfoUnitStructBlueprint> findGroupByPropertyId(Long paperDetailInfoStructBlueprintId, Long paperDetailStructBlueprintId);
+	
+	List<PaperDetailInfoUnitStructBlueprint> findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintId(Long paperDetailInfoStructBlueprintId, Long paperDetailStructBlueprintId);
+	
+	PaperDetailInfoUnitStructBlueprint findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty(Long paperDetailInfoStructBlueprintId, Long paperDetailStructBlueprintId, Long propertyId, Boolean isPublic, String propertyDifficulty);
+	
+	List<PaperDetailInfoUnitStructBlueprint> findByPropertyIdAndIsPublicAndPropertyDifficulty(Long propertyId, Boolean isPublic, String propertyDifficulty);
+}

+ 21 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperDetailStructBlueprintRepo.java

@@ -0,0 +1,21 @@
+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.PaperDetailStructBlueprint;
+
+/**
+ * @describle 蓝图试卷结构大题repo
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+public interface PaperDetailStructBlueprintRepo extends JpaRepository<PaperDetailStructBlueprint, Long>,QueryByExampleExecutor<PaperDetailStructBlueprint>,JpaSpecificationExecutor<PaperDetailStructBlueprint>{
+	
+	List<PaperDetailStructBlueprint> findByPaperStructBlueprintId(Long paperStructBlueprintId);
+	
+	List<PaperDetailStructBlueprint> findByUserIdAndPaperStructBlueprintId(Long userId, Long paperStructBlueprintId);
+}

+ 2 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperRepo.java

@@ -31,5 +31,7 @@ public interface PaperRepo extends MongoRepository<Paper, String>, QueryByExampl
     List<Paper> findByIdIn(List<String> paperIds);
     
     List<Paper> findBySpecialtyCodeAndOrgId(String specialtyCode,String orgId);
+    
+    Paper findByNameAndOrgIdAndPaperType(String name, String orgId, PaperType paperType);
 
 }

+ 18 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dao/PaperStructBlueprintRepo.java

@@ -0,0 +1,18 @@
+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.PaperStructBlueprint;
+/**
+ * @describle 蓝图试卷结构repo
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+public interface PaperStructBlueprintRepo extends JpaRepository<PaperStructBlueprint, Long>,QueryByExampleExecutor<PaperStructBlueprint>,JpaSpecificationExecutor<PaperStructBlueprint>{
+		
+	List<PaperStructBlueprint> findByCourseNo(String courseNo);
+}

+ 174 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dto/PaperDetailInfoStructBlueprintDto.java

@@ -0,0 +1,174 @@
+package com.qmth.cqb.paper.dto;
+
+import java.util.List;
+
+import com.qmth.cqb.paper.model.PaperDetailInfoStructBlueprint;
+import com.qmth.cqb.paper.model.PaperDetailInfoUnitStructBlueprint;
+/**
+ * @describle 蓝图试卷结构大题详情 dto
+ * @author Administrator
+ * @date   2017.11.20
+ */
+public class PaperDetailInfoStructBlueprintDto {
+
+	private Long id; //大题详情id
+	
+    private String questionType; //小题类型
+    
+    private Integer count; //小题数量
+	
+	private Double score; //小题分数
+	
+	private Double totalScore; //小题总分
+	
+	private Integer publicSimpleCount; //公开简单总数
+	
+	private Integer publicMediumCount; //公开中等总数
+	
+	private Integer publicDifficultyCount; //公开困难总数
+	
+	private Integer noPublicSimpleCount; //非公开简单总数
+	
+	private Integer noPublicMediumCount; //非公开中等总数
+	
+	private Integer noPublicDifficultyCount; //非公开困难总数
+	
+	private List<String> quesNames; //来源大题
+	
+	private Long paperDetailStructBlueprintId; //大题id
+	
+	private List<PaperDetailInfoUnitStructBlueprintDto> paperDetailInfoUnitStructBlueprintDtos; //蓝图试卷结构大题详情属性
+	
+	public PaperDetailInfoStructBlueprintDto(){
+		
+	}
+
+	public PaperDetailInfoStructBlueprintDto(PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint){
+		this.id = paperDetailInfoStructBlueprint.getId();
+		this.questionType = paperDetailInfoStructBlueprint.getQuestionType();
+		this.count = paperDetailInfoStructBlueprint.getCount();
+		this.score = paperDetailInfoStructBlueprint.getScore();
+		this.totalScore = paperDetailInfoStructBlueprint.getTotalScore();
+		this.paperDetailStructBlueprintId = paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId();
+		this.publicSimpleCount = paperDetailInfoStructBlueprint.getPublicSimpleCount();
+		this.publicMediumCount = paperDetailInfoStructBlueprint.getPublicMediumCount();
+		this.publicDifficultyCount = paperDetailInfoStructBlueprint.getPublicDifficultyCount();
+		this.noPublicSimpleCount = paperDetailInfoStructBlueprint.getNoPublicSimpleCount();
+		this.noPublicMediumCount = paperDetailInfoStructBlueprint.getNoPublicMediumCount();
+		this.noPublicDifficultyCount = paperDetailInfoStructBlueprint.getNoPublicDifficultyCount();
+	}
+	
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getQuestionType() {
+		return questionType;
+	}
+
+	public void setQuestionType(String questionType) {
+		this.questionType = questionType;
+	}
+
+	public Integer getCount() {
+		return count;
+	}
+
+	public void setCount(Integer count) {
+		this.count = count;
+	}
+
+	public Double getScore() {
+		return score;
+	}
+
+	public void setScore(Double score) {
+		this.score = score;
+	}
+
+	public Double getTotalScore() {
+		return totalScore;
+	}
+
+	public void setTotalScore(Double totalScore) {
+		this.totalScore = totalScore;
+	}
+
+	public List<String> getQuesNames() {
+		return quesNames;
+	}
+
+	public void setQuesNames(List<String> quesNames) {
+		this.quesNames = quesNames;
+	}
+
+	public Long getPaperDetailStructBlueprintId() {
+		return paperDetailStructBlueprintId;
+	}
+	
+	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 void setPaperDetailStructBlueprintId(Long paperDetailStructBlueprintId) {
+		this.paperDetailStructBlueprintId = paperDetailStructBlueprintId;
+	}
+
+	public List<PaperDetailInfoUnitStructBlueprintDto> getPaperDetailInfoUnitStructBlueprintDtos() {
+		return paperDetailInfoUnitStructBlueprintDtos;
+	}
+
+	public void setPaperDetailInfoUnitStructBlueprintDtos(
+			List<PaperDetailInfoUnitStructBlueprintDto> paperDetailInfoUnitStructBlueprintDtos) {
+		this.paperDetailInfoUnitStructBlueprintDtos = paperDetailInfoUnitStructBlueprintDtos;
+	}
+
+}

+ 120 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dto/PaperDetailInfoUnitStructBlueprintDto.java

@@ -0,0 +1,120 @@
+package com.qmth.cqb.paper.dto;
+
+/**
+ * @describle 蓝图试卷结构大题详情属性数量  dto
+ * @author Administrator
+ * @date   2017.11.20
+ */
+public class PaperDetailInfoUnitStructBlueprintDto {
+
+	private Long propertyId; //属性id
+	
+	private String propertyName; //属性名称
+	
+	private Long propertyParentId; //属性父id
+	
+	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 getPropertyId() {
+		return propertyId;
+	}
+
+	public void setPropertyId(Long propertyId) {
+		this.propertyId = propertyId;
+	}
+
+	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 isDisable() {
+		return disable;
+	}
+
+	public void setDisable(boolean disable) {
+		this.disable = disable;
+	}
+
+	public Long getPropertyParentId() {
+		return propertyParentId;
+	}
+
+	public void setPropertyParentId(Long propertyParentId) {
+		this.propertyParentId = propertyParentId;
+	}
+	
+}

+ 98 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/dto/PaperStructBlueprintDto.java

@@ -0,0 +1,98 @@
+package com.qmth.cqb.paper.dto;
+
+/**
+ * @describle 蓝图试卷结构 Dto
+ * @author weiwenhai
+ * @date   2017.11.17
+ */
+public class PaperStructBlueprintDto {
+	
+	private Long id;
+	
+	private String name;
+	
+	private Double totalScore;
+	
+	private String type;
+	
+	private String courseNo;
+	
+	private Long coursePropertyId;
+	
+	private String creator;
+	
+	private Long orgId;
+	
+	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 String getCourseCode() {
+		return courseNo;
+	}
+
+	public void setCourseCode(String courseNo) {
+		this.courseNo = courseNo;
+	}
+
+	public String getCreator() {
+		return creator;
+	}
+
+	public void setCreator(String creator) {
+		this.creator = creator;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public Double getTotalScore() {
+		return totalScore;
+	}
+
+	public void setTotalScore(Double totalScore) {
+		this.totalScore = totalScore;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getCourseNo() {
+		return courseNo;
+	}
+
+	public void setCourseNo(String courseNo) {
+		this.courseNo = courseNo;
+	}
+
+	public Long getCoursePropertyId() {
+		return coursePropertyId;
+	}
+
+	public void setCoursePropertyId(Long coursePropertyId) {
+		this.coursePropertyId = coursePropertyId;
+	}
+	
+}

+ 184 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailInfoStructBlueprint.java

@@ -0,0 +1,184 @@
+package com.qmth.cqb.paper.model;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+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.PaperDetailInfoStructBlueprintDto;
+
+import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
+
+/**
+ * @describle 蓝图试卷结构大题详情
+ * @author weiwenhai
+ * @date   2017.11.16
+ */
+@Entity
+@Table(name = "ecs_ques_paper_detail_info_struct_blueprint")
+public class PaperDetailInfoStructBlueprint implements Serializable{
+
+	private static final long serialVersionUID = -4313551116694332009L;
+	
+	@Id
+	@GeneratedValue
+	private Long id; //id
+	
+	@NotNull
+	private String questionType; //小题类型
+	
+	private Integer count; //小题数量
+	
+	private Double score; //小题分数
+	
+	private Double totalScore; //小题总分
+	
+	private Integer publicSimpleCount; //公开简单总数
+	
+	private Integer publicMediumCount; //公开中等总数
+	
+	private Integer publicDifficultyCount; //公开困难总数
+	
+	private Integer noPublicSimpleCount; //非公开简单总数
+	
+	private Integer noPublicMediumCount; //非公开中等总数
+	
+	private Integer noPublicDifficultyCount; //非公开困难总数
+	
+	@NotNull
+	private String quesNames; //来源大题
+	
+	private Long paperDetailStructBlueprintId; //大题id
+	
+	public PaperDetailInfoStructBlueprint(){
+		
+	}
+	
+	public PaperDetailInfoStructBlueprint(PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto){
+		this.id = paperDetailInfoStructBlueprintDto.getId();
+		this.count = paperDetailInfoStructBlueprintDto.getCount();
+		this.score = paperDetailInfoStructBlueprintDto.getScore();
+		this.totalScore = paperDetailInfoStructBlueprintDto.getTotalScore();
+		this.paperDetailStructBlueprintId = paperDetailInfoStructBlueprintDto.getPaperDetailStructBlueprintId();
+		this.publicSimpleCount = paperDetailInfoStructBlueprintDto.getPublicSimpleCount();
+		this.publicMediumCount = paperDetailInfoStructBlueprintDto.getPublicMediumCount();
+		this.publicDifficultyCount = paperDetailInfoStructBlueprintDto.getPublicDifficultyCount();
+		this.noPublicSimpleCount = paperDetailInfoStructBlueprintDto.getNoPublicSimpleCount();
+		this.noPublicMediumCount = paperDetailInfoStructBlueprintDto.getNoPublicMediumCount();
+		this.noPublicDifficultyCount = paperDetailInfoStructBlueprintDto.getNoPublicDifficultyCount();
+	}
+	
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getQuestionType() {
+		return questionType;
+	}
+
+	public void setQuestionType(String questionType) {
+		this.questionType = questionType;
+	}
+
+	public Integer getCount() {
+		return count;
+	}
+
+	public void setCount(Integer count) {
+		this.count = count;
+	}
+
+	public Double getScore() {
+		return score;
+	}
+
+	public void setScore(Double score) {
+		this.score = score;
+	}
+
+	public Double getTotalScore() {
+		return totalScore;
+	}
+
+	public void setTotalScore(Double totalScore) {
+		this.totalScore = totalScore;
+	}
+	
+	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 String getQuesNames() {
+		return quesNames;
+	}
+
+	public void setQuesNames(String quesNames) {
+		this.quesNames = quesNames;
+	}
+
+	public Long getPaperDetailStructBlueprintId() {
+		return paperDetailStructBlueprintId;
+	}
+
+	public void setPaperDetailStructBlueprintId(Long paperDetailStructBlueprintId) {
+		this.paperDetailStructBlueprintId = paperDetailStructBlueprintId;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+	
+}

+ 113 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailInfoUnitStructBlueprint.java

@@ -0,0 +1,113 @@
+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.PaperDetailInfoUnitStructBlueprintDto;
+import com.qmth.cqb.utils.enums.PropertyDifficulty;
+
+/**
+ * @describle 蓝图试卷结构大题详情属性数量
+ * @author weiwenhai
+ * @date   2017.11.16
+ */
+@Entity
+@Table(name = "ecs_ques_paper_detail_info_unit_struct_blueprint")
+public class PaperDetailInfoUnitStructBlueprint implements Serializable {
+
+	private static final long serialVersionUID = -8398385820281426872L;
+
+	@Id
+	@GeneratedValue
+	private Long id; //id
+	
+	@NotNull
+	private Long propertyId; //属性id
+	
+	private Integer number; //属性数量
+	
+	private boolean isPublic; //是否公开
+	
+	private String propertyDifficulty; //属性难度
+	
+	private Long paperDetailInfoStructBlueprintId; //大题详情id
+	
+	private Long paperDetailStructBlueprintId; //大题id
+	
+	public PaperDetailInfoUnitStructBlueprint(){
+		
+	}
+	
+	public PaperDetailInfoUnitStructBlueprint(PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto, PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint){
+		this.propertyId = paperDetailInfoUnitStructBlueprintDto.getPropertyId();
+		this.paperDetailInfoStructBlueprintId = paperDetailInfoStructBlueprint.getId();
+		this.paperDetailStructBlueprintId = paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId();
+	}
+	
+	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 Integer getNumber() {
+		return number;
+	}
+
+	public void setNumber(Integer number) {
+		this.number = number;
+	}
+
+	public Long getPaperDetailInfoStructBlueprintId() {
+		return paperDetailInfoStructBlueprintId;
+	}
+
+	public void setPaperDetailInfoStructBlueprintId(
+			Long paperDetailInfoStructBlueprintId) {
+		this.paperDetailInfoStructBlueprintId = paperDetailInfoStructBlueprintId;
+	}
+
+	public Long getPaperDetailStructBlueprintId() {
+		return paperDetailStructBlueprintId;
+	}
+
+	public void setPaperDetailStructBlueprintId(Long paperDetailStructBlueprintId) {
+		this.paperDetailStructBlueprintId = paperDetailStructBlueprintId;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+
+	public boolean isPublic() {
+		return isPublic;
+	}
+
+	public void setIsPublic(boolean isPublic) {
+		this.isPublic = isPublic;
+	}
+
+	public String getPropertyDifficulty() {
+		return propertyDifficulty;
+	}
+
+	public void setPropertyDifficulty(String propertyDifficulty) {
+		this.propertyDifficulty = propertyDifficulty;
+	}
+	
+}

+ 109 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperDetailStructBlueprint.java

@@ -0,0 +1,109 @@
+package com.qmth.cqb.paper.model;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+/**
+ * @describle 蓝图试卷结构大题
+ * @author weiwenhai
+ * @date   2017.11.15
+ */
+@Entity
+@Table(name = "ecs_ques_paper_detail_struct_blueprint")
+public class PaperDetailStructBlueprint implements Serializable{
+
+	private static final long serialVersionUID = 3227452501178462722L;
+	
+	@Id
+	@GeneratedValue
+	private Long id; //id
+	
+	@NotNull
+	private String name; //大题名称
+	
+	private String remark; //大题描述
+	
+	private Integer detailUnitCount; //小题数量
+	
+	private Double score; //大题分数
+	
+	private String type; //大题类型
+	
+	private Long userId; //登录人
+	
+	private Long paperStructBlueprintId; //试卷结构id
+
+	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 String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Integer getDetailUnitCount() {
+		return detailUnitCount;
+	}
+
+	public void setDetailUnitCount(Integer detailUnitCount) {
+		this.detailUnitCount = detailUnitCount;
+	}
+
+	public Double getScore() {
+		return score;
+	}
+
+	public void setScore(Double score) {
+		this.score = score;
+	}
+
+	public Long getPaperStructBlueprintId() {
+		return paperStructBlueprintId;
+	}
+
+	public void setPaperStructBlueprintId(Long paperStructBlueprintId) {
+		this.paperStructBlueprintId = paperStructBlueprintId;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+	
+}

+ 188 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/model/PaperStructBlueprint.java

@@ -0,0 +1,188 @@
+package com.qmth.cqb.paper.model;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+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.PaperStructBlueprintDto;
+
+/**
+ * @describle 蓝图试卷结构
+ * @author weiwenhai
+ * @date   2017.11.15
+ */
+@Entity
+@Table(name = "ecs_ques_paper_struct_blueprint")
+public class PaperStructBlueprint implements Serializable{
+
+	private static final long serialVersionUID = -5738577530345514442L;
+	
+	@Id
+	@GeneratedValue
+	private Long id; //id
+	
+	@NotNull
+	private String name; //蓝图结构名称
+	
+	@NotNull
+	private String courseNo; //制定课程
+	
+	private Long coursePropertyId; //课程属性
+	
+	private Integer detailCount; //大题数量
+	
+	private Double totalScore; //总分
+	
+	private Double difficulty; //难度 
+	
+	@NotNull
+	private String type; //设置类型
+	
+	@NotNull
+	private Long orgId; //机构ID
+	
+	@NotNull
+	private String creator; //创建人id
+	
+	private String updateCreator; //修改人
+	
+    private Date createTime; //创建时间
+    
+    private Date updateTime; //修改时间
+
+    public PaperStructBlueprint(){}
+    
+    public PaperStructBlueprint(PaperStructBlueprintDto paperStructBlueprintDto){
+    	this.id = paperStructBlueprintDto.getId();
+    	this.name = paperStructBlueprintDto.getName();
+    	this.courseNo = paperStructBlueprintDto.getCourseCode();
+    	this.coursePropertyId = paperStructBlueprintDto.getCoursePropertyId();
+    	this.totalScore = paperStructBlueprintDto.getTotalScore();
+    	this.type = paperStructBlueprintDto.getType();
+    	this.creator = paperStructBlueprintDto.getCreator();
+    	this.orgId = paperStructBlueprintDto.getOrgId();
+    }
+    
+    public Double getDifficulty() {
+		return difficulty;
+	}
+
+	public void setDifficulty(Double difficulty) {
+		this.difficulty = difficulty;
+	}
+
+	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 Integer getDetailCount() {
+		return detailCount;
+	}
+
+	public void setDetailCount(Integer detailCount) {
+		this.detailCount = detailCount;
+	}
+
+	public Double getTotalScore() {
+		return totalScore;
+	}
+
+	public void setTotalScore(Double totalScore) {
+		this.totalScore = totalScore;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+	
+	public String getCreator() {
+		return creator;
+	}
+
+	public void setCreator(String creator) {
+		this.creator = creator;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public String getUpdateCreator() {
+		return updateCreator;
+	}
+
+	public void setUpdateCreator(String updateCreator) {
+		this.updateCreator = updateCreator;
+	}
+
+	public Date getUpDateTime() {
+		return updateTime;
+	}
+
+	public void setUpDateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public String getCourseNo() {
+		return courseNo;
+	}
+
+	public void setCourseNo(String courseNo) {
+		this.courseNo = courseNo;
+	}
+
+	public Long getCoursePropertyId() {
+		return coursePropertyId;
+	}
+
+	public void setCoursePropertyId(Long coursePropertyId) {
+		this.coursePropertyId = coursePropertyId;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+    
+}

+ 26 - 10
cqb-paper/src/main/java/com/qmth/cqb/paper/service/ImportPaperService.java

@@ -13,9 +13,9 @@ import java.util.regex.Pattern;
 
 import com.qmth.cqb.base.dao.CourseRepo;
 import com.qmth.cqb.base.model.Course;
-
 import com.qmth.cqb.question.dao.QuesPkgPathRepo;
 import com.qmth.cqb.question.model.QuestionPkgPath;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
@@ -52,6 +52,7 @@ import com.qmth.cqb.utils.word.DocxProcessUtil;
 
 import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+import cn.com.qmth.examcloud.common.util.BeanCopierUtil;
 
 @Service
 public class ImportPaperService {
@@ -89,7 +90,7 @@ public class ImportPaperService {
 
     @Autowired
     QuesPkgPathRepo quesPkgPathRepo;
-
+    
     /**
      * 获取上传文件
      *
@@ -1167,7 +1168,8 @@ public class ImportPaperService {
     				paperDetailUnit.setSubScoreList(oldPaperDetailUnit.getSubScoreList());
     				paperDetailUnit.setPaperDetail(paperDetail);
     				paperDetailUnit.setQuestionType(oldPaperDetailUnit.getQuestionType());
-    				paperDetailUnit.setQuestion(oldPaperDetailUnit.getQuestion());
+    				copyQuestion(paperDetailUnit,oldPaperDetailUnit);
+    				//paperDetailUnit.setQuestion(oldPaperDetailUnit.getQuestion());
     				paperDetailUnit.setOptionOrder(oldPaperDetailUnit.getOptionOrder());
     				paperDetailUnit.setCreator(user.getName());
     				paperDetailUnit.setCreateTime(CommonUtils.getCurDateTime());
@@ -1179,16 +1181,30 @@ public class ImportPaperService {
     	}
 	}
 
+	private void copyQuestion(PaperDetailUnit paperDetailUnit,PaperDetailUnit oldPaperDetailUnit) {
+		Question oldQuestion = oldPaperDetailUnit.getQuestion();
+		Question newQuestion = BeanCopierUtil.copyProperties(oldQuestion,Question.class);
+		QuestionPkgPath oldQuesPkgPath = quesPkgPathRepo.findFirstById(oldQuestion.getQuesPkgPathId());
+		QuestionPkgPath newQuestionPkgPath = BeanCopierUtil.copyProperties(oldQuesPkgPath,QuestionPkgPath.class);
+		newQuestionPkgPath.setId(null);
+		newQuestionPkgPath = quesPkgPathRepo.save(newQuestionPkgPath);
+		newQuestion.setQuesPkgPathId(newQuestionPkgPath.getId());
+		newQuestion.setId(null);
+		newQuestion = quesRepo.save(newQuestion);
+		paperDetailUnit.setQuestion(newQuestion);
+	}
+
 	//克隆原试卷所有属性
     private Paper cloneOldPaper(Paper oldPaper,String paperName,String courseNo, AccessUser user) {
     	Course course = courseRepo.findFirstByCodeAndOrgId(courseNo,user.getRootOrgId().toString());
-    	oldPaper.setName(paperName);
-    	oldPaper.setCreateTime(CommonUtils.getCurDateTime());
-    	oldPaper.setLastModifyName(user.getName());
-    	oldPaper.setOrgId(user.getRootOrgId().toString());
-    	oldPaper.setCourse(course);
-    	oldPaper.setId(null);
-		return paperRepo.save(oldPaper);
+    	Paper newPaper = BeanCopierUtil.copyProperties(oldPaper, Paper.class);
+    	newPaper.setName(paperName);
+    	newPaper.setCreateTime(CommonUtils.getCurDateTime());
+    	newPaper.setLastModifyName(user.getName());
+    	newPaper.setOrgId(user.getRootOrgId().toString());
+    	newPaper.setCourse(course);
+    	newPaper.setId(null);
+		return paperRepo.save(newPaper);
 	}
 
 	public static void main(String[] args){

+ 44 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperDetailInfoStructBlueprintService.java

@@ -0,0 +1,44 @@
+package com.qmth.cqb.paper.service;
+
+import com.qmth.cqb.paper.dto.PaperDetailInfoStructBlueprintDto;
+import com.qmth.cqb.paper.model.PaperDetailInfoStructBlueprint;
+
+/**
+ * @describle 蓝图试卷结构大题详情
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+public interface PaperDetailInfoStructBlueprintService {
+
+	/**
+	 * 保存新增的单个大题详情
+	 * @param paperDetailInfoStructBlueprint
+	 */
+	public PaperDetailInfoStructBlueprint saveSingle(PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint);
+	
+	/**
+	 * 保存蓝图试卷结构大题详情dto
+	 * @param paperDetailInfoStructBlueprintDto
+	 */
+	public void saveDto(PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto);
+	
+	/**
+	 * 根据大题id,查询大题详情dto
+	 * @param paperDetailStructBlueprintId
+	 * @return
+	 */
+	public PaperDetailInfoStructBlueprintDto findByPaperDetailStructBlueprintId(Long paperDetailStructBlueprintId);
+	
+	/**
+	 * 根据大题id,查询大题详情
+	 * @param paperDetailStructBlueprintId
+	 * @return
+	 */
+	public PaperDetailInfoStructBlueprint getPaperDetailInfoStructBlueprint(Long paperDetailStructBlueprintId);
+	
+	/**
+	 * 删除单个大题详情
+	 * @param paperDetailInfoStructBlueprint
+	 */
+	public void deleteSingle(PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint);
+}

+ 33 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperDetailInfoUnitStructBlueprintService.java

@@ -0,0 +1,33 @@
+package com.qmth.cqb.paper.service;
+
+import java.util.List;
+
+import com.qmth.cqb.paper.model.PaperDetailInfoUnitStructBlueprint;
+
+/**
+ * @describle 蓝图试卷结构大题详情属性数量 service
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+public interface PaperDetailInfoUnitStructBlueprintService {
+
+	/**
+	 * 保存新增的单个大题详情属性
+	 * @param paperDetailInfoUnitStructBlueprint
+	 */
+	public void saveSingle(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint);
+	
+	/**
+	 * 根据大题详情id和大题id查询  大题详情属性集合
+	 * @param paperDetailInfoStructBlueprintId
+	 * @param paperDetailStructBlueprintId
+	 * @return
+	 */
+	public List<PaperDetailInfoUnitStructBlueprint> getPaperDetailInfoUnitStructBlueprint(Long paperDetailInfoStructBlueprintId, Long paperDetailStructBlueprintId);
+	
+	/**
+	 * 删除单个大题详情属性集合
+	 * @param paperDetailInfoUnitStructBlueprint
+	 */
+	public void deleteSingle(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint);
+}

+ 41 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperDetailStructBlueprintService.java

@@ -0,0 +1,41 @@
+package com.qmth.cqb.paper.service;
+
+import java.util.List;
+
+import com.qmth.cqb.paper.model.PaperDetailStructBlueprint;
+
+/**
+ * @describle 蓝图试卷结构大题 service
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+public interface PaperDetailStructBlueprintService {
+	
+	/**
+	 * 根据试卷结构id
+	 * 查询所有大题,不带分页
+	 * @param paperStructBlueprintId
+	 * @return
+	 */
+	public List<PaperDetailStructBlueprint> findAll(Long paperStructBlueprintId);
+	
+	/**
+	 * 查询新增的大题,无试卷结构id
+	 * @param userId
+	 * @param paperStructBlueprintId
+	 * @return
+	 */
+	public List<PaperDetailStructBlueprint> findSaveAll(Long userId, Long paperStructBlueprintId);
+	
+	/**
+	 * 保存新增的单个大题
+	 * @param paperDetailStructBlueprint
+	 */
+	public void saveSingle(PaperDetailStructBlueprint paperDetailStructBlueprint);
+	
+	/**
+	 * 删除单个大题
+	 * @param id
+	 */
+	public void deleteSingle(Long id);
+}

+ 51 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/PaperStructBlueprintService.java

@@ -0,0 +1,51 @@
+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.PaperStructBlueprintDto;
+import com.qmth.cqb.paper.model.PaperStructBlueprint;
+
+/**
+ * @describle 蓝图试卷结构 service
+ * @author weiwenhai
+ * @date   2017.11.17
+ */
+public interface PaperStructBlueprintService {
+
+	/**
+	 * 查询所有蓝图试卷结构带分页
+	 * @param paperStructBlueprintDto
+	 * @return
+	 */
+	public Page<PaperStructBlueprint> findAll(PaperStructBlueprintDto paperStructBlueprintDto, Pageable pageable);
+	
+	/**
+	 * 保存试卷结构
+	 * @param paperStructBlueprintDto
+	 * @param PaperDetailIds
+	 */
+	public void saveSingle(PaperStructBlueprintDto paperStructBlueprintDto, String PaperDetailIds);
+	
+	/**
+	 * 计算试卷结构难度
+	 * @param ids 试卷结构大题的ids
+	 * @return
+	 */
+	public Double getDifficulty(List<Long> ids);
+	
+	/**
+	 * 根据id删除试卷结构
+	 * @param id
+	 */
+	public void deleteSingle(Long id);
+	
+	/**
+	 * 根据课程查询查询试卷结构
+	 * @param courseNo
+	 * @return
+	 */
+	public List<PaperStructBlueprint> findByCourseNo(String courseNo);
+}

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

@@ -56,7 +56,7 @@ public class ExportPaperServiceImpl implements ExportPaperService{
 
 	@Override
 	public void exportPaperFile(String paperId,String serviceName,String exportContentList,HttpServletResponse response) throws Exception {
-		ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById(serviceName);
+		ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById("xajdExportPaperService");
 		//根据试卷id查询试卷 
 		Paper paper = paperRepo.findOne(paperId);
 		List<Paper> papers = new ArrayList<Paper>();

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

@@ -0,0 +1,314 @@
+package com.qmth.cqb.paper.service.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+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.utils.enums.PropertyDifficulty;
+
+/**
+ * @describle 蓝图试卷结构大题详情 paperDetailInfoStructBlueprintServiceImpl
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+@Service("paperDetailInfoStructBlueprintService")
+public class PaperDetailInfoStructBlueprintServiceImpl implements PaperDetailInfoStructBlueprintService{
+
+	@Autowired
+	private PaperDetailInfoStructBlueprintRepo paperDetailInfoStructBlueprintRepo;
+	
+	@Autowired
+	private PaperDetailInfoUnitStructBlueprintRepo paperDetailInfoUnitStructBlueprintRepo;
+	
+	@Autowired
+	private PropertyRepo propertyRepo;
+	
+	@Autowired
+	private PaperDetailStructBlueprintRepo paperDetailStructBlueprintRepo;
+	
+	@Override
+	public PaperDetailInfoStructBlueprint saveSingle(PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
+		if(!StringUtils.isEmpty(paperDetailInfoStructBlueprint.getQuestionType()) && !StringUtils.isEmpty(paperDetailInfoStructBlueprint.getQuesNames())){
+			PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint2 = paperDetailInfoStructBlueprintRepo.save(paperDetailInfoStructBlueprint);
+			return paperDetailInfoStructBlueprint2;
+		}
+		return null;
+	}
+
+	@Override
+	public void saveDto(PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto) {
+		//保存   蓝图试卷结构大题详情     paperDetailInfoStructBlueprint 对象
+		PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = new PaperDetailInfoStructBlueprint(paperDetailInfoStructBlueprintDto);
+		paperDetailInfoStructBlueprint.setQuestionType(paperDetailInfoStructBlueprintDto.getQuestionType());
+		paperDetailInfoStructBlueprint.setQuesNames(org.apache.commons.lang.StringUtils.join(paperDetailInfoStructBlueprintDto.getQuesNames(), ","));//集合转换成字符串
+		paperDetailInfoStructBlueprint = saveSingle(paperDetailInfoStructBlueprint);
+		List<PaperDetailInfoUnitStructBlueprintDto> paperDetailInfoUnitStructBlueprintDtos = paperDetailInfoStructBlueprintDto.getPaperDetailInfoUnitStructBlueprintDtos();
+		if(paperDetailInfoUnitStructBlueprintDtos != null && paperDetailInfoUnitStructBlueprintDtos.size() >0){
+			for(PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto:paperDetailInfoUnitStructBlueprintDtos){
+				if(paperDetailInfoStructBlueprintDto != null && paperDetailInfoStructBlueprintDto.getId() != null){
+					//修改保存
+					updatePaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto,paperDetailInfoStructBlueprint);
+				}else{
+					//新增保存   蓝图试卷结构大题详情属性数量  paperDetailInfoUnitStructBlueprint 对象
+					savePaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto,paperDetailInfoStructBlueprint);
+				}
+			}
+		}
+		//保存完整的大题
+		PaperDetailStructBlueprint paperDetailStructBlueprint = paperDetailStructBlueprintRepo.findOne(paperDetailInfoStructBlueprintDto.getPaperDetailStructBlueprintId());
+		paperDetailStructBlueprint.setDetailUnitCount(paperDetailInfoStructBlueprintDto.getCount());
+		paperDetailStructBlueprint.setScore(paperDetailInfoStructBlueprintDto.getTotalScore());
+		paperDetailStructBlueprint.setType(paperDetailInfoStructBlueprintDto.getQuestionType());
+		paperDetailStructBlueprintRepo.save(paperDetailStructBlueprint);
+	}
+
+	/** 跟新
+	 * 根据蓝图试卷结构大题详情属性数量  dto保存多个小题详情对象
+	 * @param paperDetailInfoUnitStructBlueprintDto
+	 * @param paperDetailInfoStructBlueprint
+	 */
+	private void updatePaperDetailInfoUnitStructBlueprint(PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto,PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
+		//查询已经保存的六个对象,并更新
+		//公开简单
+		if(paperDetailInfoUnitStructBlueprintDto.getPublicSimple() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+					(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), true, PropertyDifficulty.SIMPLE.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicSimple());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//公开中等
+		if(paperDetailInfoUnitStructBlueprintDto.getPublicMedium() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+					(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), true, PropertyDifficulty.MEDIUM.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicMedium());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//公开困难
+		if(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+					(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), true, PropertyDifficulty.DIFFICULTY.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//非公开简单
+		if(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+					(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), false, PropertyDifficulty.SIMPLE.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//非公开中等
+		if(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+					(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), false, PropertyDifficulty.MEDIUM.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//非公开困难
+		if(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+					(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), false, PropertyDifficulty.DIFFICULTY.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+	}
+
+	/**新增
+	 * 根据蓝图试卷结构大题详情属性数量  dto保存多个小题详情对象
+	 * @param paperDetailInfoUnitStructBlueprintDto
+	 */
+	private void savePaperDetailInfoUnitStructBlueprint(PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto, PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
+		//公开简单
+		if(paperDetailInfoUnitStructBlueprintDto.getPublicSimple() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
+			paperDetailInfoUnitStructBlueprint.setIsPublic(true);
+			paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.SIMPLE.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicSimple());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//公开中等
+		if(paperDetailInfoUnitStructBlueprintDto.getPublicMedium() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
+			paperDetailInfoUnitStructBlueprint.setIsPublic(true);
+			paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.MEDIUM.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicMedium());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//公开困难
+		if(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
+			paperDetailInfoUnitStructBlueprint.setIsPublic(true);
+			paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.DIFFICULTY.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//非公开简单
+		if(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
+			paperDetailInfoUnitStructBlueprint.setIsPublic(false);
+			paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.SIMPLE.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//非公开中等
+		if(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
+			paperDetailInfoUnitStructBlueprint.setIsPublic(false);
+			paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.MEDIUM.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+		//非公开困难
+		if(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty() != null){
+			PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
+			paperDetailInfoUnitStructBlueprint.setIsPublic(false);
+			paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.DIFFICULTY.name());
+			paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty());
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+	}
+
+	@Override
+	public PaperDetailInfoStructBlueprintDto findByPaperDetailStructBlueprintId(Long paperDetailStructBlueprintId) {
+		//查询蓝图试卷结构大题详情
+		PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = paperDetailInfoStructBlueprintRepo.findByPaperDetailStructBlueprintId(paperDetailStructBlueprintId);
+		if(paperDetailInfoStructBlueprint == null){
+			return null;
+		}
+		PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto = new PaperDetailInfoStructBlueprintDto(paperDetailInfoStructBlueprint);
+		String[] strsStrings = paperDetailInfoStructBlueprint.getQuesNames().split(",");
+		List<String> quesNames = Arrays.asList(strsStrings);
+		paperDetailInfoStructBlueprintDto.setQuesNames(quesNames);
+		//查询蓝图试卷结构大题详情属性数量
+		List<PaperDetailInfoUnitStructBlueprintDto> paperDetailInfoUnitStructBlueprintDtos = new ArrayList<PaperDetailInfoUnitStructBlueprintDto>();
+		//查询属性树
+		List<PaperDetailInfoUnitStructBlueprint> paperDetailInfoUnitStructBlueprints = paperDetailInfoUnitStructBlueprintRepo.findGroupByPropertyId(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId());
+		for(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint:paperDetailInfoUnitStructBlueprints){
+			//根据属性树包装成 PaperDetailInfoUnitStructBlueprintDto 对象
+			PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto = buildPaperDetailInfoUnitStructBlueprintDto(paperDetailInfoUnitStructBlueprint);
+			paperDetailInfoUnitStructBlueprintDtos.add(paperDetailInfoUnitStructBlueprintDto);
+		}
+		paperDetailInfoStructBlueprintDto.setPaperDetailInfoUnitStructBlueprintDtos(paperDetailInfoUnitStructBlueprintDtos);
+		return paperDetailInfoStructBlueprintDto;
+	}
+
+	/**
+	 * 根据蓝图试卷结构大题详情属性数量包装成前端需要对象
+	 * @param paperDetailInfoUnitStructBlueprint
+	 */
+	private PaperDetailInfoUnitStructBlueprintDto buildPaperDetailInfoUnitStructBlueprintDto(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint) {
+		Property property = propertyRepo.findOne(paperDetailInfoUnitStructBlueprint.getPropertyId());
+		PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto = new PaperDetailInfoUnitStructBlueprintDto();
+		paperDetailInfoUnitStructBlueprintDto.setPropertyId(property.getId());
+		paperDetailInfoUnitStructBlueprintDto.setPropertyName(property.getName());
+		paperDetailInfoUnitStructBlueprintDto.setPropertyParentId(property.getParentId());
+		//公开简单
+		paperDetailInfoUnitStructBlueprintDto.setPublicSimple(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+				(paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(), 
+						true, PropertyDifficulty.SIMPLE.name()).getNumber());
+		//公开中等
+		paperDetailInfoUnitStructBlueprintDto.setPublicMedium(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+				(paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(), 
+						true, PropertyDifficulty.MEDIUM.name()).getNumber());
+		//公开困难
+		paperDetailInfoUnitStructBlueprintDto.setPublicDifficulty(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+				(paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(), 
+						true, PropertyDifficulty.DIFFICULTY.name()).getNumber());
+		//非公开简单
+		paperDetailInfoUnitStructBlueprintDto.setNoPublicSimple(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+				(paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(), 
+						false, PropertyDifficulty.SIMPLE.name()).getNumber());
+		//非公开中等
+		paperDetailInfoUnitStructBlueprintDto.setNoPublicMedium(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+				(paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(), 
+						false, PropertyDifficulty.MEDIUM.name()).getNumber());
+		//非公开困难
+		paperDetailInfoUnitStructBlueprintDto.setNoPublicDifficulty(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
+				(paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(), 
+						false, PropertyDifficulty.DIFFICULTY.name()).getNumber());
+		paperDetailInfoUnitStructBlueprintDto.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicSimple() + paperDetailInfoUnitStructBlueprintDto.getPublicMedium()
+				+paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty() + paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple() 
+				+paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium() + paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty());
+		//判断这条记录在页面上是否置灰
+		boolean disable = setDisable(property);
+		paperDetailInfoUnitStructBlueprintDto.setDisable(disable);
+		return paperDetailInfoUnitStructBlueprintDto;
+	}
+
+	/**
+	 * 如果父节点下面没有子节点,就置灰
+	 * @param property
+	 * @return
+	 */
+	private boolean setDisable(Property property) {
+		//如果是父节点
+		if(property.getParentId() == 0L){
+			//取到子节点
+			List<Property> propertySonsList = propertyRepo.findByParentIdOrderByNumber(property.getId());
+			if(propertySonsList != null && propertySonsList.size() >0){
+				return true;
+			}else{
+				return false;
+			}
+		}
+		return false;
+	}
+
+	@Override
+	public PaperDetailInfoStructBlueprint getPaperDetailInfoStructBlueprint(Long paperDetailStructBlueprintId) {
+		PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = paperDetailInfoStructBlueprintRepo.findByPaperDetailStructBlueprintId(paperDetailStructBlueprintId);
+		return paperDetailInfoStructBlueprint;
+	}
+
+	@Override
+	public void deleteSingle(PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
+		paperDetailInfoStructBlueprintRepo.delete(paperDetailInfoStructBlueprint);
+	}
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 42 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperDetailInfoUnitStructBlueprintServiceImpl.java

@@ -0,0 +1,42 @@
+package com.qmth.cqb.paper.service.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.qmth.cqb.paper.dao.PaperDetailInfoUnitStructBlueprintRepo;
+import com.qmth.cqb.paper.model.PaperDetailInfoUnitStructBlueprint;
+import com.qmth.cqb.paper.service.PaperDetailInfoUnitStructBlueprintService;
+
+/**
+ * @describle 蓝图试卷结构大题详情属性数量  paperDetailInfoUnitStructBlueprintServiceImpl
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+@Service("paperDetailInfoUnitStructBlueprintService")
+public class PaperDetailInfoUnitStructBlueprintServiceImpl implements PaperDetailInfoUnitStructBlueprintService{
+	
+	@Autowired
+	private PaperDetailInfoUnitStructBlueprintRepo paperDetailInfoUnitStructBlueprintRepo;
+
+	@Override
+	public void saveSingle(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint) {
+		if(!StringUtils.isEmpty(paperDetailInfoUnitStructBlueprint.getPropertyId())){
+			paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
+		}
+	}
+
+	@Override
+	public List<PaperDetailInfoUnitStructBlueprint> getPaperDetailInfoUnitStructBlueprint(Long paperDetailInfoStructBlueprintId, Long paperDetailStructBlueprintId) {
+		List<PaperDetailInfoUnitStructBlueprint> paperDetailInfoUnitStructBlueprints = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintId(paperDetailInfoStructBlueprintId, paperDetailStructBlueprintId);
+		return paperDetailInfoUnitStructBlueprints;
+	}
+
+	@Override
+	public void deleteSingle(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint) {
+		paperDetailInfoUnitStructBlueprintRepo.delete(paperDetailInfoUnitStructBlueprint);
+	}
+
+}

+ 74 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperDetailStructBlueprintServiceImpl.java

@@ -0,0 +1,74 @@
+package com.qmth.cqb.paper.service.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.ctc.wstx.util.StringUtil;
+import com.netflix.infix.lang.infix.antlr.EventFilterParser.null_predicate_return;
+import com.qmth.cqb.paper.dao.PaperDetailStructBlueprintRepo;
+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.service.PaperDetailInfoStructBlueprintService;
+import com.qmth.cqb.paper.service.PaperDetailInfoUnitStructBlueprintService;
+import com.qmth.cqb.paper.service.PaperDetailStructBlueprintService;
+
+/**
+ * @describle 蓝图试卷结构大题 paperDetailStructBlueprintServiceImpl
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+@Service("paperDetailStructBlueprintService")
+public class PaperDetailStructBlueprintServiceImpl implements PaperDetailStructBlueprintService{
+
+	@Autowired
+	private PaperDetailStructBlueprintRepo paperDetailStructBlueprintRepo;
+	
+	@Autowired
+	private PaperDetailInfoStructBlueprintService paperDetailInfoStructBlueprintService;
+	
+	@Autowired
+	private PaperDetailInfoUnitStructBlueprintService paperDetailInfoUnitStructBlueprintService;
+	
+	@Override
+	public List<PaperDetailStructBlueprint> findAll(Long paperStructBlueprintId) {
+		List<PaperDetailStructBlueprint> paperDetailStructBlueprints = paperDetailStructBlueprintRepo.findByPaperStructBlueprintId(paperStructBlueprintId);
+		return paperDetailStructBlueprints;
+	}
+
+	@Override
+	public List<PaperDetailStructBlueprint> findSaveAll(Long userId, Long paperStructBlueprintId) {
+		List<PaperDetailStructBlueprint> paperDetailStructBlueprints = paperDetailStructBlueprintRepo.findByUserIdAndPaperStructBlueprintId(userId, paperStructBlueprintId);
+		return paperDetailStructBlueprints;
+	}
+	
+	@Override
+	public void saveSingle(PaperDetailStructBlueprint paperDetailStructBlueprint) {
+		if(!StringUtils.isEmpty(paperDetailStructBlueprint.getName())){
+			paperDetailStructBlueprintRepo.save(paperDetailStructBlueprint);
+		}
+	}
+
+	@Override
+	public void deleteSingle(Long id) {
+		//查询大题
+		PaperDetailStructBlueprint paperDetailStructBlueprint = paperDetailStructBlueprintRepo.findOne(id);
+		//查询大题详情
+		PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = paperDetailInfoStructBlueprintService.getPaperDetailInfoStructBlueprint(id);
+		//查询大题详情属性
+		List<PaperDetailInfoUnitStructBlueprint> paperDetailInfoUnitStructBlueprints = paperDetailInfoUnitStructBlueprintService.getPaperDetailInfoUnitStructBlueprint(paperDetailInfoStructBlueprint.getId(), id);
+		if(paperDetailInfoUnitStructBlueprints != null && paperDetailInfoUnitStructBlueprints.size() >0){
+			for(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint:paperDetailInfoUnitStructBlueprints){
+				paperDetailInfoUnitStructBlueprintService.deleteSingle(paperDetailInfoUnitStructBlueprint);
+			}
+		}
+		if(paperDetailInfoStructBlueprint != null){
+			paperDetailInfoStructBlueprintService.deleteSingle(paperDetailInfoStructBlueprint);
+		}
+		paperDetailStructBlueprintRepo.delete(paperDetailStructBlueprint);
+	}
+
+}

+ 131 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/service/impl/PaperStructBlueprintServiceImpl.java

@@ -0,0 +1,131 @@
+package com.qmth.cqb.paper.service.impl;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import javax.persistence.criteria.Predicate;
+
+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.netflix.infix.lang.infix.antlr.EventFilterParser.null_predicate_return;
+import com.qmth.cqb.paper.dao.PaperDetailInfoStructBlueprintRepo;
+import com.qmth.cqb.paper.dao.PaperDetailStructBlueprintRepo;
+import com.qmth.cqb.paper.dao.PaperStructBlueprintRepo;
+import com.qmth.cqb.paper.dto.PaperStructBlueprintDto;
+import com.qmth.cqb.paper.model.PaperDetailInfoStructBlueprint;
+import com.qmth.cqb.paper.model.PaperDetailStructBlueprint;
+import com.qmth.cqb.paper.model.PaperStructBlueprint;
+import com.qmth.cqb.paper.service.PaperDetailStructBlueprintService;
+import com.qmth.cqb.paper.service.PaperStructBlueprintService;
+import com.rabbitmq.client.AMQP.Basic.Return;
+
+/**
+ * @describle 蓝图试卷结构  coursePropertyServiceImpl
+ * @author weiwenhai
+ * @date   2017.11.17
+ */
+@Service("paperStructBlueprintService")
+public class PaperStructBlueprintServiceImpl implements PaperStructBlueprintService {
+
+	@Autowired
+	private PaperStructBlueprintRepo paperStructBlueprintRepo;
+	
+	@Autowired
+	private PaperDetailStructBlueprintRepo paperDetailStructBlueprintRepo;
+	
+	@Autowired
+	private PaperDetailInfoStructBlueprintRepo paperDetailInfoStructBlueprintRepo;
+	
+	@Autowired
+	private PaperDetailStructBlueprintService paperDetailStructBlueprintService;
+	
+	@Override
+	public Page<PaperStructBlueprint> findAll(PaperStructBlueprintDto paperStructBlueprintDto, Pageable pageable) {
+		Specification<PaperStructBlueprint> specification = getSpecification(paperStructBlueprintDto);
+		Page<PaperStructBlueprint> paperStructBlueprintsPage = paperStructBlueprintRepo.findAll(specification, pageable);
+		return paperStructBlueprintsPage;
+	}
+
+	private Specification<PaperStructBlueprint> getSpecification(PaperStructBlueprintDto paperStructBlueprintDto) {
+		PaperStructBlueprint paperStructBlueprint = new PaperStructBlueprint(paperStructBlueprintDto);
+		Specification<PaperStructBlueprint> specification = (root, query, cb) -> {
+			List<Predicate> predicates = new ArrayList<>();
+			if(!StringUtils.isEmpty(paperStructBlueprint.getId())){
+				predicates.add(cb.equal(root.get("orgId"),paperStructBlueprint.getOrgId()));
+			}
+			if(!StringUtils.isEmpty(paperStructBlueprint.getName())){
+		    	predicates.add(cb.like(root.get("name"),"%"+paperStructBlueprint.getName()+"%"));
+		    }
+			if(!StringUtils.isEmpty(paperStructBlueprint.getCourseNo())){
+		    	predicates.add(cb.equal(root.get("courseNo"),paperStructBlueprint.getCourseNo()));
+		    }
+			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+		};
+		return specification;
+	}
+
+	@Override
+	public void saveSingle(PaperStructBlueprintDto paperStructBlueprintDto, String PaperDetailIds) {
+		PaperStructBlueprint paperStructBlueprint = new PaperStructBlueprint(paperStructBlueprintDto);
+		List<Long> ids = Stream.of(PaperDetailIds.split(",")).map(s->Long.parseLong(s.trim())).collect(Collectors.toList());
+		if(ids == null || ids.size()<0){
+			paperStructBlueprint.setDetailCount(0);
+		}else{
+			paperStructBlueprint.setDetailCount(ids.size());
+			//计算试卷结构难度
+			Double difficulty = getDifficulty(ids);
+			paperStructBlueprint.setDifficulty(difficulty);
+			paperStructBlueprint.setCreateTime(new Date());
+			paperStructBlueprint = paperStructBlueprintRepo.save(paperStructBlueprint);
+			for(Long id:ids){
+				PaperDetailStructBlueprint paperDetailStructBlueprint = paperDetailStructBlueprintRepo.findOne(id);
+				paperDetailStructBlueprint.setPaperStructBlueprintId(paperStructBlueprint.getId());
+				paperDetailStructBlueprintRepo.save(paperDetailStructBlueprint);
+			}
+		}
+	}
+
+	@Override
+	public Double getDifficulty(List<Long> ids) {
+		if(ids != null && ids.size() >0){
+			Integer simpleCount = 0;
+			Integer mediumCount = 0;
+			Integer difficultyCount = 0;
+			for(Long id:ids){
+				PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = paperDetailInfoStructBlueprintRepo.findByPaperDetailStructBlueprintId(id);
+				simpleCount = paperDetailInfoStructBlueprint.getPublicSimpleCount() + paperDetailInfoStructBlueprint.getNoPublicSimpleCount();
+				mediumCount = paperDetailInfoStructBlueprint.getPublicMediumCount() + paperDetailInfoStructBlueprint.getNoPublicMediumCount();
+				difficultyCount = paperDetailInfoStructBlueprint.getPublicDifficultyCount() + paperDetailInfoStructBlueprint.getNoPublicDifficultyCount();
+			}
+			Double difficulty = ((simpleCount * 0.8) + (mediumCount * 0.5) + (difficultyCount * 0.2))/(simpleCount + mediumCount + difficultyCount);
+			return difficulty;
+		}
+		return (double)0;
+	}
+
+	@Override
+	public void deleteSingle(Long id) {
+		//查询大题数量
+		List<PaperDetailStructBlueprint> paperDetailStructBlueprints = paperDetailStructBlueprintRepo.findByPaperStructBlueprintId(id);
+		for(PaperDetailStructBlueprint paperDetailStructBlueprint:paperDetailStructBlueprints){
+			//删除每个大题下面的小题
+			paperDetailStructBlueprintService.deleteSingle(paperDetailStructBlueprint.getId());
+		}
+		paperStructBlueprintRepo.delete(id);
+	}
+
+	@Override
+	public List<PaperStructBlueprint> findByCourseNo(String courseNo) {
+		List<PaperStructBlueprint> paperStructBlueprints = paperStructBlueprintRepo.findByCourseNo(courseNo);
+		return paperStructBlueprints;
+	}
+
+}

+ 20 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/web/ImportPaperController.java

@@ -104,5 +104,25 @@ public class ImportPaperController {
             return new ResponseEntity(returnMap, HttpStatus.INTERNAL_SERVER_ERROR);
         }
     }
+    
+    /**
+     * 克隆试卷
+     * @return
+     */
+    @ApiOperation(value="克隆试卷", notes="克隆试卷")
+    @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
+    @PostMapping(value="/clonePaper/{paperId}/{paperName}/{courseNo}")
+    public ResponseEntity clonePaper(HttpServletRequest request,
+    								 @PathVariable String paperId,
+    								 @PathVariable String paperName,
+    								 @PathVariable String courseNo){
+    	AccessUser user = (AccessUser) request.getAttribute("accessUser");
+    	Map<String, Object> map = importPaperService.clonePaper(paperId, paperName, courseNo, user);
+    	if (map.get("msg").equals("success")) {
+            return new ResponseEntity(map, HttpStatus.OK);
+        } else {
+            return new ResponseEntity(map, HttpStatus.INTERNAL_SERVER_ERROR);
+        }
+    }
 
 }

+ 55 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperDetailInfoStructBlueprintController.java

@@ -0,0 +1,55 @@
+package com.qmth.cqb.paper.web;
+
+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.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+
+import com.qmth.cqb.paper.dto.PaperDetailInfoStructBlueprintDto;
+import com.qmth.cqb.paper.service.PaperDetailInfoStructBlueprintService;
+
+/**
+ * @describle 蓝图试卷结构大题详情 controller
+ * @author Administrator
+ * @date   2017.11.20
+ */
+@Controller
+@RequestMapping("${api_cqb}/")
+public class PaperDetailInfoStructBlueprintController {
+	
+	@Autowired
+	private PaperDetailInfoStructBlueprintService paperDetailInfoStructBlueprintService;
+
+	@ApiOperation(value="保存蓝图试卷结构大题详情" , notes="保存蓝图试卷结构大题详情")
+	@PostMapping(value="/paperDetailInfoStructBlueprint/save")
+	public ResponseEntity<Object> saveDto(HttpServletRequest request,@RequestBody PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		}
+		paperDetailInfoStructBlueprintService.saveDto(paperDetailInfoStructBlueprintDto);
+		return new ResponseEntity<Object>(HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="根据蓝图试卷结构大题Id查询大题详情", notes="不带分页")
+	@GetMapping(value="/paperDetailInfoStructBlueprint/{paperDetailStructBlueprintId}")
+	public ResponseEntity<Object> findByPaperDetailStructBlueprintId(HttpServletRequest request,@PathVariable Long paperDetailStructBlueprintId){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		}
+		PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto = paperDetailInfoStructBlueprintService.findByPaperDetailStructBlueprintId(paperDetailStructBlueprintId);
+		return new ResponseEntity<Object>(paperDetailInfoStructBlueprintDto,HttpStatus.OK);
+	}
+}

+ 95 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperDetailStructBlueprintController.java

@@ -0,0 +1,95 @@
+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.model.PaperDetailStructBlueprint;
+import com.qmth.cqb.paper.service.PaperDetailStructBlueprintService;
+
+/**
+ * @describle 蓝图试卷结构大题 PaperDetailStructBlueprintController
+ * @author weiwenhai
+ * @date   2017.11.20
+ */
+@Controller
+@RequestMapping("${api_cqb}/")
+public class PaperDetailStructBlueprintController {
+
+	@Autowired
+	private PaperDetailStructBlueprintService paperDetailStructBlueprintService;
+	
+	@ApiOperation(value="根据蓝图试卷结构id查询所有大题", notes="不带分页")
+	@GetMapping(value="/paperDetailStructBlueprint/all/{paperStructBlueprintId}")
+	public ResponseEntity<Object> findAll(HttpServletRequest request, @PathVariable Long paperStructBlueprintId){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		}
+		List<PaperDetailStructBlueprint> paperDetailStructBlueprints = paperDetailStructBlueprintService.findAll(paperStructBlueprintId);
+		return new ResponseEntity<Object>(paperDetailStructBlueprints,HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="查询新增的大题,无试卷结构id", notes="不带分页")
+	@GetMapping(value="/paperDetailStructBlueprint/all")
+	public ResponseEntity<Object> findSaveAll(HttpServletRequest request){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		}
+		List<PaperDetailStructBlueprint> paperDetailStructBlueprints = paperDetailStructBlueprintService.findSaveAll(accessUser.getUserId(), null);
+		return new ResponseEntity<Object>(paperDetailStructBlueprints,HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="保存新增的单个大题", notes="保存新增的单个大题")
+	@PostMapping(value="/paperDetailStructBlueprint/save")
+	public ResponseEntity<Object> saveSingle(HttpServletRequest request,@RequestBody PaperDetailStructBlueprint paperDetailStructBlueprint){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		}
+		//paperDetailStructBlueprint.setType("specifics");//细节
+		paperDetailStructBlueprint.setUserId(accessUser.getUserId());
+		paperDetailStructBlueprintService.saveSingle(paperDetailStructBlueprint);
+		return new ResponseEntity<Object>(HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="保存修改的单个大题", notes="保存修改的单个大题")
+	@PutMapping(value="/paperDetailStructBlueprint/update")
+	public ResponseEntity<Object> updateSingle(HttpServletRequest request,@RequestBody PaperDetailStructBlueprint paperDetailStructBlueprint){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		}
+		paperDetailStructBlueprint.setUserId(accessUser.getUserId());
+		paperDetailStructBlueprintService.saveSingle(paperDetailStructBlueprint);
+		return new ResponseEntity<Object>(HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="删除单个大题", notes="删除单个大题")
+	@DeleteMapping(value="/paperDetailStructBlueprint/delete/{id}")
+	public ResponseEntity<Object> deleteSingle(HttpServletRequest request,@PathVariable Long id){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+		}
+		paperDetailStructBlueprintService.deleteSingle(id);
+		return new ResponseEntity<Object>(HttpStatus.OK);
+	}
+}

+ 105 - 0
cqb-paper/src/main/java/com/qmth/cqb/paper/web/PaperStructBlueprintController.java

@@ -0,0 +1,105 @@
+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.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.ModelAttribute;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+
+import com.qmth.cqb.paper.dao.PaperStructBlueprintRepo;
+import com.qmth.cqb.paper.dto.PaperStructBlueprintDto;
+import com.qmth.cqb.paper.model.PaperStructBlueprint;
+import com.qmth.cqb.paper.service.PaperStructBlueprintService;
+
+/**
+ * @describle 蓝图试卷结构controller
+ * @author weiwenhai
+ * @date   2017.11.17
+ */
+@Controller
+@RequestMapping("${api_cqb}/")
+public class PaperStructBlueprintController {
+	
+	@Autowired
+	private PaperStructBlueprintService paperStructBlueprintService;
+	
+	@Autowired
+	private PaperStructBlueprintRepo paperStructBlueprintRepo;
+
+	@ApiOperation(value="查询所有蓝图试卷结构", notes="带分页")
+	@GetMapping(value="/paperStructBlueprint/all/{curPage}/{pageSize}")
+	public ResponseEntity<Object> findAll(@ModelAttribute PaperStructBlueprintDto paperStructBlueprintDto,
+										  @PathVariable Integer curPage,
+										  @PathVariable Integer pageSize,
+										  HttpServletRequest request){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser == null){
+			 return new ResponseEntity(HttpStatus.NOT_FOUND);
+		 }
+		paperStructBlueprintDto.setOrgId(accessUser.getRootOrgId());
+		Page<PaperStructBlueprint> paperStructBlueprintPage = paperStructBlueprintService.findAll(paperStructBlueprintDto, new PageRequest(curPage-1, pageSize));
+		return new ResponseEntity<Object>(paperStructBlueprintPage,HttpStatus.OK);
+	}
+	
+	@ApiOperation(value="保存试卷结构", notes="保存试卷结构")
+	@PostMapping(value="/paperStructBlueprint/save/{ids}")
+	public ResponseEntity<Object> saveSingle(HttpServletRequest request, @PathVariable String ids, @RequestBody PaperStructBlueprintDto paperStructBlueprintDto){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser != null){
+			paperStructBlueprintDto.setCreator(accessUser.getName());
+			paperStructBlueprintDto.setOrgId(accessUser.getRootOrgId());
+			paperStructBlueprintService.saveSingle(paperStructBlueprintDto, ids);
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="根据id查询试卷结构", notes="根据id查询试卷结构")
+	@GetMapping(value="/paperStructBlueprint/findOne/{id}")
+	public ResponseEntity<Object> findOne(HttpServletRequest request,@PathVariable Long id){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser != null){
+			PaperStructBlueprint paperStructBlueprint = paperStructBlueprintRepo.findOne(id);
+			return new ResponseEntity<Object>(paperStructBlueprint,HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="根据id删除试卷结构", notes="根据id删除试卷结构")
+	@DeleteMapping(value="/paperStructBlueprint/delete/{id}")
+	public ResponseEntity<Object> deleteSingle(HttpServletRequest request,@PathVariable Long id){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser != null){
+			paperStructBlueprintService.deleteSingle(id);
+			return new ResponseEntity<Object>(HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+	
+	@ApiOperation(value="根据课程代码查询试卷结构", notes="根据课程代码查询试卷结构")
+	@GetMapping(value="/paperStructBlueprint/findByCourseNo/{courseNo}")
+	public ResponseEntity<Object> findByCourseNo(HttpServletRequest request, @PathVariable String courseNo){
+		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
+		if(accessUser != null){
+			List<PaperStructBlueprint> paperStructBlueprints = paperStructBlueprintService.findByCourseNo(courseNo);
+			return new ResponseEntity<Object>(paperStructBlueprints,HttpStatus.OK);
+		}
+		return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
+	}
+}