parent
26dfbfb2ac
commit
c5f2d07c87
@ -0,0 +1,33 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<parent> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-module-mall</artifactId> |
||||
<version>${revision}</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<artifactId>yudao-module-statistics-api</artifactId> |
||||
<packaging>jar</packaging> |
||||
|
||||
<name>${project.artifactId}</name> |
||||
<description> |
||||
statistics 模块 API,暴露给其它模块调用 |
||||
</description> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-common</artifactId> |
||||
</dependency> |
||||
|
||||
<!-- 参数校验 --> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-validation</artifactId> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
</project> |
@ -0,0 +1,4 @@ |
||||
/** |
||||
* TODO 占位,无特殊含义 |
||||
*/ |
||||
package cn.iocoder.yudao.module.statistics.api; |
@ -0,0 +1,4 @@ |
||||
/** |
||||
* TODO 占位,无特殊含义 |
||||
*/ |
||||
package cn.iocoder.yudao.module.statistics.enums; |
@ -0,0 +1,86 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<parent> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-module-mall</artifactId> |
||||
<version>${revision}</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<artifactId>yudao-module-statistics-biz</artifactId> |
||||
<packaging>jar</packaging> |
||||
|
||||
<name>${project.artifactId}</name> |
||||
<description> |
||||
statistics 模块,主要实现统计相关功能 |
||||
例如:统计商品、会员、交易等功能。 |
||||
</description> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-module-statistics-api</artifactId> |
||||
<version>${revision}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-module-promotion-api</artifactId> |
||||
<version>${revision}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-module-product-api</artifactId> |
||||
<version>${revision}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-module-trade-api</artifactId> |
||||
<version>${revision}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-module-member-api</artifactId> |
||||
<version>${revision}</version> |
||||
</dependency> |
||||
|
||||
<!-- 业务组件 --> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
||||
</dependency> |
||||
|
||||
<!-- Web 相关 --> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-spring-boot-starter-security</artifactId> |
||||
</dependency> |
||||
|
||||
<!-- DB 相关 --> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId> |
||||
</dependency> |
||||
|
||||
<!-- Test 测试相关 --> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-spring-boot-starter-test</artifactId> |
||||
</dependency> |
||||
|
||||
<!-- 工具类相关 --> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>cn.iocoder.boot</groupId> |
||||
<artifactId>yudao-spring-boot-starter-biz-dict</artifactId> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
</project> |
@ -0,0 +1,9 @@ |
||||
/** |
||||
* TODO |
||||
* 1. 会员总数据 |
||||
* 2. 性别统计 |
||||
* 3. 渠道统计 |
||||
* 4. 地域统计 |
||||
* 5. 会员概览 |
||||
*/ |
||||
package cn.iocoder.yudao.module.statistics.controller.member; |
@ -0,0 +1 @@ |
||||
package cn.iocoder.yudao.module.statistics.controller; |
@ -0,0 +1,41 @@ |
||||
package cn.iocoder.yudao.module.statistics.controller.product; |
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
||||
import cn.iocoder.yudao.module.statistics.dal.mysql.product.ProductSpuStatisticsDO; |
||||
import cn.iocoder.yudao.module.statistics.dal.mysql.product.ProductStatisticsDO; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.util.List; |
||||
|
||||
@Tag(name = "管理后台 - 商品统计") |
||||
@RestController |
||||
@RequestMapping("/statistics/product") |
||||
@Validated |
||||
@Slf4j |
||||
public class ProductStatisticsController { |
||||
|
||||
// TODO @麦子:返回 ProductStatisticsComparisonResp, 里面有两个字段,一个是选择的时间范围的合计结果,一个是对比的时间范围的合计结果;
|
||||
// 例如说,选择时间范围是 2023-10-01 ~ 2023-10-02,那么对比就是 2023-09-30,再倒推 2 天;
|
||||
public CommonResult<Object> getProductStatisticsComparison() { |
||||
return null; |
||||
} |
||||
|
||||
// TODO @麦子:查询指定时间范围内的商品统计数据;DO 到时需要改成 VO 哈
|
||||
public CommonResult<List<ProductStatisticsDO>> getProductStatisticsList( |
||||
LocalDateTime[] times) { |
||||
return null; |
||||
} |
||||
|
||||
// TODO @麦子:查询指定时间范围内的商品 SPU 统计数据;DO 到时需要改成 VO 哈
|
||||
// 入参是分页参数 + 时间范围 + 排序字段
|
||||
public CommonResult<PageResult<ProductSpuStatisticsDO>> getProductSpuStatisticsPage() { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@ |
||||
package cn.iocoder.yudao.module.statistics.controller.trade; |
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
||||
import cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsDO; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.util.List; |
||||
|
||||
@Tag(name = "管理后台 - 交易统计") |
||||
@RestController |
||||
@RequestMapping("/statistics/product") |
||||
@Validated |
||||
@Slf4j |
||||
public class TradeStatisticsController { |
||||
|
||||
// TODO @疯狂:有个 summary 接口,返回昨日、本月、支付金额、本月订单金额等数据;具体看 ui 哈;
|
||||
|
||||
// TODO @疯狂:返回 ProductStatisticsComparisonResp, 里面有两个字段,一个是选择的时间范围的合计结果,一个是对比的时间范围的合计结果;
|
||||
// 例如说,选择时间范围是 2023-10-01 ~ 2023-10-02,那么对比就是 2023-09-30,再倒推 2 天;
|
||||
public CommonResult<Object> getTradeStatisticsComparison() { |
||||
return null; |
||||
} |
||||
|
||||
// TODO @疯狂:查询指定时间范围内的交易统计数据;DO 到时需要改成 VO 哈
|
||||
// 总收入(营业额)= 订单、充值的支付 - 订单、充值的退款
|
||||
public CommonResult<List<TradeStatisticsDO>> getTradeStatisticsList( |
||||
LocalDateTime[] times) { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,4 @@ |
||||
/** |
||||
* 占位 todo |
||||
*/ |
||||
package cn.iocoder.yudao.module.statistics.dal.dataobject; |
@ -0,0 +1,74 @@ |
||||
package cn.iocoder.yudao.module.statistics.dal.mysql.product; |
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
||||
import com.baomidou.mybatisplus.annotation.KeySequence; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.*; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
/** |
||||
* 商品 SPU 统计 DO |
||||
* |
||||
* 以天为维度,统计商品 SPU 的数据 |
||||
* |
||||
* @author 芋道源码 |
||||
*/ |
||||
@TableName("product_spu_statistics") |
||||
@KeySequence("product_spu_statistics_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ToString(callSuper = true) |
||||
@Builder |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
public class ProductSpuStatisticsDO extends BaseDO { |
||||
|
||||
/** |
||||
* 编号,主键自增 |
||||
*/ |
||||
@TableId |
||||
private Long id; |
||||
|
||||
/** |
||||
* 商品 SPU 编号 |
||||
* |
||||
* 关联 ProductSpuDO 的 id 字段 |
||||
*/ |
||||
private Long spuId; |
||||
/** |
||||
* 统计日期 |
||||
*/ |
||||
private LocalDateTime time; |
||||
|
||||
/** |
||||
* 浏览量 |
||||
*/ |
||||
private Integer browseCount; |
||||
/** |
||||
* 收藏量 |
||||
*/ |
||||
private Integer favoriteCount; |
||||
|
||||
/** |
||||
* 添加购物车次数 |
||||
* |
||||
* 以商品被添加到购物车的 createTime 计算,后续多次添加,不会增加该值。 |
||||
* 直到该次被下单、或者被删除,后续再次被添加到购物车。 |
||||
*/ |
||||
private Integer addCartCount; |
||||
/** |
||||
* 创建订单商品数 |
||||
*/ |
||||
private Integer createOrderCount; |
||||
/** |
||||
* 支付订单商品数 |
||||
*/ |
||||
private Integer payOrderCount; |
||||
/** |
||||
* 总支付金额,单位:分 |
||||
*/ |
||||
private Integer payPrice; |
||||
|
||||
} |
@ -0,0 +1,70 @@ |
||||
package cn.iocoder.yudao.module.statistics.dal.mysql.product; |
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
||||
import com.baomidou.mybatisplus.annotation.KeySequence; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.*; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
/** |
||||
* 商品统计 DO |
||||
* |
||||
* 以天为维度,统计全部的数据 |
||||
* |
||||
* 和 {@link ProductSpuStatisticsDO} 的差异是,它是全局的统计 |
||||
* |
||||
* @author 芋道源码 |
||||
*/ |
||||
@TableName("product_spu_statistics") |
||||
@KeySequence("product_spu_statistics_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ToString(callSuper = true) |
||||
@Builder |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
public class ProductStatisticsDO extends BaseDO { |
||||
|
||||
/** |
||||
* 编号,主键自增 |
||||
*/ |
||||
@TableId |
||||
private Long id; |
||||
|
||||
/** |
||||
* 统计日期 |
||||
*/ |
||||
private LocalDateTime time; |
||||
|
||||
/** |
||||
* 浏览量 |
||||
*/ |
||||
private Integer browseCount; |
||||
/** |
||||
* 收藏量 |
||||
*/ |
||||
private Integer favoriteCount; |
||||
|
||||
/** |
||||
* 添加购物车次数 |
||||
* |
||||
* 以商品被添加到购物车的 createTime 计算,后续多次添加,不会增加该值。 |
||||
* 直到该次被下单、或者被删除,后续再次被添加到购物车。 |
||||
*/ |
||||
private Integer addCartCount; |
||||
/** |
||||
* 创建订单商品数 |
||||
*/ |
||||
private Integer createOrderCount; |
||||
/** |
||||
* 支付订单商品数 |
||||
*/ |
||||
private Integer payOrderCount; |
||||
/** |
||||
* 总支付金额,单位:分 |
||||
*/ |
||||
private Integer payPrice; |
||||
|
||||
} |
@ -0,0 +1,89 @@ |
||||
package cn.iocoder.yudao.module.statistics.dal.mysql.trade; |
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
||||
import com.baomidou.mybatisplus.annotation.KeySequence; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.*; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
/** |
||||
* 交易统计 DO |
||||
* |
||||
* 以天为维度,统计全部的数据 |
||||
* |
||||
* @author 芋道源码 |
||||
*/ |
||||
@TableName("trade_statistics") |
||||
@KeySequence("trade_statistics_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ToString(callSuper = true) |
||||
@Builder |
||||
@NoArgsConstructor |
||||
@AllArgsConstructor |
||||
public class TradeStatisticsDO extends BaseDO { |
||||
|
||||
/** |
||||
* 编号,主键自增 |
||||
*/ |
||||
@TableId |
||||
private Long id; |
||||
|
||||
/** |
||||
* 统计日期 |
||||
*/ |
||||
private LocalDateTime time; |
||||
|
||||
/** |
||||
* 创建订单数 |
||||
*/ |
||||
private Integer orderCreateCount; |
||||
/** |
||||
* 支付订单商品数 |
||||
*/ |
||||
private Integer orderPayCount; |
||||
/** |
||||
* 总支付金额,单位:分 |
||||
*/ |
||||
private Integer orderPayPrice; |
||||
/** |
||||
* 总支付金额(余额),单位:分 |
||||
*/ |
||||
private Integer orderWalletPayPrice; |
||||
|
||||
/** |
||||
* 退款订单数 |
||||
*/ |
||||
private Integer afterSaleCount; |
||||
/** |
||||
* 总退款金额,单位:分 |
||||
*/ |
||||
private Integer afterSaleRefundPrice; |
||||
|
||||
/** |
||||
* 佣金金额(已结算),单位:分 |
||||
*/ |
||||
private Integer brokerageSettlementPrice; |
||||
|
||||
/** |
||||
* 充值订单数 |
||||
* |
||||
* 从 PayWalletRechargeDO 计算 |
||||
*/ |
||||
private Integer rechargePayCount; |
||||
/** |
||||
* 充值金额,单位:分 |
||||
*/ |
||||
private Integer rechargePayPrice; |
||||
/** |
||||
* 充值退款订单数 |
||||
*/ |
||||
private Integer rechargeRefundCount; |
||||
/** |
||||
* 充值退款金额,单位:分 |
||||
*/ |
||||
private Integer rechargeRefundPrice; |
||||
|
||||
} |
@ -0,0 +1,4 @@ |
||||
/** |
||||
* TODO 芋艿,占坑,无特殊含义 |
||||
*/ |
||||
package cn.iocoder.yudao.module.statistics.job; |
@ -0,0 +1,8 @@ |
||||
/** |
||||
* statistics 模块,主要实现统计相关功能。 |
||||
* 例如:统计商品、会员、交易等功能。 |
||||
* |
||||
* 1. Controller URL:以 /statistics/ 开头,避免和其它 Module 冲突 |
||||
* 2. DataObject 表名:以 statistics_ 为后缀,方便在数据库中区分【特殊】 |
||||
*/ |
||||
package cn.iocoder.yudao.module.statistics; |
Loading…
Reference in new issue