mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
【功能修复】处理统计可能导致的空指针问题
This commit is contained in:
parent
d6e491937c
commit
9b2ec3d341
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.statistics.service.member;
|
package cn.iocoder.yudao.module.statistics.service.member;
|
||||||
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.ip.core.Area;
|
import cn.iocoder.yudao.framework.ip.core.Area;
|
||||||
import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum;
|
import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum;
|
||||||
@ -15,10 +16,10 @@ import cn.iocoder.yudao.module.statistics.service.pay.PayWalletStatisticsService
|
|||||||
import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO;
|
import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO;
|
||||||
import cn.iocoder.yudao.module.statistics.service.trade.TradeOrderStatisticsService;
|
import cn.iocoder.yudao.module.statistics.service.trade.TradeOrderStatisticsService;
|
||||||
import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService;
|
import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -69,18 +70,12 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService {
|
|||||||
bo -> AreaUtils.getParentIdByType(bo.getAreaId(), AreaTypeEnum.PROVINCE),
|
bo -> AreaUtils.getParentIdByType(bo.getAreaId(), AreaTypeEnum.PROVINCE),
|
||||||
bo -> bo,
|
bo -> bo,
|
||||||
(a, b) -> new MemberAreaStatisticsRespBO()
|
(a, b) -> new MemberAreaStatisticsRespBO()
|
||||||
.setOrderCreateUserCount(
|
.setOrderCreateUserCount(ObjectUtil.defaultIfNull(a.getOrderCreateUserCount(), 0)
|
||||||
(a.getOrderCreateUserCount() != null ? a.getOrderCreateUserCount() : 0) +
|
+ ObjectUtil.defaultIfNull(b.getOrderCreateUserCount(), 0))
|
||||||
(b.getOrderCreateUserCount() != null ? b.getOrderCreateUserCount() : 0)
|
.setOrderPayUserCount(ObjectUtil.defaultIfNull(a.getOrderPayUserCount(), 0)
|
||||||
)
|
+ ObjectUtil.defaultIfNull(b.getOrderPayUserCount(), 0))
|
||||||
.setOrderPayUserCount(
|
.setOrderPayPrice(ObjectUtil.defaultIfNull(a.getOrderPayPrice(), 0)
|
||||||
(a.getOrderPayUserCount() != null ? a.getOrderPayUserCount() : 0) +
|
+ ObjectUtil.defaultIfNull(b.getOrderPayPrice(), 0)));
|
||||||
(b.getOrderPayUserCount() != null ? b.getOrderPayUserCount() : 0)
|
|
||||||
)
|
|
||||||
.setOrderPayPrice(
|
|
||||||
(a.getOrderPayPrice() != null ? a.getOrderPayPrice() : 0.0) +
|
|
||||||
(b.getOrderPayPrice() != null ? b.getOrderPayPrice() : 0.0)
|
|
||||||
)
|
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area);
|
List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area);
|
||||||
areaList.add(new Area().setId(null).setName("未知"));
|
areaList.add(new Area().setId(null).setName("未知"));
|
||||||
|
Loading…
Reference in New Issue
Block a user