Commit 367b45e3bd677d52c12f3a3fa7923b37f90e4b34
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
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 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 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,6 +32,7 @@ public class TradeStatisticsController { | ||
| 32 | @Resource | 32 | @Resource |
| 33 | private TradeStatisticsService tradeStatisticsService; | 33 | private TradeStatisticsService tradeStatisticsService; |
| 34 | 34 | ||
| 35 | + // TODO @疯狂:要不这个就是 /trend/summary 的特例,前端自己查询两次? | ||
| 35 | @GetMapping("/summary") | 36 | @GetMapping("/summary") |
| 36 | @Operation(summary = "获得交易统计") | 37 | @Operation(summary = "获得交易统计") |
| 37 | @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | 38 | @PreAuthorize("@ss.hasPermission('statistics:trade:query')") |
| @@ -39,6 +40,7 @@ public class TradeStatisticsController { | @@ -39,6 +40,7 @@ public class TradeStatisticsController { | ||
| 39 | return success(tradeStatisticsService.getTradeSummaryComparison()); | 40 | return success(tradeStatisticsService.getTradeSummaryComparison()); |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 43 | + // TODO @疯狂:直接 comparison?主要 trend 和 comparison 二选一,一个是数据趋势,一个是数据对比哈; | ||
| 42 | @GetMapping("/trend/summary") | 44 | @GetMapping("/trend/summary") |
| 43 | @Operation(summary = "获得交易状况统计") | 45 | @Operation(summary = "获得交易状况统计") |
| 44 | @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | 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,4 +36,5 @@ public class TradeTrendSummaryRespVO { | ||
| 36 | 36 | ||
| 37 | @Schema(description = "商品退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | 37 | @Schema(description = "商品退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 38 | private Integer orderRefundPrice; | 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
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,7 +26,8 @@ public interface TradeStatisticsService { | ||
| 26 | * | 26 | * |
| 27 | * @return 统计数据对照 | 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,4 +35,5 @@ public interface TradeStatisticsService { | ||
| 34 | * @return 统计数据列表 | 35 | * @return 统计数据列表 |
| 35 | */ | 36 | */ |
| 36 | List<TradeTrendSummaryRespVO> getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime); | 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,6 +79,7 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | ||
| 79 | * @return 交易数据 | 79 | * @return 交易数据 |
| 80 | */ | 80 | */ |
| 81 | private TradeSummaryRespBO getTradeSummaryByMonths(int months) { | 81 | private TradeSummaryRespBO getTradeSummaryByMonths(int months) { |
| 82 | + // TODO @疯狂:可以在 LocalDateUtils 封装方法;获得月份的开始;以及结束两个方法;然后这里就可以直接调用了 | ||
| 82 | // 月份开始时间 | 83 | // 月份开始时间 |
| 83 | LocalDateTime beginOfMonth = LocalDateTime.now() | 84 | LocalDateTime beginOfMonth = LocalDateTime.now() |
| 84 | .plusMonths(months) | 85 | .plusMonths(months) |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/bo/TradeSummaryRespBO.java
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeStatisticsMapper.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.TradeStatisticsMapper"> | 3 | <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsMapper"> |
| 4 | + | ||
| 4 | <select id="selectByTimeBetween" | 5 | <select id="selectByTimeBetween" |
| 5 | resultType="cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO"> | 6 | resultType="cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO"> |
| 6 | SELECT | 7 | SELECT |
| @@ -35,4 +36,5 @@ | @@ -35,4 +36,5 @@ | ||
| 35 | AND deleted = FALSE | 36 | AND deleted = FALSE |
| 36 | GROUP BY date | 37 | GROUP BY date |
| 37 | </select> | 38 | </select> |
| 39 | + | ||
| 38 | </mapper> | 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<BrokerageUserDO> { | @@ -139,7 +139,7 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { | ||
| 139 | @Param("endTime") LocalDateTime endTime); | 139 | @Param("endTime") LocalDateTime endTime); |
| 140 | 140 | ||
| 141 | IPage<AppBrokerageUserChildSummaryRespVO> selectSummaryPageByUserId(Page<?> page, | 141 | IPage<AppBrokerageUserChildSummaryRespVO> selectSummaryPageByUserId(Page<?> page, |
| 142 | - @Param("ids") List<Long> ids, | 142 | + @Param("ids") List<Long> ids, // BrokerageUser 的 ids 数组 |
| 143 | @Param("bizType") Integer bizType, | 143 | @Param("bizType") Integer bizType, |
| 144 | @Param("status") Integer status, | 144 | @Param("status") Integer status, |
| 145 | @Param("bindUserIds") List<Long> bindUserIds, | 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,12 +230,15 @@ public class BrokerageUserServiceImpl implements BrokerageUserService { | ||
| 230 | ? Collections.emptyList() | 230 | ? Collections.emptyList() |
| 231 | : convertList(memberUserApi.getUserListByNickname(pageReqVO.getNickname()), MemberUserRespDTO::getId); | 231 | : convertList(memberUserApi.getUserListByNickname(pageReqVO.getNickname()), MemberUserRespDTO::getId); |
| 232 | // 1.2 生成推广员编号列表 | 232 | // 1.2 生成推广员编号列表 |
| 233 | + // TODO @疯狂:是不是可以先 1.2 查询出来,然后查询对应的昵称,进行过滤?避免昵称过滤返回的 id 过多; | ||
| 233 | List<Long> bindUserIds = buildBindUserIdsByLevel(userId, pageReqVO.getLevel()); | 234 | List<Long> bindUserIds = buildBindUserIdsByLevel(userId, pageReqVO.getLevel()); |
| 235 | + | ||
| 234 | // 2. 分页查询 | 236 | // 2. 分页查询 |
| 235 | IPage<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserMapper.selectSummaryPageByUserId( | 237 | IPage<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserMapper.selectSummaryPageByUserId( |
| 236 | MyBatisUtils.buildPage(pageReqVO), ids, BrokerageRecordBizTypeEnum.ORDER.getType(), | 238 | MyBatisUtils.buildPage(pageReqVO), ids, BrokerageRecordBizTypeEnum.ORDER.getType(), |
| 237 | BrokerageRecordStatusEnum.SETTLEMENT.getStatus(), bindUserIds, pageReqVO.getSortingField() | 239 | BrokerageRecordStatusEnum.SETTLEMENT.getStatus(), bindUserIds, pageReqVO.getSortingField() |
| 238 | ); | 240 | ); |
| 241 | + | ||
| 239 | // 3. 拼接数据并返回 | 242 | // 3. 拼接数据并返回 |
| 240 | List<Long> userIds = convertList(pageResult.getRecords(), AppBrokerageUserChildSummaryRespVO::getId); | 243 | List<Long> userIds = convertList(pageResult.getRecords(), AppBrokerageUserChildSummaryRespVO::getId); |
| 241 | Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds); | 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,6 +121,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService { | ||
| 121 | return getExpressTrackList(order); | 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