Commit f5dac38ca514447a0a3c1e7bf06228fb66595184
1 parent
1ac2f2b5
商城:增加商城首页
Showing
37 changed files
with
591 additions
and
40 deletions
sql/mysql/mall.sql
0 → 100644
yudao-module-mall/yudao-module-statistics-api/src/main/java/cn/iocoder/yudao/module/statistics/enums/TimeRangeTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.enums; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 时间范围类型的枚举 | ||
| 11 | + * | ||
| 12 | + * @author owen | ||
| 13 | + */ | ||
| 14 | +@AllArgsConstructor | ||
| 15 | +@Getter | ||
| 16 | +public enum TimeRangeTypeEnum implements IntArrayValuable { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 天 | ||
| 20 | + */ | ||
| 21 | + DAY(1), | ||
| 22 | + /** | ||
| 23 | + * 周 | ||
| 24 | + */ | ||
| 25 | + WEEK(7), | ||
| 26 | + /** | ||
| 27 | + * 月 | ||
| 28 | + */ | ||
| 29 | + MONTH(30), | ||
| 30 | + /** | ||
| 31 | + * 年 | ||
| 32 | + */ | ||
| 33 | + YEAR(365), | ||
| 34 | + ; | ||
| 35 | + | ||
| 36 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TimeRangeTypeEnum::getType).toArray(); | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 状态 | ||
| 41 | + */ | ||
| 42 | + private final Integer type; | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public int[] array() { | ||
| 46 | + return ARRAYS; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/MemberStatisticsController.java
| @@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil; | @@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.enums.TerminalEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.TerminalEnum; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.*; | 6 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.*; |
| 7 | +import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; | ||
| 7 | import cn.iocoder.yudao.module.statistics.service.member.MemberStatisticsService; | 8 | import cn.iocoder.yudao.module.statistics.service.member.MemberStatisticsService; |
| 8 | import io.swagger.v3.oas.annotations.Operation; | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | import io.swagger.v3.oas.annotations.tags.Tag; | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -75,4 +76,19 @@ public class MemberStatisticsController { | @@ -75,4 +76,19 @@ public class MemberStatisticsController { | ||
| 75 | return success(list); | 76 | return success(list); |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 79 | + @GetMapping("/user-count-comparison") | ||
| 80 | + @Operation(summary = "获得用户数量对照") | ||
| 81 | + @PreAuthorize("@ss.hasPermission('statistics:member:query')") | ||
| 82 | + public CommonResult<TradeStatisticsComparisonRespVO<MemberCountRespVO>> getUserCountComparison() { | ||
| 83 | + return success(memberStatisticsService.getUserCountComparison()); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @GetMapping("/register-count-list") | ||
| 87 | + @Operation(summary = "获得会员注册数量列表") | ||
| 88 | + @PreAuthorize("@ss.hasPermission('statistics:member:query')") | ||
| 89 | + public CommonResult<List<MemberRegisterCountRespVO>> getMemberRegisterCountList(MemberAnalyseReqVO reqVO) { | ||
| 90 | + return success(memberStatisticsService.getMemberRegisterCountList( | ||
| 91 | + ArrayUtil.get(reqVO.getTimes(), 0), ArrayUtil.get(reqVO.getTimes(), 1))); | ||
| 92 | + } | ||
| 93 | + | ||
| 78 | } | 94 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/vo/MemberCountRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.controller.admin.member.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Schema(description = "管理后台 - 会员数量统计 Response VO") | ||
| 7 | +@Data | ||
| 8 | +public class MemberCountRespVO { | ||
| 9 | + | ||
| 10 | + @Schema(description = "用户访问量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 11 | + private Integer visitUserCount; | ||
| 12 | + | ||
| 13 | + @Schema(description = "新增用户数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Integer createUserCount; | ||
| 15 | + | ||
| 16 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/vo/MemberRegisterCountRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.controller.admin.member.vo; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.time.LocalDate; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | ||
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - 会员注册数量 Response VO") | ||
| 13 | +@Data | ||
| 14 | +public class MemberRegisterCountRespVO { | ||
| 15 | + | ||
| 16 | + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT) | ||
| 17 | + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 18 | + private LocalDate date; | ||
| 19 | + | ||
| 20 | + @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 21 | + private Integer count; | ||
| 22 | + | ||
| 23 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/pay/PayStatisticsController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.controller.admin.pay; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.module.statistics.service.pay.PayWalletStatisticsService; | ||
| 5 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 6 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 7 | +import lombok.extern.slf4j.Slf4j; | ||
| 8 | +import org.springframework.validation.annotation.Validated; | ||
| 9 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +import javax.annotation.Resource; | ||
| 14 | + | ||
| 15 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 16 | + | ||
| 17 | +@Tag(name = "管理后台 - 支付统计") | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("/statistics/pay") | ||
| 20 | +@Validated | ||
| 21 | +@Slf4j | ||
| 22 | +public class PayStatisticsController { | ||
| 23 | + | ||
| 24 | + @Resource | ||
| 25 | + private PayWalletStatisticsService payWalletStatisticsService; | ||
| 26 | + | ||
| 27 | + @GetMapping("/wallet-recharge-price") | ||
| 28 | + @Operation(summary = "获取充值金额") | ||
| 29 | + public CommonResult<Integer> getWalletRechargePrice() { | ||
| 30 | + return success(payWalletStatisticsService.getRechargePriceSummary()); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java
| @@ -5,7 +5,12 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | @@ -5,7 +5,12 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.*; | 6 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.*; |
| 7 | import cn.iocoder.yudao.module.statistics.convert.trade.TradeStatisticsConvert; | 7 | import cn.iocoder.yudao.module.statistics.convert.trade.TradeStatisticsConvert; |
| 8 | +import cn.iocoder.yudao.module.statistics.service.trade.AfterSaleStatisticsService; | ||
| 9 | +import cn.iocoder.yudao.module.statistics.service.trade.BrokerageStatisticsService; | ||
| 10 | +import cn.iocoder.yudao.module.statistics.service.trade.TradeOrderStatisticsService; | ||
| 8 | import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService; | 11 | import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService; |
| 12 | +import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleStatusEnum; | ||
| 13 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | ||
| 9 | import io.swagger.v3.oas.annotations.Operation; | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 10 | import io.swagger.v3.oas.annotations.tags.Tag; | 15 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 11 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
| @@ -17,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController; | @@ -17,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 17 | 22 | ||
| 18 | import javax.annotation.Resource; | 23 | import javax.annotation.Resource; |
| 19 | import javax.servlet.http.HttpServletResponse; | 24 | import javax.servlet.http.HttpServletResponse; |
| 25 | +import javax.validation.Valid; | ||
| 20 | import java.io.IOException; | 26 | import java.io.IOException; |
| 21 | import java.util.List; | 27 | import java.util.List; |
| 22 | 28 | ||
| @@ -31,6 +37,12 @@ public class TradeStatisticsController { | @@ -31,6 +37,12 @@ public class TradeStatisticsController { | ||
| 31 | 37 | ||
| 32 | @Resource | 38 | @Resource |
| 33 | private TradeStatisticsService tradeStatisticsService; | 39 | private TradeStatisticsService tradeStatisticsService; |
| 40 | + @Resource | ||
| 41 | + private TradeOrderStatisticsService tradeOrderStatisticsService; | ||
| 42 | + @Resource | ||
| 43 | + private AfterSaleStatisticsService afterSaleStatisticsService; | ||
| 44 | + @Resource | ||
| 45 | + private BrokerageStatisticsService brokerageStatisticsService; | ||
| 34 | 46 | ||
| 35 | @GetMapping("/summary") | 47 | @GetMapping("/summary") |
| 36 | @Operation(summary = "获得交易统计") | 48 | @Operation(summary = "获得交易统计") |
| @@ -68,4 +80,28 @@ public class TradeStatisticsController { | @@ -68,4 +80,28 @@ public class TradeStatisticsController { | ||
| 68 | ExcelUtils.write(response, "交易状况.xls", "数据", TradeTrendSummaryExcelVO.class, data); | 80 | ExcelUtils.write(response, "交易状况.xls", "数据", TradeTrendSummaryExcelVO.class, data); |
| 69 | } | 81 | } |
| 70 | 82 | ||
| 83 | + @GetMapping("/order-count") | ||
| 84 | + @Operation(summary = "获得交易订单数量") | ||
| 85 | + @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||
| 86 | + public CommonResult<TradeOrderCountRespVO> getOrderCount() { | ||
| 87 | + TradeOrderCountRespVO vo = tradeOrderStatisticsService.getOrderCount(); | ||
| 88 | + vo.setAfterSaleApply(afterSaleStatisticsService.getCountByStatus(AfterSaleStatusEnum.APPLY)) | ||
| 89 | + .setAuditingWithdraw(brokerageStatisticsService.getWithdrawCountByStatus(BrokerageWithdrawStatusEnum.AUDITING)); | ||
| 90 | + return success(vo); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @GetMapping("/order-comparison") | ||
| 94 | + @Operation(summary = "获得交易订单数量") | ||
| 95 | + @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||
| 96 | + public CommonResult<TradeStatisticsComparisonRespVO<TradeOrderSummaryRespVO>> getOrderComparison() { | ||
| 97 | + return success(tradeOrderStatisticsService.getOrderComparison()); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @GetMapping("/order-count-trend") | ||
| 101 | + @Operation(summary = "获得订单量趋势统计") | ||
| 102 | + @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||
| 103 | + public CommonResult<List<TradeStatisticsComparisonRespVO<TradeOrderTrendRespVO>>> getOrderCountTrendComparison(@Valid TradeOrderTrendReqVO reqVO) { | ||
| 104 | + return success(tradeOrderStatisticsService.getOrderCountTrendComparison(reqVO)); | ||
| 105 | + } | ||
| 106 | + | ||
| 71 | } | 107 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeOrderCountRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.controller.admin.trade.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Schema(description = "管理后台 - 交易订单数量 Response VO") | ||
| 7 | +@Data | ||
| 8 | +public class TradeOrderCountRespVO { | ||
| 9 | + | ||
| 10 | + @Schema(description = "待发货", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 11 | + private Long undelivered; | ||
| 12 | + | ||
| 13 | + @Schema(description = "待核销", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Long pickUp; | ||
| 15 | + | ||
| 16 | + @Schema(description = "退款中", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 17 | + private Long afterSaleApply; | ||
| 18 | + | ||
| 19 | + @Schema(description = "提现待审核", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 20 | + private Long auditingWithdraw; | ||
| 21 | + | ||
| 22 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeOrderSummaryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.controller.admin.trade.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Schema(description = "管理后台 - 交易订单统计 Response VO") | ||
| 7 | +@Data | ||
| 8 | +public class TradeOrderSummaryRespVO { | ||
| 9 | + | ||
| 10 | + @Schema(description = "支付订单商品数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 11 | + private Integer orderPayCount; | ||
| 12 | + | ||
| 13 | + @Schema(description = "总支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Integer orderPayPrice; | ||
| 15 | + | ||
| 16 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeOrderTrendReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.controller.admin.trade.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | +import cn.iocoder.yudao.module.statistics.enums.TimeRangeTypeEnum; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import javax.validation.constraints.NotNull; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - 交易订单量趋势统计 Request VO") | ||
| 15 | +@Data | ||
| 16 | +public class TradeOrderTrendReqVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "日期范围类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + @NotNull(message = "日期范围类型不能为空") | ||
| 20 | + @InEnum(value = TimeRangeTypeEnum.class, message = "日期范围类型,必须是 {value}") | ||
| 21 | + private Integer type; | ||
| 22 | + | ||
| 23 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 24 | + @Schema(description = "起始时间") | ||
| 25 | + private LocalDateTime beginTime; | ||
| 26 | + | ||
| 27 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 28 | + @Schema(description = "截止时间") | ||
| 29 | + private LocalDateTime endTime; | ||
| 30 | + | ||
| 31 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeOrderTrendRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.statistics.controller.admin.trade.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Schema(description = "管理后台 - 订单量趋势统计 Response VO") | ||
| 7 | +@Data | ||
| 8 | +public class TradeOrderTrendRespVO { | ||
| 9 | + | ||
| 10 | + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 11 | + private String date; | ||
| 12 | + | ||
| 13 | + @Schema(description = "订单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Integer orderPayCount; | ||
| 15 | + | ||
| 16 | + @Schema(description = "订单支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 17 | + private Integer orderPayPrice; | ||
| 18 | + | ||
| 19 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java
| @@ -12,14 +12,15 @@ import java.time.LocalDateTime; | @@ -12,14 +12,15 @@ import java.time.LocalDateTime; | ||
| 12 | * @author owen | 12 | * @author owen |
| 13 | */ | 13 | */ |
| 14 | @Mapper | 14 | @Mapper |
| 15 | -public interface ApiAccessLogStatisticsMapper extends BaseMapperX<Object> { | 15 | +@SuppressWarnings("rawtypes") |
| 16 | +public interface ApiAccessLogStatisticsMapper extends BaseMapperX { | ||
| 16 | 17 | ||
| 17 | - // TODO @疯狂:是不是 selectIpCount | ||
| 18 | - Integer selectCountByIp(@Param("beginTime") LocalDateTime beginTime, | ||
| 19 | - @Param("endTime") LocalDateTime endTime); | 18 | + Integer selectIpCountByCreateTimeBetween(@Param("userType") Integer userType, |
| 19 | + @Param("beginTime") LocalDateTime beginTime, | ||
| 20 | + @Param("endTime") LocalDateTime endTime); | ||
| 20 | 21 | ||
| 21 | - // TODO @疯狂:是不是 selectUserCount | ||
| 22 | - Integer selectCountByUserId(@Param("beginTime") LocalDateTime beginTime, | ||
| 23 | - @Param("endTime") LocalDateTime endTime); | 22 | + Integer selectUserCountByCreateTimeBetween(@Param("userType") Integer userType, |
| 23 | + @Param("beginTime") LocalDateTime beginTime, | ||
| 24 | + @Param("endTime") LocalDateTime endTime); | ||
| 24 | 25 | ||
| 25 | } | 26 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.statistics.dal.mysql.member; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.statistics.dal.mysql.member; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; | 4 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; |
| 5 | +import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberRegisterCountRespVO; | ||
| 5 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberSexStatisticsRespVO; | 6 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberSexStatisticsRespVO; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 7 | import org.apache.ibatis.annotations.Mapper; |
| 7 | import org.apache.ibatis.annotations.Param; | 8 | import org.apache.ibatis.annotations.Param; |
| @@ -15,7 +16,8 @@ import java.util.List; | @@ -15,7 +16,8 @@ import java.util.List; | ||
| 15 | * @author owen | 16 | * @author owen |
| 16 | */ | 17 | */ |
| 17 | @Mapper | 18 | @Mapper |
| 18 | -public interface MemberStatisticsMapper extends BaseMapperX<Object> { | 19 | +@SuppressWarnings("rawtypes") |
| 20 | +public interface MemberStatisticsMapper extends BaseMapperX { | ||
| 19 | 21 | ||
| 20 | // TODO @芋艿:已经 review | 22 | // TODO @芋艿:已经 review |
| 21 | // TODO @疯狂:要不还是搞下 bo?虽然可能冗余了点~~ | 23 | // TODO @疯狂:要不还是搞下 bo?虽然可能冗余了点~~ |
| @@ -27,4 +29,7 @@ public interface MemberStatisticsMapper extends BaseMapperX<Object> { | @@ -27,4 +29,7 @@ public interface MemberStatisticsMapper extends BaseMapperX<Object> { | ||
| 27 | Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime, | 29 | Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime, |
| 28 | @Param("endTime") LocalDateTime endTime); | 30 | @Param("endTime") LocalDateTime endTime); |
| 29 | 31 | ||
| 32 | + List<MemberRegisterCountRespVO> selectListByCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||
| 33 | + @Param("endTime") LocalDateTime endTime); | ||
| 34 | + | ||
| 30 | } | 35 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java
| 1 | package cn.iocoder.yudao.module.statistics.dal.mysql.pay; | 1 | package cn.iocoder.yudao.module.statistics.dal.mysql.pay; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | -import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | ||
| 5 | import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO; | 4 | import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO; |
| 6 | import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | 5 | import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; |
| 7 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| @@ -15,7 +14,8 @@ import java.time.LocalDateTime; | @@ -15,7 +14,8 @@ import java.time.LocalDateTime; | ||
| 15 | * @author owen | 14 | * @author owen |
| 16 | */ | 15 | */ |
| 17 | @Mapper | 16 | @Mapper |
| 18 | -public interface PayWalletStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { | 17 | +@SuppressWarnings("rawtypes") |
| 18 | +public interface PayWalletStatisticsMapper extends BaseMapperX { | ||
| 19 | 19 | ||
| 20 | WalletSummaryRespBO selectRechargeSummaryByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, | 20 | WalletSummaryRespBO selectRechargeSummaryByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, |
| 21 | @Param("endTime") LocalDateTime endTime, | 21 | @Param("endTime") LocalDateTime endTime, |
| @@ -34,4 +34,6 @@ public interface PayWalletStatisticsMapper extends BaseMapperX<TradeStatisticsDO | @@ -34,4 +34,6 @@ public interface PayWalletStatisticsMapper extends BaseMapperX<TradeStatisticsDO | ||
| 34 | @Param("endTime") LocalDateTime endTime, | 34 | @Param("endTime") LocalDateTime endTime, |
| 35 | @Param("payStatus") Boolean payStatus); | 35 | @Param("payStatus") Boolean payStatus); |
| 36 | 36 | ||
| 37 | + Integer selectRechargePriceSummary(@Param("payStatus") Integer payStatus); | ||
| 38 | + | ||
| 37 | } | 39 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/AfterSaleStatisticsMapper.java
| @@ -19,4 +19,6 @@ public interface AfterSaleStatisticsMapper extends BaseMapperX<TradeStatisticsDO | @@ -19,4 +19,6 @@ public interface AfterSaleStatisticsMapper extends BaseMapperX<TradeStatisticsDO | ||
| 19 | AfterSaleSummaryRespBO selectSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime, | 19 | AfterSaleSummaryRespBO selectSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime, |
| 20 | @Param("endTime") LocalDateTime endTime); | 20 | @Param("endTime") LocalDateTime endTime); |
| 21 | 21 | ||
| 22 | + Long selectCountByStatus(@Param("status") Integer status); | ||
| 23 | + | ||
| 22 | } | 24 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/BrokerageStatisticsMapper.java
| @@ -20,4 +20,6 @@ public interface BrokerageStatisticsMapper extends BaseMapperX<TradeStatisticsDO | @@ -20,4 +20,6 @@ public interface BrokerageStatisticsMapper extends BaseMapperX<TradeStatisticsDO | ||
| 20 | @Param("beginTime") LocalDateTime beginTime, | 20 | @Param("beginTime") LocalDateTime beginTime, |
| 21 | @Param("endTime") LocalDateTime endTime); | 21 | @Param("endTime") LocalDateTime endTime); |
| 22 | 22 | ||
| 23 | + Long selectWithdrawCountByStatus(@Param("status") Integer status); | ||
| 24 | + | ||
| 23 | } | 25 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeOrderStatisticsMapper.java
| @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.statistics.dal.mysql.trade; | @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.statistics.dal.mysql.trade; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; | 4 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; |
| 5 | +import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeOrderSummaryRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeOrderTrendRespVO; | ||
| 5 | import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | 7 | import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| 7 | import org.apache.ibatis.annotations.Param; | 9 | import org.apache.ibatis.annotations.Param; |
| @@ -38,4 +40,32 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsD | @@ -38,4 +40,32 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsD | ||
| 38 | Integer selectUserCountByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, | 40 | Integer selectUserCountByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, |
| 39 | @Param("endTime") LocalDateTime endTime); | 41 | @Param("endTime") LocalDateTime endTime); |
| 40 | 42 | ||
| 43 | + /** | ||
| 44 | + * 按照支付时间统计订单(按天分组) | ||
| 45 | + * | ||
| 46 | + * @param beginTime 支付起始时间 | ||
| 47 | + * @param endTime 支付截止时间 | ||
| 48 | + * @return 订单统计列表 | ||
| 49 | + */ | ||
| 50 | + List<TradeOrderTrendRespVO> selectListByPayTimeBetweenAndGroupByDay(@Param("beginTime") LocalDateTime beginTime, | ||
| 51 | + @Param("endTime") LocalDateTime endTime); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 按照支付时间统计订单(按月分组) | ||
| 55 | + * | ||
| 56 | + * @param beginTime 支付起始时间 | ||
| 57 | + * @param endTime 支付截止时间 | ||
| 58 | + * @return 订单统计列表 | ||
| 59 | + */ | ||
| 60 | + List<TradeOrderTrendRespVO> selectListByPayTimeBetweenAndGroupByMonth(@Param("beginTime") LocalDateTime beginTime, | ||
| 61 | + @Param("endTime") LocalDateTime endTime); | ||
| 62 | + | ||
| 63 | + Long selectCountByStatus(@Param("status") Integer status); | ||
| 64 | + | ||
| 65 | + Long selectCountByStatusAndPickUpStoreIdIsNotNull(@Param("status") Integer status); | ||
| 66 | + | ||
| 67 | + TradeOrderSummaryRespVO selectPaySummaryByStatusAndPayTimeBetween(@Param("status") Integer status, | ||
| 68 | + @Param("beginTime") LocalDateTime beginTime, | ||
| 69 | + @Param("endTime") LocalDateTime endTime); | ||
| 70 | + | ||
| 41 | } | 71 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsService.java
| @@ -14,21 +14,23 @@ public interface ApiAccessLogStatisticsService { | @@ -14,21 +14,23 @@ public interface ApiAccessLogStatisticsService { | ||
| 14 | /** | 14 | /** |
| 15 | * 获取活跃用户数量 | 15 | * 获取活跃用户数量 |
| 16 | * | 16 | * |
| 17 | + * @param userType 用户类型 | ||
| 17 | * @param beginTime 起始时间 | 18 | * @param beginTime 起始时间 |
| 18 | * @param endTime 截止时间 | 19 | * @param endTime 截止时间 |
| 19 | * @return 活跃用户数量 | 20 | * @return 活跃用户数量 |
| 20 | */ | 21 | */ |
| 21 | - Integer getActiveUserCount(LocalDateTime beginTime, LocalDateTime endTime); | 22 | + Integer getActiveUserCount(Integer userType, LocalDateTime beginTime, LocalDateTime endTime); |
| 22 | 23 | ||
| 23 | // TODO @疯狂:需要传递 userType;因为访问日志,可能涉及多种用户类型; | 24 | // TODO @疯狂:需要传递 userType;因为访问日志,可能涉及多种用户类型; |
| 24 | // TODO @疯狂:方法名,要不改成 getIpCount;原因:让它更业务无关 | 25 | // TODO @疯狂:方法名,要不改成 getIpCount;原因:让它更业务无关 |
| 25 | /** | 26 | /** |
| 26 | * 获取访问用户数量 | 27 | * 获取访问用户数量 |
| 27 | * | 28 | * |
| 29 | + * @param userType 用户类型 | ||
| 28 | * @param beginTime 起始时间 | 30 | * @param beginTime 起始时间 |
| 29 | * @param endTime 截止时间 | 31 | * @param endTime 截止时间 |
| 30 | * @return 访问用户数量 | 32 | * @return 访问用户数量 |
| 31 | */ | 33 | */ |
| 32 | - Integer getVisitorUserCount(LocalDateTime beginTime, LocalDateTime endTime); | 34 | + Integer getVisitorUserCount(Integer userType, LocalDateTime beginTime, LocalDateTime endTime); |
| 33 | 35 | ||
| 34 | } | 36 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsServiceImpl.java
| @@ -20,13 +20,13 @@ public class ApiAccessLogStatisticsServiceImpl implements ApiAccessLogStatistics | @@ -20,13 +20,13 @@ public class ApiAccessLogStatisticsServiceImpl implements ApiAccessLogStatistics | ||
| 20 | private ApiAccessLogStatisticsMapper apiAccessLogStatisticsMapper; | 20 | private ApiAccessLogStatisticsMapper apiAccessLogStatisticsMapper; |
| 21 | 21 | ||
| 22 | @Override | 22 | @Override |
| 23 | - public Integer getActiveUserCount(LocalDateTime beginTime, LocalDateTime endTime) { | ||
| 24 | - return apiAccessLogStatisticsMapper.selectCountByUserId(beginTime, endTime); | 23 | + public Integer getActiveUserCount(Integer userType, LocalDateTime beginTime, LocalDateTime endTime) { |
| 24 | + return apiAccessLogStatisticsMapper.selectUserCountByCreateTimeBetween(userType, beginTime, endTime); | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | @Override | 27 | @Override |
| 28 | - public Integer getVisitorUserCount(LocalDateTime beginTime, LocalDateTime endTime) { | ||
| 29 | - return apiAccessLogStatisticsMapper.selectCountByIp(beginTime, endTime); | 28 | + public Integer getVisitorUserCount(Integer userType, LocalDateTime beginTime, LocalDateTime endTime) { |
| 29 | + return apiAccessLogStatisticsMapper.selectIpCountByCreateTimeBetween(userType, beginTime, endTime); | ||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | } | 32 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java
| 1 | package cn.iocoder.yudao.module.statistics.service.member; | 1 | package cn.iocoder.yudao.module.statistics.service.member; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAnalyseRespVO; | ||
| 4 | -import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; | ||
| 5 | -import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberSexStatisticsRespVO; | ||
| 6 | -import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberSummaryRespVO; | 3 | +import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.*; |
| 4 | +import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; | ||
| 7 | 5 | ||
| 8 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 9 | import java.util.List; | 7 | import java.util.List; |
| @@ -47,4 +45,20 @@ public interface MemberStatisticsService { | @@ -47,4 +45,20 @@ public interface MemberStatisticsService { | ||
| 47 | */ | 45 | */ |
| 48 | List<MemberSexStatisticsRespVO> getMemberSexStatisticsList(); | 46 | List<MemberSexStatisticsRespVO> getMemberSexStatisticsList(); |
| 49 | 47 | ||
| 48 | + /** | ||
| 49 | + * 获取用户注册数量列表 | ||
| 50 | + * | ||
| 51 | + * @param beginTime 起始时间 | ||
| 52 | + * @param endTime 截止时间 | ||
| 53 | + * @return 注册数量列表 | ||
| 54 | + */ | ||
| 55 | + List<MemberRegisterCountRespVO> getMemberRegisterCountList(LocalDateTime beginTime, LocalDateTime endTime); | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 获得用户数量量统计对照 | ||
| 59 | + * | ||
| 60 | + * @return 用户数量量统计对照 | ||
| 61 | + */ | ||
| 62 | + TradeStatisticsComparisonRespVO<MemberCountRespVO> getUserCountComparison(); | ||
| 63 | + | ||
| 50 | } | 64 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java
| 1 | package cn.iocoder.yudao.module.statistics.service.member; | 1 | package cn.iocoder.yudao.module.statistics.service.member; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | ||
| 3 | import cn.hutool.core.util.NumberUtil; | 4 | import cn.hutool.core.util.NumberUtil; |
| 5 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 4 | import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum; | 6 | import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum; |
| 5 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | 7 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 6 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.*; | 8 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.*; |
| 7 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; | 9 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; |
| 10 | +import cn.iocoder.yudao.module.statistics.convert.member.MemberStatisticsConvert; | ||
| 8 | import cn.iocoder.yudao.module.statistics.dal.mysql.member.MemberStatisticsMapper; | 11 | import cn.iocoder.yudao.module.statistics.dal.mysql.member.MemberStatisticsMapper; |
| 9 | import cn.iocoder.yudao.module.statistics.service.infra.ApiAccessLogStatisticsService; | 12 | import cn.iocoder.yudao.module.statistics.service.infra.ApiAccessLogStatisticsService; |
| 10 | import cn.iocoder.yudao.module.statistics.service.pay.PayWalletStatisticsService; | 13 | import cn.iocoder.yudao.module.statistics.service.pay.PayWalletStatisticsService; |
| @@ -13,7 +16,6 @@ import cn.iocoder.yudao.module.statistics.service.trade.TradeOrderStatisticsServ | @@ -13,7 +16,6 @@ import cn.iocoder.yudao.module.statistics.service.trade.TradeOrderStatisticsServ | ||
| 13 | import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService; | 16 | import cn.iocoder.yudao.module.statistics.service.trade.TradeStatisticsService; |
| 14 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 15 | import org.springframework.validation.annotation.Validated; | 18 | import org.springframework.validation.annotation.Validated; |
| 16 | -import cn.iocoder.yudao.module.statistics.convert.member.MemberStatisticsConvert; | ||
| 17 | 19 | ||
| 18 | import javax.annotation.Resource; | 20 | import javax.annotation.Resource; |
| 19 | import java.time.Duration; | 21 | import java.time.Duration; |
| @@ -94,7 +96,7 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | @@ -94,7 +96,7 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | ||
| 94 | atv = NumberUtil.div(payPrice, payUserCount).intValue(); | 96 | atv = NumberUtil.div(payPrice, payUserCount).intValue(); |
| 95 | } | 97 | } |
| 96 | return new MemberAnalyseRespVO() | 98 | return new MemberAnalyseRespVO() |
| 97 | - .setVisitorCount(apiAccessLogStatisticsService.getVisitorUserCount(beginTime, endTime)) | 99 | + .setVisitorCount(apiAccessLogStatisticsService.getVisitorUserCount(UserTypeEnum.MEMBER.getValue(), beginTime, endTime)) |
| 98 | .setOrderUserCount(tradeOrderStatisticsService.getOrderUserCount(beginTime, endTime)) | 100 | .setOrderUserCount(tradeOrderStatisticsService.getOrderUserCount(beginTime, endTime)) |
| 99 | .setPayUserCount(payUserCount) | 101 | .setPayUserCount(payUserCount) |
| 100 | .setAtv(atv) | 102 | .setAtv(atv) |
| @@ -106,7 +108,7 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | @@ -106,7 +108,7 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | ||
| 106 | .map(RechargeSummaryRespBO::getRechargeUserCount).orElse(0); | 108 | .map(RechargeSummaryRespBO::getRechargeUserCount).orElse(0); |
| 107 | return new MemberAnalyseComparisonRespVO() | 109 | return new MemberAnalyseComparisonRespVO() |
| 108 | .setUserCount(memberStatisticsMapper.selectUserCount(beginTime, endTime)) | 110 | .setUserCount(memberStatisticsMapper.selectUserCount(beginTime, endTime)) |
| 109 | - .setActiveUserCount(apiAccessLogStatisticsService.getActiveUserCount(beginTime, endTime)) | 111 | + .setActiveUserCount(apiAccessLogStatisticsService.getActiveUserCount(UserTypeEnum.MEMBER.getValue(), beginTime, endTime)) |
| 110 | .setRechargeUserCount(rechargeUserCount); | 112 | .setRechargeUserCount(rechargeUserCount); |
| 111 | } | 113 | } |
| 112 | 114 | ||
| @@ -116,4 +118,28 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | @@ -116,4 +118,28 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | ||
| 116 | return memberStatisticsMapper.selectSummaryListBySex(); | 118 | return memberStatisticsMapper.selectSummaryListBySex(); |
| 117 | } | 119 | } |
| 118 | 120 | ||
| 121 | + @Override | ||
| 122 | + public List<MemberRegisterCountRespVO> getMemberRegisterCountList(LocalDateTime beginTime, LocalDateTime endTime) { | ||
| 123 | + return memberStatisticsMapper.selectListByCreateTimeBetween(beginTime, endTime); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + @Override | ||
| 127 | + public TradeStatisticsComparisonRespVO<MemberCountRespVO> getUserCountComparison() { | ||
| 128 | + // 今日时间范围 | ||
| 129 | + LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); | ||
| 130 | + LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(beginOfToday); | ||
| 131 | + // 昨日时间范围 | ||
| 132 | + LocalDateTime beginOfYesterday = LocalDateTimeUtil.beginOfDay(beginOfToday.minusDays(1)); | ||
| 133 | + LocalDateTime endOfYesterday = LocalDateTimeUtil.endOfDay(beginOfYesterday); | ||
| 134 | + return new TradeStatisticsComparisonRespVO<MemberCountRespVO>() | ||
| 135 | + .setValue(getUserCount(beginOfToday, endOfToday)) | ||
| 136 | + .setReference(getUserCount(beginOfYesterday, endOfYesterday)); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + private MemberCountRespVO getUserCount(LocalDateTime beginTime, LocalDateTime endTime) { | ||
| 140 | + return new MemberCountRespVO() | ||
| 141 | + .setCreateUserCount(memberStatisticsMapper.selectUserCount(beginTime, endTime)) | ||
| 142 | + .setVisitUserCount(apiAccessLogStatisticsService.getVisitorUserCount(UserTypeEnum.MEMBER.getValue(), beginTime, endTime)); | ||
| 143 | + } | ||
| 144 | + | ||
| 119 | } | 145 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java
| @@ -30,4 +30,11 @@ public interface PayWalletStatisticsService { | @@ -30,4 +30,11 @@ public interface PayWalletStatisticsService { | ||
| 30 | */ | 30 | */ |
| 31 | RechargeSummaryRespBO getUserRechargeSummary(LocalDateTime beginTime, LocalDateTime endTime); | 31 | RechargeSummaryRespBO getUserRechargeSummary(LocalDateTime beginTime, LocalDateTime endTime); |
| 32 | 32 | ||
| 33 | + /** | ||
| 34 | + * 获取充值金额合计 | ||
| 35 | + * | ||
| 36 | + * @return 充值金额合计 | ||
| 37 | + */ | ||
| 38 | + Integer getRechargePriceSummary(); | ||
| 39 | + | ||
| 33 | } | 40 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java
| 1 | package cn.iocoder.yudao.module.statistics.service.pay; | 1 | package cn.iocoder.yudao.module.statistics.service.pay; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; | 3 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; |
| 4 | +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | ||
| 4 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; | 5 | import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; |
| 5 | import cn.iocoder.yudao.module.statistics.dal.mysql.pay.PayWalletStatisticsMapper; | 6 | import cn.iocoder.yudao.module.statistics.dal.mysql.pay.PayWalletStatisticsMapper; |
| 6 | import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO; | 7 | import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO; |
| @@ -43,4 +44,9 @@ public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsServic | @@ -43,4 +44,9 @@ public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsServic | ||
| 43 | return payWalletStatisticsMapper.selectRechargeSummaryGroupByWalletId(beginTime, endTime, true); | 44 | return payWalletStatisticsMapper.selectRechargeSummaryGroupByWalletId(beginTime, endTime, true); |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 47 | + @Override | ||
| 48 | + public Integer getRechargePriceSummary() { | ||
| 49 | + return payWalletStatisticsMapper.selectRechargePriceSummary(PayOrderStatusEnum.SUCCESS.getStatus()); | ||
| 50 | + } | ||
| 51 | + | ||
| 46 | } | 52 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/AfterSaleStatisticsService.java
| 1 | package cn.iocoder.yudao.module.statistics.service.trade; | 1 | package cn.iocoder.yudao.module.statistics.service.trade; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | 3 | import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; |
| 4 | +import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleStatusEnum; | ||
| 4 | 5 | ||
| 5 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 6 | 7 | ||
| @@ -20,4 +21,12 @@ public interface AfterSaleStatisticsService { | @@ -20,4 +21,12 @@ public interface AfterSaleStatisticsService { | ||
| 20 | */ | 21 | */ |
| 21 | AfterSaleSummaryRespBO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime); | 22 | AfterSaleSummaryRespBO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime); |
| 22 | 23 | ||
| 24 | + /** | ||
| 25 | + * 获取指定状态的售后订单数量 | ||
| 26 | + * | ||
| 27 | + * @param status 售后状态 | ||
| 28 | + * @return 售后订单数量 | ||
| 29 | + */ | ||
| 30 | + Long getCountByStatus(AfterSaleStatusEnum status); | ||
| 31 | + | ||
| 23 | } | 32 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/AfterSaleStatisticsServiceImpl.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.statistics.service.trade; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.statistics.service.trade; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.AfterSaleStatisticsMapper; | 3 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.AfterSaleStatisticsMapper; |
| 4 | import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | 4 | import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; |
| 5 | +import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleStatusEnum; | ||
| 5 | import org.springframework.stereotype.Service; | 6 | import org.springframework.stereotype.Service; |
| 6 | import org.springframework.validation.annotation.Validated; | 7 | import org.springframework.validation.annotation.Validated; |
| 7 | 8 | ||
| @@ -25,4 +26,9 @@ public class AfterSaleStatisticsServiceImpl implements AfterSaleStatisticsServic | @@ -25,4 +26,9 @@ public class AfterSaleStatisticsServiceImpl implements AfterSaleStatisticsServic | ||
| 25 | return afterSaleStatisticsMapper.selectSummaryByRefundTimeBetween(beginTime, endTime); | 26 | return afterSaleStatisticsMapper.selectSummaryByRefundTimeBetween(beginTime, endTime); |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 29 | + @Override | ||
| 30 | + public Long getCountByStatus(AfterSaleStatusEnum status) { | ||
| 31 | + return afterSaleStatisticsMapper.selectCountByStatus(status.getStatus()); | ||
| 32 | + } | ||
| 33 | + | ||
| 28 | } | 34 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/BrokerageStatisticsService.java
| 1 | package cn.iocoder.yudao.module.statistics.service.trade; | 1 | package cn.iocoder.yudao.module.statistics.service.trade; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | ||
| 4 | + | ||
| 3 | import java.time.LocalDateTime; | 5 | import java.time.LocalDateTime; |
| 4 | 6 | ||
| 5 | /** | 7 | /** |
| @@ -18,4 +20,12 @@ public interface BrokerageStatisticsService { | @@ -18,4 +20,12 @@ public interface BrokerageStatisticsService { | ||
| 18 | */ | 20 | */ |
| 19 | Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime); | 21 | Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime); |
| 20 | 22 | ||
| 23 | + /** | ||
| 24 | + * 获取指定状态的提现记录数量 | ||
| 25 | + * | ||
| 26 | + * @param status 提现记录状态 | ||
| 27 | + * @return 提现记录数量 | ||
| 28 | + */ | ||
| 29 | + Long getWithdrawCountByStatus(BrokerageWithdrawStatusEnum status); | ||
| 30 | + | ||
| 21 | } | 31 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/BrokerageStatisticsServiceImpl.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.trade; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.trade; | ||
| 3 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.BrokerageStatisticsMapper; | 3 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.BrokerageStatisticsMapper; |
| 4 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; | 4 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; |
| 5 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum; | 5 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum; |
| 6 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | ||
| 6 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 7 | import org.springframework.validation.annotation.Validated; | 8 | import org.springframework.validation.annotation.Validated; |
| 8 | 9 | ||
| @@ -28,4 +29,9 @@ public class BrokerageStatisticsServiceImpl implements BrokerageStatisticsServic | @@ -28,4 +29,9 @@ public class BrokerageStatisticsServiceImpl implements BrokerageStatisticsServic | ||
| 28 | beginTime, endTime); | 29 | beginTime, endTime); |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 32 | + @Override | ||
| 33 | + public Long getWithdrawCountByStatus(BrokerageWithdrawStatusEnum status) { | ||
| 34 | + return brokerageStatisticsMapper.selectWithdrawCountByStatus(status.getStatus()); | ||
| 35 | + } | ||
| 36 | + | ||
| 31 | } | 37 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeOrderStatisticsService.java
| 1 | package cn.iocoder.yudao.module.statistics.service.trade; | 1 | package cn.iocoder.yudao.module.statistics.service.trade; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; | 3 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; |
| 4 | +import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.*; | ||
| 4 | import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | 5 | import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; |
| 5 | 6 | ||
| 6 | import java.time.LocalDateTime; | 7 | import java.time.LocalDateTime; |
| @@ -60,4 +61,26 @@ public interface TradeOrderStatisticsService { | @@ -60,4 +61,26 @@ public interface TradeOrderStatisticsService { | ||
| 60 | */ | 61 | */ |
| 61 | Integer getOrderPayPrice(LocalDateTime beginTime, LocalDateTime endTime); | 62 | Integer getOrderPayPrice(LocalDateTime beginTime, LocalDateTime endTime); |
| 62 | 63 | ||
| 64 | + /** | ||
| 65 | + * 获得交易订单数量 | ||
| 66 | + * | ||
| 67 | + * @return 订单数量 | ||
| 68 | + */ | ||
| 69 | + TradeOrderCountRespVO getOrderCount(); | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 交易订单销售额对照 | ||
| 73 | + * | ||
| 74 | + * @return 销售额对照 | ||
| 75 | + */ | ||
| 76 | + TradeStatisticsComparisonRespVO<TradeOrderSummaryRespVO> getOrderComparison(); | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 获得订单量趋势统计 | ||
| 80 | + * | ||
| 81 | + * @param reqVO 统计参数 | ||
| 82 | + * @return 订单量趋势统计 | ||
| 83 | + */ | ||
| 84 | + List<TradeStatisticsComparisonRespVO<TradeOrderTrendRespVO>> getOrderCountTrendComparison(TradeOrderTrendReqVO reqVO); | ||
| 85 | + | ||
| 63 | } | 86 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeOrderStatisticsServiceImpl.java
| 1 | package cn.iocoder.yudao.module.statistics.service.trade; | 1 | package cn.iocoder.yudao.module.statistics.service.trade; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.date.LocalDateTimeUtil; | ||
| 5 | +import cn.hutool.core.util.ObjUtil; | ||
| 6 | +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; | ||
| 3 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; | 7 | import cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO; |
| 8 | +import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.*; | ||
| 4 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeOrderStatisticsMapper; | 9 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeOrderStatisticsMapper; |
| 10 | +import cn.iocoder.yudao.module.statistics.enums.TimeRangeTypeEnum; | ||
| 5 | import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | 11 | import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; |
| 12 | +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; | ||
| 6 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 7 | import org.springframework.validation.annotation.Validated; | 14 | import org.springframework.validation.annotation.Validated; |
| 8 | 15 | ||
| 9 | import javax.annotation.Resource; | 16 | import javax.annotation.Resource; |
| 17 | +import java.time.Duration; | ||
| 10 | import java.time.LocalDateTime; | 18 | import java.time.LocalDateTime; |
| 11 | import java.util.List; | 19 | import java.util.List; |
| 20 | +import java.util.stream.Collectors; | ||
| 21 | +import java.util.stream.IntStream; | ||
| 12 | 22 | ||
| 13 | /** | 23 | /** |
| 14 | * 交易订单统计 Service 实现类 | 24 | * 交易订单统计 Service 实现类 |
| @@ -50,4 +60,53 @@ public class TradeOrderStatisticsServiceImpl implements TradeOrderStatisticsServ | @@ -50,4 +60,53 @@ public class TradeOrderStatisticsServiceImpl implements TradeOrderStatisticsServ | ||
| 50 | return tradeOrderStatisticsMapper.selectSummaryPriceByPayTimeBetween(beginTime, endTime); | 60 | return tradeOrderStatisticsMapper.selectSummaryPriceByPayTimeBetween(beginTime, endTime); |
| 51 | } | 61 | } |
| 52 | 62 | ||
| 63 | + @Override | ||
| 64 | + public TradeOrderCountRespVO getOrderCount() { | ||
| 65 | + Long undeliveredCount = tradeOrderStatisticsMapper.selectCountByStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()); | ||
| 66 | + Long pickUpCount = tradeOrderStatisticsMapper.selectCountByStatusAndPickUpStoreIdIsNotNull(TradeOrderStatusEnum.DELIVERED.getStatus()); | ||
| 67 | + | ||
| 68 | + return new TradeOrderCountRespVO() | ||
| 69 | + .setPickUp(ObjUtil.defaultIfNull(pickUpCount, 0L)) | ||
| 70 | + .setUndelivered(ObjUtil.defaultIfNull(undeliveredCount, 0L)); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Override | ||
| 74 | + public TradeStatisticsComparisonRespVO<TradeOrderSummaryRespVO> getOrderComparison() { | ||
| 75 | + return new TradeStatisticsComparisonRespVO<TradeOrderSummaryRespVO>() | ||
| 76 | + .setValue(getPayPriceSummary(LocalDateTime.now())) | ||
| 77 | + .setReference(getPayPriceSummary(LocalDateTime.now().minusDays(1))); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + private TradeOrderSummaryRespVO getPayPriceSummary(LocalDateTime date) { | ||
| 81 | + LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(date); | ||
| 82 | + LocalDateTime endTime = LocalDateTimeUtil.beginOfDay(date); | ||
| 83 | + | ||
| 84 | + return tradeOrderStatisticsMapper.selectPaySummaryByStatusAndPayTimeBetween(PayOrderStatusEnum.SUCCESS.getStatus(), beginTime, endTime); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @Override | ||
| 88 | + public List<TradeStatisticsComparisonRespVO<TradeOrderTrendRespVO>> getOrderCountTrendComparison(TradeOrderTrendReqVO reqVO) { | ||
| 89 | + // 查询当前数据 | ||
| 90 | + List<TradeOrderTrendRespVO> value = getOrderCountTrend(reqVO.getType(), reqVO.getBeginTime(), reqVO.getEndTime()); | ||
| 91 | + // 查询对照数据 | ||
| 92 | + LocalDateTime referenceEndTime = reqVO.getBeginTime().minusDays(1); | ||
| 93 | + LocalDateTime referenceBeginTime = referenceEndTime.minus(Duration.between(reqVO.getBeginTime(), reqVO.getEndTime())); | ||
| 94 | + List<TradeOrderTrendRespVO> reference = getOrderCountTrend(reqVO.getType(), referenceBeginTime, referenceEndTime); | ||
| 95 | + | ||
| 96 | + return IntStream.range(0, value.size()) | ||
| 97 | + .mapToObj(index -> new TradeStatisticsComparisonRespVO<TradeOrderTrendRespVO>() | ||
| 98 | + .setValue(CollUtil.get(value, index)) | ||
| 99 | + .setReference(CollUtil.get(reference, index))) | ||
| 100 | + .collect(Collectors.toList()); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + private List<TradeOrderTrendRespVO> getOrderCountTrend(Integer timeRangeType, LocalDateTime beginTime, LocalDateTime endTime) { | ||
| 104 | + // 情况一:按年统计时,以月份分组 | ||
| 105 | + if (TimeRangeTypeEnum.YEAR.getType().equals(timeRangeType)) { | ||
| 106 | + return tradeOrderStatisticsMapper.selectListByPayTimeBetweenAndGroupByMonth(beginTime, endTime); | ||
| 107 | + } | ||
| 108 | + // 情况二:其它以天分组(天、周、月) | ||
| 109 | + return tradeOrderStatisticsMapper.selectListByPayTimeBetweenAndGroupByDay(beginTime, endTime); | ||
| 110 | + } | ||
| 111 | + | ||
| 53 | } | 112 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsService.java
| @@ -33,7 +33,7 @@ public interface TradeStatisticsService { | @@ -33,7 +33,7 @@ public interface TradeStatisticsService { | ||
| 33 | * 获得交易状况统计 | 33 | * 获得交易状况统计 |
| 34 | * | 34 | * |
| 35 | * @param beginTime 开始时间 | 35 | * @param beginTime 开始时间 |
| 36 | - * @param endTime 结束时间 | 36 | + * @param endTime 结束时间 |
| 37 | * @return 统计数据对照 | 37 | * @return 统计数据对照 |
| 38 | */ | 38 | */ |
| 39 | Integer getExpensePrice(LocalDateTime beginTime, LocalDateTime endTime); | 39 | Integer getExpensePrice(LocalDateTime beginTime, LocalDateTime endTime); |
| @@ -41,6 +41,8 @@ public interface TradeStatisticsService { | @@ -41,6 +41,8 @@ public interface TradeStatisticsService { | ||
| 41 | /** | 41 | /** |
| 42 | * 获得交易状况明细 | 42 | * 获得交易状况明细 |
| 43 | * | 43 | * |
| 44 | + * @param beginTime 开始时间 | ||
| 45 | + * @param endTime 结束时间 | ||
| 44 | * @return 统计数据列表 | 46 | * @return 统计数据列表 |
| 45 | */ | 47 | */ |
| 46 | List<TradeTrendSummaryRespVO> getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime); | 48 | List<TradeTrendSummaryRespVO> getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime); |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java
| @@ -2,17 +2,17 @@ package cn.iocoder.yudao.module.statistics.service.trade; | @@ -2,17 +2,17 @@ package cn.iocoder.yudao.module.statistics.service.trade; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.date.LocalDateTimeUtil; | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; | 4 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 5 | -import cn.iocoder.yudao.module.statistics.service.pay.PayWalletStatisticsService; | ||
| 6 | -import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | ||
| 7 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; | 5 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeStatisticsComparisonRespVO; |
| 8 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeSummaryRespVO; | 6 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeSummaryRespVO; |
| 9 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO; | 7 | import cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO; |
| 10 | import cn.iocoder.yudao.module.statistics.convert.trade.TradeStatisticsConvert; | 8 | import cn.iocoder.yudao.module.statistics.convert.trade.TradeStatisticsConvert; |
| 11 | import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; | 9 | import cn.iocoder.yudao.module.statistics.dal.dataobject.trade.TradeStatisticsDO; |
| 12 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsMapper; | 10 | import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsMapper; |
| 13 | -import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeSummaryRespBO; | 11 | +import cn.iocoder.yudao.module.statistics.service.pay.PayWalletStatisticsService; |
| 14 | import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; | 12 | import cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO; |
| 15 | import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; | 13 | import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeOrderSummaryRespBO; |
| 14 | +import cn.iocoder.yudao.module.statistics.service.trade.bo.TradeSummaryRespBO; | ||
| 15 | +import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; | ||
| 16 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 17 | import org.springframework.util.StopWatch; | 17 | import org.springframework.util.StopWatch; |
| 18 | import org.springframework.validation.annotation.Validated; | 18 | import org.springframework.validation.annotation.Validated; |
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml
| @@ -2,23 +2,21 @@ | @@ -2,23 +2,21 @@ | ||
| 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.infra.ApiAccessLogStatisticsMapper"> | 3 | <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.infra.ApiAccessLogStatisticsMapper"> |
| 4 | 4 | ||
| 5 | - <select id="selectCountByIp" resultType="java.lang.Integer"> | ||
| 6 | - <!-- TODO @疯狂:distinct 会不会更合适哈 --> | ||
| 7 | - SELECT COUNT(1) | 5 | + <select id="selectIpCountByCreateTimeBetween" resultType="java.lang.Integer"> |
| 6 | + SELECT COUNT(DISTINCT user_ip) | ||
| 8 | FROM infra_api_access_log | 7 | FROM infra_api_access_log |
| 9 | - WHERE create_time BETWEEN #{beginTime} AND #{endTime} | ||
| 10 | - AND deleted = FALSE | ||
| 11 | - GROUP BY user_ip | 8 | + WHERE user_type = #{userType} |
| 9 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | ||
| 10 | + AND deleted = FALSE | ||
| 12 | </select> | 11 | </select> |
| 13 | 12 | ||
| 14 | - <select id="selectCountByUserId" resultType="java.lang.Integer"> | ||
| 15 | - <!-- TODO @疯狂:distinct 会不会更合适哈 --> | ||
| 16 | - SELECT COUNT(1) | 13 | + <select id="selectUserCountByCreateTimeBetween" resultType="java.lang.Integer"> |
| 14 | + SELECT COUNT(DISTINCT user_id) | ||
| 17 | FROM infra_api_access_log | 15 | FROM infra_api_access_log |
| 18 | WHERE user_id > 0 | 16 | WHERE user_id > 0 |
| 17 | + AND user_type = #{userType} | ||
| 19 | AND create_time BETWEEN #{beginTime} AND #{endTime} | 18 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 20 | AND deleted = FALSE | 19 | AND deleted = FALSE |
| 21 | - GROUP BY user_id | ||
| 22 | </select> | 20 | </select> |
| 23 | 21 | ||
| 24 | </mapper> | 22 | </mapper> |
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml
| @@ -30,4 +30,14 @@ | @@ -30,4 +30,14 @@ | ||
| 30 | </if> | 30 | </if> |
| 31 | </select> | 31 | </select> |
| 32 | 32 | ||
| 33 | + <select id="selectListByCreateTimeBetween" | ||
| 34 | + resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberRegisterCountRespVO"> | ||
| 35 | + SELECT DATE_FORMAT(create_time, '%Y-%m-%d') AS date, | ||
| 36 | + count(1) AS count | ||
| 37 | + FROM member_user | ||
| 38 | + WHERE create_time BETWEEN #{beginTime} AND #{endTime} | ||
| 39 | + AND deleted = FALSE | ||
| 40 | + GROUP BY date | ||
| 41 | + </select> | ||
| 42 | + | ||
| 33 | </mapper> | 43 | </mapper> |
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml
| @@ -46,4 +46,11 @@ | @@ -46,4 +46,11 @@ | ||
| 46 | GROUP BY wallet_id | 46 | GROUP BY wallet_id |
| 47 | </select> | 47 | </select> |
| 48 | 48 | ||
| 49 | + <select id="selectRechargePriceSummary" resultType="java.lang.Integer"> | ||
| 50 | + SELECT IFNULL(SUM(pay_price), 0) | ||
| 51 | + FROM pay_wallet_recharge | ||
| 52 | + WHERE pay_status = #{payStatus} | ||
| 53 | + AND deleted = FALSE | ||
| 54 | + </select> | ||
| 55 | + | ||
| 49 | </mapper> | 56 | </mapper> |
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml
| @@ -11,4 +11,11 @@ | @@ -11,4 +11,11 @@ | ||
| 11 | AND deleted = FALSE | 11 | AND deleted = FALSE |
| 12 | </select> | 12 | </select> |
| 13 | 13 | ||
| 14 | + <select id="selectCountByStatus" resultType="java.lang.Long"> | ||
| 15 | + SELECT COUNT(1) | ||
| 16 | + FROM trade_after_sale | ||
| 17 | + WHERE status = #{status} | ||
| 18 | + AND deleted = FALSE | ||
| 19 | + </select> | ||
| 20 | + | ||
| 14 | </mapper> | 21 | </mapper> |
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml
| @@ -11,4 +11,11 @@ | @@ -11,4 +11,11 @@ | ||
| 11 | AND deleted = FALSE | 11 | AND deleted = FALSE |
| 12 | </select> | 12 | </select> |
| 13 | 13 | ||
| 14 | + <select id="selectWithdrawCountByStatus" resultType="java.lang.Long"> | ||
| 15 | + SELECT COUNT(1) | ||
| 16 | + FROM trade_brokerage_withdraw | ||
| 17 | + WHERE status = #{status} | ||
| 18 | + AND deleted = FALSE | ||
| 19 | + </select> | ||
| 20 | + | ||
| 14 | </mapper> | 21 | </mapper> |
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeOrderStatisticsMapper"> | 3 | <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeOrderStatisticsMapper"> |
| 4 | - | ||
| 5 | <select id="selectSummaryListByAreaId" | 4 | <select id="selectSummaryListByAreaId" |
| 6 | resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO"> | 5 | resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO"> |
| 7 | SELECT receiver_area_id AS areaId, | 6 | SELECT receiver_area_id AS areaId, |
| @@ -24,14 +23,14 @@ | @@ -24,14 +23,14 @@ | ||
| 24 | </select> | 23 | </select> |
| 25 | 24 | ||
| 26 | <select id="selectUserCountByCreateTimeBetween" resultType="java.lang.Integer"> | 25 | <select id="selectUserCountByCreateTimeBetween" resultType="java.lang.Integer"> |
| 27 | - SELECT COUNT(DISTINCT(user_id)) | 26 | + SELECT COUNT(DISTINCT (user_id)) |
| 28 | FROM trade_order | 27 | FROM trade_order |
| 29 | WHERE deleted = FALSE | 28 | WHERE deleted = FALSE |
| 30 | AND create_time BETWEEN #{beginTime} AND #{endTime} | 29 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 31 | </select> | 30 | </select> |
| 32 | 31 | ||
| 33 | <select id="selectUserCountByPayTimeBetween" resultType="java.lang.Integer"> | 32 | <select id="selectUserCountByPayTimeBetween" resultType="java.lang.Integer"> |
| 34 | - SELECT COUNT(DISTINCT(user_id)) | 33 | + SELECT COUNT(DISTINCT (user_id)) |
| 35 | FROM trade_order | 34 | FROM trade_order |
| 36 | WHERE pay_time BETWEEN #{beginTime} AND #{endTime} | 35 | WHERE pay_time BETWEEN #{beginTime} AND #{endTime} |
| 37 | AND pay_status = TRUE | 36 | AND pay_status = TRUE |
| @@ -61,4 +60,52 @@ | @@ -61,4 +60,52 @@ | ||
| 61 | AND create_time BETWEEN #{beginTime} AND #{endTime} | 60 | AND create_time BETWEEN #{beginTime} AND #{endTime} |
| 62 | </select> | 61 | </select> |
| 63 | 62 | ||
| 63 | + <select id="selectListByPayTimeBetweenAndGroupByDay" | ||
| 64 | + resultType="cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeOrderTrendRespVO"> | ||
| 65 | + SELECT DATE_FORMAT(pay_time, '%Y-%m-%d') AS date, | ||
| 66 | + COUNT(1) AS orderPayCount, | ||
| 67 | + SUM(pay_price) AS orderPayPrice | ||
| 68 | + FROM trade_order | ||
| 69 | + WHERE pay_status = TRUE | ||
| 70 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | ||
| 71 | + AND deleted = FALSE | ||
| 72 | + GROUP BY date | ||
| 73 | + </select> | ||
| 74 | + | ||
| 75 | + <select id="selectListByPayTimeBetweenAndGroupByMonth" | ||
| 76 | + resultType="cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeOrderTrendRespVO"> | ||
| 77 | + SELECT DATE_FORMAT(pay_time, '%Y-%m') AS date, | ||
| 78 | + COUNT(1) AS orderPayCount, | ||
| 79 | + SUM(pay_price) AS orderPayPrice | ||
| 80 | + FROM trade_order | ||
| 81 | + WHERE pay_status = TRUE | ||
| 82 | + AND create_time BETWEEN #{beginTime} AND #{endTime} | ||
| 83 | + AND deleted = FALSE | ||
| 84 | + GROUP BY date | ||
| 85 | + </select> | ||
| 86 | + | ||
| 87 | + <select id="selectCountByStatus" resultType="java.lang.Long"> | ||
| 88 | + SELECT COUNT(1) | ||
| 89 | + FROM trade_order | ||
| 90 | + WHERE status = #{status} AND deleted = FALSE | ||
| 91 | + </select> | ||
| 92 | + | ||
| 93 | + <select id="selectCountByStatusAndPickUpStoreIdIsNotNull" resultType="java.lang.Long"> | ||
| 94 | + SELECT COUNT(1) | ||
| 95 | + FROM trade_order | ||
| 96 | + WHERE status = #{status} | ||
| 97 | + AND pick_up_store_id IS NOT NULL | ||
| 98 | + AND deleted = FALSE | ||
| 99 | + </select> | ||
| 100 | + | ||
| 101 | + <select id="selectPaySummaryByStatusAndPayTimeBetween" | ||
| 102 | + resultType="cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeOrderSummaryRespVO"> | ||
| 103 | + SELECT IFNULL(SUM(pay_price), 0) AS orderPayPrice, | ||
| 104 | + COUNT(1) AS orderPayCount | ||
| 105 | + FROM trade_order | ||
| 106 | + WHERE status = #{status} | ||
| 107 | + AND pay_time BETWEEN #{beginTime} AND #{endTime} | ||
| 108 | + AND deleted = FALSE | ||
| 109 | + </select> | ||
| 110 | + | ||
| 64 | </mapper> | 111 | </mapper> |