解决当某地区有人下单但无人支付时的空指针异常

Signed-off-by: 杨宇庆 <hiyyq@qq.com>
This commit is contained in:
杨宇庆 2024-02-04 18:59:53 +00:00 committed by Gitee
parent 3367b4b6d4
commit 5a2554205d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.statistics.service.member;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.ip.core.Area;
import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum;
@ -71,7 +72,7 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService {
(a, b) -> new MemberAreaStatisticsRespBO()
.setOrderCreateUserCount(a.getOrderCreateUserCount() + b.getOrderCreateUserCount())
.setOrderPayUserCount(a.getOrderPayUserCount() + b.getOrderPayUserCount())
.setOrderPayPrice(a.getOrderPayPrice() + b.getOrderPayPrice()));
.setOrderPayPrice(ObjUtil.defaultIfNull(a.getOrderPayPrice(), 0) + ObjUtil.defaultIfNull(b.getOrderPayPrice(), 0)));
// 拼接数据
List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area);
areaList.add(new Area().setId(null).setName("未知"));