|
@@ -5,13 +5,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import com.qmth.teachcloud.report.business.bean.result.TAExamCourseResult;
|
|
|
import com.qmth.teachcloud.report.business.entity.TAExamCourse;
|
|
|
+import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
|
|
|
import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.SemesterEnum;
|
|
|
import com.qmth.teachcloud.report.business.mapper.TAExamCourseMapper;
|
|
|
+import com.qmth.teachcloud.report.business.mapper.TAExamCourseRecordMapper;
|
|
|
import com.qmth.teachcloud.report.business.service.TAExamCourseService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -30,6 +35,9 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
@Resource
|
|
|
TAExamCourseMapper taExamCourseMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TAExamCourseRecordMapper taExamCourseRecordMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 开课课程考试总览列表接口
|
|
|
*
|
|
@@ -50,6 +58,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
return taExamCourseMapper.getOverview(schoolId, semester, examId, courseCode);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 赋分管理列表接口
|
|
|
*
|
|
@@ -70,10 +79,33 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
// 不及格率
|
|
|
- Map<String, String > scoreAndRate = taExamCourseMapper.getScoreAndRate(schoolId, semester, examId, courseCode);
|
|
|
+ Map<String, String> scoreAndRate = taExamCourseMapper.getScoreAndRate(schoolId, semester, examId, courseCode);
|
|
|
map.put("scoreAndRate", scoreAndRate);
|
|
|
- // 成绩正态分布 todo
|
|
|
-
|
|
|
+ // 成绩正态分布
|
|
|
+ String[] strings = {"90~100", "80~89", "70~79", "60~69", "55~59", "1~54"};
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ for (String string : strings) {
|
|
|
+ String[] str = string.split("~");
|
|
|
+ double startScore = Double.parseDouble(str[0]);
|
|
|
+ double endScore = Double.parseDouble(str[1]);
|
|
|
+ List<TAExamCourseRecord> taExamCourseRecords = taExamCourseRecordMapper.listExamCourseRecord(schoolId, semester, examId, courseCode);
|
|
|
+ // 全部有效人数
|
|
|
+ int totalRealityCount = taExamCourseRecords.size();
|
|
|
+ // 本分数段人数
|
|
|
+ long totalScoreCount = taExamCourseRecords.stream().filter(m -> m.getAssignedScore().doubleValue() >= startScore && m.getAssignedScore().doubleValue() <= endScore).count();
|
|
|
+ // 应届有效人数
|
|
|
+ long totalCurrentCount = taExamCourseRecords.stream().filter(m -> m.getCurrent() == 1).count();
|
|
|
+ // 本分数段应届有效人数
|
|
|
+ long totalScoreCurrentCount = taExamCourseRecords.stream().filter(m -> m.getCurrent() == 1 && m.getAssignedScore().doubleValue() >= startScore && m.getAssignedScore().doubleValue() <= endScore).count();
|
|
|
+ Map<String, Object> objectMap = new HashMap<>();
|
|
|
+ objectMap.put("scores", String.join(",", str));
|
|
|
+ objectMap.put("totalRealityCount", totalRealityCount);
|
|
|
+ objectMap.put("totalRate", totalRealityCount == 0 ? 0 : new BigDecimal(totalScoreCount).divide(new BigDecimal(totalRealityCount), 2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ objectMap.put("currentRealityCount", totalCurrentCount);
|
|
|
+ objectMap.put("totalRate", totalCurrentCount == 0 ? 0 : new BigDecimal(totalScoreCurrentCount).divide(new BigDecimal(totalCurrentCount), 2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ mapList.add(objectMap);
|
|
|
+ }
|
|
|
+ map.put("grades", mapList);
|
|
|
return map;
|
|
|
}
|
|
|
}
|