From 9b2ec3d341689c83c4c4ec9585713e293a1ff4c1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 21 Aug 2024 21:54:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=91=E5=A4=84=E7=90=86=E7=BB=9F=E8=AE=A1=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/MemberStatisticsServiceImpl.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java index 2257c8d39..15e46ff18 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.statistics.service.member; 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.ip.core.Area; 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.trade.TradeOrderStatisticsService; import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService; +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; import java.time.Duration; import java.time.LocalDateTime; import java.util.List; @@ -69,18 +70,12 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { bo -> AreaUtils.getParentIdByType(bo.getAreaId(), AreaTypeEnum.PROVINCE), bo -> bo, (a, b) -> new MemberAreaStatisticsRespBO() - .setOrderCreateUserCount( - (a.getOrderCreateUserCount() != null ? a.getOrderCreateUserCount() : 0) + - (b.getOrderCreateUserCount() != null ? b.getOrderCreateUserCount() : 0) - ) - .setOrderPayUserCount( - (a.getOrderPayUserCount() != null ? a.getOrderPayUserCount() : 0) + - (b.getOrderPayUserCount() != null ? b.getOrderPayUserCount() : 0) - ) - .setOrderPayPrice( - (a.getOrderPayPrice() != null ? a.getOrderPayPrice() : 0.0) + - (b.getOrderPayPrice() != null ? b.getOrderPayPrice() : 0.0) - ) + .setOrderCreateUserCount(ObjectUtil.defaultIfNull(a.getOrderCreateUserCount(), 0) + + ObjectUtil.defaultIfNull(b.getOrderCreateUserCount(), 0)) + .setOrderPayUserCount(ObjectUtil.defaultIfNull(a.getOrderPayUserCount(), 0) + + ObjectUtil.defaultIfNull(b.getOrderPayUserCount(), 0)) + .setOrderPayPrice(ObjectUtil.defaultIfNull(a.getOrderPayPrice(), 0) + + ObjectUtil.defaultIfNull(b.getOrderPayPrice(), 0))); // 拼接数据 List areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area); areaList.add(new Area().setId(null).setName("未知"));