fix:NullPointException

This commit is contained in:
nieziyan 2023-09-05 16:23:12 +08:00
parent d78267f219
commit fb4b563aee

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -15,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
@ -26,8 +28,10 @@ public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, Gar
Map<String, Double> halfLife = MapUtil.newHashMap();
if (CollUtil.isEmpty(nuclideNames))
return halfLife;
halfLife = baseMapper.halfLife(nuclideNames).stream().collect(Collectors
.toMap(GardsNuclLibDto::getName, GardsNuclLibDto::getHalflife));
halfLife = baseMapper.halfLife(nuclideNames).stream()
.filter(obj -> StrUtil.isNotBlank(obj.getName()))
.filter(obj -> ObjectUtil.isNotNull(obj.getHalflife()))
.collect(Collectors.toMap(GardsNuclLibDto::getName, GardsNuclLibDto::getHalflife));
return halfLife;
}