From 01e9b12eaf2c3f73984efe45acbfe0192d2ec8f6 Mon Sep 17 00:00:00 2001 From: GoCo Date: Mon, 15 Sep 2025 21:35:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E9=A2=98=E7=9B=AE?= =?UTF-8?q?=E5=8A=A0=E7=9F=A5=E8=AF=86=E7=82=B9=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aiol/controller/AiolChatController.java | 83 +++++++++++++++++++ .../modules/aiol/entity/AiolQuestion.java | 4 + .../src/views/aiol/AiolQuestion.data.ts | 22 +++++ 3 files changed, 109 insertions(+) diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolChatController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolChatController.java index 12d1dba4..4199302f 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolChatController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolChatController.java @@ -22,8 +22,12 @@ import org.jeecg.config.shiro.IgnoreAuth; import org.jeecg.modules.aiol.entity.AiolChat; import org.jeecg.modules.aiol.entity.AiolChatMember; import org.jeecg.modules.aiol.entity.AiolChatMessage; +import org.jeecg.modules.aiol.entity.AiolClass; +import org.jeecg.modules.aiol.entity.AiolClassStudent; import org.jeecg.modules.aiol.mapper.AiolChatMemberMapper; import org.jeecg.modules.aiol.mapper.AiolChatMessageMapper; +import org.jeecg.modules.aiol.mapper.AiolClassMapper; +import org.jeecg.modules.aiol.mapper.AiolClassStudentMapper; import org.jeecg.modules.aiol.service.IAiolChatService; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.mapper.SysUserMapper; @@ -75,6 +79,12 @@ public class AiolChatController extends JeecgController> queryChatDetail(@PathVariable(value = "chatId") String chatId) { + try { + // 1. 查询会话基本信息 + AiolChat chat = aiolChatService.getById(chatId); + if (chat == null) { + return Result.error("会话不存在"); + } + + // 2. 构建返回结果 + Map result = new java.util.HashMap<>(); + result.put("id", chat.getId()); + result.put("type", chat.getType()); + result.put("name", chat.getName()); + result.put("avatar", chat.getAvatar()); + result.put("refId", chat.getRefId()); + result.put("izAllMuted", chat.getIzAllMuted()); + result.put("showLabel", chat.getShowLabel()); + result.put("createBy", chat.getCreateBy()); + result.put("createTime", chat.getCreateTime()); + result.put("updateBy", chat.getUpdateBy()); + result.put("updateTime", chat.getUpdateTime()); + + // 3. 如果是群聊类型(type==1),查询班级信息 + if (chat.getType() != null && chat.getType() == 1 && chat.getRefId() != null) { + try { + // 查询班级信息 + AiolClass aiolClass = aiolClassMapper.selectById(chat.getRefId()); + if (aiolClass != null) { + Map classInfo = new java.util.HashMap<>(); + classInfo.put("id", aiolClass.getId()); + classInfo.put("name", aiolClass.getName()); + classInfo.put("courseId", aiolClass.getCourseId()); + classInfo.put("inviteCode", aiolClass.getInviteCode()); + classInfo.put("createBy", aiolClass.getCreateBy()); + classInfo.put("createTime", aiolClass.getCreateTime()); + + // 查询班级人数 + QueryWrapper studentWrapper = new QueryWrapper<>(); + studentWrapper.eq("class_id", aiolClass.getId()); + long studentCount = aiolClassStudentMapper.selectCount(studentWrapper); + classInfo.put("studentCount", studentCount); + + result.put("classInfo", classInfo); + } else { + log.warn("群聊会话 {} 关联的班级 {} 不存在", chatId, chat.getRefId()); + result.put("classInfo", null); + } + } catch (Exception e) { + log.error("查询群聊班级信息失败: chatId={}, refId={}, error={}", + chatId, chat.getRefId(), e.getMessage(), e); + result.put("classInfo", null); + } + } else { + result.put("classInfo", null); + } + + log.info("查询会话详情成功: chatId={}, type={}", chatId, chat.getType()); + return Result.OK(result); + + } catch (Exception e) { + log.error("查询会话详情失败: chatId={}, error={}", chatId, e.getMessage(), e); + return Result.error("查询会话详情失败: " + e.getMessage()); + } + } } diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/entity/AiolQuestion.java b/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/entity/AiolQuestion.java index 330455fe..d921d1fd 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/entity/AiolQuestion.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/entity/AiolQuestion.java @@ -75,6 +75,10 @@ public class AiolQuestion implements Serializable { @Excel(name = "状态", width = 15) @Schema(description = "状态") private java.lang.Integer status; + /**知识点*/ + @Excel(name = "知识点", width = 15) + @Schema(description = "知识点") + private java.lang.String knowledge; /**创建人*/ @Schema(description = "创建人") private java.lang.String createBy; diff --git a/jeecgboot-vue3/src/views/aiol/AiolQuestion.data.ts b/jeecgboot-vue3/src/views/aiol/AiolQuestion.data.ts index 5c868665..4df10c1a 100644 --- a/jeecgboot-vue3/src/views/aiol/AiolQuestion.data.ts +++ b/jeecgboot-vue3/src/views/aiol/AiolQuestion.data.ts @@ -45,6 +45,16 @@ export const columns: BasicColumn[] = [ align:"center", dataIndex: 'ability' }, + { + title: '状态', + align:"center", + dataIndex: 'status' + }, + { + title: '知识点', + align:"center", + dataIndex: 'knowledge' + }, ]; //查询数据 export const searchFormSchema: FormSchema[] = [ @@ -96,6 +106,16 @@ export const formSchema: FormSchema[] = [ label: '能力', field: 'ability', component: 'InputNumber', + }, + { + label: '状态', + field: 'status', + component: 'InputNumber', + }, + { + label: '知识点', + field: 'knowledge', + component: 'Input', }, // TODO 主键隐藏字段,目前写死为ID { @@ -116,6 +136,8 @@ export const superQuerySchema = { score: {title: '分值',order: 5,view: 'number', type: 'number',}, degree: {title: '程度',order: 6,view: 'number', type: 'number',}, ability: {title: '能力',order: 7,view: 'number', type: 'number',}, + status: {title: '状态',order: 8,view: 'number', type: 'number',}, + knowledge: {title: '知识点',order: 9,view: 'text', type: 'string',}, }; /**