Commit 46996c3a authored by suhuiguang's avatar suhuiguang

1.修改空指针

parent 6b621fd7
...@@ -295,8 +295,7 @@ public class View3dServiceImpl implements IView3dService { ...@@ -295,8 +295,7 @@ public class View3dServiceImpl implements IView3dService {
} }
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L); Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L);
TodaySafetyIndexVo vo = new TodaySafetyIndexVo(); TodaySafetyIndexVo vo = new TodaySafetyIndexVo();
if(optional.isPresent()){ if(optional.isPresent()){ //1.按照等级进行转换rpn为分数-机构
//1.按照等级进行转换rpn为分数-机构
RiskSource riskSource = optional.get(); RiskSource riskSource = optional.get();
double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn()); double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
vo.setSafetyIndex(safetyIndex); vo.setSafetyIndex(safetyIndex);
...@@ -420,7 +419,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -420,7 +419,8 @@ public class View3dServiceImpl implements IView3dService {
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode()); List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> { exceptionList = regionList.stream().filter(riskSource -> {
BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn(); BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
return rpn.subtract(riskSource.getRpni()).doubleValue() > 0; BigDecimal rpni = riskSource.getRpni() == null ? new BigDecimal("0") : riskSource.getRpni();
return rpn.subtract(rpni).doubleValue() > 0;
}).map(riskSource -> { }).map(riskSource -> {
ExceptionRegionVo regionVo = new ExceptionRegionVo(); ExceptionRegionVo regionVo = new ExceptionRegionVo();
regionVo.setId(riskSource.getId()); regionVo.setId(riskSource.getId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment