This commit is contained in:
2026-03-08 16:35:17 +08:00
parent f76af4d01a
commit a125b5922f
8 changed files with 745 additions and 1671 deletions

View File

@@ -96,7 +96,7 @@ public class AiUsageStatsServiceImpl implements AiUsageStatsService {
public PageResult<AiUsageUserStatsRespVO> getUserStatsPage(AiUsageStatsPageReqVO reqVO) {
// 查询用户统计数据
List<Map<String, Object>> userStatsList = pointRecordMapper.selectUserStats(
reqVO.getStartTime(), reqVO.getEndTime(), reqVO.getBizType(), reqVO.getUserId());
reqVO.getStartTime(), reqVO.getEndTime(), reqVO.getBizType(), reqVO.getUserId(), reqVO.getMobile());
// 计算总数
long total = userStatsList.size();

View File

@@ -34,6 +34,9 @@ public class AiUsageStatsPageReqVO extends SortablePageParam {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "手机号")
private String mobile;
@Schema(description = "服务标识")
private String serviceCode;

View File

@@ -78,13 +78,15 @@ public interface PointRecordMapper extends BaseMapperX<PointRecordDO> {
"<if test='endTime != null'> AND create_time &lt;= #{endTime}</if>" +
"<if test='bizType != null and bizType != \"\"'> AND biz_type = #{bizType}</if>" +
"<if test='userId != null'> AND user_id = #{userId}</if>" +
"<if test='mobile != null and mobile != \"\"'> AND mobile LIKE CONCAT('%', #{mobile}, '%')</if>" +
"GROUP BY user_id, mobile " +
"ORDER BY consumePoints DESC" +
"</script>")
List<Map<String, Object>> selectUserStats(@Param("startTime") LocalDateTime startTime,
@Param("endTime") LocalDateTime endTime,
@Param("bizType") String bizType,
@Param("userId") Long userId);
@Param("userId") Long userId,
@Param("mobile") String mobile);
/**
* 按应用统计