Commit 367b45e3bd677d52c12f3a3fa7923b37f90e4b34

Authored by YunaiV
1 parent b376de1a

code review:数据统计

Showing 14 changed files with 23 additions and 5 deletions
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/member/package-info.java renamed to yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/package-info.java
... ... @@ -6,4 +6,4 @@
6 6 * 4. 地域统计
7 7 * 5. 会员概览
8 8 */
9   -package cn.iocoder.yudao.module.statistics.controller.member;
  9 +package cn.iocoder.yudao.module.statistics.controller.admin.member;
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/product/ProductStatisticsController.java renamed to yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/product/ProductStatisticsController.java
1   -package cn.iocoder.yudao.module.statistics.controller.product;
  1 +package cn.iocoder.yudao.module.statistics.controller.admin.product;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java
... ... @@ -32,6 +32,7 @@ public class TradeStatisticsController {
32 32 @Resource
33 33 private TradeStatisticsService tradeStatisticsService;
34 34  
  35 + // TODO @疯狂:要不这个就是 /trend/summary 的特例,前端自己查询两次?
35 36 @GetMapping("/summary")
36 37 @Operation(summary = "获得交易统计")
37 38 @PreAuthorize("@ss.hasPermission('statistics:trade:query')")
... ... @@ -39,6 +40,7 @@ public class TradeStatisticsController {
39 40 return success(tradeStatisticsService.getTradeSummaryComparison());
40 41 }
41 42  
  43 + // TODO @疯狂:直接 comparison?主要 trend 和 comparison 二选一,一个是数据趋势,一个是数据对比哈;
42 44 @GetMapping("/trend/summary")
43 45 @Operation(summary = "获得交易状况统计")
44 46 @PreAuthorize("@ss.hasPermission('statistics:trade:query')")
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeTrendSummaryRespVO.java
... ... @@ -36,4 +36,5 @@ public class TradeTrendSummaryRespVO {
36 36  
37 37 @Schema(description = "商品退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
38 38 private Integer orderRefundPrice;
  39 +
39 40 }
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/app/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 芋艿:占位
  3 + */
  4 +package cn.iocoder.yudao.module.statistics.controller.app;
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/package-info.java deleted
1   -package cn.iocoder.yudao.module.statistics.controller;
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsService.java
... ... @@ -26,7 +26,8 @@ public interface TradeStatisticsService {
26 26 *
27 27 * @return 统计数据对照
28 28 */
29   - TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO> getTradeTrendSummaryComparison(LocalDateTime beginTime, LocalDateTime endTime);
  29 + TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO> getTradeTrendSummaryComparison(
  30 + LocalDateTime beginTime, LocalDateTime endTime);
30 31  
31 32 /**
32 33 * 获得交易状况明细
... ... @@ -34,4 +35,5 @@ public interface TradeStatisticsService {
34 35 * @return 统计数据列表
35 36 */
36 37 List<TradeTrendSummaryRespVO> getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime);
  38 +
37 39 }
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java
... ... @@ -79,6 +79,7 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
79 79 * @return 交易数据
80 80 */
81 81 private TradeSummaryRespBO getTradeSummaryByMonths(int months) {
  82 + // TODO @疯狂:可以在 LocalDateUtils 封装方法;获得月份的开始;以及结束两个方法;然后这里就可以直接调用了
82 83 // 月份开始时间
83 84 LocalDateTime beginOfMonth = LocalDateTime.now()
84 85 .plusMonths(months)
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/bo/TradeSummaryRespBO.java
... ... @@ -19,4 +19,5 @@ public class TradeSummaryRespBO {
19 19 * 合计
20 20 */
21 21 private Integer summary;
  22 +
22 23 }
... ...
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeStatisticsMapper.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3 <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsMapper">
  4 +
4 5 <select id="selectByTimeBetween"
5 6 resultType="cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO">
6 7 SELECT
... ... @@ -35,4 +36,5 @@
35 36 AND deleted = FALSE
36 37 GROUP BY date
37 38 </select>
  39 +
38 40 </mapper>
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageUserMapper.java
... ... @@ -139,7 +139,7 @@ public interface BrokerageUserMapper extends BaseMapperX&lt;BrokerageUserDO&gt; {
139 139 @Param("endTime") LocalDateTime endTime);
140 140  
141 141 IPage<AppBrokerageUserChildSummaryRespVO> selectSummaryPageByUserId(Page<?> page,
142   - @Param("ids") List<Long> ids,
  142 + @Param("ids") List<Long> ids, // BrokerageUser 的 ids 数组
143 143 @Param("bizType") Integer bizType,
144 144 @Param("status") Integer status,
145 145 @Param("bindUserIds") List<Long> bindUserIds,
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
... ... @@ -230,12 +230,15 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
230 230 ? Collections.emptyList()
231 231 : convertList(memberUserApi.getUserListByNickname(pageReqVO.getNickname()), MemberUserRespDTO::getId);
232 232 // 1.2 生成推广员编号列表
  233 + // TODO @疯狂:是不是可以先 1.2 查询出来,然后查询对应的昵称,进行过滤?避免昵称过滤返回的 id 过多;
233 234 List<Long> bindUserIds = buildBindUserIdsByLevel(userId, pageReqVO.getLevel());
  235 +
234 236 // 2. 分页查询
235 237 IPage<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserMapper.selectSummaryPageByUserId(
236 238 MyBatisUtils.buildPage(pageReqVO), ids, BrokerageRecordBizTypeEnum.ORDER.getType(),
237 239 BrokerageRecordStatusEnum.SETTLEMENT.getStatus(), bindUserIds, pageReqVO.getSortingField()
238 240 );
  241 +
239 242 // 3. 拼接数据并返回
240 243 List<Long> userIds = convertList(pageResult.getRecords(), AppBrokerageUserChildSummaryRespVO::getId);
241 244 Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds);
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java
... ... @@ -121,6 +121,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
121 121 return getExpressTrackList(order);
122 122 }
123 123  
  124 + // TODO @puhui999:可以加个 spring 缓存,30 分钟;主要考虑及时性要求不高,但是每次调用需要钱;
124 125 /**
125 126 * 获得订单的物流轨迹
126 127 *
... ...
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java
... ... @@ -39,4 +39,6 @@ public class MemberSignInRecordDO extends BaseDO {
39 39 */
40 40 private Integer point;
41 41  
  42 + // TODO 疯狂:签到的经验
  43 +
42 44 }
... ...