|
@@ -4,6 +4,7 @@ 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.*;
|
|
|
+import com.qmth.teachcloud.report.business.entity.TBCommonLevelConfig;
|
|
|
import com.qmth.teachcloud.report.business.entity.TBPaper;
|
|
|
import com.qmth.teachcloud.report.business.enums.GradeScopeEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.PiecewiseScopeEnum;
|
|
@@ -15,7 +16,10 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -41,6 +45,15 @@ public class ReportCommonServiceImpl implements ReportCommonService {
|
|
|
@Resource
|
|
|
TBDimensionService tbDimensionService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TBCommonLevelConfigService tbCommonLevelConfigService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBPaperStructService tbPaperStructService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBAnswerService tbAnswerService;
|
|
|
+
|
|
|
/**
|
|
|
* 学院学科报表查询科目信息
|
|
|
*
|
|
@@ -235,4 +248,67 @@ public class ReportCommonServiceImpl implements ReportCommonService {
|
|
|
}
|
|
|
return new DimensionAnalyzeResult(dimensionAnalyzeList);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查找题目相关
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param courseCode
|
|
|
+ * @param collegeId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public QuestionInfoResult findSituationOfQuestions(Long examId, String courseCode, Long collegeId) {
|
|
|
+ //查找难易度
|
|
|
+ QueryWrapper<TBCommonLevelConfig> tbCommonLevelConfigQueryWrapper = new QueryWrapper<>();
|
|
|
+ tbCommonLevelConfigQueryWrapper.lambda().eq(TBCommonLevelConfig::getExamId, examId)
|
|
|
+ .eq(TBCommonLevelConfig::getCourseCode, courseCode)
|
|
|
+ .eq(TBCommonLevelConfig::getLevelType, "难度等级");
|
|
|
+ List<TBCommonLevelConfig> configLevelDatasource = tbCommonLevelConfigService.list(tbCommonLevelConfigQueryWrapper);
|
|
|
+ //查找试卷结构
|
|
|
+ List<TBPaperStructResult> questionDatasource = tbPaperStructService.findQuestionInfo(examId, courseCode);
|
|
|
+ //查找答题记录
|
|
|
+ List<TBAnswerResult> answerDetailDatasource = tbAnswerService.findValidAnswerDetail(examId, courseCode);
|
|
|
+ Set<String> paperTypeList = questionDatasource.stream().map(e -> e.getPaperType()).collect(Collectors.toSet());
|
|
|
+ List<PaperTypeResult> questionInfoList = new ArrayList<>();
|
|
|
+ for (String paperType : paperTypeList) {
|
|
|
+ List<CellResult> cellList = new ArrayList<>();
|
|
|
+ for (TBCommonLevelConfig tbCommonLevelConfig : configLevelDatasource) {
|
|
|
+ String interpret = tbCommonLevelConfig.getInterpret();
|
|
|
+ String scope = tbCommonLevelConfig.getScope();
|
|
|
+
|
|
|
+ Integer count = questionDatasource.parallelStream()
|
|
|
+ .filter(e -> paperType.equals(e.getPaperType()) && interpret.equals(e.getDifficult()))
|
|
|
+ .collect(Collectors.toList()).size(); // 题目信息
|
|
|
+ List<TBAnswerResult> answerDetailForSch = answerDetailDatasource.parallelStream()
|
|
|
+ .filter(e -> paperType.equals(e.getPaperType()) && interpret.equals(e.getDifficult()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ double colAvgScoreRate = answerDetailForSch.parallelStream()
|
|
|
+ .filter(e -> collegeId.longValue() == e.getCollegeId()).collect(Collectors.toList())
|
|
|
+ .parallelStream().collect(Collectors.averagingDouble(s -> s.getScoreRate()));
|
|
|
+ double schAvgScoreRate = answerDetailForSch.parallelStream()
|
|
|
+ .collect(Collectors.averagingDouble(e -> e.getScoreRate()));
|
|
|
+
|
|
|
+ // 得分率保留2位小数处理
|
|
|
+ colAvgScoreRate = MathUtil.formatDouble2(colAvgScoreRate * 100);
|
|
|
+ schAvgScoreRate = MathUtil.formatDouble2(schAvgScoreRate * 100);
|
|
|
+ cellList.add(new CellResult(interpret, scope, colAvgScoreRate, schAvgScoreRate, count));
|
|
|
+ }
|
|
|
+ questionInfoList.add(new PaperTypeResult(paperType, cellList));
|
|
|
+ }
|
|
|
+ return new QuestionInfoResult(questionInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查找老师信息
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param courseCode
|
|
|
+ * @param collegeId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Object findTeacherInfo(Long examId, String courseCode, Long collegeId) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|