Commit fef808d88ccaf1088d15c12e3c77cc6a6e8e8d21

Authored by YunaiV
1 parent 704087ce

code review:统计代码

Showing 32 changed files with 73 additions and 181 deletions
yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtils.java
@@ -132,7 +132,9 @@ public class AreaUtils { @@ -132,7 +132,9 @@ public class AreaUtils {
132 return convertList(areas.values(), func, area -> type.getType().equals(area.getType())); 132 return convertList(areas.values(), func, area -> type.getType().equals(area.getType()));
133 } 133 }
134 134
  135 + // TODO @疯狂:注释写下;
135 public static Integer getParentIdByType(Integer id, @NonNull AreaTypeEnum type) { 136 public static Integer getParentIdByType(Integer id, @NonNull AreaTypeEnum type) {
  137 + // TODO @疯狂:这种不要用 while true;因为万一脏数据,可能会死循环;可以转换成 for (int i = 0; i < Byte.MAX; i++) 一般是优先层级;
136 do { 138 do {
137 Area area = AreaUtils.getArea(id); 139 Area area = AreaUtils.getArea(id);
138 if (area == null) { 140 if (area == null) {
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java
@@ -7,15 +7,17 @@ import org.apache.ibatis.annotations.Param; @@ -7,15 +7,17 @@ import org.apache.ibatis.annotations.Param;
7 import java.time.LocalDateTime; 7 import java.time.LocalDateTime;
8 8
9 /** 9 /**
10 - * API 访问日志统计 Mapper 10 + * API 访问日志的统计 Mapper
11 * 11 *
12 * @author owen 12 * @author owen
13 */ 13 */
14 @Mapper 14 @Mapper
15 public interface ApiAccessLogStatisticsMapper extends BaseMapperX<Object> { 15 public interface ApiAccessLogStatisticsMapper extends BaseMapperX<Object> {
16 16
17 - Integer selectCountByIp(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); 17 + Integer selectCountByIp(@Param("beginTime") LocalDateTime beginTime,
  18 + @Param("endTime") LocalDateTime endTime);
18 19
19 - Integer selectCountByUserId(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); 20 + Integer selectCountByUserId(@Param("beginTime") LocalDateTime beginTime,
  21 + @Param("endTime") LocalDateTime endTime);
20 22
21 } 23 }
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java
@@ -10,7 +10,7 @@ import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import java.time.LocalDateTime;
10 import java.util.List; 10 import java.util.List;
11 11
12 /** 12 /**
13 - * 会员统计 Mapper 13 + * 会员信息的统计 Mapper
14 * 14 *
15 * @author owen 15 * @author owen
16 */ 16 */
@@ -21,6 +21,7 @@ public interface MemberStatisticsMapper extends BaseMapperX&lt;Object&gt; { @@ -21,6 +21,7 @@ public interface MemberStatisticsMapper extends BaseMapperX&lt;Object&gt; {
21 21
22 List<MemberSexStatisticsRespVO> selectSummaryListBySex(); 22 List<MemberSexStatisticsRespVO> selectSummaryListBySex();
23 23
24 - Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); 24 + Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime,
  25 + @Param("endTime") LocalDateTime endTime);
25 26
26 } 27 }
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java
@@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Param; @@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Param;
10 import java.time.LocalDateTime; 10 import java.time.LocalDateTime;
11 11
12 /** 12 /**
13 - * 交易统计 Mapper 13 + * 支付钱包的统计 Mapper
14 * 14 *
15 * @author owen 15 * @author owen
16 */ 16 */
@@ -29,6 +29,7 @@ public interface PayWalletStatisticsMapper extends BaseMapperX&lt;TradeStatisticsDO @@ -29,6 +29,7 @@ public interface PayWalletStatisticsMapper extends BaseMapperX&lt;TradeStatisticsDO
29 @Param("endTime") LocalDateTime endTime, 29 @Param("endTime") LocalDateTime endTime,
30 @Param("bizType") Integer bizType); 30 @Param("bizType") Integer bizType);
31 31
  32 + // TODO @疯狂:是不是搞个单独的 BO 呀;
32 MemberSummaryRespVO selectRechargeSummaryGroupByWalletId(@Param("beginTime") LocalDateTime beginTime, 33 MemberSummaryRespVO selectRechargeSummaryGroupByWalletId(@Param("beginTime") LocalDateTime beginTime,
33 @Param("endTime") LocalDateTime endTime, 34 @Param("endTime") LocalDateTime endTime,
34 @Param("payStatus") Boolean payStatus); 35 @Param("payStatus") Boolean payStatus);
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/AfterSaleStatisticsMapper.java
@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Param; @@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Param;
9 import java.time.LocalDateTime; 9 import java.time.LocalDateTime;
10 10
11 /** 11 /**
12 - * 交易统计 Mapper 12 + * 售后订单的统计 Mapper
13 * 13 *
14 * @author owen 14 * @author owen
15 */ 15 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/BrokerageStatisticsMapper.java
@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param; @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
8 import java.time.LocalDateTime; 8 import java.time.LocalDateTime;
9 9
10 /** 10 /**
11 - * 交易统计 Mapper 11 + * 订单分销的统计 Mapper
12 * 12 *
13 * @author owen 13 * @author owen
14 */ 14 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeOrderStatisticsMapper.java
@@ -10,7 +10,7 @@ import java.time.LocalDateTime; @@ -10,7 +10,7 @@ import java.time.LocalDateTime;
10 import java.util.List; 10 import java.util.List;
11 11
12 /** 12 /**
13 - * 交易统计 Mapper 13 + * 交易订单的统计 Mapper
14 * 14 *
15 * @author owen 15 * @author owen
16 */ 16 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeStatisticsMapper.java
@@ -19,6 +19,7 @@ import java.util.List; @@ -19,6 +19,7 @@ import java.util.List;
19 @Mapper 19 @Mapper
20 public interface TradeStatisticsMapper extends BaseMapperX<TradeStatisticsDO> { 20 public interface TradeStatisticsMapper extends BaseMapperX<TradeStatisticsDO> {
21 21
  22 + // TODO @疯狂:这个要不要也挪到 xml 里,保持统一?
22 @Select("SELECT IFNULL(SUM(order_create_count), 0) AS count, IFNULL(SUM(order_pay_price), 0) AS summary " + 23 @Select("SELECT IFNULL(SUM(order_create_count), 0) AS count, IFNULL(SUM(order_pay_price), 0) AS summary " +
23 "FROM trade_statistics " + 24 "FROM trade_statistics " +
24 "WHERE time BETWEEN #{beginTime} AND #{endTime} AND deleted = FALSE") 25 "WHERE time BETWEEN #{beginTime} AND #{endTime} AND deleted = FALSE")
@@ -33,4 +34,5 @@ public interface TradeStatisticsMapper extends BaseMapperX&lt;TradeStatisticsDO&gt; { @@ -33,4 +34,5 @@ public interface TradeStatisticsMapper extends BaseMapperX&lt;TradeStatisticsDO&gt; {
33 34
34 Integer selectExpensePriceByTimeBetween(@Param("beginTime") LocalDateTime beginTime, 35 Integer selectExpensePriceByTimeBetween(@Param("beginTime") LocalDateTime beginTime,
35 @Param("endTime") LocalDateTime endTime); 36 @Param("endTime") LocalDateTime endTime);
  37 +
36 } 38 }
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsService.java
@@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.infra; @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.infra;
3 import java.time.LocalDateTime; 3 import java.time.LocalDateTime;
4 4
5 /** 5 /**
6 - * API 访问日志统计 Service 接口 6 + * API 访问日志的统计 Service 接口
7 * 7 *
8 * @author owen 8 * @author owen
9 */ 9 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsServiceImpl.java
@@ -8,7 +8,7 @@ import javax.annotation.Resource; @@ -8,7 +8,7 @@ import javax.annotation.Resource;
8 import java.time.LocalDateTime; 8 import java.time.LocalDateTime;
9 9
10 /** 10 /**
11 - * API 访问日志统计 Service 实现类 11 + * API 访问日志的统计 Service 实现类
12 * 12 *
13 * @author owen 13 * @author owen
14 */ 14 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java
@@ -9,7 +9,7 @@ import java.time.LocalDateTime; @@ -9,7 +9,7 @@ import java.time.LocalDateTime;
9 import java.util.List; 9 import java.util.List;
10 10
11 /** 11 /**
12 - * 会员统计 Service 接口 12 + * 会员信息的统计 Service 接口
13 * 13 *
14 * @author owen 14 * @author owen
15 */ 15 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java
@@ -24,7 +24,7 @@ import java.util.Optional; @@ -24,7 +24,7 @@ import java.util.Optional;
24 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; 24 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
25 25
26 /** 26 /**
27 - * 会员统计 Service 实现类 27 + * 会员信息的统计 Service 实现类
28 * 28 *
29 * @author owen 29 * @author owen
30 */ 30 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java
@@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO;
6 import java.time.LocalDateTime; 6 import java.time.LocalDateTime;
7 7
8 /** 8 /**
9 - * 钱包统计 Service 接口 9 + * 钱包的统计 Service 接口
10 * 10 *
11 * @author owen 11 * @author owen
12 */ 12 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java
@@ -12,7 +12,7 @@ import javax.annotation.Resource; @@ -12,7 +12,7 @@ import javax.annotation.Resource;
12 import java.time.LocalDateTime; 12 import java.time.LocalDateTime;
13 13
14 /** 14 /**
15 - * 钱包统计 Service 实现类 15 + * 钱包的统计 Service 实现类
16 * 16 *
17 * @author owen 17 * @author owen
18 */ 18 */
@@ -31,11 +31,10 @@ public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsServic @@ -31,11 +31,10 @@ public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsServic
31 beginTime, endTime, PayRefundStatusEnum.SUCCESS.getStatus()); 31 beginTime, endTime, PayRefundStatusEnum.SUCCESS.getStatus());
32 Integer walletPayPrice = payWalletStatisticsMapper.selectPriceSummaryByBizTypeAndCreateTimeBetween( 32 Integer walletPayPrice = payWalletStatisticsMapper.selectPriceSummaryByBizTypeAndCreateTimeBetween(
33 beginTime, endTime, PayWalletBizTypeEnum.PAYMENT.getType()); 33 beginTime, endTime, PayWalletBizTypeEnum.PAYMENT.getType());
34 -  
35 - paySummary.setOrderWalletPayPrice(walletPayPrice);  
36 - paySummary.setRechargeRefundCount(refundSummary.getRechargeRefundCount());  
37 - paySummary.setRechargeRefundPrice(refundSummary.getRechargeRefundPrice());  
38 - 34 + // 拼接
  35 + paySummary.setOrderWalletPayPrice(walletPayPrice)
  36 + .setRechargeRefundCount(refundSummary.getRechargeRefundCount())
  37 + .setRechargeRefundPrice(refundSummary.getRechargeRefundPrice());
39 return paySummary; 38 return paySummary;
40 } 39 }
41 40
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeOrderStatisticsService.java
@@ -7,7 +7,7 @@ import java.time.LocalDateTime; @@ -7,7 +7,7 @@ import java.time.LocalDateTime;
7 import java.util.List; 7 import java.util.List;
8 8
9 /** 9 /**
10 - * 交易订单统计 Service 接口 10 + * 交易订单的统计 Service 接口
11 * 11 *
12 * @author owen 12 * @author owen
13 */ 13 */
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java
@@ -45,16 +45,15 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { @@ -45,16 +45,15 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
45 45
46 @Override 46 @Override
47 public TradeStatisticsComparisonRespVO<TradeSummaryRespVO> getTradeSummaryComparison() { 47 public TradeStatisticsComparisonRespVO<TradeSummaryRespVO> getTradeSummaryComparison() {
48 - // 昨天的数据 48 + // 1.1 昨天的数据
49 TradeSummaryRespBO yesterdayData = getTradeSummaryByDays(-1); 49 TradeSummaryRespBO yesterdayData = getTradeSummaryByDays(-1);
50 - // 前天的数据(用于对照昨天的数据) 50 + // 1.2 前天的数据(用于对照昨天的数据)
51 TradeSummaryRespBO beforeYesterdayData = getTradeSummaryByDays(-2); 51 TradeSummaryRespBO beforeYesterdayData = getTradeSummaryByDays(-2);
52 -  
53 - // 本月数据; 52 + // 2.1 本月数据
54 TradeSummaryRespBO monthData = getTradeSummaryByMonths(0); 53 TradeSummaryRespBO monthData = getTradeSummaryByMonths(0);
55 - // 上月数据(用于对照本月的数据) 54 + // 2.2 上月数据(用于对照本月的数据)
56 TradeSummaryRespBO lastMonthData = getTradeSummaryByMonths(-1); 55 TradeSummaryRespBO lastMonthData = getTradeSummaryByMonths(-1);
57 - 56 + // 转换返回
58 return TradeStatisticsConvert.INSTANCE.convert(yesterdayData, beforeYesterdayData, monthData, lastMonthData); 57 return TradeStatisticsConvert.INSTANCE.convert(yesterdayData, beforeYesterdayData, monthData, lastMonthData);
59 } 58 }
60 59
@@ -81,31 +80,31 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { @@ -81,31 +80,31 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
81 80
82 @Override 81 @Override
83 public String statisticsYesterdayTrade() { 82 public String statisticsYesterdayTrade() {
84 - // 处理统计参数  
85 LocalDateTime yesterday = LocalDateTime.now().minusDays(1); 83 LocalDateTime yesterday = LocalDateTime.now().minusDays(1);
86 LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(yesterday); 84 LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(yesterday);
87 LocalDateTime endTime = LocalDateTimeUtil.endOfDay(yesterday); 85 LocalDateTime endTime = LocalDateTimeUtil.endOfDay(yesterday);
88 - // 统计 86 + // 1.1 统计订单
89 StopWatch stopWatch = new StopWatch("交易统计"); 87 StopWatch stopWatch = new StopWatch("交易统计");
90 stopWatch.start("统计订单"); 88 stopWatch.start("统计订单");
91 TradeOrderSummaryRespBO orderSummary = tradeOrderStatisticsService.getOrderSummary(beginTime, endTime); 89 TradeOrderSummaryRespBO orderSummary = tradeOrderStatisticsService.getOrderSummary(beginTime, endTime);
92 stopWatch.stop(); 90 stopWatch.stop();
93 - 91 + // 1.2 统计售后
94 stopWatch.start("统计售后"); 92 stopWatch.start("统计售后");
95 AfterSaleSummaryRespBO afterSaleSummary = afterSaleStatisticsService.getAfterSaleSummary(beginTime, endTime); 93 AfterSaleSummaryRespBO afterSaleSummary = afterSaleStatisticsService.getAfterSaleSummary(beginTime, endTime);
96 stopWatch.stop(); 94 stopWatch.stop();
97 - 95 + // 1.3 统计佣金
98 stopWatch.start("统计佣金"); 96 stopWatch.start("统计佣金");
99 Integer brokerageSettlementPrice = brokerageStatisticsService.getBrokerageSettlementPriceSummary(beginTime, endTime); 97 Integer brokerageSettlementPrice = brokerageStatisticsService.getBrokerageSettlementPriceSummary(beginTime, endTime);
100 stopWatch.stop(); 98 stopWatch.stop();
101 - 99 + // 1.4 统计充值
102 stopWatch.start("统计充值"); 100 stopWatch.start("统计充值");
103 WalletSummaryRespBO walletSummary = payWalletStatisticsService.getWalletSummary(beginTime, endTime); 101 WalletSummaryRespBO walletSummary = payWalletStatisticsService.getWalletSummary(beginTime, endTime);
104 stopWatch.stop(); 102 stopWatch.stop();
105 - // 插入数据  
106 - TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary, brokerageSettlementPrice, walletSummary); 103 +
  104 + // 2. 插入数据
  105 + TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary,
  106 + brokerageSettlementPrice, walletSummary);
107 tradeStatisticsMapper.insert(entity); 107 tradeStatisticsMapper.insert(entity);
108 - // 返回计时结果  
109 return stopWatch.prettyPrint(); 108 return stopWatch.prettyPrint();
110 } 109 }
111 110
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/bo/WalletSummaryRespBO.java
@@ -9,6 +9,7 @@ import lombok.Data; @@ -9,6 +9,7 @@ import lombok.Data;
9 */ 9 */
10 @Data 10 @Data
11 public class WalletSummaryRespBO { 11 public class WalletSummaryRespBO {
  12 +
12 /** 13 /**
13 * 总支付金额(余额),单位:分 14 * 总支付金额(余额),单位:分
14 */ 15 */
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.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.infra.ApiAccessLogStatisticsMapper"> 3 <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.infra.ApiAccessLogStatisticsMapper">
  4 +
4 <select id="selectCountByIp" resultType="java.lang.Integer"> 5 <select id="selectCountByIp" resultType="java.lang.Integer">
5 SELECT COUNT(1) 6 SELECT COUNT(1)
6 FROM infra_api_access_log 7 FROM infra_api_access_log
7 - WHERE deleted = FALSE  
8 - AND create_time BETWEEN #{beginTime} AND #{endTime} 8 + WHERE create_time BETWEEN #{beginTime} AND #{endTime}
  9 + AND deleted = FALSE
9 GROUP BY user_ip 10 GROUP BY user_ip
10 </select> 11 </select>
11 12
12 <select id="selectCountByUserId" resultType="java.lang.Integer"> 13 <select id="selectCountByUserId" resultType="java.lang.Integer">
13 SELECT COUNT(1) 14 SELECT COUNT(1)
14 FROM infra_api_access_log 15 FROM infra_api_access_log
15 - WHERE user_id != 0  
16 - AND deleted = FALSE 16 + WHERE user_id > 0
17 AND create_time BETWEEN #{beginTime} AND #{endTime} 17 AND create_time BETWEEN #{beginTime} AND #{endTime}
  18 + AND deleted = FALSE
18 GROUP BY user_id 19 GROUP BY user_id
19 </select> 20 </select>
  21 +
20 </mapper> 22 </mapper>
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 FROM member_user 8 FROM member_user
9 WHERE deleted = FALSE 9 WHERE deleted = FALSE
10 GROUP BY area_id 10 GROUP BY area_id
  11 + <!-- TODO @疯狂:order by 是不是交给内存哈 -->
11 ORDER BY userCount DESC 12 ORDER BY userCount DESC
12 </select> 13 </select>
13 14
@@ -17,6 +18,7 @@ @@ -17,6 +18,7 @@
17 FROM member_user 18 FROM member_user
18 WHERE deleted = FALSE 19 WHERE deleted = FALSE
19 GROUP BY sex 20 GROUP BY sex
  21 + <!-- TODO @疯狂:order by 是不是交给内存哈 -->
20 ORDER BY userCount DESC 22 ORDER BY userCount DESC
21 </select> 23 </select>
22 24
@@ -31,4 +33,5 @@ @@ -31,4 +33,5 @@
31 AND create_time &lt;= #{endTime} 33 AND create_time &lt;= #{endTime}
32 </if> 34 </if>
33 </select> 35 </select>
34 -</mapper>  
35 \ No newline at end of file 36 \ No newline at end of file
  37 +
  38 +</mapper>
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml
@@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
7 SUM(pay_price) AS rechargePayPrice 7 SUM(pay_price) AS rechargePayPrice
8 FROM pay_wallet_recharge 8 FROM pay_wallet_recharge
9 WHERE pay_status = #{payStatus} 9 WHERE pay_status = #{payStatus}
10 - AND deleted = FALSE  
11 AND pay_time BETWEEN #{beginTime} AND #{endTime} 10 AND pay_time BETWEEN #{beginTime} AND #{endTime}
  11 + AND deleted = FALSE
12 </select> 12 </select>
13 13
14 <select id="selectRechargeSummaryByRefundTimeBetween" 14 <select id="selectRechargeSummaryByRefundTimeBetween"
@@ -17,16 +17,16 @@ @@ -17,16 +17,16 @@
17 SUM(pay_price) AS rechargeRefundPrice 17 SUM(pay_price) AS rechargeRefundPrice
18 FROM pay_wallet_recharge 18 FROM pay_wallet_recharge
19 WHERE refund_status = #{refundStatus} 19 WHERE refund_status = #{refundStatus}
20 - AND deleted = FALSE  
21 AND refund_time BETWEEN #{beginTime} AND #{endTime} 20 AND refund_time BETWEEN #{beginTime} AND #{endTime}
  21 + AND deleted = FALSE
22 </select> 22 </select>
23 23
24 <select id="selectPriceSummaryByBizTypeAndCreateTimeBetween" resultType="java.lang.Integer"> 24 <select id="selectPriceSummaryByBizTypeAndCreateTimeBetween" resultType="java.lang.Integer">
25 SELECT SUM(price) 25 SELECT SUM(price)
26 FROM pay_wallet_transaction 26 FROM pay_wallet_transaction
27 WHERE biz_type = #{bizType} 27 WHERE biz_type = #{bizType}
28 - AND deleted = FALSE  
29 AND create_time BETWEEN #{beginTime} AND #{endTime} 28 AND create_time BETWEEN #{beginTime} AND #{endTime}
  29 + AND deleted = FALSE
30 </select> 30 </select>
31 31
32 <select id="selectRechargeSummaryGroupByWalletId" 32 <select id="selectRechargeSummaryGroupByWalletId"
@@ -35,13 +35,14 @@ @@ -35,13 +35,14 @@
35 SUM(pay_price) AS rechargePrice 35 SUM(pay_price) AS rechargePrice
36 FROM pay_wallet_recharge 36 FROM pay_wallet_recharge
37 WHERE pay_status = #{payStatus} 37 WHERE pay_status = #{payStatus}
38 - AND deleted = FALSE  
39 <if test="beginTime != null"> 38 <if test="beginTime != null">
40 AND pay_time >= #{beginTime} 39 AND pay_time >= #{beginTime}
41 </if> 40 </if>
42 <if test="endTime != null"> 41 <if test="endTime != null">
43 AND pay_time &lt;= #{endTime} 42 AND pay_time &lt;= #{endTime}
44 </if> 43 </if>
  44 + AND deleted = FALSE
45 GROUP BY wallet_id 45 GROUP BY wallet_id
46 </select> 46 </select>
  47 +
47 </mapper> 48 </mapper>
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.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.AfterSaleStatisticsMapper"> 3 <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.AfterSaleStatisticsMapper">
  4 +
4 <select id="selectSummaryByRefundTimeBetween" 5 <select id="selectSummaryByRefundTimeBetween"
5 resultType="cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO"> 6 resultType="cn.iocoder.yudao.module.statistics.service.trade.bo.AfterSaleSummaryRespBO">
6 SELECT COUNT(1) AS afterSaleCount, 7 SELECT COUNT(1) AS afterSaleCount,
7 SUM(refund_price) AS afterSaleRefundPrice 8 SUM(refund_price) AS afterSaleRefundPrice
8 FROM trade_after_sale 9 FROM trade_after_sale
9 - WHERE deleted = FALSE  
10 - AND refund_time BETWEEN #{beginTime} AND #{endTime} 10 + WHERE refund_time BETWEEN #{beginTime} AND #{endTime}
  11 + AND deleted = FALSE
11 </select> 12 </select>
  13 +
12 </mapper> 14 </mapper>
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/BrokerageStatisticsMapper.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.BrokerageStatisticsMapper"> 3 <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.BrokerageStatisticsMapper">
  4 +
4 <select id="selectSummaryPriceByStatusAndUnfreezeTimeBetween" resultType="java.lang.Integer"> 5 <select id="selectSummaryPriceByStatusAndUnfreezeTimeBetween" resultType="java.lang.Integer">
5 SELECT SUM(price) 6 SELECT SUM(price)
6 FROM trade_brokerage_record 7 FROM trade_brokerage_record
7 WHERE biz_type = #{bizType} 8 WHERE biz_type = #{bizType}
8 AND status = #{status} 9 AND status = #{status}
9 - AND deleted = FALSE  
10 AND unfreeze_time BETWEEN #{beginTime} AND #{endTime} 10 AND unfreeze_time BETWEEN #{beginTime} AND #{endTime}
  11 + AND deleted = FALSE
11 </select> 12 </select>
  13 +
12 </mapper> 14 </mapper>
yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.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.TradeOrderStatisticsMapper"> 3 <mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.trade.TradeOrderStatisticsMapper">
  4 +
4 <select id="selectSummaryListByAreaId" 5 <select id="selectSummaryListByAreaId"
5 resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO"> 6 resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO">
6 SELECT receiver_area_id AS areaId, 7 SELECT receiver_area_id AS areaId,
@@ -33,25 +34,25 @@ @@ -33,25 +34,25 @@
33 <select id="selectUserCountByPayTimeBetween" resultType="java.lang.Integer"> 34 <select id="selectUserCountByPayTimeBetween" resultType="java.lang.Integer">
34 SELECT COUNT(1) 35 SELECT COUNT(1)
35 FROM trade_order 36 FROM trade_order
36 - WHERE deleted = FALSE 37 + WHERE pay_time BETWEEN #{beginTime} AND #{endTime}
37 AND pay_status = TRUE 38 AND pay_status = TRUE
38 - AND pay_time BETWEEN #{beginTime} AND #{endTime} 39 + AND deleted = FALSE
39 GROUP BY user_id 40 GROUP BY user_id
40 </select> 41 </select>
41 42
42 <select id="selectCountByCreateTimeBetween" resultType="java.lang.Integer"> 43 <select id="selectCountByCreateTimeBetween" resultType="java.lang.Integer">
43 SELECT COUNT(1) 44 SELECT COUNT(1)
44 FROM trade_order 45 FROM trade_order
45 - WHERE deleted = FALSE  
46 - AND create_time BETWEEN #{beginTime} AND #{endTime} 46 + WHERE create_time BETWEEN #{beginTime} AND #{endTime}
  47 + AND deleted = FALSE
47 </select> 48 </select>
48 49
49 <select id="selectCountByPayTimeBetween" resultType="java.lang.Integer"> 50 <select id="selectCountByPayTimeBetween" resultType="java.lang.Integer">
50 SELECT COUNT(1) 51 SELECT COUNT(1)
51 FROM trade_order 52 FROM trade_order
52 WHERE pay_status = TRUE 53 WHERE pay_status = TRUE
53 - AND deleted = FALSE  
54 AND create_time BETWEEN #{beginTime} AND #{endTime} 54 AND create_time BETWEEN #{beginTime} AND #{endTime}
  55 + AND deleted = FALSE
55 </select> 56 </select>
56 57
57 <select id="selectSummaryPriceByPayTimeBetween" resultType="java.lang.Integer"> 58 <select id="selectSummaryPriceByPayTimeBetween" resultType="java.lang.Integer">
@@ -61,4 +62,5 @@ @@ -61,4 +62,5 @@
61 AND deleted = FALSE 62 AND deleted = FALSE
62 AND create_time BETWEEN #{beginTime} AND #{endTime} 63 AND create_time BETWEEN #{beginTime} AND #{endTime}
63 </select> 64 </select>
  65 +
64 </mapper> 66 </mapper>
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
@@ -48,4 +49,5 @@ @@ -48,4 +49,5 @@
48 AND time &lt;= #{endTime} 49 AND time &lt;= #{endTime}
49 </if> 50 </if>
50 </select> 51 </select>
  52 +
51 </mapper> 53 </mapper>
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApi.java deleted
1 -package cn.iocoder.yudao.module.trade.api.aftersale;  
2 -  
3 -/**  
4 - * 售后 API 接口  
5 - *  
6 - * @author owen  
7 - */  
8 -public interface TradeAfterSaleApi {  
9 -  
10 -}  
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApi.java deleted
1 -package cn.iocoder.yudao.module.trade.api.brokerage;  
2 -  
3 -/**  
4 - * 分销 API 接口  
5 - *  
6 - * @author owen  
7 - */  
8 -public interface TradeBrokerageApi {  
9 -  
10 -}  
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java
@@ -28,25 +28,6 @@ public interface TradeOrderApi { @@ -28,25 +28,6 @@ public interface TradeOrderApi {
28 */ 28 */
29 TradeOrderRespDTO getOrder(Long id); 29 TradeOrderRespDTO getOrder(Long id);
30 30
31 - /**  
32 - * 获取订单统计  
33 - *  
34 - * @param beginTime 起始时间  
35 - * @param endTime 截止时间  
36 - * @return 订单统计结果  
37 - */  
38 - TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime);  
39 -  
40 - /**  
41 - * 更新拼团相关信息到订单  
42 - *  
43 - * @param orderId 订单编号  
44 - * @param activityId 拼团活动编号  
45 - * @param combinationRecordId 拼团记录编号  
46 - * @param headId 团长编号  
47 - */  
48 - void updateOrderCombinationInfo(Long orderId, Long activityId, Long combinationRecordId, Long headId);  
49 -  
50 // TODO 芋艿:需要优化下; 31 // TODO 芋艿:需要优化下;
51 /** 32 /**
52 * 取消支付订单 33 * 取消支付订单
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApiImpl.java deleted
1 -package cn.iocoder.yudao.module.trade.api.aftersale;  
2 -  
3 -import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;  
4 -import org.springframework.stereotype.Service;  
5 -import org.springframework.validation.annotation.Validated;  
6 -  
7 -import javax.annotation.Resource;  
8 -  
9 -/**  
10 - * 售后 API 接口实现类  
11 - *  
12 - * @author owen  
13 - */  
14 -@Service  
15 -@Validated  
16 -public class TradeAfterSaleApiImpl implements TradeAfterSaleApi {  
17 -  
18 - @Resource  
19 - private AfterSaleService afterSaleService;  
20 -  
21 -}  
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApiImpl.java deleted
1 -package cn.iocoder.yudao.module.trade.api.brokerage;  
2 -  
3 -import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService;  
4 -import org.springframework.stereotype.Service;  
5 -import org.springframework.validation.annotation.Validated;  
6 -  
7 -import javax.annotation.Resource;  
8 -  
9 -/**  
10 - * 订单 API 接口实现类  
11 - *  
12 - * @author HUIHUI  
13 - */  
14 -@Service  
15 -@Validated  
16 -public class TradeBrokerageApiImpl implements TradeBrokerageApi {  
17 -  
18 - @Resource  
19 - private BrokerageRecordService brokerageRecordService;  
20 -  
21 -}  
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.api.order; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.api.order;
2 2
3 import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; 3 import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
4 import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert; 4 import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
5 -import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;  
6 import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; 5 import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
7 import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; 6 import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService;
8 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
@@ -12,9 +11,6 @@ import javax.annotation.Resource; @@ -12,9 +11,6 @@ import javax.annotation.Resource;
12 import java.util.Collection; 11 import java.util.Collection;
13 import java.util.List; 12 import java.util.List;
14 13
15 -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;  
16 -import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;  
17 -  
18 /** 14 /**
19 * 订单 API 接口实现类 15 * 订单 API 接口实现类
20 * 16 *
@@ -40,16 +36,6 @@ public class TradeOrderApiImpl implements TradeOrderApi { @@ -40,16 +36,6 @@ public class TradeOrderApiImpl implements TradeOrderApi {
40 } 36 }
41 37
42 @Override 38 @Override
43 - public TradeOrderSummaryRespDTO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime) {  
44 - return tradeOrderQueryService.getOrderSummary(beginTime, endTime);  
45 - }  
46 -  
47 - @Override  
48 - public void updateOrderCombinationInfo(Long orderId, Long activityId, Long combinationRecordId, Long headId) {  
49 - tradeOrderUpdateService.updateOrderCombinationInfo(orderId, activityId, combinationRecordId, headId);  
50 - }  
51 -  
52 - @Override  
53 public void cancelPaidOrder(Long userId, Long orderId) { 39 public void cancelPaidOrder(Long userId, Long orderId) {
54 tradeOrderUpdateService.cancelPaidOrder(userId, orderId); 40 tradeOrderUpdateService.cancelPaidOrder(userId, orderId);
55 } 41 }
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApi.java deleted
1 -package cn.iocoder.yudao.module.pay.api.wallet;  
2 -  
3 -/**  
4 - * 钱包 API 接口  
5 - *  
6 - * @author owen  
7 - */  
8 -public interface PayWalletApi {  
9 -  
10 -}  
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApiImpl.java deleted
1 -package cn.iocoder.yudao.module.pay.api.wallet;  
2 -  
3 -import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService;  
4 -import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;  
5 -import org.springframework.stereotype.Service;  
6 -import org.springframework.validation.annotation.Validated;  
7 -  
8 -import javax.annotation.Resource;  
9 -  
10 -/**  
11 - * 钱包 API 接口实现类  
12 - *  
13 - * @author owen  
14 - */  
15 -@Service  
16 -@Validated  
17 -public class PayWalletApiImpl implements PayWalletApi {  
18 -  
19 - @Resource  
20 - private PayWalletRechargeService payWalletRechargeService;  
21 - @Resource  
22 - private PayWalletTransactionService payWalletTransactionService;  
23 -  
24 -}