|
@@ -191,9 +191,12 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
double classZf = 0D;
|
|
|
//获取各科成绩满分
|
|
|
List<ScoreDataMfBo> scoreDataMfBoList = bo.getScoreDataMfBoList();
|
|
|
+ //组装一个学科 满分的MAP
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
if (scoreDataMfBoList != null && scoreDataMfBoList.size() > 0) {
|
|
|
for (ScoreDataMfBo scoreDataMfBo : scoreDataMfBoList) {
|
|
|
scoreDataMfBo.setScoreId(scoreId);
|
|
|
+ map.put(scoreDataMfBo.getXueke(),scoreDataMfBo.getManfen());
|
|
|
}
|
|
|
scoreDataMfMapper.insertBatch(MapstructUtils.convert(scoreDataMfBoList, org.dromara.system.domain.score.ScoreDataMf.class));
|
|
|
}
|
|
@@ -211,6 +214,8 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
scoreDataDetailBo.setScoreId(scoreId);
|
|
|
scoreDataDetailBo.setScoreDataName(scoreDataStudentBo.getScoreDataName());
|
|
|
scoreDataDetailBo.setScoreDataNameId(scoreDataStudentBo.getScoreDataNameId());
|
|
|
+ //插入满分
|
|
|
+ scoreDataDetailBo.setManfen(map.get(scoreDataDetailBo.getXueke()));
|
|
|
}
|
|
|
classZf = classZf + zf;
|
|
|
scoreDataStudentBo.setZongfen(zf);
|
|
@@ -429,6 +434,62 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
return scoreDataStudentVos;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 后台首页成绩统计列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<ScoreDataStudentVo> indexList(ScoreData scoreData) {
|
|
|
+ //可以搜索学生姓名&选择班级进行年级排名
|
|
|
+ //接收考试时间和考试类型,所有考试时间相同的
|
|
|
+ String scoreClassName = scoreData.getScoreClassName();
|
|
|
+ //截取两位年级
|
|
|
+ String grade = scoreClassName.substring(0, 2);
|
|
|
+ scoreData.setScoreClassName(grade);
|
|
|
+ //先去获取所有的考试学生
|
|
|
+ //获取年级所有学生排名
|
|
|
+ List<ScoreDataStudentVo> scoreDataStudentVos = scoreDataStudentMapper.gradeRank(scoreData);
|
|
|
+ Long scoreId = scoreData.getScoreId();
|
|
|
+ Map<String,Double> map = new HashMap<>();
|
|
|
+ if (scoreId != null){
|
|
|
+ //过滤出本班学生id
|
|
|
+ scoreDataStudentVos = scoreDataStudentVos.stream().filter(scoreDataStudentVo -> scoreDataStudentVo.getScoreId().equals(scoreId)).sorted(Comparator.comparing(ScoreDataStudentVo::getZongfen)).collect(Collectors.toList());
|
|
|
+ //去查询对应学生的具体学科成绩/计算学科平均分
|
|
|
+ //获取所有学生id
|
|
|
+ List<Long> scoreDataNameIds = scoreDataStudentVos.stream().map(ScoreDataStudentVo::getScoreDataNameId).collect(Collectors.toList());
|
|
|
+ List<ScoreDataDetailVo> scoreDataDetailVos = scoreDataDetailMapper.selectListByscoreDataNameId(scoreDataNameIds);
|
|
|
+ //根据学科进行分组
|
|
|
+ if (scoreDataDetailVos != null && scoreDataDetailVos.size() > 0){
|
|
|
+ Map<String, List<ScoreDataDetailVo>> xuekeCollect = scoreDataDetailVos.parallelStream().collect(Collectors.groupingBy(ScoreDataDetailVo::getXueke));
|
|
|
+ for (String xueke : xuekeCollect.keySet()) {
|
|
|
+ List<ScoreDataDetailVo> scoreDataDetailVosXueke = xuekeCollect.get(xueke);
|
|
|
+ //获取学科总分
|
|
|
+ double sum = scoreDataDetailVosXueke.stream().mapToDouble(ScoreDataDetailVo::getScore).sum();
|
|
|
+ //计算学科平均分 = 学科总分 /人数
|
|
|
+ double xueKeAvg = sum / scoreDataNameIds.size();
|
|
|
+ map.put(xueke,xueKeAvg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //总成绩均分
|
|
|
+ double sum = scoreDataStudentVos.stream().mapToDouble(ScoreDataStudentVo::getZongfen).sum();
|
|
|
+ double zongFenAvg = sum / scoreDataStudentVos.size();
|
|
|
+
|
|
|
+ //给学生对象插入数据
|
|
|
+ //对学生成绩根据学生id进行分组
|
|
|
+ Map<Long, List<ScoreDataDetailVo>> scoreDataNameIdCollect = scoreDataDetailVos.parallelStream().collect(Collectors.groupingBy(ScoreDataDetailVo::getScoreDataNameId));
|
|
|
+ for (ScoreDataStudentVo scoreDataStudentVo : scoreDataStudentVos) {
|
|
|
+ scoreDataStudentVo.setAvg(String.valueOf(zongFenAvg));
|
|
|
+ List<ScoreDataDetailVo> scoreDataDetailVosList = scoreDataNameIdCollect.get(scoreDataStudentVo.getScoreDataNameId());
|
|
|
+ if (scoreDataDetailVosList != null && scoreDataDetailVosList.size() > 0){
|
|
|
+ for (ScoreDataDetailVo scoreDataDetailVo : scoreDataDetailVosList) {
|
|
|
+ scoreDataDetailVo.setAvg(String.valueOf(map.get(scoreDataDetailVo.getXueke())));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ scoreDataStudentVo.setScoreDataDetailVoList(scoreDataDetailVosList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return scoreDataStudentVos;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 成绩年级统计
|
|
@@ -452,6 +513,12 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<ScoreDataVo> classRank(ScoreData scoreData) {
|
|
|
+ //可以搜索学生姓名&选择班级进行年级排名
|
|
|
+ //接收考试时间和考试类型,所有考试时间相同的
|
|
|
+ String scoreClassName = scoreData.getScoreClassName();
|
|
|
+ //截取两位年级
|
|
|
+ String grade = scoreClassName.substring(0, 2);
|
|
|
+ scoreData.setScoreClassName(grade);
|
|
|
return baseMapper.classRank(scoreData);
|
|
|
}
|
|
|
|
|
@@ -463,7 +530,12 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
@Override
|
|
|
public Map<String, Object> classRankZheXian(ScoreData scoreData) {
|
|
|
Map<String, Object> map = new HashMap<>(3);
|
|
|
-
|
|
|
+ //可以搜索学生姓名&选择班级进行年级排名
|
|
|
+ //接收考试时间和考试类型,所有考试时间相同的
|
|
|
+ String scoreClassName = scoreData.getScoreClassName();
|
|
|
+ //截取两位年级
|
|
|
+ String grade = scoreClassName.substring(0, 2);
|
|
|
+ scoreData.setScoreClassName(grade);
|
|
|
//接受考试类型/考试时间/考试班级名称
|
|
|
//查询出所有对应班级的考试id和平均分
|
|
|
List<ScoreDataVo> scoreDataVos = baseMapper.avgRank(scoreData);
|
|
@@ -508,6 +580,12 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<ScoreDataVo> avgRank(ScoreData scoreData) {
|
|
|
+ //可以搜索学生姓名&选择班级进行年级排名
|
|
|
+ //接收考试时间和考试类型,所有考试时间相同的
|
|
|
+ String scoreClassName = scoreData.getScoreClassName();
|
|
|
+ //截取两位年级
|
|
|
+ String grade = scoreClassName.substring(0, 2);
|
|
|
+ scoreData.setScoreClassName(grade);
|
|
|
//接受考试类型/考试时间/考试班级名称
|
|
|
//查询出所有对应班级的考试id和平均分
|
|
|
List<ScoreDataVo> scoreDataVos = baseMapper.avgRank(scoreData);
|
|
@@ -537,6 +615,90 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
return scoreDataVos;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 年级分数段统计
|
|
|
+ * @param scoreData
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> bingTuRank(ScoreData scoreData) {
|
|
|
+ Map<String, Object> map = new HashMap<>(8);
|
|
|
+ int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0;
|
|
|
+ String aZ = "0%", bZ = "0%", cZ = "0%", dZ = "0%", eZ = "0%", fZ = "0%", gZ = "0%", hZ = "0%";
|
|
|
+ map.put("One", a);
|
|
|
+ map.put("Tow", b);
|
|
|
+ map.put("Thr", c);
|
|
|
+ map.put("For", d);
|
|
|
+ map.put("Fiv", e);
|
|
|
+ map.put("Six", f);
|
|
|
+ map.put("Sev", g);
|
|
|
+ map.put("Eig", h);
|
|
|
+ map.put("OneZ", aZ);
|
|
|
+ map.put("TowZ", bZ);
|
|
|
+ map.put("ThrZ", cZ);
|
|
|
+ map.put("ForZ", dZ);
|
|
|
+ map.put("FivZ", eZ);
|
|
|
+ map.put("SixZ", fZ);
|
|
|
+ map.put("SevZ", gZ);
|
|
|
+ map.put("EigZ", hZ);
|
|
|
+ //可以搜索学生姓名&选择班级进行年级排名
|
|
|
+ //接收考试时间和考试类型,所有考试时间相同的
|
|
|
+ String scoreClassName = scoreData.getScoreClassName();
|
|
|
+ //截取两位年级
|
|
|
+ String grade = scoreClassName.substring(0, 2);
|
|
|
+ scoreData.setScoreClassName(grade);
|
|
|
+ List<ScoreDataVo> scoreDataVos = baseMapper.avgRank(scoreData);
|
|
|
+ if (scoreDataVos != null && scoreDataVos.size() > 0) {
|
|
|
+ long[] scoreIds = scoreDataVos.stream().mapToLong(ScoreDataVo::getScoreId).toArray();
|
|
|
+ //拿着考试id去查询对应学生
|
|
|
+ List<ScoreDataStudentVo> scoreDataStudentVos = scoreDataStudentMapper.selectScoreByScoreIds(scoreIds);
|
|
|
+ //判断学生的总分所在分数段
|
|
|
+ for (ScoreDataStudentVo scoreDataStudentVo : scoreDataStudentVos) {
|
|
|
+ Double zongfen = scoreDataStudentVo.getZongfen();
|
|
|
+ if (zongfen >= 0 && zongfen <= 100) {
|
|
|
+ a++;
|
|
|
+ } else if (zongfen > 100 && zongfen <= 200) {
|
|
|
+ b++;
|
|
|
+ } else if (zongfen > 200 && zongfen <= 300) {
|
|
|
+ c++;
|
|
|
+ } else if (zongfen > 300 && zongfen <= 400) {
|
|
|
+ d++;
|
|
|
+ } else if (zongfen > 400 && zongfen <= 500) {
|
|
|
+ e++;
|
|
|
+ } else if (zongfen > 500 && zongfen <= 600) {
|
|
|
+ f++;
|
|
|
+ } else if (zongfen > 600 && zongfen <= 700) {
|
|
|
+ g++;
|
|
|
+ } else if (zongfen > 700) {
|
|
|
+ h++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //总人数
|
|
|
+ int size = scoreDataStudentVos.size();
|
|
|
+ if (size > 0){
|
|
|
+ DecimalFormat df = new DecimalFormat("##.0%");
|
|
|
+ map.put("OneZ", df.format(size/a));
|
|
|
+ map.put("TowZ", df.format(size/b));
|
|
|
+ map.put("ThrZ", df.format(size/c));
|
|
|
+ map.put("ForZ", df.format(size/d));
|
|
|
+ map.put("FivZ", df.format(size/e));
|
|
|
+ map.put("SixZ", df.format(size/f));
|
|
|
+ map.put("SevZ", df.format(size/g));
|
|
|
+ map.put("EigZ", df.format(size/h));
|
|
|
+ }
|
|
|
+ map.put("One", a);
|
|
|
+ map.put("Tow", b);
|
|
|
+ map.put("Thr", c);
|
|
|
+ map.put("For", d);
|
|
|
+ map.put("Fiv", e);
|
|
|
+ map.put("Six", f);
|
|
|
+ map.put("Sev", g);
|
|
|
+ map.put("Eig", h);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询成绩
|
|
|
*
|