code review:数据统计

This commit is contained in:
YunaiV 2023-09-30 12:30:01 +08:00
parent b376de1ad3
commit 367b45e3bd
14 changed files with 23 additions and 5 deletions

View File

@ -6,4 +6,4 @@
* 4. 地域统计
* 5. 会员概览
*/
package cn.iocoder.yudao.module.statistics.controller.member;
package cn.iocoder.yudao.module.statistics.controller.admin.member;

View File

@ -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;

View File

@ -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')")

View File

@ -36,4 +36,5 @@ public class TradeTrendSummaryRespVO {
@Schema(description = "商品退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Integer orderRefundPrice;
}

View File

@ -0,0 +1,4 @@
/**
* TODO 芋艿占位
*/
package cn.iocoder.yudao.module.statistics.controller.app;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.module.statistics.controller;

View File

@ -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);
}

View File

@ -79,6 +79,7 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
* @return 交易数据
*/
private TradeSummaryRespBO getTradeSummaryByMonths(int months) {
// TODO @疯狂可以在 LocalDateUtils 封装方法获得月份的开始以及结束两个方法然后这里就可以直接调用了
// 月份开始时间
LocalDateTime beginOfMonth = LocalDateTime.now()
.plusMonths(months)

View File

@ -19,4 +19,5 @@ public class TradeSummaryRespBO {
* 合计
*/
private Integer summary;
}

View File

@ -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>

View File

@ -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,

View File

@ -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);

View File

@ -121,6 +121,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
return getExpressTrackList(order);
}
// TODO @puhui999可以加个 spring 缓存30 分钟主要考虑及时性要求不高但是每次调用需要钱
/**
* 获得订单的物流轨迹
*

View File

@ -39,4 +39,6 @@ public class MemberSignInRecordDO extends BaseDO {
*/
private Integer point;
// TODO 疯狂签到的经验
}