Commit d6e491937c25f1a9f19ffec89b80df25e76eab71
Committed by
Gitee
!1048 【功能修复】处理统计可能导致的空指针问题
Merge pull request !1048 from 卢越/master-jdk17
Showing
1 changed file
with
12 additions
and
3 deletions
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java
| ... | ... | @@ -69,9 +69,18 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { |
| 69 | 69 | bo -> AreaUtils.getParentIdByType(bo.getAreaId(), AreaTypeEnum.PROVINCE), |
| 70 | 70 | bo -> bo, |
| 71 | 71 | (a, b) -> new MemberAreaStatisticsRespBO() |
| 72 | - .setOrderCreateUserCount(a.getOrderCreateUserCount() + b.getOrderCreateUserCount()) | |
| 73 | - .setOrderPayUserCount(a.getOrderPayUserCount() + b.getOrderPayUserCount()) | |
| 74 | - .setOrderPayPrice(a.getOrderPayPrice() + b.getOrderPayPrice())); | |
| 72 | + .setOrderCreateUserCount( | |
| 73 | + (a.getOrderCreateUserCount() != null ? a.getOrderCreateUserCount() : 0) + | |
| 74 | + (b.getOrderCreateUserCount() != null ? b.getOrderCreateUserCount() : 0) | |
| 75 | + ) | |
| 76 | + .setOrderPayUserCount( | |
| 77 | + (a.getOrderPayUserCount() != null ? a.getOrderPayUserCount() : 0) + | |
| 78 | + (b.getOrderPayUserCount() != null ? b.getOrderPayUserCount() : 0) | |
| 79 | + ) | |
| 80 | + .setOrderPayPrice( | |
| 81 | + (a.getOrderPayPrice() != null ? a.getOrderPayPrice() : 0.0) + | |
| 82 | + (b.getOrderPayPrice() != null ? b.getOrderPayPrice() : 0.0) | |
| 83 | + ) | |
| 75 | 84 | // 拼接数据 |
| 76 | 85 | List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area); |
| 77 | 86 | areaList.add(new Area().setId(null).setName("未知")); | ... | ... |