mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-01 02:38:43 +08:00 
			
		
		
		
	code review:商城统计
This commit is contained in:
		| @@ -77,6 +77,7 @@ public class MemberStatisticsController { | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     // TODO @疯狂:要不 get 前缀去掉,和下面的 list 接口保持一致 | ||||
|     @GetMapping("/get-area-statistics-list") | ||||
|     @Operation(summary = "按照省份,获得会员统计列表") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:member:query')") | ||||
| @@ -85,6 +86,7 @@ public class MemberStatisticsController { | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     // TODO @疯狂:要不 get 前缀去掉,和下面的 list 接口保持一致 | ||||
|     @GetMapping("/get-sex-statistics-list") | ||||
|     @Operation(summary = "按照性别,获得会员统计列表") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:member:query')") | ||||
| @@ -92,6 +94,8 @@ public class MemberStatisticsController { | ||||
|         return success(memberStatisticsService.getMemberSexStatisticsList()); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     // TODO @疯狂:要不 get 前缀去掉,和下面的 list 接口保持一致 | ||||
|     @GetMapping("/get-terminal-statistics-list") | ||||
|     @Operation(summary = "按照终端,获得会员统计列表") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:member:query')") | ||||
| @@ -106,6 +110,7 @@ public class MemberStatisticsController { | ||||
|         return success(memberStatisticsService.getUserCountComparison()); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     @GetMapping("/register-count-list") | ||||
|     @Operation(summary = "获得会员注册数量列表") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:member:query')") | ||||
|   | ||||
| @@ -10,6 +10,7 @@ public class MemberCountRespVO { | ||||
|     @Schema(description = "用户访问量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||||
|     private Integer visitUserCount; | ||||
|  | ||||
|     // TODO @疯狂:要不改成 registerUserCount,注册 | ||||
|     @Schema(description = "新增用户数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||||
|     private Integer createUserCount; | ||||
|  | ||||
|   | ||||
| @@ -24,6 +24,7 @@ public class PayStatisticsController { | ||||
|     @Resource | ||||
|     private PayWalletStatisticsService payWalletStatisticsService; | ||||
|  | ||||
|     // TODO @疯狂:要不搞成 PaySummary?只是目前只有 rechargePrice 充值金额? | ||||
|     @GetMapping("/wallet-recharge-price") | ||||
|     @Operation(summary = "获取充值金额") | ||||
|     public CommonResult<Integer> getWalletRechargePrice() { | ||||
|   | ||||
| @@ -47,6 +47,7 @@ public class TradeStatisticsController { | ||||
|     @Resource | ||||
|     private BrokerageStatisticsService brokerageStatisticsService; | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     @GetMapping("/summary") | ||||
|     @Operation(summary = "获得交易统计") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||||
| @@ -55,6 +56,7 @@ public class TradeStatisticsController { | ||||
|         TradeSummaryRespBO yesterdayData = tradeStatisticsService.getTradeSummaryByDays(-1); | ||||
|         // 1.2 前天的数据(用于对照昨天的数据) | ||||
|         TradeSummaryRespBO beforeYesterdayData = tradeStatisticsService.getTradeSummaryByDays(-2); | ||||
|  | ||||
|         // 2.1 本月数据 | ||||
|         TradeSummaryRespBO monthData = tradeStatisticsService.getTradeSummaryByMonths(0); | ||||
|         // 2.2 上月数据(用于对照本月的数据) | ||||
| @@ -73,6 +75,7 @@ public class TradeStatisticsController { | ||||
|                 ArrayUtil.get(reqVO.getTimes(), 1))); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     @GetMapping("/list") | ||||
|     @Operation(summary = "获得交易状况明细") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||||
| @@ -82,6 +85,7 @@ public class TradeStatisticsController { | ||||
|         return success(TradeStatisticsConvert.INSTANCE.convertList(list)); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     @GetMapping("/export-excel") | ||||
|     @Operation(summary = "导出获得交易状况明细 Excel") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:export')") | ||||
| @@ -94,16 +98,20 @@ public class TradeStatisticsController { | ||||
|         ExcelUtils.write(response, "交易状况.xls", "数据", TradeTrendSummaryExcelVO.class, data); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     @GetMapping("/order-count") | ||||
|     @Operation(summary = "获得交易订单数量") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||||
|     public CommonResult<TradeOrderCountRespVO> getOrderCount() { | ||||
|         // 订单统计 | ||||
|         TradeOrderCountRespVO vo = tradeOrderStatisticsService.getOrderCount(); | ||||
|         // 售后统计 | ||||
|         vo.setAfterSaleApply(afterSaleStatisticsService.getCountByStatus(AfterSaleStatusEnum.APPLY)) | ||||
|                 .setAuditingWithdraw(brokerageStatisticsService.getWithdrawCountByStatus(BrokerageWithdrawStatusEnum.AUDITING)); | ||||
|         return success(vo); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     @GetMapping("/order-comparison") | ||||
|     @Operation(summary = "获得交易订单数量") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||||
| @@ -111,6 +119,7 @@ public class TradeStatisticsController { | ||||
|         return success(tradeOrderStatisticsService.getOrderComparison()); | ||||
|     } | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     @GetMapping("/order-count-trend") | ||||
|     @Operation(summary = "获得订单量趋势统计") | ||||
|     @PreAuthorize("@ss.hasPermission('statistics:trade:query')") | ||||
|   | ||||
| @@ -52,6 +52,7 @@ public interface TradeStatisticsConvert { | ||||
|  | ||||
|     List<TradeTrendSummaryRespVO> convertList(List<TradeStatisticsDO> list); | ||||
|  | ||||
|     // TODO @疯狂:要不要搞个默认的 convertA 方法,然后这个 convert 去调用 convertA,特殊字段再去 set? | ||||
|     default TradeTrendSummaryRespVO convert(TradeStatisticsDO tradeStatistics) { | ||||
|         return new TradeTrendSummaryRespVO() | ||||
|                 .setDate(tradeStatistics.getTime().toLocalDate()) | ||||
|   | ||||
| @@ -63,6 +63,7 @@ public class TradeStatisticsDO extends TenantBaseDO { | ||||
|      */ | ||||
|     private Integer brokerageSettlementPrice; | ||||
|  | ||||
|     // TODO @疯狂:walletPayPrice,钱包支付金额 | ||||
|     /** | ||||
|      * 总支付金额(余额),单位:分 | ||||
|      */ | ||||
|   | ||||
| @@ -16,10 +16,12 @@ import java.time.LocalDateTime; | ||||
| @SuppressWarnings("rawtypes") | ||||
| public interface ApiAccessLogStatisticsMapper extends BaseMapperX { | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     Integer selectIpCountByUserTypeAndCreateTimeBetween(@Param("userType") Integer userType, | ||||
|                                                         @Param("beginTime") LocalDateTime beginTime, | ||||
|                                                         @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     Integer selectUserCountByUserTypeAndCreateTimeBetween(@Param("userType") Integer userType, | ||||
|                                                           @Param("beginTime") LocalDateTime beginTime, | ||||
|                                                           @Param("endTime") LocalDateTime endTime); | ||||
|   | ||||
| @@ -20,16 +20,27 @@ import java.util.List; | ||||
| @SuppressWarnings("rawtypes") | ||||
| public interface MemberStatisticsMapper extends BaseMapperX { | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     List<MemberAreaStatisticsRespBO> selectSummaryListByAreaId(); | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     List<MemberSexStatisticsRespVO> selectSummaryListBySex(); | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     List<MemberTerminalStatisticsRespVO> selectSummaryListByRegisterTerminal(); | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime, | ||||
|                             @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     /** | ||||
|      * 获得用户的每天注册数量列表 | ||||
|      * | ||||
|      * @param beginTime 开始时间 | ||||
|      * @param endTime 结束时间 | ||||
|      * @return 每天注册数量列表 | ||||
|      */ | ||||
|     List<MemberRegisterCountRespVO> selectListByCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                                   @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|   | ||||
| @@ -37,6 +37,7 @@ public interface PayWalletStatisticsMapper extends BaseMapperX { | ||||
|                                                                @Param("endTime") LocalDateTime endTime, | ||||
|                                                                @Param("payStatus") Boolean payStatus); | ||||
|  | ||||
|     // TODO 芋艿:已经 review; | ||||
|     Integer selectRechargePriceSummary(@Param("payStatus") Integer payStatus); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -20,6 +20,7 @@ public interface AfterSaleStatisticsMapper extends BaseMapperX<TradeStatisticsDO | ||||
|     AfterSaleSummaryRespBO selectSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                             @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     Long selectCountByStatus(@Param("status") Integer status); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -15,11 +15,13 @@ import java.time.LocalDateTime; | ||||
| @Mapper | ||||
| public interface BrokerageStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     Integer selectSummaryPriceByStatusAndUnfreezeTimeBetween(@Param("bizType") Integer bizType, | ||||
|                                                              @Param("status") Integer status, | ||||
|                                                              @Param("beginTime") LocalDateTime beginTime, | ||||
|                                                              @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     Long selectWithdrawCountByStatus(@Param("status") Integer status); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -42,6 +42,7 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsD | ||||
|     Integer selectUserCountByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                             @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 按照支付时间统计订单(按天分组) | ||||
|      * | ||||
| @@ -52,6 +53,7 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsD | ||||
|     List<TradeOrderTrendRespVO> selectListByPayTimeBetweenAndGroupByDay(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                                         @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 按照支付时间统计订单(按月分组) | ||||
|      * | ||||
| @@ -62,10 +64,13 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsD | ||||
|     List<TradeOrderTrendRespVO> selectListByPayTimeBetweenAndGroupByMonth(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                                           @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     Long selectCountByStatus(@Param("status") Integer status); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     Long selectCountByStatusAndPickUpStoreIdIsNotNull(@Param("status") Integer status); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     TradeOrderSummaryRespVO selectPaySummaryByStatusAndPayTimeBetween(@Param("status") Integer status, | ||||
|                                                                       @Param("beginTime") LocalDateTime beginTime, | ||||
|                                                                       @Param("endTime") LocalDateTime endTime); | ||||
|   | ||||
| @@ -25,14 +25,17 @@ public interface TradeStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { | ||||
|     TradeTrendSummaryRespVO selectVoByTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                                   @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     default List<TradeStatisticsDO> selectListByTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) { | ||||
|         return selectList(new LambdaQueryWrapperX<TradeStatisticsDO>() | ||||
|                 .between(TradeStatisticsDO::getTime, beginTime, endTime)); | ||||
|     } | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     Integer selectExpensePriceByTimeBetween(@Param("beginTime") LocalDateTime beginTime, | ||||
|                                             @Param("endTime") LocalDateTime endTime); | ||||
|  | ||||
|     // TODO @芋艿:已经 review | ||||
|     default TradeStatisticsDO selectByTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) { | ||||
|         return selectOne(new LambdaQueryWrapperX<TradeStatisticsDO>() | ||||
|                 .between(TradeStatisticsDO::getTime, beginTime, endTime)); | ||||
|   | ||||
| @@ -30,6 +30,7 @@ public class TradeStatisticsJob implements JobHandler { | ||||
|     @Override | ||||
|     @TenantJob | ||||
|     public String execute(String param) { | ||||
|         // TODO @疯狂:要搞个默认的 1 哈; | ||||
|         if (NumberUtil.isInteger(param)) { | ||||
|             throw new RuntimeException("交易统计任务的参数只能为是正整数"); | ||||
|         } | ||||
|   | ||||
| @@ -9,6 +9,7 @@ import java.time.LocalDateTime; | ||||
|  */ | ||||
| public interface ApiAccessLogStatisticsService { | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获取活跃用户数量 | ||||
|      * | ||||
| @@ -19,6 +20,7 @@ public interface ApiAccessLogStatisticsService { | ||||
|      */ | ||||
|     Integer getUserCount(Integer userType, LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获取访问用户数量 | ||||
|      * | ||||
|   | ||||
| @@ -21,6 +21,7 @@ public interface MemberStatisticsService { | ||||
|      */ | ||||
|     MemberSummaryRespVO getMemberSummary(); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获取会员分析对照数据 | ||||
|      * | ||||
| @@ -31,6 +32,7 @@ public interface MemberStatisticsService { | ||||
|     DataComparisonRespVO<MemberAnalyseDataRespVO> getMemberAnalyseComparisonData(LocalDateTime beginTime, | ||||
|                                                                                  LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 按照省份,获得会员统计列表 | ||||
|      * | ||||
| @@ -38,6 +40,7 @@ public interface MemberStatisticsService { | ||||
|      */ | ||||
|     List<MemberAreaStatisticsRespVO> getMemberAreaStatisticsList(); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 按照性别,获得会员统计列表 | ||||
|      * | ||||
| @@ -45,6 +48,7 @@ public interface MemberStatisticsService { | ||||
|      */ | ||||
|     List<MemberSexStatisticsRespVO> getMemberSexStatisticsList(); | ||||
|  | ||||
|     // TODO @疯狂:这个要不要使用 getMemberTerminalStatisticsList;保持统一? | ||||
|     /** | ||||
|      * 按照终端,获得会员统计列表 | ||||
|      * | ||||
| @@ -52,6 +56,7 @@ public interface MemberStatisticsService { | ||||
|      */ | ||||
|     List<MemberTerminalStatisticsRespVO> getRegisterTerminalStatisticsList(); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获取用户注册数量列表 | ||||
|      * | ||||
| @@ -61,6 +66,7 @@ public interface MemberStatisticsService { | ||||
|      */ | ||||
|     List<MemberRegisterCountRespVO> getMemberRegisterCountList(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获得用户数量量统计对照 | ||||
|      * | ||||
|   | ||||
| @@ -32,6 +32,7 @@ public interface PayWalletStatisticsService { | ||||
|      */ | ||||
|     RechargeSummaryRespBO getUserRechargeSummary(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获取充值金额合计 | ||||
|      * | ||||
|   | ||||
| @@ -6,7 +6,6 @@ import lombok.Data; | ||||
| /** | ||||
|  * 充值统计 Response BO | ||||
|  */ | ||||
| @Schema(description = "管理后台 - ") | ||||
| @Data | ||||
| public class RechargeSummaryRespBO { | ||||
|  | ||||
|   | ||||
| @@ -22,6 +22,7 @@ public interface AfterSaleStatisticsService { | ||||
|      */ | ||||
|     AfterSaleSummaryRespBO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获取指定状态的售后订单数量 | ||||
|      * | ||||
|   | ||||
| @@ -21,6 +21,7 @@ public interface BrokerageStatisticsService { | ||||
|      */ | ||||
|     Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获取指定状态的提现记录数量 | ||||
|      * | ||||
|   | ||||
| @@ -62,6 +62,7 @@ public interface TradeOrderStatisticsService { | ||||
|      */ | ||||
|     Integer getOrderPayPrice(LocalDateTime beginTime, LocalDateTime endTime); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获得交易订单数量 | ||||
|      * | ||||
| @@ -69,6 +70,7 @@ public interface TradeOrderStatisticsService { | ||||
|      */ | ||||
|     TradeOrderCountRespVO getOrderCount(); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 交易订单销售额对照 | ||||
|      * | ||||
| @@ -76,6 +78,7 @@ public interface TradeOrderStatisticsService { | ||||
|      */ | ||||
|     DataComparisonRespVO<TradeOrderSummaryRespVO> getOrderComparison(); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 获得订单量趋势统计 | ||||
|      * | ||||
|   | ||||
| @@ -63,9 +63,9 @@ public class TradeOrderStatisticsServiceImpl implements TradeOrderStatisticsServ | ||||
|  | ||||
|     @Override | ||||
|     public TradeOrderCountRespVO getOrderCount() { | ||||
|         // TODO 疯狂:这个可以根据 status + delivertyType 来过滤呀;ps:是不是搞个 service 方法,交给上层去聚合,这样 TradeOrderCountRespVO 可以更明确返回,不用搞 bo; | ||||
|         Long undeliveredCount = tradeOrderStatisticsMapper.selectCountByStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()); | ||||
|         Long pickUpCount = tradeOrderStatisticsMapper.selectCountByStatusAndPickUpStoreIdIsNotNull(TradeOrderStatusEnum.DELIVERED.getStatus()); | ||||
|  | ||||
|         return new TradeOrderCountRespVO() | ||||
|                 .setPickUp(ObjUtil.defaultIfNull(pickUpCount, 0L)) | ||||
|                 .setUndelivered(ObjUtil.defaultIfNull(undeliveredCount, 0L)); | ||||
| @@ -81,8 +81,8 @@ public class TradeOrderStatisticsServiceImpl implements TradeOrderStatisticsServ | ||||
|     private TradeOrderSummaryRespVO getPayPriceSummary(LocalDateTime date) { | ||||
|         LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(date); | ||||
|         LocalDateTime endTime = LocalDateTimeUtil.beginOfDay(date); | ||||
|  | ||||
|         return tradeOrderStatisticsMapper.selectPaySummaryByStatusAndPayTimeBetween(PayOrderStatusEnum.SUCCESS.getStatus(), beginTime, endTime); | ||||
|         return tradeOrderStatisticsMapper.selectPaySummaryByStatusAndPayTimeBetween( | ||||
|                 PayOrderStatusEnum.SUCCESS.getStatus(), beginTime, endTime); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -93,7 +93,7 @@ public class TradeOrderStatisticsServiceImpl implements TradeOrderStatisticsServ | ||||
|         LocalDateTime referenceEndTime = reqVO.getBeginTime().minusDays(1); | ||||
|         LocalDateTime referenceBeginTime = referenceEndTime.minus(Duration.between(reqVO.getBeginTime(), reqVO.getEndTime())); | ||||
|         List<TradeOrderTrendRespVO> reference = getOrderCountTrend(reqVO.getType(), referenceBeginTime, referenceEndTime); | ||||
|  | ||||
|         // 顺序对比返回 | ||||
|         return IntStream.range(0, value.size()) | ||||
|                 .mapToObj(index -> new DataComparisonRespVO<TradeOrderTrendRespVO>() | ||||
|                         .setValue(CollUtil.get(value, index)) | ||||
|   | ||||
| @@ -49,6 +49,7 @@ public interface TradeStatisticsService { | ||||
|      */ | ||||
|     String statisticsTrade(Integer days); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 统计指定日期的交易数据 | ||||
|      * | ||||
| @@ -57,6 +58,7 @@ public interface TradeStatisticsService { | ||||
|      */ | ||||
|     TradeSummaryRespBO getTradeSummaryByDays(int days); | ||||
|  | ||||
|     // TODO 芋艿:已经 review | ||||
|     /** | ||||
|      * 统计指定月份的交易数据 | ||||
|      * | ||||
|   | ||||
| @@ -83,6 +83,7 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | ||||
|     @Override | ||||
|     public String statisticsTrade(Integer days) { | ||||
|         LocalDateTime today = LocalDateTime.now(); | ||||
|         // TODO @疯狂:不用并发哈,因为租户可能会丢;然后,一般串行就好,对性能没绝对的要求哈,天数也不会多; | ||||
|         return IntStream.rangeClosed(1, days) | ||||
|                 .parallel() | ||||
|                 .mapToObj(day -> statisticsTrade(today.minusDays(day))) | ||||
| @@ -130,6 +131,7 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | ||||
|         entity = TradeStatisticsConvert.INSTANCE.convert(date, orderSummary, afterSaleSummary, brokerageSettlementPrice, | ||||
|                 walletSummary); | ||||
|         tradeStatisticsMapper.insert(entity); | ||||
|         // TODO @疯狂:这里是不是也要把日期带上?类似 108 那边 | ||||
|         return stopWatch.prettyPrint(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| <?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.TradeOrderStatisticsMapper"> | ||||
|  | ||||
|     <!-- TODO @疯狂:是返回不是的 MemberAreaStatisticsRespBO 哈 --> | ||||
|     <select id="selectSummaryListByAreaId" | ||||
|             resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO"> | ||||
|         SELECT receiver_area_id                                AS areaId, | ||||
| @@ -87,7 +89,8 @@ | ||||
|     <select id="selectCountByStatus" resultType="java.lang.Long"> | ||||
|         SELECT COUNT(1) | ||||
|         FROM trade_order | ||||
|         WHERE status = #{status} AND deleted = FALSE | ||||
|         WHERE status = #{status} | ||||
|           AND deleted = FALSE | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectCountByStatusAndPickUpStoreIdIsNotNull" resultType="java.lang.Long"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 zhijiantianya@gmail.com
					zhijiantianya@gmail.com