|
@@ -1,8 +1,25 @@
|
|
package com.qmth.teachcloud.report.business.service.impl;
|
|
package com.qmth.teachcloud.report.business.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.google.gson.Gson;
|
|
|
|
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
|
+import com.qmth.teachcloud.report.business.bean.result.CourseInfoResult;
|
|
|
|
+import com.qmth.teachcloud.report.business.bean.result.DescriptiveStatisticsResult;
|
|
|
|
+import com.qmth.teachcloud.report.business.bean.result.TAExamCourseCollegeInspectResult;
|
|
|
|
+import com.qmth.teachcloud.report.business.bean.result.TBPaperInfoResult;
|
|
|
|
+import com.qmth.teachcloud.report.business.entity.TBPaper;
|
|
import com.qmth.teachcloud.report.business.service.ReportCommonService;
|
|
import com.qmth.teachcloud.report.business.service.ReportCommonService;
|
|
|
|
+import com.qmth.teachcloud.report.business.service.TAExamCourseCollegeInspectService;
|
|
|
|
+import com.qmth.teachcloud.report.business.service.TBPaperService;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Set;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @Description: 教研公共服务
|
|
* @Description: 教研公共服务
|
|
* @Param:
|
|
* @Param:
|
|
@@ -12,4 +29,60 @@ import org.springframework.stereotype.Service;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class ReportCommonServiceImpl implements ReportCommonService {
|
|
public class ReportCommonServiceImpl implements ReportCommonService {
|
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(ReportCommonServiceImpl.class);
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TBPaperService tbPaperService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TAExamCourseCollegeInspectService taExamCourseCollegeInspectService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 学院学科报表查询科目信息
|
|
|
|
+ *
|
|
|
|
+ * @param examId
|
|
|
|
+ * @param courseCode
|
|
|
|
+ * @param collegeId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public CourseInfoResult findCourseInfo(Long examId, String courseCode, Long collegeId) {
|
|
|
|
+ //查找试卷
|
|
|
|
+ QueryWrapper<TBPaper> tbPaperQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ tbPaperQueryWrapper.lambda().eq(TBPaper::getExamId, examId)
|
|
|
|
+ .eq(TBPaper::getCourseCode, courseCode);
|
|
|
|
+ List<TBPaper> tbPaperList = tbPaperService.list(tbPaperQueryWrapper);
|
|
|
|
+
|
|
|
|
+ //查找学院科目维度
|
|
|
|
+ List<TAExamCourseCollegeInspectResult> taExamCourseCollegeInspectResultList = taExamCourseCollegeInspectService.findCourseDescriptiveStatisticsForCollege(examId, courseCode);
|
|
|
|
+ //查找学校科目维度
|
|
|
|
+ List<TAExamCourseCollegeInspectResult> taExamCourseSchoolInspectResultList = taExamCourseCollegeInspectService.findCourseDescriptiveStatisticsForSchool(examId, courseCode);
|
|
|
|
+
|
|
|
|
+ // 课程概况
|
|
|
|
+ if (tbPaperList.size() < 1) {
|
|
|
|
+ throw ExceptionResultEnum.NO_DATA.exception();
|
|
|
|
+ }
|
|
|
|
+ Set<String> paperTypeSet = tbPaperList.stream().map(e -> e.getPaperType()).collect(Collectors.toSet());
|
|
|
|
+ String paperType = String.join(",", paperTypeSet); // 多种试卷类型的试卷类型合并','号隔开
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
+ TBPaperInfoResult TBPaperInfoResult = gson.fromJson(gson.toJson(tbPaperList.get(0)), TBPaperInfoResult.class);
|
|
|
|
+ TBPaperInfoResult.setPaperType(paperType);
|
|
|
|
+ TBPaperInfoResult.setCollegeCount(taExamCourseCollegeInspectResultList.size());
|
|
|
|
+
|
|
|
|
+ // 学院该科目的描述统计
|
|
|
|
+ List<TAExamCourseCollegeInspectResult> collegeDescriptiveStatisticsList = taExamCourseCollegeInspectResultList
|
|
|
|
+ .stream().filter(e -> collegeId.intValue() == e.getCollegeId().intValue()).collect(Collectors.toList());
|
|
|
|
+ if (collegeDescriptiveStatisticsList.size() != 1) {
|
|
|
|
+ throw ExceptionResultEnum.DATA_COUNT_EXCEPTION.exception();
|
|
|
|
+ }
|
|
|
|
+ TAExamCourseCollegeInspectResult collegeDescriptiveStatistics = taExamCourseCollegeInspectResultList.get(0);
|
|
|
|
+
|
|
|
|
+ // 全校该科目的描述统计
|
|
|
|
+ if (taExamCourseSchoolInspectResultList.size() != 1) {
|
|
|
|
+ throw ExceptionResultEnum.DATA_COUNT_EXCEPTION.exception();
|
|
|
|
+ }
|
|
|
|
+ TAExamCourseCollegeInspectResult schoolDescriptiveStatistics = taExamCourseSchoolInspectResultList.get(0);
|
|
|
|
+ DescriptiveStatisticsResult descriptiveStatisticsResult = new DescriptiveStatisticsResult(collegeDescriptiveStatistics, schoolDescriptiveStatistics);
|
|
|
|
+ return new CourseInfoResult(TBPaperInfoResult, descriptiveStatisticsResult);
|
|
|
|
+ }
|
|
}
|
|
}
|