feat: 添加热词组筛选功能并更新相关API和前端逻辑

- 在 `HotWords.tsx` 中添加热词组筛选选项,并更新 `useEffect` 依赖
- 更新 `hotword.ts` 和 `HotWordController.java` 以支持 `hotWordGroupId` 参数
- 在 `MeetingDetail.tsx` 中添加 `getPinyinSuggestion` API 调用,优化热词创建逻辑
dev_na
chenhao 2026-04-22 16:06:50 +08:00
parent 2d788bac75
commit b36a08adc7
4 changed files with 34 additions and 10 deletions

View File

@ -80,6 +80,7 @@ public class HotWordController {
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(required = false) String word,
@RequestParam(required = false) String category,
@RequestParam(required = false) Long hotWordGroupId,
@RequestParam(required = false) Long tenantId) {
LoginUser loginUser = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Long targetTenantId = Boolean.TRUE.equals(loginUser.getIsPlatformAdmin()) ? tenantId : null;
@ -87,6 +88,7 @@ public class HotWordController {
LambdaQueryWrapper<HotWord> wrapper = new LambdaQueryWrapper<HotWord>()
.like(word != null && !word.isEmpty(), HotWord::getWord, word)
.eq(category != null && !category.isEmpty(), HotWord::getCategory, category)
.eq(hotWordGroupId != null, HotWord::getHotWordGroupId, hotWordGroupId)
.orderByDesc(HotWord::getCreatedAt);
wrapper.eq(targetTenantId != null, HotWord::getTenantId, targetTenantId);

View File

@ -35,6 +35,7 @@ export const getHotWordPage = (params: {
size: number;
word?: string;
category?: string;
hotWordGroupId?: number;
tenantId?: number;
}) => {
return http.get<{ code: string; data: { records: HotWordVO[]; total: number }; msg: string }>(

View File

@ -83,6 +83,7 @@ const HotWords: React.FC = () => {
const [size, setSize] = useState(10);
const [searchWord, setSearchWord] = useState("");
const [searchCategory, setSearchCategory] = useState<string | undefined>(undefined);
const [searchGroupId, setSearchGroupId] = useState<number | undefined>(undefined);
const [modalVisible, setModalVisible] = useState(false);
const [editingId, setEditingId] = useState<number | null>(null);
@ -103,7 +104,7 @@ const HotWords: React.FC = () => {
useEffect(() => {
void fetchData();
}, [current, searchCategory, searchWord, size]);
}, [current, searchCategory, searchGroupId, searchWord, size]);
useEffect(() => {
void loadGroupOptions();
@ -117,6 +118,7 @@ const HotWords: React.FC = () => {
size,
word: searchWord,
category: searchCategory,
hotWordGroupId: searchGroupId,
tenantId: isPlatformAdmin ? activeTenantId : undefined,
});
if (res.data?.data) {
@ -396,6 +398,16 @@ const HotWords: React.FC = () => {
</Option>
))}
</Select>
<Select
placeholder="按热词组筛选"
style={{ width: 180 }}
allowClear
options={groupOptions.map((item) => ({ label: item.groupName, value: item.id }))}
onChange={(value) => {
setSearchGroupId(value);
setCurrent(1);
}}
/>
<Input
placeholder="搜索热词原文"
prefix={<SearchOutlined />}

View File

@ -42,7 +42,7 @@ import {
updateSpeakerInfo,
} from '../../api/business/meeting';
import { getAiModelDefault, getAiModelPage, AiModelVO } from '../../api/business/aimodel';
import { getHotWordPage, saveHotWord } from '../../api/business/hotword';
import { getHotWordPage, getPinyinSuggestion, saveHotWord } from '../../api/business/hotword';
import { getPromptPage, PromptTemplateVO } from '../../api/business/prompt';
import { listUsers } from '../../api';
import { useDict } from '../../hooks/useDict';
@ -977,15 +977,24 @@ const MeetingDetail: React.FC = () => {
await Promise.all(
toCreate.map((word) =>
saveHotWord({
(async () => {
let pinyinList: string[] = [];
try {
const pinyinRes = await getPinyinSuggestion(word);
pinyinList = (pinyinRes.data?.data || []).map((item) => item.trim()).filter(Boolean);
} catch {
pinyinList = [];
}
return saveHotWord({
word,
pinyinList: [],
pinyinList,
matchStrategy: 1,
category: '',
weight: 2,
status: 1,
remark: meeting ? `来源于会议:${meeting.title}` : '来源于会议关键词',
}),
});
})(),
),
);