按单批次分析-解决当专业为空相关的查询错误(map映射不能为空)

This commit is contained in:
YuNan 2025-01-11 23:37:52 +08:00
parent 4266d351c4
commit 2376619f63
1 changed files with 7 additions and 6 deletions

View File

@ -97,9 +97,9 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
@Override
public Result<JSONObject> getRateByBatch(String college, String batchStr) {
if (redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr) != null) {
return Result.ok((JSONObject) redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr));
}
// if (redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr) != null) {
// return Result.ok((JSONObject) redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr));
// }
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
DecimalFormat decimalFormat = new DecimalFormat("#.#");
Date batch;
@ -127,9 +127,10 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
passedList = passedList.stream().filter(e -> trueEntryDate.contains(e.getEntrydate())).collect(Collectors.toList());
if(college.equals("全校")){
collect = passedList.stream().collect(Collectors.groupingBy(Cet_4::getCollege));
}else{
//TODOmajorname为空时存在异常
collect = passedList.stream().collect(Collectors.groupingBy(Cet_4::getMajorname));
} else {
collect = passedList.stream()
.filter(cet4 -> cet4.getMajorname() != null)
.collect(Collectors.groupingBy(Cet_4::getMajorname));
}
// 过滤除去错误的数据