From a125b5922f156fd4cbd5a4da2cef242f8714397a Mon Sep 17 00:00:00 2001 From: sion123 <450702724@qq.com> Date: Sun, 8 Mar 2026 16:35:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/app/web-gold/src/views/dh/Video.vue | 1550 ----------------- .../service/AiUsageStatsServiceImpl.java | 2 +- .../vo/AiUsageStatsPageReqVO.java | 3 + .../pointrecord/mapper/PointRecordMapper.java | 4 +- .../src/api/muye/aiusagestats/index.ts | 1 + .../muye/aiusage/components/AppStatsPanel.vue | 360 ++++ .../aiusage/components/UserStatsPanel.vue | 370 ++++ .../src/views/muye/aiusage/index.vue | 126 +- 8 files changed, 745 insertions(+), 1671 deletions(-) delete mode 100644 frontend/app/web-gold/src/views/dh/Video.vue create mode 100644 yudao-ui-admin-vue3/src/views/muye/aiusage/components/AppStatsPanel.vue create mode 100644 yudao-ui-admin-vue3/src/views/muye/aiusage/components/UserStatsPanel.vue diff --git a/frontend/app/web-gold/src/views/dh/Video.vue b/frontend/app/web-gold/src/views/dh/Video.vue deleted file mode 100644 index 51f0a73904..0000000000 --- a/frontend/app/web-gold/src/views/dh/Video.vue +++ /dev/null @@ -1,1550 +0,0 @@ - - - - - - - - - - 文案 - - - - - 音色 - - - - {{ source === 'system' ? '系统音色' : '我的音色' }} - - - - - {{ voiceSource === 'user' ? '还没有配音,可先在"配音管理"中上传' : '暂无可用的系统音色' }} - - - - - - {{ voice.gender === 'male' ? '👨' : '👩' }} - - {{ voice.name }} - {{ voice.description }} - - - - - - - - - - - - - - - - - - - - 语速 - - - {{ speechRateDisplay }} - 重置 - - - - - - - 情感 - - - 语调 - - - 情感 - - - - - {{ inst.label }} - - - {{ emo.label }} - - - - - - - - - 视频 - - - - 点击或拖拽上传视频 - - 支持格式:MP4、MOV、AVI、WMV、FLV | 建议分辨率 ≥ 720p - - - - - - 已上传视频 - 清除 - - - - - - - - - - {{ isGenerating ? '生成中...' : '生成视频' }} - - 生成视频将消耗积分,消耗量与视频时长相关 - - - - - - 状态: - {{ getStatusText(currentTaskStatus) }} - - - 步骤: - {{ getStepText(currentTaskStep) }} - - - - - - - - - - - 视频预览 - - - - 📹 - 生成的视频将在这里显示 - 请先完成配置,然后点击生成 - - - - - - 下载视频 - - - - - - - - - diff --git a/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/service/AiUsageStatsServiceImpl.java b/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/service/AiUsageStatsServiceImpl.java index 0db0364f77..8ace06c3ea 100644 --- a/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/service/AiUsageStatsServiceImpl.java +++ b/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/service/AiUsageStatsServiceImpl.java @@ -96,7 +96,7 @@ public class AiUsageStatsServiceImpl implements AiUsageStatsService { public PageResult getUserStatsPage(AiUsageStatsPageReqVO reqVO) { // 查询用户统计数据 List> 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(); diff --git a/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/vo/AiUsageStatsPageReqVO.java b/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/vo/AiUsageStatsPageReqVO.java index 34d37340ba..368a3406de 100644 --- a/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/vo/AiUsageStatsPageReqVO.java +++ b/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/aiusagestats/vo/AiUsageStatsPageReqVO.java @@ -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; diff --git a/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/pointrecord/mapper/PointRecordMapper.java b/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/pointrecord/mapper/PointRecordMapper.java index eb52f5f688..59663b7a1f 100644 --- a/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/pointrecord/mapper/PointRecordMapper.java +++ b/yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/muye/pointrecord/mapper/PointRecordMapper.java @@ -78,13 +78,15 @@ public interface PointRecordMapper extends BaseMapperX { " AND create_time <= #{endTime}" + " AND biz_type = #{bizType}" + " AND user_id = #{userId}" + + " AND mobile LIKE CONCAT('%', #{mobile}, '%')" + "GROUP BY user_id, mobile " + "ORDER BY consumePoints DESC" + "") List> 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); /** * 按应用统计 diff --git a/yudao-ui-admin-vue3/src/api/muye/aiusagestats/index.ts b/yudao-ui-admin-vue3/src/api/muye/aiusagestats/index.ts index b5d278b429..dfb9228407 100644 --- a/yudao-ui-admin-vue3/src/api/muye/aiusagestats/index.ts +++ b/yudao-ui-admin-vue3/src/api/muye/aiusagestats/index.ts @@ -68,6 +68,7 @@ export const getAiUsageUserStatsPage = (params: { endTime?: string bizType?: string userId?: number + mobile?: string }) => { return request.get({ url: '/muye/ai-usage-stats/user-stats', params }) } diff --git a/yudao-ui-admin-vue3/src/views/muye/aiusage/components/AppStatsPanel.vue b/yudao-ui-admin-vue3/src/views/muye/aiusage/components/AppStatsPanel.vue new file mode 100644 index 0000000000..a3e59cd3a6 --- /dev/null +++ b/yudao-ui-admin-vue3/src/views/muye/aiusage/components/AppStatsPanel.vue @@ -0,0 +1,360 @@ + + + + + + + + + + + + 查询 + + + 重置 + + + + + + + + + + + + + + 应用数量 + {{ summary.appCount?.toLocaleString() || 0 }} + + + + + + + + + + + + 总调用次数 + {{ summary.totalCallCount?.toLocaleString() || 0 }} + + + + + + + + + + + + 总消耗积分 + {{ summary.totalConsumePoints?.toLocaleString() || 0 }} + + + + + + + + + + + + 平均积分/应用 + {{ avgPointsPerApp }} + + + + + + + + + + + + + 应用积分消耗排行 TOP10 + + + + + + + + + + 平台占比分布 + + + + + + + + + + + + 应用详细统计 + + + + + + + + {{ row.callCount?.toLocaleString() }} + + + {{ row.consumePoints?.toLocaleString() }} + + + {{ row.totalTokens?.toLocaleString() || '-' }} + + + {{ row.avgPointsPerCall?.toFixed(2) }} + + + {{ row.avgTokensPerCall?.toFixed(2) }} + + + + + + + + + diff --git a/yudao-ui-admin-vue3/src/views/muye/aiusage/components/UserStatsPanel.vue b/yudao-ui-admin-vue3/src/views/muye/aiusage/components/UserStatsPanel.vue new file mode 100644 index 0000000000..2b855e7025 --- /dev/null +++ b/yudao-ui-admin-vue3/src/views/muye/aiusage/components/UserStatsPanel.vue @@ -0,0 +1,370 @@ + + + + + + + + + + 查询 + + + 重置 + + + + + + + + + + + + + + 活跃用户数 + {{ summary.activeUserCount?.toLocaleString() || 0 }} + + + + + + + + + + + + 总调用次数 + {{ summary.totalCallCount?.toLocaleString() || 0 }} + + + + + + + + + + + + 总消耗积分 + {{ summary.totalConsumePoints?.toLocaleString() || 0 }} + + + + + + + + + + + + 平均积分/用户 + {{ avgPointsPerUser }} + + + + + + + + + + + + + 用户积分消耗排行 TOP10 + + + + + + + + + + 用户调用次数排行 TOP10 + + + + + + + + + + + + 用户详细统计 + + + + + + + {{ row.callCount?.toLocaleString() }} + + + {{ row.consumePoints?.toLocaleString() }} + + + {{ row.inputTokens?.toLocaleString() || '-' }} + + + {{ row.outputTokens?.toLocaleString() || '-' }} + + + {{ row.totalTokens?.toLocaleString() || '-' }} + + + {{ row.avgPointsPerCall?.toFixed(2) }} + + + + + + + + + + diff --git a/yudao-ui-admin-vue3/src/views/muye/aiusage/index.vue b/yudao-ui-admin-vue3/src/views/muye/aiusage/index.vue index 87c020025e..288b3e95b6 100644 --- a/yudao-ui-admin-vue3/src/views/muye/aiusage/index.vue +++ b/yudao-ui-admin-vue3/src/views/muye/aiusage/index.vue @@ -29,7 +29,7 @@ - + @@ -136,58 +136,12 @@ - - - - - {{ row.callCount?.toLocaleString() }} - - - {{ row.consumePoints?.toLocaleString() }} - - - {{ row.inputTokens?.toLocaleString() || '-' }} - - - {{ row.outputTokens?.toLocaleString() || '-' }} - - - {{ row.totalTokens?.toLocaleString() || '-' }} - - - {{ row.avgPointsPerCall?.toFixed(2) }} - - - + - - - - - - {{ row.callCount?.toLocaleString() }} - - - {{ row.consumePoints?.toLocaleString() }} - - - {{ row.totalTokens?.toLocaleString() || '-' }} - - - {{ row.avgPointsPerCall?.toFixed(2) }} - - - {{ row.avgTokensPerCall?.toFixed(2) }} - - + @@ -198,13 +152,11 @@ import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue' import * as echarts from 'echarts' import { getAiUsageOverview, - getAiUsageUserStatsPage, - getAiUsageAppStats, getAiUsageTrend, - type AiUsageOverview, - type AiUsageUserStats, - type AiUsageAppStats + type AiUsageOverview } from '@/api/muye/aiusagestats' +import UserStatsPanel from './components/UserStatsPanel.vue' +import AppStatsPanel from './components/AppStatsPanel.vue' defineOptions({ name: 'AiUsageStats' }) @@ -254,19 +206,6 @@ const activeTab = ref('overview') // 概览数据 const overviewData = ref({} as AiUsageOverview) -// 用户统计 -const userLoading = ref(false) -const userStatsList = ref([]) -const userPageParams = reactive({ - pageNo: 1, - pageSize: 10, - total: 0 -}) - -// 应用统计 -const appLoading = ref(false) -const appStatsList = ref([]) - // 图表 const trendChartRef = ref() const pieChartRef = ref() @@ -303,10 +242,8 @@ const getTrendData = async () => { type: 'day' }) - // 确保 DOM 已渲染 await nextTick() - // 初始化图表 if (!initTrendChart()) { console.warn('趋势图表容器未找到') return @@ -342,7 +279,6 @@ const initPieChart = () => { // 绘制饼图 const drawPieChart = () => { - // 初始化图表 if (!initPieChart()) { console.warn('饼图容器未找到') return @@ -367,61 +303,13 @@ const drawPieChart = () => { } } -// 获取用户统计列表 -const getUserStatsList = async () => { - userLoading.value = true - try { - const [startTime, endTime] = queryParams.timeRange || [] - const res = await getAiUsageUserStatsPage({ - pageNo: userPageParams.pageNo, - pageSize: userPageParams.pageSize, - startTime, - endTime, - bizType: queryParams.bizType - }) - userStatsList.value = res?.list || [] - userPageParams.total = res?.total || 0 - } finally { - userLoading.value = false - } -} - -// 获取应用统计列表 -const getAppStatsList = async () => { - appLoading.value = true - try { - const [startTime, endTime] = queryParams.timeRange || [] - const res = await getAiUsageAppStats({ - startTime, - endTime, - bizType: queryParams.bizType - }) - appStatsList.value = res || [] - } finally { - appLoading.value = false - } -} - // 查询 const handleQuery = async () => { + if (activeTab.value !== 'overview') return await getOverviewData() await getTrendData() await nextTick() drawPieChart() - if (activeTab.value === 'user') { - getUserStatsList() - } else if (activeTab.value === 'app') { - getAppStatsList() - } -} - -// Tab 切换 -const handleTabChange = (tab: string) => { - if (tab === 'user') { - getUserStatsList() - } else if (tab === 'app') { - getAppStatsList() - } } // 窗口大小变化时重绘图表
点击或拖拽上传视频
- 支持格式:MP4、MOV、AVI、WMV、FLV | 建议分辨率 ≥ 720p -
生成视频将消耗积分,消耗量与视频时长相关