From b6d400e04ac300c3e6632d4999d5e037b0125047 Mon Sep 17 00:00:00 2001 From: owen Date: Mon, 16 Oct 2023 14:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=EF=BC=9A=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/member/MemberStatisticsController.java | 9 +-------- .../dal/mysql/member/MemberStatisticsMapper.java | 3 +++ .../service/member/MemberStatisticsService.java | 7 +++++++ .../service/member/MemberStatisticsServiceImpl.java | 5 +++++ .../resources/mapper/member/MemberStatisticsMapper.xml | 8 ++++++++ 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/MemberStatisticsController.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/MemberStatisticsController.java index 211d340f5..3ee8eb919 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/MemberStatisticsController.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/MemberStatisticsController.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.statistics.controller.admin.member; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.NumberUtil; -import cn.iocoder.yudao.framework.common.enums.TerminalEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.statistics.controller.admin.common.vo.DataComparisonRespVO; @@ -25,7 +24,6 @@ import java.time.LocalDateTime; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; @Tag(name = "管理后台 - 会员统计") @RestController @@ -98,12 +96,7 @@ public class MemberStatisticsController { @Operation(summary = "按照终端,获得会员统计列表") @PreAuthorize("@ss.hasPermission('statistics:member:query')") public CommonResult> getMemberTerminalStatisticsList() { - // TODO 疯狂:这个可以晚点写,因为 user = = 上还没记录 terminal - // TODO @疯狂:在 member_user 上,增加 registerTerminal 字段,基于它来统计哈; - List list = convertList(TerminalEnum.values(), - t -> new MemberTerminalStatisticsRespVO() - .setTerminal(t.getTerminal()).setUserCount(t.getTerminal() * 100)); - return success(list); + return success(memberStatisticsService.getRegisterTerminalStatisticsList()); } @GetMapping("/user-count-comparison") diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java index 0b3160c5c..4b1bc8783 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.statistics.dal.mysql.member; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberRegisterCountRespVO; import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberSexStatisticsRespVO; +import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberTerminalStatisticsRespVO; import cn.iocoder.yudao.module.statistics.service.member.bo.MemberAreaStatisticsRespBO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -23,6 +24,8 @@ public interface MemberStatisticsMapper extends BaseMapperX { List selectSummaryListBySex(); + List selectSummaryListByRegisterTerminal(); + // TODO @芋艿:已经 review Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java index af875f456..2ace6f86a 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java @@ -45,6 +45,13 @@ public interface MemberStatisticsService { */ List getMemberSexStatisticsList(); + /** + * 按照终端,获得会员统计列表 + * + * @return 会员统计列表 + */ + List getRegisterTerminalStatisticsList(); + /** * 获取用户注册数量列表 * 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 f06c98ae8..0b8f9cb53 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 @@ -104,6 +104,11 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { return memberStatisticsMapper.selectSummaryListBySex(); } + @Override + public List getRegisterTerminalStatisticsList() { + return memberStatisticsMapper.selectSummaryListByRegisterTerminal(); + } + @Override public List getMemberRegisterCountList(LocalDateTime beginTime, LocalDateTime endTime) { return memberStatisticsMapper.selectListByCreateTimeBetween(beginTime, endTime); diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml index 5c464d926..33500fb43 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml @@ -18,6 +18,14 @@ GROUP BY sex + +