按单批次分析-解决当专业为空相关的查询错误(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 @Override
public Result<JSONObject> getRateByBatch(String college, String batchStr) { public Result<JSONObject> getRateByBatch(String college, String batchStr) {
if (redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr) != null) { // if (redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr) != null) {
return Result.ok((JSONObject) redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr)); // return Result.ok((JSONObject) redisTemplate.opsForValue().get("getRateByBatch" + college + batchStr));
} // }
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
DecimalFormat decimalFormat = new DecimalFormat("#.#"); DecimalFormat decimalFormat = new DecimalFormat("#.#");
Date batch; Date batch;
@ -128,8 +128,9 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
if(college.equals("全校")){ if(college.equals("全校")){
collect = passedList.stream().collect(Collectors.groupingBy(Cet_4::getCollege)); collect = passedList.stream().collect(Collectors.groupingBy(Cet_4::getCollege));
} else { } else {
//TODOmajorname为空时存在异常 collect = passedList.stream()
collect = passedList.stream().collect(Collectors.groupingBy(Cet_4::getMajorname)); .filter(cet4 -> cet4.getMajorname() != null)
.collect(Collectors.groupingBy(Cet_4::getMajorname));
} }
// 过滤除去错误的数据 // 过滤除去错误的数据