|
@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
+import org.dromara.system.controller.system.SysDictTypeController;
|
|
import org.dromara.system.domain.FormalParentsStudent;
|
|
import org.dromara.system.domain.FormalParentsStudent;
|
|
import org.dromara.system.domain.FormalTeacherClass;
|
|
import org.dromara.system.domain.FormalTeacherClass;
|
|
import org.dromara.system.domain.SysUser;
|
|
import org.dromara.system.domain.SysUser;
|
|
@@ -31,17 +32,21 @@ import org.dromara.system.domain.score.vo.ScoreDataMfVo;
|
|
import org.dromara.system.domain.score.vo.ScoreDataStudentVo;
|
|
import org.dromara.system.domain.score.vo.ScoreDataStudentVo;
|
|
import org.dromara.system.domain.score.vo.ScoreDataVo;
|
|
import org.dromara.system.domain.score.vo.ScoreDataVo;
|
|
import org.dromara.system.domain.vo.FormalTeacherClassVo;
|
|
import org.dromara.system.domain.vo.FormalTeacherClassVo;
|
|
|
|
+import org.dromara.system.domain.vo.SysDictDataVo;
|
|
import org.dromara.system.mapper.FormalParentsStudentMapper;
|
|
import org.dromara.system.mapper.FormalParentsStudentMapper;
|
|
import org.dromara.system.mapper.FormalTeacherClassMapper;
|
|
import org.dromara.system.mapper.FormalTeacherClassMapper;
|
|
|
|
+import org.dromara.system.mapper.SysDictTypeMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataDetailMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataDetailMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataMfMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataMfMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataStudentMapper;
|
|
import org.dromara.system.mapper.score.ScoreDataStudentMapper;
|
|
|
|
+import org.dromara.system.service.impl.SysDictTypeServiceImpl;
|
|
import org.dromara.system.service.score.IScoreDataService;
|
|
import org.dromara.system.service.score.IScoreDataService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
|
|
+import java.text.NumberFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -58,6 +63,7 @@ import static org.dromara.common.core.constant.CacheConstants.*;
|
|
public class ScoreDataServiceImpl implements IScoreDataService {
|
|
public class ScoreDataServiceImpl implements IScoreDataService {
|
|
|
|
|
|
private final ScoreDataMapper baseMapper;
|
|
private final ScoreDataMapper baseMapper;
|
|
|
|
+ private final SysDictTypeServiceImpl sysDictTypeService;
|
|
private final ScoreDataStudentMapper scoreDataStudentMapper;
|
|
private final ScoreDataStudentMapper scoreDataStudentMapper;
|
|
private final ScoreDataDetailMapper scoreDataDetailMapper;
|
|
private final ScoreDataDetailMapper scoreDataDetailMapper;
|
|
private final ScoreDataMfMapper scoreDataMfMapper;
|
|
private final ScoreDataMfMapper scoreDataMfMapper;
|
|
@@ -168,21 +174,21 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
Map<String, Object> params = bo.getParams();
|
|
Map<String, Object> params = bo.getParams();
|
|
LambdaQueryWrapper<ScoreData> lqw = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<ScoreData> lqw = Wrappers.lambdaQuery();
|
|
String scoreType = bo.getScoreType();
|
|
String scoreType = bo.getScoreType();
|
|
- if (StringUtils.isNotBlank(scoreType) && "5".equals(scoreType)){
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(scoreType) && "5".equals(scoreType)) {
|
|
//说明是统计查询成绩列表的全部 = score_type != 4
|
|
//说明是统计查询成绩列表的全部 = score_type != 4
|
|
- lqw.ne(ScoreData::getScoreTitle,"4");
|
|
|
|
|
|
+ lqw.ne(ScoreData::getScoreTitle, "4");
|
|
}
|
|
}
|
|
- if (StringUtils.isNotBlank(scoreType) && !"5".equals(scoreType)){
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(scoreType) && !"5".equals(scoreType)) {
|
|
//说明是统计查询成绩列表的全部 = score_type != 4
|
|
//说明是统计查询成绩列表的全部 = score_type != 4
|
|
- lqw.eq(ScoreData::getScoreTitle,scoreType);
|
|
|
|
|
|
+ lqw.eq(ScoreData::getScoreTitle, scoreType);
|
|
}
|
|
}
|
|
lqw.eq(StringUtils.isNotBlank(bo.getScoreTitle()), ScoreData::getScoreTitle, bo.getScoreTitle());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getScoreTitle()), ScoreData::getScoreTitle, bo.getScoreTitle());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getScoreTime()), ScoreData::getScoreTime, bo.getScoreTime());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getScoreTime()), ScoreData::getScoreTime, bo.getScoreTime());
|
|
lqw.like(StringUtils.isNotBlank(bo.getScoreClassName()), ScoreData::getScoreClassName, bo.getScoreClassName());
|
|
lqw.like(StringUtils.isNotBlank(bo.getScoreClassName()), ScoreData::getScoreClassName, bo.getScoreClassName());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getPrivacyType()), ScoreData::getPrivacyType, bo.getPrivacyType());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getPrivacyType()), ScoreData::getPrivacyType, bo.getPrivacyType());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getAvg()), ScoreData::getAvg, bo.getAvg());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getAvg()), ScoreData::getAvg, bo.getAvg());
|
|
- if (bo.getScoreClassId() != null){
|
|
|
|
- lqw.apply("find_in_set(score_class_id,'"+bo.getScoreClassId()+"')");
|
|
|
|
|
|
+ if (bo.getScoreClassId() != null) {
|
|
|
|
+ lqw.apply("find_in_set(score_class_id,'" + bo.getScoreClassId() + "')");
|
|
}
|
|
}
|
|
return lqw;
|
|
return lqw;
|
|
}
|
|
}
|
|
@@ -192,6 +198,8 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean insertByBo(ScoreDataBo bo) {
|
|
public Boolean insertByBo(ScoreDataBo bo) {
|
|
|
|
+
|
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
ScoreData add = MapstructUtils.convert(bo, ScoreData.class);
|
|
ScoreData add = MapstructUtils.convert(bo, ScoreData.class);
|
|
//validEntityBeforeSave(add);
|
|
//validEntityBeforeSave(add);
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
@@ -225,14 +233,15 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
zf = zf + scoreDataDetailBo.getScore();
|
|
zf = zf + scoreDataDetailBo.getScore();
|
|
scoreDataDetailBo.setScoreId(scoreId);
|
|
scoreDataDetailBo.setScoreId(scoreId);
|
|
scoreDataDetailBo.setScoreDataName(scoreDataStudentBo.getScoreDataName());
|
|
scoreDataDetailBo.setScoreDataName(scoreDataStudentBo.getScoreDataName());
|
|
- scoreDataDetailBo.setScoreDataNameId(scoreDataStudentBo.getScoreDataNameId());
|
|
|
|
|
|
+ scoreDataDetailBo.setStudentNumber(scoreDataStudentBo.getStudentNumber());
|
|
|
|
+ //scoreDataDetailBo.setScoreDataNameId(scoreDataStudentBo.getScoreDataNameId());
|
|
//插入满分
|
|
//插入满分
|
|
scoreDataDetailBo.setManfen(map.get(scoreDataDetailBo.getXueke()));
|
|
scoreDataDetailBo.setManfen(map.get(scoreDataDetailBo.getXueke()));
|
|
}
|
|
}
|
|
classZf = classZf + zf;
|
|
classZf = classZf + zf;
|
|
scoreDataStudentBo.setZongfen(zf);
|
|
scoreDataStudentBo.setZongfen(zf);
|
|
- //计算平均分 = 总分/学科数
|
|
|
|
- scoreDataStudentBo.setAvg(String.valueOf(zf / scoreDataDetailBoList.size()));
|
|
|
|
|
|
+ //计算个人平均分 = 总分/学科数
|
|
|
|
+ scoreDataStudentBo.setAvg(String.valueOf(df.format(zf / scoreDataDetailBoList.size())));
|
|
scoreDataStudentBo.setScoreId(scoreId);
|
|
scoreDataStudentBo.setScoreId(scoreId);
|
|
|
|
|
|
scoreDataDetailMapper.insertBatch(MapstructUtils.convert(scoreDataDetailBoList, ScoreDataDetail.class));
|
|
scoreDataDetailMapper.insertBatch(MapstructUtils.convert(scoreDataDetailBoList, ScoreDataDetail.class));
|
|
@@ -255,9 +264,11 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
scoreDataStudentMapper.insertBatch(MapstructUtils.convert(scoreDataStudentBoList, ScoreDataStudent.class));
|
|
scoreDataStudentMapper.insertBatch(MapstructUtils.convert(scoreDataStudentBoList, ScoreDataStudent.class));
|
|
|
|
|
|
//计算班级总分平均分=各学生总分/学生人数
|
|
//计算班级总分平均分=各学生总分/学生人数
|
|
- double classAvg = classZf / scoreDataStudentBoList.size();
|
|
|
|
- add.setAvg(classAvg);
|
|
|
|
|
|
+ String classAvg = df.format(classZf / scoreDataStudentBoList.size());
|
|
|
|
+ add.setAvg(Double.parseDouble(classAvg));
|
|
baseMapper.updateById(add);
|
|
baseMapper.updateById(add);
|
|
|
|
+ RedisUtils.setCacheObject(SCORE_PEOPLE_ALL + scoreId, scoreDataStudentBoList.size());
|
|
|
|
+ RedisUtils.setCacheObject(SCORE_PEOPLE_CHAKAN_COUNT + scoreId, 0);
|
|
}
|
|
}
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
@@ -468,7 +479,7 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
//去查询对应学生的具体学科成绩/计算学科平均分
|
|
//去查询对应学生的具体学科成绩/计算学科平均分
|
|
//获取所有学生id
|
|
//获取所有学生id
|
|
List<Long> scoreDataNameIds = scoreDataStudentVos.stream().map(ScoreDataStudentVo::getScoreDataNameId).collect(Collectors.toList());
|
|
List<Long> scoreDataNameIds = scoreDataStudentVos.stream().map(ScoreDataStudentVo::getScoreDataNameId).collect(Collectors.toList());
|
|
- List<ScoreDataDetailVo> scoreDataDetailVos = scoreDataDetailMapper.selectListByscoreDataNameId(scoreDataNameIds,scoreId);
|
|
|
|
|
|
+ List<ScoreDataDetailVo> scoreDataDetailVos = scoreDataDetailMapper.selectListByscoreDataNameId(scoreDataNameIds, scoreId);
|
|
//根据学科进行分组
|
|
//根据学科进行分组
|
|
if (scoreDataDetailVos != null && scoreDataDetailVos.size() > 0) {
|
|
if (scoreDataDetailVos != null && scoreDataDetailVos.size() > 0) {
|
|
Map<String, List<ScoreDataDetailVo>> xuekeCollect = scoreDataDetailVos.parallelStream().collect(Collectors.groupingBy(ScoreDataDetailVo::getXueke));
|
|
Map<String, List<ScoreDataDetailVo>> xuekeCollect = scoreDataDetailVos.parallelStream().collect(Collectors.groupingBy(ScoreDataDetailVo::getXueke));
|
|
@@ -535,7 +546,7 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 班级总分平均分排名统计折线
|
|
|
|
|
|
+ * 年级总分平均分排名统计折线
|
|
*
|
|
*
|
|
* @param scoreData
|
|
* @param scoreData
|
|
* @return
|
|
* @return
|
|
@@ -553,19 +564,20 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
//查询出所有对应班级的考试id和平均分
|
|
//查询出所有对应班级的考试id和平均分
|
|
List<ScoreDataVo> scoreDataVos = baseMapper.avgRank(scoreData);
|
|
List<ScoreDataVo> scoreDataVos = baseMapper.avgRank(scoreData);
|
|
if (scoreDataVos != null && scoreDataVos.size() > 0) {
|
|
if (scoreDataVos != null && scoreDataVos.size() > 0) {
|
|
|
|
+ //年级平均分
|
|
|
|
+ double avg = scoreDataVos.stream().mapToDouble(ScoreDataVo::getAvg).sum() / scoreDataVos.size();
|
|
long[] scoreIds = scoreDataVos.stream().mapToLong(ScoreDataVo::getScoreId).toArray();
|
|
long[] scoreIds = scoreDataVos.stream().mapToLong(ScoreDataVo::getScoreId).toArray();
|
|
//拿着考试id去查询对应学生
|
|
//拿着考试id去查询对应学生
|
|
List<ScoreDataStudentVo> scoreDataStudentVos = scoreDataStudentMapper.selectScoreByScoreIds(scoreIds);
|
|
List<ScoreDataStudentVo> scoreDataStudentVos = scoreDataStudentMapper.selectScoreByScoreIds(scoreIds);
|
|
List<String> x = new ArrayList<>();
|
|
List<String> x = new ArrayList<>();
|
|
List<Integer> y1 = new ArrayList<>();
|
|
List<Integer> y1 = new ArrayList<>();
|
|
List<Integer> y2 = new ArrayList<>();
|
|
List<Integer> y2 = new ArrayList<>();
|
|
- //判断对应班级的对应学生的总分在班级总分平均分的位置
|
|
|
|
|
|
+ //判断对应班级的对应学生的平均分在年级平均分的位置
|
|
for (ScoreDataVo scoreDataVo : scoreDataVos) {
|
|
for (ScoreDataVo scoreDataVo : scoreDataVos) {
|
|
//存放X轴数据
|
|
//存放X轴数据
|
|
x.add(scoreDataVo.getScoreClassName());
|
|
x.add(scoreDataVo.getScoreClassName());
|
|
Long scoreId = scoreDataVo.getScoreId();
|
|
Long scoreId = scoreDataVo.getScoreId();
|
|
- //班级平均分
|
|
|
|
- double avg = scoreDataVo.getAvg();
|
|
|
|
|
|
+
|
|
Map<Long, List<ScoreDataStudentVo>> collect = scoreDataStudentVos.stream().collect(Collectors.groupingBy(ScoreDataStudentVo::getScoreId));
|
|
Map<Long, List<ScoreDataStudentVo>> collect = scoreDataStudentVos.stream().collect(Collectors.groupingBy(ScoreDataStudentVo::getScoreId));
|
|
//获取对应考试的学生集合
|
|
//获取对应考试的学生集合
|
|
List<ScoreDataStudentVo> scoreDataStudentVosList = collect.get(scoreId);
|
|
List<ScoreDataStudentVo> scoreDataStudentVosList = collect.get(scoreId);
|
|
@@ -582,6 +594,7 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
map.put("x", x);
|
|
map.put("x", x);
|
|
|
|
+ map.put("avg", avg);
|
|
map.put("y1", y1);
|
|
map.put("y1", y1);
|
|
map.put("y2", y2);
|
|
map.put("y2", y2);
|
|
}
|
|
}
|
|
@@ -603,14 +616,14 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
//查询出所有对应班级的考试id和平均分
|
|
//查询出所有对应班级的考试id和平均分
|
|
List<ScoreDataVo> scoreDataVos = baseMapper.avgRank(scoreData);
|
|
List<ScoreDataVo> scoreDataVos = baseMapper.avgRank(scoreData);
|
|
if (scoreDataVos != null && scoreDataVos.size() > 0) {
|
|
if (scoreDataVos != null && scoreDataVos.size() > 0) {
|
|
|
|
+ //年级平均分
|
|
|
|
+ double avg = scoreDataVos.stream().mapToDouble(ScoreDataVo::getAvg).sum() / scoreDataVos.size();
|
|
long[] scoreIds = scoreDataVos.stream().mapToLong(ScoreDataVo::getScoreId).toArray();
|
|
long[] scoreIds = scoreDataVos.stream().mapToLong(ScoreDataVo::getScoreId).toArray();
|
|
//拿着考试id去查询对应学生
|
|
//拿着考试id去查询对应学生
|
|
List<ScoreDataStudentVo> scoreDataStudentVos = scoreDataStudentMapper.selectScoreByScoreIds(scoreIds);
|
|
List<ScoreDataStudentVo> scoreDataStudentVos = scoreDataStudentMapper.selectScoreByScoreIds(scoreIds);
|
|
//判断对应班级的对应学生的总分在班级总分平均分的位置
|
|
//判断对应班级的对应学生的总分在班级总分平均分的位置
|
|
for (ScoreDataVo scoreDataVo : scoreDataVos) {
|
|
for (ScoreDataVo scoreDataVo : scoreDataVos) {
|
|
Long scoreId = scoreDataVo.getScoreId();
|
|
Long scoreId = scoreDataVo.getScoreId();
|
|
- //班级平均分
|
|
|
|
- double avg = scoreDataVo.getAvg();
|
|
|
|
Map<Long, List<ScoreDataStudentVo>> collect = scoreDataStudentVos.stream().collect(Collectors.groupingBy(ScoreDataStudentVo::getScoreId));
|
|
Map<Long, List<ScoreDataStudentVo>> collect = scoreDataStudentVos.stream().collect(Collectors.groupingBy(ScoreDataStudentVo::getScoreId));
|
|
//获取对应考试的学生集合
|
|
//获取对应考试的学生集合
|
|
List<ScoreDataStudentVo> scoreDataStudentVosList = collect.get(scoreId);
|
|
List<ScoreDataStudentVo> scoreDataStudentVosList = collect.get(scoreId);
|
|
@@ -618,7 +631,7 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
if (scoreDataStudentVosList != null && scoreDataStudentVosList.size() > 0) {
|
|
if (scoreDataStudentVosList != null && scoreDataStudentVosList.size() > 0) {
|
|
List<ScoreDataStudentVo> scoreDataStudentVosListUp = scoreDataStudentVosList.stream().filter(scoreDataStudent -> scoreDataStudent.getZongfen() >= avg)
|
|
List<ScoreDataStudentVo> scoreDataStudentVosListUp = scoreDataStudentVosList.stream().filter(scoreDataStudent -> scoreDataStudent.getZongfen() >= avg)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- List<ScoreDataStudentVo> scoreDataStudentVosListDown = scoreDataStudentVosList.stream().filter(scoreDataStudent -> scoreDataStudent.getZongfen() < avg)
|
|
|
|
|
|
+ List<ScoreDataStudentVo> scoreDataStudentVosListDown = scoreDataStudentVosList.stream().filter(scoreDataStudent -> scoreDataStudent.getZongfen()< avg)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
scoreDataVo.setUp(scoreDataStudentVosListUp.size());
|
|
scoreDataVo.setUp(scoreDataStudentVosListUp.size());
|
|
scoreDataVo.setDown(scoreDataStudentVosListDown.size());
|
|
scoreDataVo.setDown(scoreDataStudentVosListDown.size());
|
|
@@ -688,39 +701,41 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//总人数
|
|
//总人数
|
|
- int size = scoreDataStudentVos.size();
|
|
|
|
|
|
+ float size = scoreDataStudentVos.size();
|
|
|
|
+
|
|
if (size > 0) {
|
|
if (size > 0) {
|
|
- DecimalFormat df = new DecimalFormat("##.0%");
|
|
|
|
|
|
+ NumberFormat nf = NumberFormat.getPercentInstance();
|
|
|
|
+ nf.setMaximumFractionDigits(2);
|
|
if (a > 0) {
|
|
if (a > 0) {
|
|
- map.put("OneZ", df.format(size / a));
|
|
|
|
|
|
+ map.put("OneZ", nf.format((float) a/size));
|
|
|
|
|
|
}
|
|
}
|
|
if (b > 0) {
|
|
if (b > 0) {
|
|
- map.put("TowZ", df.format(size / b));
|
|
|
|
|
|
+ map.put("TowZ", nf.format((float) b/size));
|
|
|
|
|
|
}
|
|
}
|
|
if (c > 0) {
|
|
if (c > 0) {
|
|
- map.put("ThrZ", df.format(size / c));
|
|
|
|
|
|
+ map.put("ThrZ", nf.format((float) c/size));
|
|
|
|
|
|
}
|
|
}
|
|
if (d > 0) {
|
|
if (d > 0) {
|
|
- map.put("ForZ", df.format(size / d));
|
|
|
|
|
|
+ map.put("ForZ", nf.format((float) d/size));
|
|
|
|
|
|
}
|
|
}
|
|
if (e > 0) {
|
|
if (e > 0) {
|
|
- map.put("FivZ", df.format(size / e));
|
|
|
|
|
|
+ map.put("FivZ", nf.format((float) e/size));
|
|
|
|
|
|
}
|
|
}
|
|
if (f > 0) {
|
|
if (f > 0) {
|
|
- map.put("SixZ", df.format(size / f));
|
|
|
|
|
|
+ map.put("SixZ", nf.format((float) f/size));
|
|
|
|
|
|
}
|
|
}
|
|
if (g > 0) {
|
|
if (g > 0) {
|
|
- map.put("SevZ", df.format(size / g));
|
|
|
|
|
|
+ map.put("SevZ", nf.format((float) g/size));
|
|
|
|
|
|
}
|
|
}
|
|
if (h > 0) {
|
|
if (h > 0) {
|
|
- map.put("EigZ", df.format(size / h));
|
|
|
|
|
|
+ map.put("EigZ", nf.format((float) h/size));
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -800,4 +815,51 @@ public class ScoreDataServiceImpl implements IScoreDataService {
|
|
scoreDataVo.setScoreDataStudentVoList(scoreDataStudentVos);
|
|
scoreDataVo.setScoreDataStudentVoList(scoreDataStudentVos);
|
|
return scoreDataVo;
|
|
return scoreDataVo;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 学生成绩导入
|
|
|
|
+ *
|
|
|
|
+ * @param maps
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void importData(ScoreDataBo scoreData, List<Map<String, String>> maps) {
|
|
|
|
+ //去字典值中匹配学科名称 sys_subject
|
|
|
|
+ List<SysDictDataVo> sysSubject = sysDictTypeService.selectDictDataByType("sys_subject");
|
|
|
|
+ List<String> xueKeList = sysSubject.stream().map(SysDictDataVo::getDictLabel).collect(Collectors.toList());
|
|
|
|
+ List<ScoreDataStudentBo> scoreDataStudentBoList = new ArrayList<>();
|
|
|
|
+ //获取满分设置
|
|
|
|
+ Map<String, String> manFenMap = maps.get(0);
|
|
|
|
+ if (manFenMap != null) {
|
|
|
|
+ List<ScoreDataMfBo> scoreDataMfBoList = new ArrayList<>();
|
|
|
|
+ for (String xueKe : manFenMap.keySet()) {
|
|
|
|
+ ScoreDataMfBo scoreDataMfBo = new ScoreDataMfBo();
|
|
|
|
+ scoreDataMfBo.setXueke(xueKe);
|
|
|
|
+ scoreDataMfBo.setManfen(manFenMap.get(xueKe));
|
|
|
|
+ scoreDataMfBoList.add(scoreDataMfBo);
|
|
|
|
+ }
|
|
|
|
+ maps.remove(0);
|
|
|
|
+ scoreData.setScoreDataMfBoList(scoreDataMfBoList);
|
|
|
|
+ }
|
|
|
|
+ //处理数据成对象
|
|
|
|
+ for (Map<String, String> map : maps) {
|
|
|
|
+ //每一个Map里面有学生姓名和各科成绩
|
|
|
|
+ //组装成一个ScoreDataBo对象中的
|
|
|
|
+ ScoreDataStudentBo studentBo = new ScoreDataStudentBo();
|
|
|
|
+ studentBo.setScoreDataName(map.get("姓名"));
|
|
|
|
+ studentBo.setStudentNumber(map.get("学号"));
|
|
|
|
+ List<ScoreDataDetailBo> scoreDataDetailBoList = new ArrayList<>();
|
|
|
|
+ for (String key : map.keySet()) {
|
|
|
|
+ if (xueKeList.contains(key)) {
|
|
|
|
+ ScoreDataDetailBo scoreDataDetailBo = new ScoreDataDetailBo();
|
|
|
|
+ scoreDataDetailBo.setXueke(key);
|
|
|
|
+ scoreDataDetailBo.setScore(Double.valueOf(map.get(key)));
|
|
|
|
+ scoreDataDetailBoList.add(scoreDataDetailBo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ studentBo.setScoreDataDetailBoList(scoreDataDetailBoList);
|
|
|
|
+ scoreDataStudentBoList.add(studentBo);
|
|
|
|
+ }
|
|
|
|
+ scoreData.setScoreDataStudentBoList(scoreDataStudentBoList);
|
|
|
|
+ this.insertByBo(scoreData);
|
|
|
|
+ }
|
|
}
|
|
}
|