mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	code review:数据统计
This commit is contained in:
		| @@ -6,4 +6,4 @@ | ||||
|  * 4. 地域统计 | ||||
|  * 5. 会员概览 | ||||
|  */ | ||||
| package cn.iocoder.yudao.module.statistics.controller.member; | ||||
| package cn.iocoder.yudao.module.statistics.controller.admin.member; | ||||
| @@ -1,4 +1,4 @@ | ||||
| package cn.iocoder.yudao.module.statistics.controller.product; | ||||
| package cn.iocoder.yudao.module.statistics.controller.admin.product; | ||||
| 
 | ||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| @@ -32,6 +32,7 @@ public class TradeStatisticsController { | ||||
|     @Resource | ||||
|     private TradeStatisticsService tradeStatisticsService; | ||||
|  | ||||
|     // TODO @疯狂:要不这个就是 /trend/summary 的特例,前端自己查询两次? | ||||
|     @GetMapping("/summary") | ||||
|     @Operation(summary = "获得交易统计") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||||
| @@ -39,6 +40,7 @@ public class TradeStatisticsController { | ||||
|         return success(tradeStatisticsService.getTradeSummaryComparison()); | ||||
|     } | ||||
|  | ||||
|     // TODO @疯狂:直接 comparison?主要 trend 和 comparison 二选一,一个是数据趋势,一个是数据对比哈; | ||||
|     @GetMapping("/trend/summary") | ||||
|     @Operation(summary = "获得交易状况统计") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||||
|   | ||||
| @@ -36,4 +36,5 @@ public class TradeTrendSummaryRespVO { | ||||
|  | ||||
|     @Schema(description = "商品退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||||
|     private Integer orderRefundPrice; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,4 @@ | ||||
| /** | ||||
|  * TODO 芋艿:占位 | ||||
|  */ | ||||
| package cn.iocoder.yudao.module.statistics.controller.app; | ||||
| @@ -1 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.statistics.controller; | ||||
| @@ -26,7 +26,8 @@ public interface TradeStatisticsService { | ||||
|      * | ||||
|      * @return 统计数据对照 | ||||
|      */ | ||||
|     TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO> getTradeTrendSummaryComparison(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|     TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO> getTradeTrendSummaryComparison( | ||||
|             LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
|     /** | ||||
|      * 获得交易状况明细 | ||||
| @@ -34,4 +35,5 @@ public interface TradeStatisticsService { | ||||
|      * @return 统计数据列表 | ||||
|      */ | ||||
|     List<TradeTrendSummaryRespVO> getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -79,6 +79,7 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | ||||
|      * @return 交易数据 | ||||
|      */ | ||||
|     private TradeSummaryRespBO getTradeSummaryByMonths(int months) { | ||||
|         // TODO @疯狂:可以在 LocalDateUtils 封装方法;获得月份的开始;以及结束两个方法;然后这里就可以直接调用了 | ||||
|         // 月份开始时间 | ||||
|         LocalDateTime beginOfMonth = LocalDateTime.now() | ||||
|                 .plusMonths(months) | ||||
|   | ||||
| @@ -19,4 +19,5 @@ public class TradeSummaryRespBO { | ||||
|      * 合计 | ||||
|      */ | ||||
|     private Integer summary; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeStatisticsMapper"> | ||||
|  | ||||
|     <select id="selectByTimeBetween" | ||||
|             resultType="cn.iocoder.yudao.module.statistics.controller.admin.trade.vo.TradeTrendSummaryRespVO"> | ||||
|         SELECT | ||||
| @@ -35,4 +36,5 @@ | ||||
|           AND deleted = FALSE | ||||
|         GROUP BY date | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -139,7 +139,7 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { | ||||
|                                                                                   @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     IPage<AppBrokerageUserChildSummaryRespVO> selectSummaryPageByUserId(Page<?> page, | ||||
|                                                                         @Param("ids") List<Long> ids, | ||||
|                                                                         @Param("ids") List<Long> ids, // BrokerageUser 的 ids 数组 | ||||
|                                                                         @Param("bizType") Integer bizType, | ||||
|                                                                         @Param("status") Integer status, | ||||
|                                                                         @Param("bindUserIds") List<Long> bindUserIds, | ||||
|   | ||||
| @@ -230,12 +230,15 @@ public class BrokerageUserServiceImpl implements BrokerageUserService { | ||||
|                 ? Collections.emptyList() | ||||
|                 : convertList(memberUserApi.getUserListByNickname(pageReqVO.getNickname()), MemberUserRespDTO::getId); | ||||
|         // 1.2 生成推广员编号列表 | ||||
|         // TODO @疯狂:是不是可以先 1.2 查询出来,然后查询对应的昵称,进行过滤?避免昵称过滤返回的 id 过多; | ||||
|         List<Long> bindUserIds = buildBindUserIdsByLevel(userId, pageReqVO.getLevel()); | ||||
|  | ||||
|         // 2. 分页查询 | ||||
|         IPage<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserMapper.selectSummaryPageByUserId( | ||||
|                 MyBatisUtils.buildPage(pageReqVO), ids, BrokerageRecordBizTypeEnum.ORDER.getType(), | ||||
|                 BrokerageRecordStatusEnum.SETTLEMENT.getStatus(), bindUserIds, pageReqVO.getSortingField() | ||||
|         ); | ||||
|  | ||||
|         // 3. 拼接数据并返回 | ||||
|         List<Long> userIds = convertList(pageResult.getRecords(), AppBrokerageUserChildSummaryRespVO::getId); | ||||
|         Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds); | ||||
|   | ||||
| @@ -121,6 +121,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService { | ||||
|         return getExpressTrackList(order); | ||||
|     } | ||||
|  | ||||
|     // TODO @puhui999:可以加个 spring 缓存,30 分钟;主要考虑及时性要求不高,但是每次调用需要钱; | ||||
|     /** | ||||
|      * 获得订单的物流轨迹 | ||||
|      * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV