feat: 增强管理端工作台用户活跃榜能力

- 新增用户活跃榜接口、筛选与导出能力

- 支持按智能体过滤排行榜并补充前后端测试
This commit is contained in:
2026-05-10 17:06:22 +08:00
parent 8d07b306e5
commit 516d43ce7d
14 changed files with 868 additions and 126 deletions

View File

@@ -104,6 +104,28 @@ public class ChatAnalyticalDBRepositoryTest {
Assert.assertTrue(operations.lastQuerySql.contains("(agg.assistant_id IN (?) OR agg.assistant_id IS NULL)"));
}
/**
* 验证用户活跃榜支持按智能体过滤,且导出场景可不带 limit。
*/
@Test
public void shouldSupportAssistantFilterAndUnlimitedUserRanks() {
RecordingAnalyticalDBOperations operations = new RecordingAnalyticalDBOperations();
ChatAnalyticalDBRepository repository = newRepository(operations);
repository.queryActiveUserRanks(
LocalDate.of(2026, 4, 1),
LocalDate.of(2026, 4, 8),
BigInteger.ONE,
BigInteger.TEN,
null
);
Assert.assertNotNull(operations.lastQuerySql);
Assert.assertTrue(operations.lastQuerySql.contains("AND agg.assistant_id = ?"));
Assert.assertTrue(operations.lastQuerySql.contains("ORDER BY agg.session_total DESC, agg.message_total DESC, agg.user_id ASC"));
Assert.assertFalse(operations.lastQuerySql.contains("LIMIT ?"));
}
/**
* 构造仓储实例。
*