xiatian 5 éve
szülő
commit
695f4e3ec3

+ 7 - 4
examcloud-core-reports-api-provider/src/main/java/cn/com/qmth/examcloud/core/reports/api/controller/ExamCourseDataReportController.java

@@ -30,7 +30,7 @@ public class ExamCourseDataReportController extends ControllerSupport {
 	private ExamCourseDataReportService examCourseDataReportService;
 	@Autowired
 	private ProjectService projectService;
-	//TODO 难度 标准差 差异系数 前十后十查询
+
 	@ApiOperation(value = "查询考试课程数据")
 	@GetMapping(value = "/getExamCourseMainList")
 	public List<ExamCourseReportMainBean> getExamCourseMainList(@RequestParam Long projectId,
@@ -51,6 +51,7 @@ public class ExamCourseDataReportController extends ControllerSupport {
 		}
 		return examCourseDataReportService.getExamCourseMainList(projectId, examId);
 	}
+
 	@ApiOperation(value = "查询考试课程数据Top10")
 	@GetMapping(value = "/getExamCourseMainTop10")
 	public ExamCourseMainTopTen getExamCourseMainTop10(@RequestParam Long projectId,
@@ -69,11 +70,13 @@ public class ExamCourseDataReportController extends ControllerSupport {
 		if (!ReportStatus.SUCCESS.equals(pe.getReportStatus())) {
 			throw new StatusException("100024", "只能查看报表计算成功的项目");
 		}
-		return examCourseDataReportService.getExamOrgMainTop10(projectId, examId);
+		return examCourseDataReportService.getExamCourseMainTop10(projectId, examId);
 	}
+
 	@ApiOperation(value = "导出数据")
 	@GetMapping(value = "/export")
-	public void exportAll(@RequestParam Long projectId, @RequestParam(required = false) Long examId,HttpServletResponse response) {
+	public void exportAll(@RequestParam Long projectId, @RequestParam(required = false) Long examId,
+			HttpServletResponse response) {
 		if (projectId == null) {
 			throw new StatusException("100031", "projectId不能为空");
 		}
@@ -88,6 +91,6 @@ public class ExamCourseDataReportController extends ControllerSupport {
 		if (!ReportStatus.SUCCESS.equals(pe.getReportStatus())) {
 			throw new StatusException("100034", "只能导出报表计算成功的项目");
 		}
-		examCourseDataReportService.exportAll(pe,examId, response);
+		examCourseDataReportService.exportAll(pe, examId, response);
 	}
 }

+ 3 - 3
examcloud-core-reports-base/src/main/java/cn/com/qmth/examcloud/core/reports/base/bean/ExamCourseMainTopTen.java

@@ -46,7 +46,7 @@ public class ExamCourseMainTopTen {
 	@ApiModelProperty(value = "及格/实考人数比例前十")
 	private List<ExamCourseReportMainBean> passParticipantRatioDesc;
 	@ApiModelProperty(value = "分段人数")
-	private List<PartitionTopTen<ExamCourseReportMainBean>> partition;
+	private List<PartitionTopTen<PartitionDataBean>> partition;
 	public List<ExamCourseReportMainBean> getParticipant() {
 		return participant;
 	}
@@ -83,10 +83,10 @@ public class ExamCourseMainTopTen {
 	public void setPassDesc(List<ExamCourseReportMainBean> passDesc) {
 		this.passDesc = passDesc;
 	}
-	public List<PartitionTopTen<ExamCourseReportMainBean>> getPartition() {
+	public List<PartitionTopTen<PartitionDataBean>> getPartition() {
 		return partition;
 	}
-	public void setPartition(List<PartitionTopTen<ExamCourseReportMainBean>> partition) {
+	public void setPartition(List<PartitionTopTen<PartitionDataBean>> partition) {
 		this.partition = partition;
 	}
 	public List<ExamCourseReportMainBean> getParticipantRatio() {

+ 8 - 0
examcloud-core-reports-base/src/main/java/cn/com/qmth/examcloud/core/reports/base/bean/PartitionDataBean.java

@@ -7,6 +7,8 @@ public class PartitionDataBean {
 	private String examName;
 	@ApiModelProperty(value = "中心名称")
 	private String orgName;
+	@ApiModelProperty(value = "课程名称")
+	private String courseName;
 	@ApiModelProperty(value = "分段人数")
 	private Long count;
 	@ApiModelProperty(value = "分段人数报名占比(%)")
@@ -43,5 +45,11 @@ public class PartitionDataBean {
 	public void setOrgName(String orgName) {
 		this.orgName = orgName;
 	}
+	public String getCourseName() {
+		return courseName;
+	}
+	public void setCourseName(String courseName) {
+		this.courseName = courseName;
+	}
 	
 }

+ 1 - 1
examcloud-core-reports-service/src/main/java/cn/com/qmth/examcloud/core/reports/service/ExamCourseDataReportService.java

@@ -14,6 +14,6 @@ public interface ExamCourseDataReportService {
 	public void saveExamCourseDataReportList(List<ExamCourseDataReportBean> beans);
 	public void deleteByProject(Long projectId,Long rootOrgId);
 	public List<ExamCourseReportMainBean> getExamCourseMainList(Long projectId, Long examId);
-	public ExamCourseMainTopTen getExamOrgMainTop10(Long projectId, Long examId);
+	public ExamCourseMainTopTen getExamCourseMainTop10(Long projectId, Long examId);
 	public void exportAll(ProjectEntity pe, Long examId, HttpServletResponse response);
 }

+ 72 - 22
examcloud-core-reports-service/src/main/java/cn/com/qmth/examcloud/core/reports/service/impl/ExamCourseDataReportServiceImpl.java

@@ -119,7 +119,7 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 	}
 
 	@Override
-	public ExamCourseMainTopTen getExamOrgMainTop10(Long projectId, Long examId) {
+	public ExamCourseMainTopTen getExamCourseMainTop10(Long projectId, Long examId) {
 		ExamCourseMainTopTen ret = new ExamCourseMainTopTen();
 		List<ExamCourseReportMainBean> list = getExamCourseMainList(projectId, examId);
 		if (list != null && list.size() > 0) {
@@ -293,9 +293,17 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 
 			@Override
 			public int compare(ExamCourseReportMainBean o1, ExamCourseReportMainBean o2) {
-				if (o1.getPassParticipantRatio() > o2.getPassParticipantRatio()) {
+				Double d1=o1.getPassParticipantRatio();
+				Double d2=o2.getPassParticipantRatio();
+				if(d1==null) {
+					d1=0d;
+				}
+				if(d2==null) {
+					d2=0d;
+				}
+				if (d1 > d2) {
 					return 1 - ascOrDesc;
-				} else if (o1.getPassParticipantRatio() < o2.getPassParticipantRatio()) {
+				} else if (d1 < d2) {
 					return -1 + ascOrDesc;
 				} else {
 					return 0;
@@ -310,11 +318,11 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 		}
 	}
 
-	private List<PartitionTopTen<ExamCourseReportMainBean>> getPartitionSort(List<ExamCourseReportMainBean> list) {
-		List<PartitionTopTen<ExamCourseReportMainBean>> ret = new ArrayList<PartitionTopTen<ExamCourseReportMainBean>>();
+	private List<PartitionTopTen<PartitionDataBean>> getPartitionSort(List<ExamCourseReportMainBean> list) {
+		List<PartitionTopTen<PartitionDataBean>> ret = new ArrayList<PartitionTopTen<PartitionDataBean>>();
 		int size = list.get(0).getPartitionData().size();
 		for (int i = 0; i < size; i++) {
-			PartitionTopTen<ExamCourseReportMainBean> pt = new PartitionTopTen<ExamCourseReportMainBean>();
+			PartitionTopTen<PartitionDataBean> pt = new PartitionTopTen<PartitionDataBean>();
 			pt.setCountAsc(getPartitionCountSort(list, i, asc));
 			pt.setCountDesc(getPartitionCountSort(list, i, desc));
 			pt.setSignRatioAsc(getPartitionSignRatioSort(list, i, asc));
@@ -326,7 +334,7 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 		return ret;
 	}
 
-	private List<ExamCourseReportMainBean> getPartitionCountSort(List<ExamCourseReportMainBean> list, int index,
+	private List<PartitionDataBean> getPartitionCountSort(List<ExamCourseReportMainBean> list, int index,
 			int ascOrDesc) {
 		List<ExamCourseReportMainBean> ret = new ArrayList<ExamCourseReportMainBean>(list);
 		Collections.sort(ret, new Comparator<ExamCourseReportMainBean>() {
@@ -346,13 +354,13 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 
 		});
 		if (ret.size() > 10) {
-			return ret.subList(0, 10);
+			return of(ret.subList(0, 10),index);
 		} else {
-			return ret;
+			return of(ret,index);
 		}
 	}
 
-	private List<ExamCourseReportMainBean> getPartitionSignRatioSort(List<ExamCourseReportMainBean> list, int index,
+	private List<PartitionDataBean> getPartitionSignRatioSort(List<ExamCourseReportMainBean> list, int index,
 			int ascOrDesc) {
 		List<ExamCourseReportMainBean> ret = new ArrayList<ExamCourseReportMainBean>(list);
 		Collections.sort(ret, new Comparator<ExamCourseReportMainBean>() {
@@ -372,13 +380,13 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 
 		});
 		if (ret.size() > 10) {
-			return ret.subList(0, 10);
+			return of(ret.subList(0, 10),index);
 		} else {
-			return ret;
+			return of(ret,index);
 		}
 	}
 
-	private List<ExamCourseReportMainBean> getPartitionParticipantRatioSort(List<ExamCourseReportMainBean> list,
+	private List<PartitionDataBean> getPartitionParticipantRatioSort(List<ExamCourseReportMainBean> list,
 			int index, int ascOrDesc) {
 		List<ExamCourseReportMainBean> ret = new ArrayList<ExamCourseReportMainBean>(list);
 		Collections.sort(ret, new Comparator<ExamCourseReportMainBean>() {
@@ -387,6 +395,12 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 			public int compare(ExamCourseReportMainBean o1, ExamCourseReportMainBean o2) {
 				Double c1 = o1.getPartitionData().get(index).getParticipantRatio();
 				Double c2 = o2.getPartitionData().get(index).getParticipantRatio();
+				if(c1==null) {
+					c1=0d;
+				}
+				if(c2==null) {
+					c2=0d;
+				}
 				if (c1 > c2) {
 					return 1 - ascOrDesc;
 				} else if (c1 < c2) {
@@ -398,21 +412,41 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 
 		});
 		if (ret.size() > 10) {
-			return ret.subList(0, 10);
+			return of(ret.subList(0, 10),index);
 		} else {
-			return ret;
+			return of(ret,index);
 		}
 	}
-
+	private List<PartitionDataBean> of(List<ExamCourseReportMainBean> list, int index) {
+		List<PartitionDataBean> ret = new ArrayList<PartitionDataBean>();
+		for(ExamCourseReportMainBean b:list) {
+			PartitionDataBean pb=new PartitionDataBean();
+			pb.setCount(b.getPartitionData().get(index).getCount());
+			pb.setParticipantRatio(b.getPartitionData().get(index).getParticipantRatio());
+			pb.setSignRatio(b.getPartitionData().get(index).getSignRatio());
+			pb.setCourseName(b.getCourseName());
+			pb.setExamName(b.getExamName());
+			ret.add(pb);
+		}
+		return ret;
+	}
 	private List<ExamCourseReportMainBean> getDifficultyDegreeSort(List<ExamCourseReportMainBean> list, int ascOrDesc) {
 		List<ExamCourseReportMainBean> ret = new ArrayList<ExamCourseReportMainBean>(list);
 		Collections.sort(ret, new Comparator<ExamCourseReportMainBean>() {
 
 			@Override
 			public int compare(ExamCourseReportMainBean o1, ExamCourseReportMainBean o2) {
-				if (o1.getAvgDifficultyDegree() > o2.getAvgDifficultyDegree()) {
+				Double d1=o1.getAvgDifficultyDegree();
+				Double d2=o2.getAvgDifficultyDegree();
+				if(d1==null) {
+					d1=0d;
+				}
+				if(d2==null) {
+					d2=0d;
+				}
+				if (d1 > d2) {
 					return 1 - ascOrDesc;
-				} else if (o1.getAvgDifficultyDegree() < o2.getAvgDifficultyDegree()) {
+				} else if (d1 < d2) {
 					return -1 + ascOrDesc;
 				} else {
 					return 0;
@@ -432,9 +466,17 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 
 			@Override
 			public int compare(ExamCourseReportMainBean o1, ExamCourseReportMainBean o2) {
-				if (o1.getStd() > o2.getStd()) {
+				Double d1=o1.getStd();
+				Double d2=o2.getStd();
+				if(d1==null) {
+					d1=0d;
+				}
+				if(d2==null) {
+					d2=0d;
+				}
+				if (d1 > d2) {
 					return 1 - ascOrDesc;
-				} else if (o1.getStd() < o2.getStd()) {
+				} else if (d1 < d2) {
 					return -1 + ascOrDesc;
 				} else {
 					return 0;
@@ -454,9 +496,17 @@ public class ExamCourseDataReportServiceImpl implements ExamCourseDataReportServ
 
 			@Override
 			public int compare(ExamCourseReportMainBean o1, ExamCourseReportMainBean o2) {
-				if (o1.getCdi() > o2.getCdi()) {
+				Double d1=o1.getCdi();
+				Double d2=o2.getCdi();
+				if(d1==null) {
+					d1=0d;
+				}
+				if(d2==null) {
+					d2=0d;
+				}
+				if (d1 > d2) {
 					return 1 - ascOrDesc;
-				} else if (o1.getCdi() < o2.getCdi()) {
+				} else if (d1 < d2) {
 					return -1 + ascOrDesc;
 				} else {
 					return 0;