|
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
-import com.qmth.boot.api.exception.ApiException;
|
|
|
|
import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
@@ -20,7 +19,6 @@ import com.qmth.teachcloud.report.business.entity.*;
|
|
import com.qmth.teachcloud.report.business.enums.AssignEnum;
|
|
import com.qmth.teachcloud.report.business.enums.AssignEnum;
|
|
import com.qmth.teachcloud.report.business.mapper.*;
|
|
import com.qmth.teachcloud.report.business.mapper.*;
|
|
import com.qmth.teachcloud.report.business.service.TBExamStudentService;
|
|
import com.qmth.teachcloud.report.business.service.TBExamStudentService;
|
|
-import io.swagger.annotations.Api;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -30,11 +28,13 @@ import org.springframework.web.multipart.MultipartFile;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -68,6 +68,15 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
|
|
@Resource
|
|
@Resource
|
|
TAExamCourseRecordDioMapper taExamCourseRecordDioMapper;
|
|
TAExamCourseRecordDioMapper taExamCourseRecordDioMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ TAExamCourseRecordModMapper taExamCourseRecordModMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TBModuleConfigMapper tbModuleConfigMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TBModuleProficiencyMapper tbModuleProficiencyMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询开课学院列表
|
|
* 查询开课学院列表
|
|
*
|
|
*
|
|
@@ -291,19 +300,88 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
|
|
}
|
|
}
|
|
diagnosisResult.setAssignedScore(isAssignedScore);
|
|
diagnosisResult.setAssignedScore(isAssignedScore);
|
|
double passScore = papers.get(0).getPassScore().doubleValue();
|
|
double passScore = papers.get(0).getPassScore().doubleValue();
|
|
- boolean result = examCourseRecords.get(0).getAssignedScore().doubleValue() >=passScore;
|
|
|
|
|
|
+ boolean result = examCourseRecords.get(0).getAssignedScore().doubleValue() >= passScore;
|
|
diagnosisResult.setResult(result);
|
|
diagnosisResult.setResult(result);
|
|
|
|
|
|
// 模块
|
|
// 模块
|
|
QueryWrapper<TAExamCourseRecordDio> examCourseRecordDioQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TAExamCourseRecordDio> examCourseRecordDioQueryWrapper = new QueryWrapper<>();
|
|
examCourseRecordDioQueryWrapper.lambda().eq(TAExamCourseRecordDio::getSchoolId, schoolId).eq(TAExamCourseRecordDio::getExamId, examId).eq(TAExamCourseRecordDio::getCourseCode, courseCode);
|
|
examCourseRecordDioQueryWrapper.lambda().eq(TAExamCourseRecordDio::getSchoolId, schoolId).eq(TAExamCourseRecordDio::getExamId, examId).eq(TAExamCourseRecordDio::getCourseCode, courseCode);
|
|
List<TAExamCourseRecordDio> examCourseRecordDios = taExamCourseRecordDioMapper.selectList(examCourseRecordDioQueryWrapper);
|
|
List<TAExamCourseRecordDio> examCourseRecordDios = taExamCourseRecordDioMapper.selectList(examCourseRecordDioQueryWrapper);
|
|
- Set<String> moduleNames = examCourseRecordDios.stream().map(m->m.getDimensionType()).collect(Collectors.toSet());
|
|
|
|
|
|
+ Set<String> moduleNames = examCourseRecordDios.stream().map(m -> m.getDimensionType()).collect(Collectors.toSet());
|
|
|
|
+ List<DiagnosisDetailResult> diagnosisDetailResults = new ArrayList<>();
|
|
for (String moduleName : moduleNames) {
|
|
for (String moduleName : moduleNames) {
|
|
|
|
+ DiagnosisDetailResult diagnosisDetailResult = new DiagnosisDetailResult();
|
|
|
|
+ diagnosisDetailResult.setName(moduleName);
|
|
QueryWrapper<TAExamCourseRecordMod> examCourseRecordModQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TAExamCourseRecordMod> examCourseRecordModQueryWrapper = new QueryWrapper<>();
|
|
examCourseRecordModQueryWrapper.lambda().eq(TAExamCourseRecordMod::getSchoolId, schoolId).eq(TAExamCourseRecordMod::getExamId, examId).eq(TAExamCourseRecordMod::getStudentCode, studentCode).eq(TAExamCourseRecordMod::getCourseCode, courseCode);
|
|
examCourseRecordModQueryWrapper.lambda().eq(TAExamCourseRecordMod::getSchoolId, schoolId).eq(TAExamCourseRecordMod::getExamId, examId).eq(TAExamCourseRecordMod::getStudentCode, studentCode).eq(TAExamCourseRecordMod::getCourseCode, courseCode);
|
|
|
|
+ List<TAExamCourseRecordMod> examCourseRecordMods = taExamCourseRecordModMapper.selectList(examCourseRecordModQueryWrapper);
|
|
|
|
+ if (examCourseRecordMods.size() != 1) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("获取数据异常,应该有且仅有一条数据");
|
|
|
|
+ }
|
|
|
|
+ TAExamCourseRecordMod taExamCourseRecordMod = examCourseRecordMods.get(0);
|
|
|
|
+ String levelCode = taExamCourseRecordMod.getLevel();
|
|
|
|
+
|
|
|
|
+ QueryWrapper<TBModuleConfig> moduleConfigQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ moduleConfigQueryWrapper.lambda().eq(TBModuleConfig::getExamId, examId).eq(TBModuleConfig::getCourseCode, courseCode).eq(TBModuleConfig::getLevelCode, levelCode).eq(TBModuleConfig::getModuleType, moduleName);
|
|
|
|
+ List<TBModuleConfig> moduleConfigs = tbModuleConfigMapper.selectList(moduleConfigQueryWrapper);
|
|
|
|
+ if (moduleConfigs.size() != 1) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("获取数据异常,应该有且仅有一条数据");
|
|
|
|
+ }
|
|
|
|
+ diagnosisDetailResult.setResult(moduleConfigs.get(0).getResult());
|
|
|
|
+ diagnosisDetailResult.setAdvice(moduleConfigs.get(0).getAdvice());
|
|
|
|
+
|
|
|
|
+ QueryWrapper<TBModuleProficiency> moduleProficiencyQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ moduleProficiencyQueryWrapper.lambda().eq(TBModuleProficiency::getExamId, examId).eq(TBModuleProficiency::getCourseCode, courseCode).eq(TBModuleProficiency::getModuleType, moduleName);
|
|
|
|
+ List<TBModuleProficiency> moduleProficiencies = tbModuleProficiencyMapper.selectList(moduleProficiencyQueryWrapper);
|
|
|
|
+ List<TBModuleProficiency> moduleProficiencieTemps = moduleProficiencies.stream().flatMap(e -> {
|
|
|
|
+ TBModuleProficiency tbModuleProficiency = new TBModuleProficiency();
|
|
|
|
+ tbModuleProficiency.setExamId(e.getExamId());
|
|
|
|
+ tbModuleProficiency.setCourseCode(e.getCourseCode());
|
|
|
|
+ tbModuleProficiency.setModuleType(e.getModuleType());
|
|
|
|
+ tbModuleProficiency.setInterpret(e.getInterpret());
|
|
|
|
+ return Stream.of(tbModuleProficiency);
|
|
|
|
+ }).distinct().collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ if (moduleProficiencieTemps.size() != 1) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("获取数据异常,应该有且仅有一条数据");
|
|
|
|
+ }
|
|
|
|
+ ModuleResult moduleResult = new ModuleResult();
|
|
|
|
+ TBModuleProficiency tbModuleProficiency = moduleProficiencieTemps.get(0);
|
|
|
|
+ String info = tbModuleProficiency.getModuleType().concat(":").concat(tbModuleProficiency.getInterpret());
|
|
|
|
+ moduleResult.setInfo(info);
|
|
|
|
+
|
|
|
|
+ List<ModuleDetailResult> dios = taExamCourseRecordDioMapper.listDiosBySchoolIdAndExamIdAndCourseCodeAndModuleName(schoolId, examId, courseCode, moduleName);
|
|
|
|
+ moduleResult.setDios(dios);
|
|
|
|
+ diagnosisDetailResult.setModules(moduleResult);
|
|
|
|
+
|
|
|
|
+ DimensionResult dimensionResult = new DimensionResult();
|
|
|
|
+ dimensionResult.setMyScore(taExamCourseRecordMod.getTotalScore().setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
|
+ dimensionResult.setMasteryRate(taExamCourseRecordMod.getScoreRate().multiply(new BigDecimal("100")).setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
|
+ dimensionResult.setDioFullScore(taExamCourseRecordMod.getFullScore().setScale(1, BigDecimal.ROUND_HALF_UP));
|
|
|
|
+
|
|
|
|
+ List<DimensionDetailResult> subDios = taExamCourseRecordDioMapper.listSubDiosBySchoolIdAndExamIdAndStudentCodeAndCourseCodeAndModuleName(schoolId, examId, studentCode, courseCode, moduleName);
|
|
|
|
+ dimensionResult.setSubDios(subDios);
|
|
|
|
+
|
|
|
|
+ List<DimensionMasterysResult> dimensionMasterysResults = new ArrayList<>();
|
|
|
|
+ List<String> defines = new ArrayList<>();
|
|
|
|
+ for (TBModuleProficiency moduleProficiency : moduleProficiencies) {
|
|
|
|
+ DimensionMasterysResult dimensionMasterysResult = new DimensionMasterysResult();
|
|
|
|
+ dimensionMasterysResult.setLevel(moduleProficiency.getLevel());
|
|
|
|
+ List<Double> grades = new ArrayList<>();
|
|
|
|
+ grades.add(Double.valueOf(moduleProficiency.getMin()));
|
|
|
|
+ grades.add(Double.valueOf(moduleProficiency.getMax()));
|
|
|
|
+ dimensionMasterysResult.setGrade(grades);
|
|
|
|
+ dimensionMasterysResults.add(dimensionMasterysResult);
|
|
|
|
+ defines.add(moduleProficiency.getDefine());
|
|
|
|
+ }
|
|
|
|
+ dimensionResult.setDefine(defines);
|
|
|
|
+ dimensionResult.setMasterys(dimensionMasterysResults);
|
|
|
|
+ diagnosisDetailResult.setDetail(dimensionResult);
|
|
|
|
+ diagnosisDetailResults.add(diagnosisDetailResult);
|
|
}
|
|
}
|
|
- return null;
|
|
|
|
|
|
+ diagnosisResult.setList(diagnosisDetailResults);
|
|
|
|
+ collegeResult.setDiagnosis(diagnosisResult);
|
|
|
|
+ return collegeResult;
|
|
}
|
|
}
|
|
|
|
|
|
private ExamStudentResult buildExamStudentResult(String schoolId, String examId, String studentCode, String courseCode) {
|
|
private ExamStudentResult buildExamStudentResult(String schoolId, String examId, String studentCode, String courseCode) {
|