diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/ChatController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/ChatController.java new file mode 100644 index 0000000..07fc3a4 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/ChatController.java @@ -0,0 +1,657 @@ +//package com.chenhai.system.controller; +// +//import java.util.*; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.*; +//import com.chenhai.common.core.controller.BaseController; +//import com.chenhai.common.core.domain.AjaxResult; +//import com.chenhai.common.core.domain.model.LoginUser; +//import com.chenhai.common.utils.SecurityUtils; +//import com.chenhai.system.domain.SysChatMessage; +//import com.chenhai.system.domain.SysChatSession; +//import com.chenhai.system.service.ISysChatMessageService; +//import com.chenhai.system.service.ISysChatSessionService; +//import com.chenhai.vet.domain.VetExperts; +//import com.chenhai.vet.service.IVetExpertsService; +// +//@RestController +//@RequestMapping("/system/chat") +//public class ChatController extends BaseController { +// +// @Autowired +// private IVetExpertsService expertsService; +// +// @Autowired +// private ISysChatSessionService sessionService; +// +// @Autowired +// private ISysChatMessageService messageService; +// +// /** +// * 获取当前用户身份(基于权限判断) +// */ +// @GetMapping("/identity") +// public AjaxResult getIdentity() { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// Map result = new HashMap<>(); +// +// // 检查用户权限 +// boolean isExpertRole = SecurityUtils.hasPermi("vet:experts:list"); +// boolean isMuhuRole = SecurityUtils.hasPermi("system:notice:list"); // 假设牧户有这个权限 +// +// // 或者使用角色检查(如果您的系统使用角色) +// // boolean isExpertRole = SecurityUtils.hasRole("vetnotshenhe"); +// // boolean isMuhuRole = SecurityUtils.hasRole("muhu"); +// +// // 判断是否是专家 +// List experts = expertsService.selectVetExpertsList(null); +// VetExperts currentExpert = null; +// for (VetExperts expert : experts) { +// if (expert.getUserId() != null && expert.getUserId().equals(loginUser.getUserId())) { +// currentExpert = expert; +// break; +// } +// } +// +// if (currentExpert != null) { +// // 是专家 +// result.put("userType", "expert"); +// result.put("expertId", currentExpert.getExpertId()); +// result.put("expertName", currentExpert.getRealName()); +// result.put("expertAvatar", currentExpert.getAvatar()); +// result.put("isOnline", currentExpert.getIsOnline()); +// } else if (isMuhuRole) { +// // 是牧户 +// result.put("userType", "user"); +// result.put("userId", loginUser.getUserId()); +// result.put("userName", loginUser.getUsername()); +// } else { +// // 其他用户 +// result.put("userType", "unknown"); +// } +// +// return AjaxResult.success(result); +// +// } catch (Exception e) { +// logger.error("获取用户身份失败", e); +// return AjaxResult.error("获取失败"); +// } +// } +// +// /** +// * 获取在线专家列表(牧户端使用) +// */ +// @GetMapping("/experts") +// public AjaxResult getOnlineExperts() { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// // 查询所有在线专家 +// VetExperts query = new VetExperts(); +// query.setStatus("0"); // 只查询状态正常的专家 +// List allExperts = expertsService.selectVetExpertsList(query); +// +// List> result = new ArrayList<>(); +// +// for (VetExperts expert : allExperts) { +// Map expertMap = new HashMap<>(); +// expertMap.put("expertId", expert.getExpertId()); +// expertMap.put("realName", expert.getRealName()); +// expertMap.put("title", expert.getTitle()); +// expertMap.put("avatar", expert.getAvatar()); +// expertMap.put("expertiseArea", expert.getExpertiseArea()); +// expertMap.put("isOnline", "1".equals(expert.getIsOnline()) ? "在线" : "离线"); +// expertMap.put("introduction", expert.getIntroduction()); +// expertMap.put("workExperience", expert.getWorkExperience()); +// +// // 获取未读数(牧户视角) +// SysChatSession querySession = new SysChatSession(); +// querySession.setUserId(loginUser.getUserId()); +// querySession.setExpertId(expert.getExpertId()); +// querySession.setDelFlag("0"); +// List sessions = sessionService.selectSysChatSessionList(querySession); +// long unreadCount = 0; +// if (!sessions.isEmpty()) { +// unreadCount = sessions.get(0).getUnreadUser() != null ? sessions.get(0).getUnreadUser() : 0; +// } +// expertMap.put("unreadCount", unreadCount); +// +// result.add(expertMap); +// } +// +// return AjaxResult.success(result); +// +// } catch (Exception e) { +// logger.error("获取专家列表失败", e); +// return AjaxResult.error("获取失败"); +// } +// } +// +// /** +// * 获取用户会话列表(牧户端使用) +// */ +// @GetMapping("/sessions") +// public AjaxResult getUserSessions() { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// // 查询用户的所有会话 +// SysChatSession query = new SysChatSession(); +// query.setUserId(loginUser.getUserId()); +// query.setDelFlag("0"); +// query.setSessionStatus("0"); // 只查询进行中的会话 +// List sessions = sessionService.selectSysChatSessionList(query); +// +// List> result = new ArrayList<>(); +// for (SysChatSession session : sessions) { +// Map sessionMap = new HashMap<>(); +// sessionMap.put("sessionId", session.getSessionId()); +// sessionMap.put("expertId", session.getExpertId()); +// sessionMap.put("animalType", session.getAnimalType()); +// sessionMap.put("symptomSummary", session.getSymptomSummary()); +// sessionMap.put("lastMessage", session.getLastMessage()); +// sessionMap.put("lastMessageTime", session.getLastMessageTime()); +// sessionMap.put("createTime", session.getCreateTime()); +// sessionMap.put("unreadCount", session.getUnreadUser() != null ? session.getUnreadUser() : 0); +// sessionMap.put("sessionStatus", session.getSessionStatus()); +// +// // 获取专家信息 +// VetExperts expert = expertsService.selectVetExpertsByExpertId(session.getExpertId()); +// if (expert != null) { +// sessionMap.put("expertName", expert.getRealName()); +// sessionMap.put("expertTitle", expert.getTitle()); +// sessionMap.put("expertAvatar", expert.getAvatar()); +// sessionMap.put("expertIsOnline", expert.getIsOnline()); +// } +// +// result.add(sessionMap); +// } +// +// // 按最后消息时间排序 +// result.sort((a, b) -> { +// Date timeA = (Date) a.get("lastMessageTime"); +// Date timeB = (Date) b.get("lastMessageTime"); +// if (timeA == null && timeB == null) return 0; +// if (timeA == null) return 1; +// if (timeB == null) return -1; +// return timeB.compareTo(timeA); +// }); +// +// return AjaxResult.success(result); +// +// } catch (Exception e) { +// logger.error("获取用户会话列表失败", e); +// return AjaxResult.error("获取失败"); +// } +// } +// +// /** +// * 专家端:获取等待回复的会话列表 +// */ +// @GetMapping("/expert/sessions") +// public AjaxResult getExpertSessions() { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// // 检查是否是专家 +// List experts = expertsService.selectVetExpertsList(null); +// VetExperts currentExpert = null; +// for (VetExperts expert : experts) { +// if (expert.getUserId() != null && expert.getUserId().equals(loginUser.getUserId())) { +// currentExpert = expert; +// break; +// } +// } +// +// if (currentExpert == null) { +// return AjaxResult.error("您不是专家或专家信息未配置"); +// } +// +// // 查询该专家的所有会话 +// SysChatSession query = new SysChatSession(); +// query.setExpertId(currentExpert.getExpertId()); +// query.setDelFlag("0"); +// query.setSessionStatus("0"); // 只查询进行中的 +// List sessions = sessionService.selectSysChatSessionList(query); +// +// List> result = new ArrayList<>(); +// for (SysChatSession session : sessions) { +// Map sessionMap = new HashMap<>(); +// sessionMap.put("sessionId", session.getSessionId()); +// sessionMap.put("userId", session.getUserId()); +// sessionMap.put("animalType", session.getAnimalType()); +// sessionMap.put("symptomSummary", session.getSymptomSummary()); +// sessionMap.put("lastMessage", session.getLastMessage()); +// sessionMap.put("lastMessageTime", session.getLastMessageTime()); +// sessionMap.put("createTime", session.getCreateTime()); +// sessionMap.put("unreadCount", session.getUnreadExpert() != null ? session.getUnreadExpert() : 0); +// sessionMap.put("sessionStatus", session.getSessionStatus()); +// +// result.add(sessionMap); +// } +// +// // 按最后消息时间排序 +// result.sort((a, b) -> { +// Date timeA = (Date) a.get("lastMessageTime"); +// Date timeB = (Date) b.get("lastMessageTime"); +// if (timeA == null && timeB == null) return 0; +// if (timeA == null) return 1; +// if (timeB == null) return -1; +// return timeB.compareTo(timeA); +// }); +// +// return AjaxResult.success(result); +// +// } catch (Exception e) { +// logger.error("获取专家会话列表失败", e); +// return AjaxResult.error("获取失败"); +// } +// } +// +// /** +// * 开始咨询(创建会话) +// */ +// @PostMapping("/start") +// public AjaxResult startConsultation(@RequestBody Map params) { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// Long expertId = Long.valueOf(params.get("expertId").toString()); +// String animalType = params.get("animalType") != null ? params.get("animalType").toString() : "牛"; +// String symptom = params.get("symptom") != null ? params.get("symptom").toString() : ""; +// +// // 检查专家是否存在 +// VetExperts expert = expertsService.selectVetExpertsByExpertId(expertId); +// if (expert == null) { +// return AjaxResult.error("专家不存在"); +// } +// +// // 创建会话 +// String sessionId = sessionService.createOrGetSession(loginUser.getUserId(), expertId, animalType, symptom); +// +// // 发送欢迎消息 +// String welcomeMessage = "您好,我是" + expert.getRealName() + "专家,有什么可以帮您?"; +// messageService.sendTextMessage(sessionId, "1", expertId, welcomeMessage); +// +// Map result = new HashMap<>(); +// result.put("sessionId", sessionId); +// result.put("expert", expert); +// result.put("message", welcomeMessage); +// +// return AjaxResult.success("咨询开始", result); +// +// } catch (Exception e) { +// logger.error("开始咨询失败", e); +// return AjaxResult.error("开始咨询失败"); +// } +// } +// +// /** +// * 发送消息(通用,根据身份自动判断) +// */ +// @PostMapping("/send") +// public AjaxResult sendMessage(@RequestBody Map params) { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// String sessionId = params.get("sessionId").toString(); +// String content = params.get("content").toString(); +// String msgType = params.get("msgType") != null ? params.get("msgType").toString() : "text"; +// +// // 获取会话 +// SysChatSession session = sessionService.selectSysChatSessionBySessionId(sessionId); +// if (session == null) { +// return AjaxResult.error("会话不存在"); +// } +// +// // 判断发送者身份 +// String senderType; +// Long senderId; +// +// // 检查是否是专家 +// List experts = expertsService.selectVetExpertsList(null); +// VetExperts currentExpert = null; +// for (VetExperts expert : experts) { +// if (expert.getUserId() != null && expert.getUserId().equals(loginUser.getUserId())) { +// currentExpert = expert; +// break; +// } +// } +// +// if (currentExpert != null && currentExpert.getExpertId().equals(session.getExpertId())) { +// // 专家回复 +// senderType = "1"; +// senderId = currentExpert.getExpertId(); +// } else if (session.getUserId().equals(loginUser.getUserId())) { +// // 用户发送 +// senderType = "0"; +// senderId = loginUser.getUserId(); +// } else { +// return AjaxResult.error("无权发送消息"); +// } +// +// // 发送消息 +// if ("image".equals(msgType)) { +// messageService.sendImageMessage(sessionId, senderType, senderId, content); +// } else { +// messageService.sendTextMessage(sessionId, senderType, senderId, content); +// } +// +// return AjaxResult.success("发送成功"); +// +// } catch (Exception e) { +// logger.error("发送消息失败", e); +// return AjaxResult.error("发送失败"); +// } +// } +// +// /** +// * 结束咨询(用户端和专家端通用) +// */ +// @PostMapping("/end") +// public AjaxResult endConsultation(@RequestBody Map params) { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// String sessionId = params.get("sessionId").toString(); +// String reason = params.get("reason") != null ? params.get("reason").toString() : "咨询结束"; +// +// // 获取会话 +// SysChatSession session = sessionService.selectSysChatSessionBySessionId(sessionId); +// if (session == null) { +// return AjaxResult.error("会话不存在"); +// } +// +// // 验证权限 +// boolean hasPermission = false; +// String endBy = ""; +// +// // 检查是否是专家 +// List experts = expertsService.selectVetExpertsList(null); +// VetExperts currentExpert = null; +// for (VetExperts expert : experts) { +// if (expert.getUserId() != null && expert.getUserId().equals(loginUser.getUserId())) { +// currentExpert = expert; +// break; +// } +// } +// +// if (currentExpert != null && currentExpert.getExpertId().equals(session.getExpertId())) { +// // 专家可以结束会话 +// hasPermission = true; +// endBy = "expert"; +// } else if (session.getUserId().equals(loginUser.getUserId())) { +// // 用户可以结束自己的会话 +// hasPermission = true; +// endBy = "user"; +// } +// +// if (!hasPermission) { +// return AjaxResult.error("无权结束会话"); +// } +// +// // 结束会话 +// sessionService.endSession(sessionId, endBy, reason); +// +// // 发送结束消息 +// String endMessage = ""; +// if ("expert".equals(endBy)) { +// endMessage = "专家已结束本次咨询,感谢您的信任。"; +// } else { +// endMessage = "您已结束本次咨询,感谢专家的帮助。"; +// } +// +// if (currentExpert != null) { +// messageService.sendSystemMessage(sessionId, "系统通知:" + endMessage); +// } +// +// return AjaxResult.success("咨询已结束"); +// +// } catch (Exception e) { +// logger.error("结束咨询失败", e); +// return AjaxResult.error("结束咨询失败"); +// } +// } +// +// /** +// * 获取聊天历史(通用) +// */ +// @GetMapping("/history") +// public AjaxResult getChatHistory(@RequestParam String sessionId) { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// // 获取会话 +// SysChatSession session = sessionService.selectSysChatSessionBySessionId(sessionId); +// if (session == null) { +// return AjaxResult.error("会话不存在"); +// } +// +// // 验证权限(用户或专家都可以查看) +// boolean hasPermission = false; +// +// // 检查是否是专家 +// List experts = expertsService.selectVetExpertsList(null); +// VetExperts currentExpert = null; +// for (VetExperts expert : experts) { +// if (expert.getUserId() != null && expert.getUserId().equals(loginUser.getUserId())) { +// currentExpert = expert; +// break; +// } +// } +// +// if (currentExpert != null && currentExpert.getExpertId().equals(session.getExpertId())) { +// // 专家可以查看 +// hasPermission = true; +// // 标记专家已读 +// sessionService.markMessagesAsReadByExpert(sessionId); +// } else if (session.getUserId().equals(loginUser.getUserId())) { +// // 用户可以查看 +// hasPermission = true; +// // 标记用户已读 +// sessionService.markMessagesAsReadByUser(sessionId); +// } +// +// if (!hasPermission) { +// return AjaxResult.error("无权查看"); +// } +// +// // 获取消息 +// List messages = messageService.selectMessagesBySessionId(sessionId); +// +// // 格式化消息 +// List> formattedMessages = new ArrayList<>(); +// for (SysChatMessage msg : messages) { +// Map msgMap = new HashMap<>(); +// msgMap.put("id", msg.getMessageId()); +// msgMap.put("messageId", msg.getMessageId()); +// msgMap.put("senderType", msg.getSenderType()); +// msgMap.put("content", msg.getContent()); +// msgMap.put("msgType", msg.getMsgType()); +// msgMap.put("time", msg.getCreateTime()); +// msgMap.put("createTime", msg.getCreateTime()); +// msgMap.put("isRead", msg.getIsRead()); +// formattedMessages.add(msgMap); +// } +// +// // 获取相关用户信息 +// Map userInfo = new HashMap<>(); +// if (currentExpert != null && currentExpert.getExpertId().equals(session.getExpertId())) { +// // 专家端:获取用户信息 +// userInfo.put("type", "user"); +// userInfo.put("userId", session.getUserId()); +// userInfo.put("userName", session.getUserName()); +// } else { +// // 用户端:获取专家信息 +// VetExperts expert = expertsService.selectVetExpertsByExpertId(session.getExpertId()); +// if (expert != null) { +// userInfo.put("type", "expert"); +// userInfo.put("expertId", expert.getExpertId()); +// userInfo.put("realName", expert.getRealName()); +// userInfo.put("title", expert.getTitle()); +// userInfo.put("avatar", expert.getAvatar()); +// userInfo.put("isOnline", expert.getIsOnline()); +// } +// } +// +// Map result = new HashMap<>(); +// result.put("session", session); +// result.put("userInfo", userInfo); +// result.put("messages", formattedMessages); +// +// return AjaxResult.success(result); +// +// } catch (Exception e) { +// logger.error("获取聊天历史失败", e); +// return AjaxResult.error("获取失败"); +// } +// } +// +// /** +// * 标记消息为已读 +// */ +// @PostMapping("/read") +// public AjaxResult markAsRead(@RequestBody Map params) { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// String sessionId = params.get("sessionId").toString(); +// String messageIds = params.get("messageIds") != null ? params.get("messageIds").toString() : ""; +// +// // 获取会话 +// SysChatSession session = sessionService.selectSysChatSessionBySessionId(sessionId); +// if (session == null) { +// return AjaxResult.error("会话不存在"); +// } +// +// // 验证权限 +// boolean hasPermission = false; +// String readerType = ""; +// +// // 检查是否是专家 +// List experts = expertsService.selectVetExpertsList(null); +// VetExperts currentExpert = null; +// for (VetExperts expert : experts) { +// if (expert.getUserId() != null && expert.getUserId().equals(loginUser.getUserId())) { +// currentExpert = expert; +// break; +// } +// } +// +// if (currentExpert != null && currentExpert.getExpertId().equals(session.getExpertId())) { +// // 专家标记已读 +// hasPermission = true; +// readerType = "expert"; +// } else if (session.getUserId().equals(loginUser.getUserId())) { +// // 用户标记已读 +// hasPermission = true; +// readerType = "user"; +// } +// +// if (!hasPermission) { +// return AjaxResult.error("无权操作"); +// } +// +// // 标记已读 +// if ("expert".equals(readerType)) { +// messageService.markMessagesAsReadByExpert(sessionId, messageIds); +// } else { +// messageService.markMessagesAsReadByUser(sessionId, messageIds); +// } +// +// return AjaxResult.success("标记已读成功"); +// +// } catch (Exception e) { +// logger.error("标记已读失败", e); +// return AjaxResult.error("标记已读失败"); +// } +// } +// +// /** +// * 获取未读消息数量 +// */ +// @GetMapping("/unread/count") +// public AjaxResult getUnreadCount() { +// try { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// return AjaxResult.error("用户未登录"); +// } +// +// Map result = new HashMap<>(); +// +// // 检查是否是专家 +// List experts = expertsService.selectVetExpertsList(null); +// VetExperts currentExpert = null; +// for (VetExperts expert : experts) { +// if (expert.getUserId() != null && expert.getUserId().equals(loginUser.getUserId())) { +// currentExpert = expert; +// break; +// } +// } +// +// long totalUnread = 0; +// if (currentExpert != null) { +// // 专家获取未读消息数 +// SysChatSession query = new SysChatSession(); +// query.setExpertId(currentExpert.getExpertId()); +// query.setDelFlag("0"); +// query.setSessionStatus("0"); +// List sessions = sessionService.selectSysChatSessionList(query); +// +// for (SysChatSession session : sessions) { +// totalUnread += session.getUnreadExpert() != null ? session.getUnreadExpert() : 0; +// } +// result.put("userType", "expert"); +// } else { +// // 用户获取未读消息数 +// SysChatSession query = new SysChatSession(); +// query.setUserId(loginUser.getUserId()); +// query.setDelFlag("0"); +// query.setSessionStatus("0"); +// List sessions = sessionService.selectSysChatSessionList(query); +// +// for (SysChatSession session : sessions) { +// totalUnread += session.getUnreadUser() != null ? session.getUnreadUser() : 0; +// } +// result.put("userType", "user"); +// } +// +// result.put("totalUnread", totalUnread); +// return AjaxResult.success(result); +// +// } catch (Exception e) { +// logger.error("获取未读消息数失败", e); +// return AjaxResult.error("获取失败"); +// } +// } +//} \ No newline at end of file diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysChatMessageController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysChatMessageController.java new file mode 100644 index 0000000..a4df600 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysChatMessageController.java @@ -0,0 +1,275 @@ +package com.chenhai.web.controller.system; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +import com.chenhai.common.utils.SecurityUtils; +import com.chenhai.common.utils.file.FileUploadUtils; +import com.chenhai.system.domain.SysChatSession; +import com.chenhai.system.service.ISysChatSessionService; +import jakarta.servlet.http.HttpServletResponse; +import lombok.Data; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.system.domain.SysChatMessage; +import com.chenhai.system.service.ISysChatMessageService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 兽医咨询聊天消息Controller + * + * @author ruoyi + * @date 2026-01-19 + */ +@RestController +@RequestMapping("/system/message") +public class SysChatMessageController extends BaseController +{ + @Autowired + private ISysChatMessageService sysChatMessageService; + + @Autowired // 添加这个注入 + private ISysChatSessionService sysChatSessionService; + + /** + * 查询兽医咨询聊天消息列表 + */ + @PreAuthorize("@ss.hasPermi('system:message:list')") + @GetMapping("/list") + public TableDataInfo list(SysChatMessage sysChatMessage) + { + startPage(); + List list = sysChatMessageService.selectSysChatMessageList(sysChatMessage); + return getDataTable(list); + } + + /** + * 导出兽医咨询聊天消息列表 + */ + @PreAuthorize("@ss.hasPermi('system:message:export')") + @Log(title = "兽医咨询聊天消息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysChatMessage sysChatMessage) + { + List list = sysChatMessageService.selectSysChatMessageList(sysChatMessage); + ExcelUtil util = new ExcelUtil(SysChatMessage.class); + util.exportExcel(response, list, "兽医咨询聊天消息数据"); + } + + /** + * 获取兽医咨询聊天消息详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:message:query')") + @GetMapping(value = "/{messageId}") + public AjaxResult getInfo(@PathVariable("messageId") Long messageId) + { + return success(sysChatMessageService.selectSysChatMessageByMessageId(messageId)); + } + + /** + * 新增兽医咨询聊天消息 + */ + @PreAuthorize("@ss.hasPermi('system:message:add')") + @Log(title = "兽医咨询聊天消息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysChatMessage sysChatMessage) + { + return toAjax(sysChatMessageService.insertSysChatMessage(sysChatMessage)); + } + + /** + * 修改兽医咨询聊天消息 + */ + @PreAuthorize("@ss.hasPermi('system:message:edit')") + @Log(title = "兽医咨询聊天消息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysChatMessage sysChatMessage) + { + return toAjax(sysChatMessageService.updateSysChatMessage(sysChatMessage)); + } + + /** + * 删除兽医咨询聊天消息 + */ + @PreAuthorize("@ss.hasPermi('system:message:remove')") + @Log(title = "兽医咨询聊天消息", businessType = BusinessType.DELETE) + @DeleteMapping("/{messageIds}") + public AjaxResult remove(@PathVariable Long[] messageIds) + { + return toAjax(sysChatMessageService.deleteSysChatMessageByMessageIds(messageIds)); + } + + /** + * 发送文本消息(新增) + */ + @PostMapping("/send") + public AjaxResult sendMessage(@RequestBody MessageSendRequest request) { + try { + // 验证用户 + Long currentUserId = SecurityUtils.getUserId(); + + // 如果是用户发送,验证senderId + if ("0".equals(request.getSenderType()) && !currentUserId.equals(request.getSenderId())) { + return error("用户ID不匹配"); + } + + // 发送消息 + int result = sysChatMessageService.sendTextMessage( + request.getSessionId(), + request.getSenderType(), + request.getSenderId(), + request.getContent() + ); + + if (result > 0) { + return success("消息发送成功"); + } else { + return error("消息发送失败"); + } + } catch (Exception e) { + return error("发送消息失败:" + e.getMessage()); + } + } + + /** + * 获取会话消息(新增) + */ + @GetMapping("/session/{sessionId}") + public AjaxResult getSessionMessages(@PathVariable String sessionId) { + try { + // 验证权限:用户必须是会话的参与者 + Long currentUserId = SecurityUtils.getUserId(); + List messages = sysChatMessageService.selectMessagesBySessionId(sessionId); + + // 过滤返回的消息,确保安全性 + if (!messages.isEmpty()) { + SysChatMessage firstMessage = messages.get(0); + // 这里应该查询会话信息来验证权限,简化处理 + } + + return success(messages); + } catch (Exception e) { + return error("获取消息失败:" + e.getMessage()); + } + } + + /** + * 标记所有消息为已读(新增) + */ + @PostMapping("/markAllRead") + public AjaxResult markAllMessagesAsRead(@RequestBody MarkReadRequest request) { + try { + int count = sysChatMessageService.markAllMessagesAsRead( + request.getSessionId(), + request.getSenderType() + ); + return success("已标记" + count + "条消息为已读"); + } catch (Exception e) { + return error("标记已读失败:" + e.getMessage()); + } + } + + /** + * 获取用户未读消息数量(新增) + */ + @GetMapping("/unreadCount/{userId}") + public AjaxResult getUnreadCount(@PathVariable Long userId) { + try { + // 验证当前用户 + Long currentUserId = SecurityUtils.getUserId(); + if (!currentUserId.equals(userId)) { + return error("无权限查看"); + } + + // 通过会话服务获取未读数 + SysChatSession query = new SysChatSession(); + query.setUserId(userId); + query.setDelFlag("0"); + List sessions = sysChatSessionService.selectSysChatSessionList(query); + + int totalUnread = sessions.stream() + .mapToInt(session -> session.getUnreadUser() != null ? + session.getUnreadUser().intValue() : 0) + .sum(); + + return success(totalUnread); + } catch (Exception e) { + return error("获取未读数失败:" + e.getMessage()); + } + } + + /** + * 上传聊天图片(新增) + */ + @PostMapping("/uploadImage") + public AjaxResult uploadImage(@RequestParam("file") MultipartFile file, + @RequestParam("sessionId") String sessionId) { + try { + if (file.isEmpty()) { + return error("请选择文件"); + } + + // 验证文件类型 + String originalFilename = file.getOriginalFilename(); + String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); + if (!Arrays.asList(".jpg", ".jpeg", ".png", ".gif").contains(suffix.toLowerCase())) { + return error("只支持jpg、jpeg、png、gif格式的图片"); + } + + // 验证文件大小(5MB以内) + if (file.getSize() > 5 * 1024 * 1024) { + return error("图片大小不能超过5MB"); + } + + // 上传文件到服务器 + String filePath = FileUploadUtils.upload(file); + + // 发送图片消息 + Long currentUserId = SecurityUtils.getUserId(); + String imageUrl = "/profile/upload/" + filePath; + + SysChatMessage message = new SysChatMessage(); + message.setSessionId(sessionId); + message.setSenderType("0"); // 用户发送 + message.setSenderId(currentUserId); + message.setContent("[图片]" + imageUrl); + message.setMsgType("image"); + message.setIsRead("0"); + message.setDelFlag("0"); + message.setCreateTime(new Date()); + + int result = sysChatMessageService.insertSysChatMessage(message); + + if (result > 0) { + return success(imageUrl); + } else { + return error("发送图片失败"); + } + } catch (Exception e) { + return error("上传失败:" + e.getMessage()); + } + } + + // 请求参数类 + @Data + public static class MessageSendRequest { + private String sessionId; + private String senderType; // 0-用户,1-专家 + private Long senderId; + private String content; + } + + @Data + public static class MarkReadRequest { + private String sessionId; + private String senderType; // 标记谁的消息为已读 + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysChatSessionController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysChatSessionController.java new file mode 100644 index 0000000..2116dee --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysChatSessionController.java @@ -0,0 +1,215 @@ +package com.chenhai.web.controller.system; + +import java.util.Date; +import java.util.List; + +import com.chenhai.common.utils.SecurityUtils; +import com.chenhai.system.service.ISysChatMessageService; +import jakarta.servlet.http.HttpServletResponse; +import lombok.Data; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.system.domain.SysChatSession; +import com.chenhai.system.service.ISysChatSessionService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 兽医咨询聊天会话Controller + * + * @author ruoyi + * @date 2026-01-19 + */ +@RestController +@RequestMapping("/system/session") +public class SysChatSessionController extends BaseController +{ + @Autowired + private ISysChatSessionService sysChatSessionService; + + @Autowired + private ISysChatMessageService sysChatMessageService; + + /** + * 查询兽医咨询聊天会话列表 + */ + @PreAuthorize("@ss.hasPermi('system:session:list')") + @GetMapping("/list") + public TableDataInfo list(SysChatSession sysChatSession) + { + startPage(); + List list = sysChatSessionService.selectSysChatSessionList(sysChatSession); + return getDataTable(list); + } + + /** + * 导出兽医咨询聊天会话列表 + */ + @PreAuthorize("@ss.hasPermi('system:session:export')") + @Log(title = "兽医咨询聊天会话", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysChatSession sysChatSession) + { + List list = sysChatSessionService.selectSysChatSessionList(sysChatSession); + ExcelUtil util = new ExcelUtil(SysChatSession.class); + util.exportExcel(response, list, "兽医咨询聊天会话数据"); + } + + /** + * 获取兽医咨询聊天会话详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:session:query')") + @GetMapping(value = "/{sessionId}") + public AjaxResult getInfo(@PathVariable("sessionId") String sessionId) + { + return success(sysChatSessionService.selectSysChatSessionBySessionId(sessionId)); + } + + /** + * 新增兽医咨询聊天会话 + */ + @PreAuthorize("@ss.hasPermi('system:session:add')") + @Log(title = "兽医咨询聊天会话", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysChatSession sysChatSession) + { + return toAjax(sysChatSessionService.insertSysChatSession(sysChatSession)); + } + + /** + * 修改兽医咨询聊天会话 + */ + @PreAuthorize("@ss.hasPermi('system:session:edit')") + @Log(title = "兽医咨询聊天会话", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysChatSession sysChatSession) + { + return toAjax(sysChatSessionService.updateSysChatSession(sysChatSession)); + } + + /** + * 删除兽医咨询聊天会话 + */ + @PreAuthorize("@ss.hasPermi('system:session:remove')") + @Log(title = "兽医咨询聊天会话", businessType = BusinessType.DELETE) + @DeleteMapping("/{sessionIds}") + public AjaxResult remove(@PathVariable String[] sessionIds) + { + return toAjax(sysChatSessionService.deleteSysChatSessionBySessionIds(sessionIds)); + } + + /** + * 创建或获取会话(新增) + */ + @PostMapping("/createOrGetSession") + public AjaxResult createOrGetSession(@RequestBody SessionCreateRequest request) { + try { + Long currentUserId = SecurityUtils.getUserId(); + String sessionId = sysChatSessionService.createOrGetSession( + currentUserId, // 使用当前登录用户 + request.getExpertId(), + request.getAnimalType(), + request.getSymptomSummary() + ); + + // 发送欢迎消息 + if (sessionId != null) { + sysChatMessageService.sendSystemMessage(sessionId, + "欢迎咨询,请描述您的问题。专家会尽快回复您。"); + } + + return success(sessionId); + } catch (Exception e) { + return error("创建会话失败:" + e.getMessage()); + } + } + + /** + * 获取用户会话列表(新增) + */ + @GetMapping("/user/list") + public AjaxResult getUserSessionList() { + Long userId = SecurityUtils.getUserId(); + List sessions = sysChatSessionService.selectSessionsByUserId(userId); + return success(sessions); + } + + /** + * 获取专家会话列表(新增) + */ + @GetMapping("/expert/list") + public AjaxResult getExpertSessionList() { + Long expertId = SecurityUtils.getUserId(); // 假设专家也是用userId + List sessions = sysChatSessionService.selectSessionsByExpertId(expertId); + return success(sessions); + } + + /** + * 结束会话(新增) + */ + @PostMapping("/end") + public AjaxResult endSession(@RequestBody EndSessionRequest request) { + try { + SysChatSession session = sysChatSessionService.selectSysChatSessionBySessionId( + request.getSessionId() + ); + + if (session == null) { + return error("会话不存在"); + } + + // 验证权限 + Long currentUserId = SecurityUtils.getUserId(); + if (!currentUserId.equals(session.getUserId()) && + !currentUserId.equals(session.getExpertId())) { + return error("无权限结束此会话"); + } + + // 更新会话状态 + session.setSessionStatus("1"); + session.setRemark("结束原因:" + request.getReason()); + session.setUpdateTime(new Date()); + + int result = sysChatSessionService.updateSysChatSession(session); + + if (result > 0) { + // 发送结束消息 + sysChatMessageService.sendSystemMessage( + request.getSessionId(), + "本次咨询已结束:" + request.getReason() + ); + return success("会话已结束"); + } else { + return error("结束会话失败"); + } + } catch (Exception e) { + return error("操作失败:" + e.getMessage()); + } + } + + // 请求参数类 + @Data + public static class SessionCreateRequest { + private Long expertId; + private String animalType; + private String symptomSummary; + } + + @Data + public static class EndSessionRequest { + private String sessionId; + private String reason; + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysDictDataController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysDictDataController.java index d1b9e82..93e5248 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysDictDataController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysDictDataController.java @@ -40,7 +40,7 @@ public class SysDictDataController extends BaseController @Autowired private ISysDictTypeService dictTypeService; - @PreAuthorize("@ss.hasPermi('system:dict:list')") + @PreAuthorize("@ss.hasPermi('system:dict:list') or @ss.hasRole('muhu')") @GetMapping("/list") public TableDataInfo list(SysDictData dictData) { @@ -50,7 +50,7 @@ public class SysDictDataController extends BaseController } @Log(title = "字典数据", businessType = BusinessType.EXPORT) - @PreAuthorize("@ss.hasPermi('system:dict:export')") + @PreAuthorize("@ss.hasPermi('system:dict:export') or @ss.hasRole('muhu')") @PostMapping("/export") public void export(HttpServletResponse response, SysDictData dictData) { @@ -62,7 +62,7 @@ public class SysDictDataController extends BaseController /** * 查询字典数据详细 */ - @PreAuthorize("@ss.hasPermi('system:dict:query')") + @PreAuthorize("@ss.hasPermi('system:dict:query') or @ss.hasRole('muhu')") @GetMapping(value = "/{dictCode}") public AjaxResult getInfo(@PathVariable Long dictCode) { @@ -86,7 +86,7 @@ public class SysDictDataController extends BaseController /** * 新增字典类型 */ - @PreAuthorize("@ss.hasPermi('system:dict:add')") + @PreAuthorize("@ss.hasPermi('system:dict:add') or @ss.hasRole('muhu')") @Log(title = "字典数据", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysDictData dict) @@ -98,7 +98,7 @@ public class SysDictDataController extends BaseController /** * 修改保存字典类型 */ - @PreAuthorize("@ss.hasPermi('system:dict:edit')") + @PreAuthorize("@ss.hasPermi('system:dict:edit') or @ss.hasRole('muhu')") @Log(title = "字典数据", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@Validated @RequestBody SysDictData dict) @@ -110,7 +110,7 @@ public class SysDictDataController extends BaseController /** * 删除字典类型 */ - @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @PreAuthorize("@ss.hasPermi('system:dict:remove') or @ss.hasRole('muhu')") @Log(title = "字典类型", businessType = BusinessType.DELETE) @DeleteMapping("/{dictCodes}") public AjaxResult remove(@PathVariable Long[] dictCodes) diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java deleted file mode 100644 index 2dc18d4..0000000 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.chenhai.web.controller.system; - -import java.util.List; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.chenhai.common.annotation.Log; -import com.chenhai.common.core.controller.BaseController; -import com.chenhai.common.core.domain.AjaxResult; -import com.chenhai.common.enums.BusinessType; -import com.chenhai.system.domain.SysExpertConsultation; -import com.chenhai.system.service.ISysExpertConsultationService; -import com.chenhai.common.utils.poi.ExcelUtil; -import com.chenhai.common.core.page.TableDataInfo; - -/** - * 专家咨询Controller - * - * @author ruoyi - * @date 2026-01-12 - */ -@RestController -@RequestMapping("/system/consultation") -public class SysExpertConsultationController extends BaseController -{ - @Autowired - private ISysExpertConsultationService sysExpertConsultationService; - - /** - * 查询专家咨询列表 - */ - @PreAuthorize("@ss.hasPermi('system:consultation:list')") - @GetMapping("/list") - public TableDataInfo list(SysExpertConsultation sysExpertConsultation) - { - startPage(); - List list = sysExpertConsultationService.selectSysExpertConsultationList(sysExpertConsultation); - return getDataTable(list); - } - - /** - * 导出专家咨询列表 - */ - @PreAuthorize("@ss.hasPermi('system:consultation:export')") - @Log(title = "专家咨询", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, SysExpertConsultation sysExpertConsultation) - { - List list = sysExpertConsultationService.selectSysExpertConsultationList(sysExpertConsultation); - ExcelUtil util = new ExcelUtil(SysExpertConsultation.class); - util.exportExcel(response, list, "专家咨询数据"); - } - - /** - * 获取专家咨询详细信息 - */ - @PreAuthorize("@ss.hasPermi('system:consultation:query')") - @GetMapping(value = "/{consultationId}") - public AjaxResult getInfo(@PathVariable("consultationId") Long consultationId) - { - return success(sysExpertConsultationService.selectSysExpertConsultationByConsultationId(consultationId)); - } - - /** - * 新增专家咨询 - */ - @PreAuthorize("@ss.hasPermi('system:consultation:add')") - @Log(title = "专家咨询", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody SysExpertConsultation sysExpertConsultation) - { - return toAjax(sysExpertConsultationService.insertSysExpertConsultation(sysExpertConsultation)); - } - - /** - * 修改专家咨询 - */ - @PreAuthorize("@ss.hasPermi('system:consultation:edit')") - @Log(title = "专家咨询", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody SysExpertConsultation sysExpertConsultation) - { - return toAjax(sysExpertConsultationService.updateSysExpertConsultation(sysExpertConsultation)); - } - - /** - * 删除专家咨询 - */ - @PreAuthorize("@ss.hasPermi('system:consultation:remove')") - @Log(title = "专家咨询", businessType = BusinessType.DELETE) - @DeleteMapping("/{consultationIds}") - public AjaxResult remove(@PathVariable Long[] consultationIds) - { - return toAjax(sysExpertConsultationService.deleteSysExpertConsultationByConsultationIds(consultationIds)); - } -} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysKnowledgeQueryController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysKnowledgeQueryController.java new file mode 100644 index 0000000..5062c54 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysKnowledgeQueryController.java @@ -0,0 +1,104 @@ +package com.chenhai.web.controller.system; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.system.domain.SysKnowledgeQuery; +import com.chenhai.system.service.ISysKnowledgeQueryService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 知识库查询Controller + * + * @author ruoyi + * @date 2026-01-21 + */ +@RestController +@RequestMapping("/system/query") +public class SysKnowledgeQueryController extends BaseController +{ + @Autowired + private ISysKnowledgeQueryService sysKnowledgeQueryService; + + /** + * 查询知识库查询列表 + */ + @PreAuthorize("@ss.hasPermi('system:query:list') or @ss.hasRole('muhu')") + @GetMapping("/list") + public TableDataInfo list(SysKnowledgeQuery sysKnowledgeQuery) + { + startPage(); + List list = sysKnowledgeQueryService.selectSysKnowledgeQueryList(sysKnowledgeQuery); + return getDataTable(list); + } + + /** + * 导出知识库查询列表 + */ + @PreAuthorize("@ss.hasPermi('system:query:export') or @ss.hasRole('muhu')") + @Log(title = "知识库查询", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysKnowledgeQuery sysKnowledgeQuery) + { + List list = sysKnowledgeQueryService.selectSysKnowledgeQueryList(sysKnowledgeQuery); + ExcelUtil util = new ExcelUtil(SysKnowledgeQuery.class); + util.exportExcel(response, list, "知识库查询数据"); + } + + /** + * 获取知识库查询详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:query:query') or @ss.hasRole('muhu')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysKnowledgeQueryService.selectSysKnowledgeQueryById(id)); + } + + /** + * 新增知识库查询 + */ + @PreAuthorize("@ss.hasPermi('system:query:add') or @ss.hasRole('muhu')") + @Log(title = "知识库查询", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysKnowledgeQuery sysKnowledgeQuery) + { + return toAjax(sysKnowledgeQueryService.insertSysKnowledgeQuery(sysKnowledgeQuery)); + } + + /** + * 修改知识库查询 + */ + @PreAuthorize("@ss.hasPermi('system:query:edit') or @ss.hasRole('muhu')") + @Log(title = "知识库查询", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysKnowledgeQuery sysKnowledgeQuery) + { + return toAjax(sysKnowledgeQueryService.updateSysKnowledgeQuery(sysKnowledgeQuery)); + } + + /** + * 删除知识库查询 + */ + @PreAuthorize("@ss.hasPermi('system:query:remove')") + @Log(title = "知识库查询", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysKnowledgeQueryService.deleteSysKnowledgeQueryByIds(ids)); + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysLoginController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysLoginController.java index 3576d1e..8be440c 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysLoginController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysLoginController.java @@ -23,6 +23,7 @@ import com.chenhai.framework.web.service.SysPermissionService; import com.chenhai.framework.web.service.TokenService; import com.chenhai.system.service.ISysConfigService; import com.chenhai.system.service.ISysMenuService; +import com.chenhai.vet.service.IVetExpertsService; /** * 登录验证 @@ -47,6 +48,9 @@ public class SysLoginController @Autowired private ISysConfigService configService; + @Autowired // 添加这行 + private IVetExpertsService vetExpertsService; + /** * 登录方法 * diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysMedicineRecommendationController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysMedicineRecommendationController.java new file mode 100644 index 0000000..377686d --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysMedicineRecommendationController.java @@ -0,0 +1,104 @@ +package com.chenhai.web.controller.system; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.system.domain.SysMedicineRecommendation; +import com.chenhai.system.service.ISysMedicineRecommendationService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 药品推荐Controller + * + * @author ruoyi + * @date 2026-01-20 + */ +@RestController +@RequestMapping("/system/recommendation") +public class SysMedicineRecommendationController extends BaseController +{ + @Autowired + private ISysMedicineRecommendationService sysMedicineRecommendationService; + + /** + * 查询药品推荐列表 + */ + @PreAuthorize("@ss.hasPermi('system:recommendation:list') or @ss.hasRole('muhu')") + @GetMapping("/list") + public TableDataInfo list(SysMedicineRecommendation sysMedicineRecommendation) + { + startPage(); + List list = sysMedicineRecommendationService.selectSysMedicineRecommendationList(sysMedicineRecommendation); + return getDataTable(list); + } + + /** + * 导出药品推荐列表 + */ + @PreAuthorize("@ss.hasPermi('system:recommendation:export') or @ss.hasRole('muhu')") + @Log(title = "药品推荐", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysMedicineRecommendation sysMedicineRecommendation) + { + List list = sysMedicineRecommendationService.selectSysMedicineRecommendationList(sysMedicineRecommendation); + ExcelUtil util = new ExcelUtil(SysMedicineRecommendation.class); + util.exportExcel(response, list, "药品推荐数据"); + } + + /** + * 获取药品推荐详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:recommendation:query') or @ss.hasRole('muhu')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysMedicineRecommendationService.selectSysMedicineRecommendationById(id)); + } + + /** + * 新增药品推荐 + */ + @PreAuthorize("@ss.hasPermi('system:recommendation:add') or @ss.hasRole('muhu')") + @Log(title = "药品推荐", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysMedicineRecommendation sysMedicineRecommendation) + { + return toAjax(sysMedicineRecommendationService.insertSysMedicineRecommendation(sysMedicineRecommendation)); + } + + /** + * 修改药品推荐 + */ + @PreAuthorize("@ss.hasPermi('system:recommendation:edit') or @ss.hasRole('muhu')") + @Log(title = "药品推荐", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysMedicineRecommendation sysMedicineRecommendation) + { + return toAjax(sysMedicineRecommendationService.updateSysMedicineRecommendation(sysMedicineRecommendation)); + } + + /** + * 删除药品推荐 + */ + @PreAuthorize("@ss.hasPermi('system:recommendation:remove') or @ss.hasRole('muhu')") + @Log(title = "药品推荐", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysMedicineRecommendationService.deleteSysMedicineRecommendationByIds(ids)); + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysPolicyInterpretationController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysPolicyInterpretationController.java index 3e8501e..2f5584d 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysPolicyInterpretationController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysPolicyInterpretationController.java @@ -159,4 +159,31 @@ public class SysPolicyInterpretationController extends BaseController String removalReason = (String) requestBody.get("removalReason"); return toAjax(sysPolicyInterpretationService.unpublishSysPolicyInterpretationByIds(ids, removalReason)); } + + /** + * 查询已上架政策解读列表(公共接口,无需权限) + */ + @PreAuthorize("@ss.hasRole('muhu')") + @GetMapping("/published/list") + public TableDataInfo publishedList(SysPolicyInterpretation sysPolicyInterpretation) + { + startPage(); + List list = sysPolicyInterpretationService.selectPublishedSysPolicyInterpretationList(sysPolicyInterpretation); + return getDataTable(list); + } + + /** + * 获取已上架政策解读详情(公共接口,无需权限) + */ + @PreAuthorize("@ss.hasRole('muhu')") + @GetMapping("/published/{id}") + public AjaxResult getPublishedInfo(@PathVariable("id") Long id) + { + SysPolicyInterpretation policy = sysPolicyInterpretationService.selectSysPolicyInterpretationById(id); + // 检查是否已上架 + if (policy == null || !"1".equals(policy.getPublishStatus())) { + return error("政策解读不存在或未上架"); + } + return success(policy); + } } diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysQueryTipController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysQueryTipController.java new file mode 100644 index 0000000..3e1e927 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysQueryTipController.java @@ -0,0 +1,104 @@ +package com.chenhai.web.controller.system; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.system.domain.SysQueryTip; +import com.chenhai.system.service.ISysQueryTipService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 知识库查询提示Controller + * + * @author ruoyi + * @date 2026-01-22 + */ +@RestController +@RequestMapping("/system/tip") +public class SysQueryTipController extends BaseController +{ + @Autowired + private ISysQueryTipService sysQueryTipService; + + /** + * 查询知识库查询提示列表 + */ + @PreAuthorize("@ss.hasPermi('system:tip:list') or @ss.hasRole('muhu')") + @GetMapping("/list") + public TableDataInfo list(SysQueryTip sysQueryTip) + { + startPage(); + List list = sysQueryTipService.selectSysQueryTipList(sysQueryTip); + return getDataTable(list); + } + + /** + * 导出知识库查询提示列表 + */ + @PreAuthorize("@ss.hasPermi('system:tip:export') or @ss.hasRole('muhu')") + @Log(title = "知识库查询提示", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysQueryTip sysQueryTip) + { + List list = sysQueryTipService.selectSysQueryTipList(sysQueryTip); + ExcelUtil util = new ExcelUtil(SysQueryTip.class); + util.exportExcel(response, list, "知识库查询提示数据"); + } + + /** + * 获取知识库查询提示详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:tip:query') or @ss.hasRole('muhu')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysQueryTipService.selectSysQueryTipById(id)); + } + + /** + * 新增知识库查询提示 + */ + @PreAuthorize("@ss.hasPermi('system:tip:add') or @ss.hasRole('muhu')") + @Log(title = "知识库查询提示", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysQueryTip sysQueryTip) + { + return toAjax(sysQueryTipService.insertSysQueryTip(sysQueryTip)); + } + + /** + * 修改知识库查询提示 + */ + @PreAuthorize("@ss.hasPermi('system:tip:edit') or @ss.hasRole('muhu')") + @Log(title = "知识库查询提示", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysQueryTip sysQueryTip) + { + return toAjax(sysQueryTipService.updateSysQueryTip(sysQueryTip)); + } + + /** + * 删除知识库查询提示 + */ + @PreAuthorize("@ss.hasPermi('system:tip:remove') or @ss.hasRole('muhu')") + @Log(title = "知识库查询提示", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysQueryTipService.deleteSysQueryTipByIds(ids)); + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java index 91553df..652a16f 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java @@ -4,14 +4,7 @@ import java.util.List; import jakarta.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.chenhai.common.annotation.Log; import com.chenhai.common.core.controller.BaseController; import com.chenhai.common.core.domain.AjaxResult; @@ -101,4 +94,16 @@ public class VetExpertsController extends BaseController { return toAjax(vetExpertsService.deleteVetExpertsByExpertIds(expertIds)); } + + /** + * 搜索专家信息(按真实姓名和擅长领域) + */ + @PreAuthorize("@ss.hasPermi('vet:experts:list') or @ss.hasRole('muhu')") + @GetMapping("/search") + public TableDataInfo search(@RequestParam(value = "keyword", required = false) String keyword) + { + startPage(); + List list = vetExpertsService.searchVetExperts(keyword); + return getDataTable(list); + } } diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetKnowledgeController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetKnowledgeController.java index 4236d92..f94b921 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetKnowledgeController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetKnowledgeController.java @@ -38,7 +38,7 @@ public class VetKnowledgeController extends BaseController /** * 查询兽医文章列表 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:list')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:list') or @ss.hasRole('muhu')") @GetMapping("/list") public TableDataInfo list(VetKnowledge vetKnowledge) { @@ -50,7 +50,7 @@ public class VetKnowledgeController extends BaseController /** * 导出兽医文章列表 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:export')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:export') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, VetKnowledge vetKnowledge) @@ -63,7 +63,7 @@ public class VetKnowledgeController extends BaseController /** * 获取兽医文章详细信息 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:query')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:query') or @ss.hasRole('muhu')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -73,7 +73,7 @@ public class VetKnowledgeController extends BaseController /** * 新增兽医文章 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:add')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:add') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody VetKnowledge vetKnowledge) @@ -86,7 +86,7 @@ public class VetKnowledgeController extends BaseController /** * 修改兽医文章 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:edit')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:edit') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody VetKnowledge vetKnowledge) @@ -97,7 +97,7 @@ public class VetKnowledgeController extends BaseController /** * 删除兽医文章 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:remove')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:remove') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) @@ -108,7 +108,7 @@ public class VetKnowledgeController extends BaseController /** * 提交审核 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:submit')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:submit') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.UPDATE) @PutMapping("/submit/{id}") public AjaxResult submitForAudit(@PathVariable Long id) { @@ -118,7 +118,7 @@ public class VetKnowledgeController extends BaseController /** * 审核文章 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:audit')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:audit') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.UPDATE) @PutMapping("/audit/{id}") public AjaxResult audit(@PathVariable Long id, @@ -133,7 +133,7 @@ public class VetKnowledgeController extends BaseController /** * 发布文章 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:publish')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:publish') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.UPDATE) @PutMapping("/publish/{id}") public AjaxResult publish(@PathVariable Long id) { @@ -143,7 +143,7 @@ public class VetKnowledgeController extends BaseController /** * 上架文章 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:publish')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:publish') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.UPDATE) @PutMapping("/online/{id}") public AjaxResult online(@PathVariable Long id) { @@ -153,7 +153,7 @@ public class VetKnowledgeController extends BaseController /** * 下架文章 */ - @PreAuthorize("@ss.hasPermi('vet:knowledge:publish')") + @PreAuthorize("@ss.hasPermi('vet:knowledge:publish') or @ss.hasRole('muhu')") @Log(title = "兽医文章", businessType = BusinessType.UPDATE) @PutMapping("/offline/{id}") public AjaxResult offline(@PathVariable Long id, @RequestParam(required = false) String auditComment) { @@ -162,4 +162,37 @@ public class VetKnowledgeController extends BaseController } return vetKnowledgeService.offlineVetKnowledge(id, auditComment); } + + /** + * 查询已发布且审核通过的兽医文章列表(公开接口,无需权限) + * 用于前端展示给用户,只显示可公开的文章 + */ + @PreAuthorize("@ss.hasRole('muhu')") + @GetMapping("/published/list") + public TableDataInfo publishedList(VetKnowledge vetKnowledge) + { + startPage(); + List list = vetKnowledgeService.selectPublishedKnowledgeList(vetKnowledge); + return getDataTable(list); + } + + /** + * 获取已发布文章的详细信息(公开接口) + */ + @PreAuthorize("@ss.hasRole('muhu')") + @GetMapping("/published/{id}") + public AjaxResult getPublishedInfo(@PathVariable("id") Long id) + { + VetKnowledge knowledge = vetKnowledgeService.selectVetKnowledgeById(id); + // 检查文章是否是已发布且审核通过状态 + if (knowledge != null && "1".equals(knowledge.getArticleStatus()) && "2".equals(knowledge.getAuditStatus())) { + // 增加查看次数 + vetKnowledgeService.addViewCount(id); + // 重新查询以获取更新后的查看次数 + knowledge = vetKnowledgeService.selectVetKnowledgeById(id); + return success(knowledge); + } + return error("文章不存在或未发布"); + } + } \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysChatMessage.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysChatMessage.java new file mode 100644 index 0000000..0dbf54d --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysChatMessage.java @@ -0,0 +1,163 @@ +package com.chenhai.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 兽医咨询聊天消息对象 sys_chat_message + * + * @author ruoyi + * @date 2026-01-19 + */ +public class SysChatMessage extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 消息ID */ + private Long messageId; + + /** 会话ID */ + @Excel(name = "会话ID") + private String sessionId; + + /** 发送者类型:0-用户,1-专家 */ + @Excel(name = "发送者类型:0-用户,1-专家") + private String senderType; + + /** 发送者ID */ + @Excel(name = "发送者ID") + private Long senderId; + + /** 消息内容 */ + @Excel(name = "消息内容") + private String content; + + /** 消息类型:text-文本,image-图片 */ + @Excel(name = "消息类型:text-文本,image-图片") + private String msgType; + + /** 是否已读:0-未读,1-已读 */ + @Excel(name = "是否已读:0-未读,1-已读") + private String isRead; + + /** 阅读时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "阅读时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date readTime; + + /** 删除标志(0-存在 2-删除) */ + private String delFlag; + + public void setMessageId(Long messageId) + { + this.messageId = messageId; + } + + public Long getMessageId() + { + return messageId; + } + + public void setSessionId(String sessionId) + { + this.sessionId = sessionId; + } + + public String getSessionId() + { + return sessionId; + } + + public void setSenderType(String senderType) + { + this.senderType = senderType; + } + + public String getSenderType() + { + return senderType; + } + + public void setSenderId(Long senderId) + { + this.senderId = senderId; + } + + public Long getSenderId() + { + return senderId; + } + + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + public void setMsgType(String msgType) + { + this.msgType = msgType; + } + + public String getMsgType() + { + return msgType; + } + + public void setIsRead(String isRead) + { + this.isRead = isRead; + } + + public String getIsRead() + { + return isRead; + } + + public void setReadTime(Date readTime) + { + this.readTime = readTime; + } + + public Date getReadTime() + { + return readTime; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("messageId", getMessageId()) + .append("sessionId", getSessionId()) + .append("senderType", getSenderType()) + .append("senderId", getSenderId()) + .append("content", getContent()) + .append("msgType", getMsgType()) + .append("isRead", getIsRead()) + .append("readTime", getReadTime()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysChatSession.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysChatSession.java new file mode 100644 index 0000000..adfa930 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysChatSession.java @@ -0,0 +1,194 @@ +package com.chenhai.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 兽医咨询聊天会话对象 sys_chat_session + * + * @author ruoyi + * @date 2026-01-19 + */ +public class SysChatSession extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 会话ID,格式:user_{uid}_expert_{eid} */ + private String sessionId; + + /** 用户ID */ + @Excel(name = "用户ID") + private Long userId; + + /** 专家ID */ + @Excel(name = "专家ID") + private Long expertId; + + /** 动物类型 */ + @Excel(name = "动物类型") + private String animalType; + + /** 症状摘要 */ + @Excel(name = "症状摘要") + private String symptomSummary; + + /** 最后一条消息 */ + @Excel(name = "最后一条消息") + private String lastMessage; + + /** 最后消息时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "最后消息时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date lastMessageTime; + + /** 用户未读数 */ + @Excel(name = "用户未读数") + private Long unreadUser; + + /** 专家未读数 */ + @Excel(name = "专家未读数") + private Long unreadExpert; + + /** 0-进行中 1-已结束 */ + @Excel(name = "0-进行中 1-已结束") + private String sessionStatus; + + /** 删除标志(0-存在 2-删除) */ + private String delFlag; + + public void setSessionId(String sessionId) + { + this.sessionId = sessionId; + } + + public String getSessionId() + { + return sessionId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setExpertId(Long expertId) + { + this.expertId = expertId; + } + + public Long getExpertId() + { + return expertId; + } + + public void setAnimalType(String animalType) + { + this.animalType = animalType; + } + + public String getAnimalType() + { + return animalType; + } + + public void setSymptomSummary(String symptomSummary) + { + this.symptomSummary = symptomSummary; + } + + public String getSymptomSummary() + { + return symptomSummary; + } + + public void setLastMessage(String lastMessage) + { + this.lastMessage = lastMessage; + } + + public String getLastMessage() + { + return lastMessage; + } + + public void setLastMessageTime(Date lastMessageTime) + { + this.lastMessageTime = lastMessageTime; + } + + public Date getLastMessageTime() + { + return lastMessageTime; + } + + public void setUnreadUser(Long unreadUser) + { + this.unreadUser = unreadUser; + } + + public Long getUnreadUser() + { + return unreadUser; + } + + public void setUnreadExpert(Long unreadExpert) + { + this.unreadExpert = unreadExpert; + } + + public Long getUnreadExpert() + { + return unreadExpert; + } + + public void setSessionStatus(String sessionStatus) + { + this.sessionStatus = sessionStatus; + } + + public String getSessionStatus() + { + return sessionStatus; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("sessionId", getSessionId()) + .append("userId", getUserId()) + .append("expertId", getExpertId()) + .append("animalType", getAnimalType()) + .append("symptomSummary", getSymptomSummary()) + .append("lastMessage", getLastMessage()) + .append("lastMessageTime", getLastMessageTime()) + .append("unreadUser", getUnreadUser()) + .append("unreadExpert", getUnreadExpert()) + .append("sessionStatus", getSessionStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java deleted file mode 100644 index cc76c76..0000000 --- a/chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.chenhai.system.domain; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.chenhai.common.annotation.Excel; -import com.chenhai.common.core.domain.BaseEntity; - -/** - * 专家咨询对象 sys_expert_consultation - * - * @author ruoyi - * @date 2026-01-12 - */ -public class SysExpertConsultation extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 咨询ID */ - private Long consultationId; - - /** 用户ID */ - @Excel(name = "用户ID") - private Long userId; - - /** 专家ID */ - @Excel(name = "专家ID") - private Long expertId; - - /** 关联问诊单ID */ - @Excel(name = "关联问诊单ID") - private Long formId; - - /** 咨询类型: 1-图文咨询, 2-电话咨询, 3-视频咨询 */ - @Excel(name = "咨询类型: 1-图文咨询, 2-电话咨询, 3-视频咨询") - private String consultationType; - - /** 咨询状态: 0-待接诊, 1-进行中, 2-已完成, 3-已取消 */ - @Excel(name = "咨询状态: 0-待接诊, 1-进行中, 2-已完成, 3-已取消") - private String consultationStatus; - - /** 咨询标题 */ - @Excel(name = "咨询标题") - private String consultationTitle; - - /** 用户初始咨询内容 */ - @Excel(name = "用户初始咨询内容") - private String initialContent; - - /** 用户初始附件(JSON数组) */ - @Excel(name = "用户初始附件(JSON数组)") - private String initialAttachments; - - /** 对话消息(JSON格式) */ - @Excel(name = "对话消息(JSON格式)") - private String messages; - - /** 用户评分(1-5分) */ - @Excel(name = "用户评分(1-5分)") - private Integer rating; - - /** 用户评价内容 */ - @Excel(name = "用户评价内容") - private String evaluation; - - /** 评价标签(JSON数组) */ - @Excel(name = "评价标签(JSON数组)") - private String evaluationTags; - - /** 评价时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "评价时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date evaluationTime; - - /** 咨询开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "咨询开始时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date startTime; - - /** 咨询结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "咨询结束时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date endTime; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdTime; - - /** 更新时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedTime; - - public void setConsultationId(Long consultationId) - { - this.consultationId = consultationId; - } - - public Long getConsultationId() - { - return consultationId; - } - - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - - public void setExpertId(Long expertId) - { - this.expertId = expertId; - } - - public Long getExpertId() - { - return expertId; - } - - public void setFormId(Long formId) - { - this.formId = formId; - } - - public Long getFormId() - { - return formId; - } - - public void setConsultationType(String consultationType) - { - this.consultationType = consultationType; - } - - public String getConsultationType() - { - return consultationType; - } - - public void setConsultationStatus(String consultationStatus) - { - this.consultationStatus = consultationStatus; - } - - public String getConsultationStatus() - { - return consultationStatus; - } - - public void setConsultationTitle(String consultationTitle) - { - this.consultationTitle = consultationTitle; - } - - public String getConsultationTitle() - { - return consultationTitle; - } - - public void setInitialContent(String initialContent) - { - this.initialContent = initialContent; - } - - public String getInitialContent() - { - return initialContent; - } - - public void setInitialAttachments(String initialAttachments) - { - this.initialAttachments = initialAttachments; - } - - public String getInitialAttachments() - { - return initialAttachments; - } - - public void setMessages(String messages) - { - this.messages = messages; - } - - public String getMessages() - { - return messages; - } - - public void setRating(Integer rating) - { - this.rating = rating; - } - - public Integer getRating() - { - return rating; - } - - public void setEvaluation(String evaluation) - { - this.evaluation = evaluation; - } - - public String getEvaluation() - { - return evaluation; - } - - public void setEvaluationTags(String evaluationTags) - { - this.evaluationTags = evaluationTags; - } - - public String getEvaluationTags() - { - return evaluationTags; - } - - public void setEvaluationTime(Date evaluationTime) - { - this.evaluationTime = evaluationTime; - } - - public Date getEvaluationTime() - { - return evaluationTime; - } - - public void setStartTime(Date startTime) - { - this.startTime = startTime; - } - - public Date getStartTime() - { - return startTime; - } - - public void setEndTime(Date endTime) - { - this.endTime = endTime; - } - - public Date getEndTime() - { - return endTime; - } - - public void setCreatedTime(Date createdTime) - { - this.createdTime = createdTime; - } - - public Date getCreatedTime() - { - return createdTime; - } - - public void setUpdatedTime(Date updatedTime) - { - this.updatedTime = updatedTime; - } - - public Date getUpdatedTime() - { - return updatedTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("consultationId", getConsultationId()) - .append("userId", getUserId()) - .append("expertId", getExpertId()) - .append("formId", getFormId()) - .append("consultationType", getConsultationType()) - .append("consultationStatus", getConsultationStatus()) - .append("consultationTitle", getConsultationTitle()) - .append("initialContent", getInitialContent()) - .append("initialAttachments", getInitialAttachments()) - .append("messages", getMessages()) - .append("rating", getRating()) - .append("evaluation", getEvaluation()) - .append("evaluationTags", getEvaluationTags()) - .append("evaluationTime", getEvaluationTime()) - .append("startTime", getStartTime()) - .append("endTime", getEndTime()) - .append("createdTime", getCreatedTime()) - .append("updatedTime", getUpdatedTime()) - .toString(); - } -} diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysKnowledgeQuery.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysKnowledgeQuery.java new file mode 100644 index 0000000..4965bf8 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysKnowledgeQuery.java @@ -0,0 +1,130 @@ +package com.chenhai.system.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +import java.util.Date; + +/** + * 知识库查询对象 sys_knowledge_query + * + * @author ruoyi + * @date 2026-01-21 + */ +public class SysKnowledgeQuery extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 标题,如“猪瘟防治” */ + @Excel(name = "标题,如“猪瘟防治”") + private String title; + + /** 具体内容,如防治措施、饲养方法等 */ + @Excel(name = "具体内容,如防治措施、饲养方法等") + private String content; + + /** 分类,如“疾病防治”、“饲养管理” */ + @Excel(name = "分类,如“疾病防治”、“饲养管理”") + private String categoryType; + + /** 关键词 */ + @Excel(name = "关键词") + private String keywords; + + /** 发布时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date publishTime; + + /** 搜索关键字(非数据库字段) */ + private String searchKey; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + public void setCategoryType(String categoryType) + { + this.categoryType = categoryType; + } + + public String getCategoryType() + { + return categoryType; + } + + public void setKeywords(String keywords) + { + this.keywords = keywords; + } + + public String getKeywords() + { + return keywords; + } + + public Date getPublishTime() + { + return publishTime; + } + + public void setPublishTime(Date publishTime) + { + this.publishTime = publishTime; + } + + public String getSearchKey() + { + return searchKey; + } + + public void setSearchKey(String searchKey) + { + this.searchKey = searchKey; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("title", getTitle()) + .append("content", getContent()) + .append("categoryType", getCategoryType()) + .append("keywords", getKeywords()) + .append("publishTime", getPublishTime()) + .append("searchKey", getSearchKey()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysMedicineRecommendation.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysMedicineRecommendation.java new file mode 100644 index 0000000..fb2fdd4 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysMedicineRecommendation.java @@ -0,0 +1,531 @@ +package com.chenhai.system.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 药品推荐对象 sys_medicine_recommendation + * + * @author ruoyi + * @date 2026-01-20 + */ +public class SysMedicineRecommendation extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 药品名称 */ + @Excel(name = "药品名称") + private String medicineName; + + /** 药品类型(处方药、非处方药、中成药、保健品等) */ + @Excel(name = "药品类型", readConverterExp = "处=方药、非处方药、中成药、保健品等") + private String medicineType; + + /** 规格(如:0.25g*24粒/盒) */ + @Excel(name = "规格", readConverterExp = "如=:0.25g*24粒/盒") + private String specification; + + /** 当前价格 */ + @Excel(name = "当前价格") + private BigDecimal price; + + /** 原价 */ + @Excel(name = "原价") + private BigDecimal originalPrice; + + /** 已售数量 */ + @Excel(name = "已售数量") + private Long soldQuantity; + + /** 适用症状 */ + @Excel(name = "适用症状") + private String indications; + + /** 用法用量 */ + @Excel(name = "用法用量") + private String usageDosage; + + /** 注意事项 */ + @Excel(name = "注意事项") + private String precautions; + + /** 贮藏方式 */ + @Excel(name = "贮藏方式") + private String storageMethod; + + /** 有效期 */ + @Excel(name = "有效期") + private String expiryDate; + + /** 生产厂家 */ + @Excel(name = "生产厂家") + private String manufacturer; + + /** 销售类型(hot:热销, new:新品, recommend:推荐, normal:普通) */ + @Excel(name = "销售类型") + private String salesType; + + /** 专家ID */ + @Excel(name = "专家ID") + private Long expertId; + + /** 推荐理由 */ + @Excel(name = "推荐理由") + private String recommendReason; + + /** 药品图片(多张图片用逗号分隔) */ + @Excel(name = "药品图片") + private String images; + + /** 轮播图片URL */ + @Excel(name = "轮播图片URL") + private String imageUrl; + + /** 搜索关键词(用于快速搜索,包含药品名称、症状、厂家等信息) */ + @Excel(name = "搜索关键词") + private String searchKeywords; + + /** 推荐时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "推荐时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date recommendTime; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedAt; + + // 专家信息(不持久化到数据库,仅用于展示) + private String expertAvatar; + private String expertName; + private String expertExpert; + private String expertIntroduction; + private String expertAddress; + private String expertExpertiseArea; + private String expertWorkExperience; + + // 推荐店铺信息 + /** 店铺名称 */ + @Excel(name = "店铺名称") + private String storeName; + + /** 店铺地址 */ + @Excel(name = "店铺地址") + private String storeAddress; + + /** 店铺电话 */ + @Excel(name = "店铺电话") + private String storePhone; + + /** 营业时间 */ + @Excel(name = "营业时间") + private String businessHours; + + /** 备注 */ + @Excel(name = "备注") + private String storeRemark; + + /** 经度 */ + @Excel(name = "经度") + private BigDecimal longitude; + + /** 纬度 */ + @Excel(name = "纬度") + private BigDecimal latitude; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setMedicineName(String medicineName) + { + this.medicineName = medicineName; + } + + public String getMedicineName() + { + return medicineName; + } + + public void setMedicineType(String medicineType) + { + this.medicineType = medicineType; + } + + public String getMedicineType() + { + return medicineType; + } + + public void setSpecification(String specification) + { + this.specification = specification; + } + + public String getSpecification() + { + return specification; + } + + public void setPrice(BigDecimal price) + { + this.price = price; + } + + public BigDecimal getPrice() + { + return price; + } + + public void setOriginalPrice(BigDecimal originalPrice) + { + this.originalPrice = originalPrice; + } + + public BigDecimal getOriginalPrice() + { + return originalPrice; + } + + public void setSoldQuantity(Long soldQuantity) + { + this.soldQuantity = soldQuantity; + } + + public Long getSoldQuantity() + { + return soldQuantity; + } + + public void setIndications(String indications) + { + this.indications = indications; + } + + public String getIndications() + { + return indications; + } + + public void setUsageDosage(String usageDosage) + { + this.usageDosage = usageDosage; + } + + public String getUsageDosage() + { + return usageDosage; + } + + public void setPrecautions(String precautions) + { + this.precautions = precautions; + } + + public String getPrecautions() + { + return precautions; + } + + public void setStorageMethod(String storageMethod) + { + this.storageMethod = storageMethod; + } + + public String getStorageMethod() + { + return storageMethod; + } + + public void setExpiryDate(String expiryDate) + { + this.expiryDate = expiryDate; + } + + public String getExpiryDate() + { + return expiryDate; + } + + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + public void setManufacturer(String manufacturer) + { + this.manufacturer = manufacturer; + } + + public String getManufacturer() + { + return manufacturer; + } + + public void setSalesType(String salesType) + { + this.salesType = salesType; + } + + public String getSalesType() + { + return salesType; + } + + public void setExpertId(Long expertId) + { + this.expertId = expertId; + } + + public Long getExpertId() + { + return expertId; + } + + public void setRecommendReason(String recommendReason) + { + this.recommendReason = recommendReason; + } + + public String getRecommendReason() + { + return recommendReason; + } + + public void setRecommendTime(Date recommendTime) + { + this.recommendTime = recommendTime; + } + + public Date getRecommendTime() + { + return recommendTime; + } + + public void setExpertAvatar(String expertAvatar) + { + this.expertAvatar = expertAvatar; + } + + public String getExpertAvatar() + { + return expertAvatar; + } + + public void setExpertName(String expertName) + { + this.expertName = expertName; + } + + public String getExpertName() + { + return expertName; + } + + public void setExpertExpert(String expertExpert) + { + this.expertExpert = expertExpert; + } + + public String getExpertExpert() + { + return expertExpert; + } + + public void setExpertIntroduction(String expertIntroduction) + { + this.expertIntroduction = expertIntroduction; + } + + public String getExpertIntroduction() + { + return expertIntroduction; + } + + public void setExpertAddress(String expertAddress) + { + this.expertAddress = expertAddress; + } + + public String getExpertAddress() + { + return expertAddress; + } + + public void setExpertExpertiseArea(String expertExpertiseArea) + { + this.expertExpertiseArea = expertExpertiseArea; + } + + public String getExpertExpertiseArea() + { + return expertExpertiseArea; + } + + public void setExpertWorkExperience(String expertWorkExperience) + { + this.expertWorkExperience = expertWorkExperience; + } + + public String getExpertWorkExperience() + { + return expertWorkExperience; + } + + + // 店铺相关getter/setter + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getStoreAddress() { + return storeAddress; + } + + public void setStoreAddress(String storeAddress) { + this.storeAddress = storeAddress; + } + + public String getStorePhone() { + return storePhone; + } + + public void setStorePhone(String storePhone) { + this.storePhone = storePhone; + } + + public String getBusinessHours() { + return businessHours; + } + + public void setBusinessHours(String businessHours) { + this.businessHours = businessHours; + } + + public String getStoreRemark() { + return storeRemark; + } + + public void setStoreRemark(String storeRemark) { + this.storeRemark = storeRemark; + } + + public BigDecimal getLongitude() { + return longitude; + } + + public void setLongitude(BigDecimal longitude) { + this.longitude = longitude; + } + + public BigDecimal getLatitude() { + return latitude; + } + + public void setLatitude(BigDecimal latitude) { + this.latitude = latitude; + } + + public void setImages(String images) + { + this.images = images; + } + + public String getImages() + { + return images; + } + + public void setImageUrl(String imageUrl) + { + this.imageUrl = imageUrl; + } + + public String getImageUrl() + { + return imageUrl; + } + + public void setSearchKeywords(String searchKeywords) + { + this.searchKeywords = searchKeywords; + } + + public String getSearchKeywords() + { + return searchKeywords; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("medicineName", getMedicineName()) + .append("medicineType", getMedicineType()) + .append("specification", getSpecification()) + .append("price", getPrice()) + .append("originalPrice", getOriginalPrice()) + .append("soldQuantity", getSoldQuantity()) + .append("indications", getIndications()) + .append("usageDosage", getUsageDosage()) + .append("precautions", getPrecautions()) + .append("storageMethod", getStorageMethod()) + .append("expiryDate", getExpiryDate()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .append("manufacturer", getManufacturer()) + .append("salesType", getSalesType()) + .append("expertId", getExpertId()) + .append("recommendReason", getRecommendReason()) + .append("recommendTime", getRecommendTime()) + .append("storeName", getStoreName()) + .append("storeAddress", getStoreAddress()) + .append("storePhone", getStorePhone()) + .append("businessHours", getBusinessHours()) + .append("storeRemark", getStoreRemark()) + .append("longitude", getLongitude()) + .append("latitude", getLatitude()) + .append("images", getImages()) + .append("imageUrl", getImageUrl()) + .append("searchKeywords", getSearchKeywords()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysPolicyInterpretation.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysPolicyInterpretation.java index 0460e45..9645c1e 100644 --- a/chenhai-system/src/main/java/com/chenhai/system/domain/SysPolicyInterpretation.java +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysPolicyInterpretation.java @@ -49,6 +49,10 @@ public class SysPolicyInterpretation extends BaseEntity @Excel(name = "下架原因") private String removalReason; + /** 政策分类 */ + @Excel(name = "政策分类") // 添加dictType用于字典转换 + private String policyCategory; + /** 删除标志(0代表存在 2代表删除) */ private String delFlag; @@ -142,6 +146,16 @@ public class SysPolicyInterpretation extends BaseEntity return delFlag; } + public void setPolicyCategory(String policyCategory) + { + this.policyCategory = policyCategory; + } + + public String getPolicyCategory() + { + return policyCategory; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -159,6 +173,7 @@ public class SysPolicyInterpretation extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("remark", getRemark()) + .append("policyCategory", getPolicyCategory()) .toString(); } } diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysQueryTip.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysQueryTip.java new file mode 100644 index 0000000..deb8c2a --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysQueryTip.java @@ -0,0 +1,67 @@ +package com.chenhai.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 知识库查询提示对象 sys_query_tip + * + * @author ruoyi + * @date 2026-01-22 + */ +public class SysQueryTip extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键id */ + private Long id; + + /** 关联知识库查询id */ + @Excel(name = "关联知识库查询id") + private Long queryId; + + /** 提示 */ + @Excel(name = "提示") + private String tips; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setQueryId(Long queryId) + { + this.queryId = queryId; + } + + public Long getQueryId() + { + return queryId; + } + + public void setTips(String tips) + { + this.tips = tips; + } + + public String getTips() + { + return tips; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("queryId", getQueryId()) + .append("tips", getTips()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysChatMessageMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysChatMessageMapper.java new file mode 100644 index 0000000..f3bfdb5 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysChatMessageMapper.java @@ -0,0 +1,61 @@ +package com.chenhai.system.mapper; + +import java.util.List; +import com.chenhai.system.domain.SysChatMessage; + +/** + * 兽医咨询聊天消息Mapper接口 + * + * @author ruoyi + * @date 2026-01-19 + */ +public interface SysChatMessageMapper +{ + /** + * 查询兽医咨询聊天消息 + * + * @param messageId 兽医咨询聊天消息主键 + * @return 兽医咨询聊天消息 + */ + public SysChatMessage selectSysChatMessageByMessageId(Long messageId); + + /** + * 查询兽医咨询聊天消息列表 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 兽医咨询聊天消息集合 + */ + public List selectSysChatMessageList(SysChatMessage sysChatMessage); + + /** + * 新增兽医咨询聊天消息 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 结果 + */ + public int insertSysChatMessage(SysChatMessage sysChatMessage); + + /** + * 修改兽医咨询聊天消息 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 结果 + */ + public int updateSysChatMessage(SysChatMessage sysChatMessage); + + /** + * 删除兽医咨询聊天消息 + * + * @param messageId 兽医咨询聊天消息主键 + * @return 结果 + */ + public int deleteSysChatMessageByMessageId(Long messageId); + + /** + * 批量删除兽医咨询聊天消息 + * + * @param messageIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysChatMessageByMessageIds(Long[] messageIds); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysChatSessionMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysChatSessionMapper.java new file mode 100644 index 0000000..b560779 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysChatSessionMapper.java @@ -0,0 +1,61 @@ +package com.chenhai.system.mapper; + +import java.util.List; +import com.chenhai.system.domain.SysChatSession; + +/** + * 兽医咨询聊天会话Mapper接口 + * + * @author ruoyi + * @date 2026-01-19 + */ +public interface SysChatSessionMapper +{ + /** + * 查询兽医咨询聊天会话 + * + * @param sessionId 兽医咨询聊天会话主键 + * @return 兽医咨询聊天会话 + */ + public SysChatSession selectSysChatSessionBySessionId(String sessionId); + + /** + * 查询兽医咨询聊天会话列表 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 兽医咨询聊天会话集合 + */ + public List selectSysChatSessionList(SysChatSession sysChatSession); + + /** + * 新增兽医咨询聊天会话 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 结果 + */ + public int insertSysChatSession(SysChatSession sysChatSession); + + /** + * 修改兽医咨询聊天会话 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 结果 + */ + public int updateSysChatSession(SysChatSession sysChatSession); + + /** + * 删除兽医咨询聊天会话 + * + * @param sessionId 兽医咨询聊天会话主键 + * @return 结果 + */ + public int deleteSysChatSessionBySessionId(String sessionId); + + /** + * 批量删除兽医咨询聊天会话 + * + * @param sessionIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysChatSessionBySessionIds(String[] sessionIds); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java deleted file mode 100644 index d442511..0000000 --- a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.chenhai.system.mapper; - -import java.util.List; -import com.chenhai.system.domain.SysExpertConsultation; - -/** - * 专家咨询Mapper接口 - * - * @author ruoyi - * @date 2026-01-12 - */ -public interface SysExpertConsultationMapper -{ - /** - * 查询专家咨询 - * - * @param consultationId 专家咨询主键 - * @return 专家咨询 - */ - public SysExpertConsultation selectSysExpertConsultationByConsultationId(Long consultationId); - - /** - * 查询专家咨询列表 - * - * @param sysExpertConsultation 专家咨询 - * @return 专家咨询集合 - */ - public List selectSysExpertConsultationList(SysExpertConsultation sysExpertConsultation); - - /** - * 新增专家咨询 - * - * @param sysExpertConsultation 专家咨询 - * @return 结果 - */ - public int insertSysExpertConsultation(SysExpertConsultation sysExpertConsultation); - - /** - * 修改专家咨询 - * - * @param sysExpertConsultation 专家咨询 - * @return 结果 - */ - public int updateSysExpertConsultation(SysExpertConsultation sysExpertConsultation); - - /** - * 删除专家咨询 - * - * @param consultationId 专家咨询主键 - * @return 结果 - */ - public int deleteSysExpertConsultationByConsultationId(Long consultationId); - - /** - * 批量删除专家咨询 - * - * @param consultationIds 需要删除的数据主键集合 - * @return 结果 - */ - public int deleteSysExpertConsultationByConsultationIds(Long[] consultationIds); -} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysKnowledgeQueryMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysKnowledgeQueryMapper.java new file mode 100644 index 0000000..46affea --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysKnowledgeQueryMapper.java @@ -0,0 +1,61 @@ +package com.chenhai.system.mapper; + +import java.util.List; +import com.chenhai.system.domain.SysKnowledgeQuery; + +/** + * 知识库查询Mapper接口 + * + * @author ruoyi + * @date 2026-01-21 + */ +public interface SysKnowledgeQueryMapper +{ + /** + * 查询知识库查询 + * + * @param id 知识库查询主键 + * @return 知识库查询 + */ + public SysKnowledgeQuery selectSysKnowledgeQueryById(Long id); + + /** + * 查询知识库查询列表 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 知识库查询集合 + */ + public List selectSysKnowledgeQueryList(SysKnowledgeQuery sysKnowledgeQuery); + + /** + * 新增知识库查询 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 结果 + */ + public int insertSysKnowledgeQuery(SysKnowledgeQuery sysKnowledgeQuery); + + /** + * 修改知识库查询 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 结果 + */ + public int updateSysKnowledgeQuery(SysKnowledgeQuery sysKnowledgeQuery); + + /** + * 删除知识库查询 + * + * @param id 知识库查询主键 + * @return 结果 + */ + public int deleteSysKnowledgeQueryById(Long id); + + /** + * 批量删除知识库查询 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysKnowledgeQueryByIds(Long[] ids); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysMedicineRecommendationMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysMedicineRecommendationMapper.java new file mode 100644 index 0000000..e747374 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysMedicineRecommendationMapper.java @@ -0,0 +1,72 @@ +package com.chenhai.system.mapper; + +import java.util.List; +import com.chenhai.system.domain.SysMedicineRecommendation; + +/** + * 药品推荐Mapper接口 + * + * @author ruoyi + * @date 2026-01-20 + */ +public interface SysMedicineRecommendationMapper +{ + /** + * 查询药品推荐 + * + * @param id 药品推荐主键 + * @return 药品推荐 + */ + public SysMedicineRecommendation selectSysMedicineRecommendationById(Long id); + + /** + * 查询药品推荐列表 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 药品推荐集合 + */ + public List selectSysMedicineRecommendationList(SysMedicineRecommendation sysMedicineRecommendation); + + /** + * 新增药品推荐 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 结果 + */ + public int insertSysMedicineRecommendation(SysMedicineRecommendation sysMedicineRecommendation); + + /** + * 修改药品推荐 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 结果 + */ + public int updateSysMedicineRecommendation(SysMedicineRecommendation sysMedicineRecommendation); + + /** + * 删除药品推荐 + * + * @param id 药品推荐主键 + * @return 结果 + */ + public int deleteSysMedicineRecommendationById(Long id); + + /** + * 批量删除药品推荐 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysMedicineRecommendationByIds(Long[] ids); + + // 添加专家查询方法声明 + String getExpertNameById(Long expertId); + String getExpertExpertById(Long expertId); + String getExpertIntroductionById(Long expertId); + String getExpertAddressById(Long expertId); + + String getExpertExpertiseAreaById(Long expertId); + + String getExpertWorkExperienceById(Long expertId); + +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysPolicyInterpretationMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysPolicyInterpretationMapper.java index 9ba5c36..2809cdb 100644 --- a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysPolicyInterpretationMapper.java +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysPolicyInterpretationMapper.java @@ -92,4 +92,12 @@ public interface SysPolicyInterpretationMapper * @return 结果 */ public int unpublishSysPolicyInterpretationByIds(Long[] ids, String removalReason); + + /** + * 查询已上架政策解读列表 + * + * @param sysPolicyInterpretation 政策解读查询条件(会忽略publish_status条件) + * @return 政策解读集合 + */ + public List selectPublishedSysPolicyInterpretationList(SysPolicyInterpretation sysPolicyInterpretation); } diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysQueryTipMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysQueryTipMapper.java new file mode 100644 index 0000000..d7a38fe --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysQueryTipMapper.java @@ -0,0 +1,61 @@ +package com.chenhai.system.mapper; + +import java.util.List; +import com.chenhai.system.domain.SysQueryTip; + +/** + * 知识库查询提示Mapper接口 + * + * @author ruoyi + * @date 2026-01-22 + */ +public interface SysQueryTipMapper +{ + /** + * 查询知识库查询提示 + * + * @param id 知识库查询提示主键 + * @return 知识库查询提示 + */ + public SysQueryTip selectSysQueryTipById(Long id); + + /** + * 查询知识库查询提示列表 + * + * @param sysQueryTip 知识库查询提示 + * @return 知识库查询提示集合 + */ + public List selectSysQueryTipList(SysQueryTip sysQueryTip); + + /** + * 新增知识库查询提示 + * + * @param sysQueryTip 知识库查询提示 + * @return 结果 + */ + public int insertSysQueryTip(SysQueryTip sysQueryTip); + + /** + * 修改知识库查询提示 + * + * @param sysQueryTip 知识库查询提示 + * @return 结果 + */ + public int updateSysQueryTip(SysQueryTip sysQueryTip); + + /** + * 删除知识库查询提示 + * + * @param id 知识库查询提示主键 + * @return 结果 + */ + public int deleteSysQueryTipById(Long id); + + /** + * 批量删除知识库查询提示 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysQueryTipByIds(Long[] ids); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysChatMessageService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysChatMessageService.java new file mode 100644 index 0000000..9400836 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysChatMessageService.java @@ -0,0 +1,87 @@ +package com.chenhai.system.service; + +import java.util.List; +import com.chenhai.system.domain.SysChatMessage; + +/** + * 兽医咨询聊天消息Service接口 + * + * @author ruoyi + * @date 2026-01-19 + */ +public interface ISysChatMessageService +{ + /** + * 查询兽医咨询聊天消息 + * + * @param messageId 兽医咨询聊天消息主键 + * @return 兽医咨询聊天消息 + */ + public SysChatMessage selectSysChatMessageByMessageId(Long messageId); + + /** + * 查询兽医咨询聊天消息列表 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 兽医咨询聊天消息集合 + */ + public List selectSysChatMessageList(SysChatMessage sysChatMessage); + + /** + * 新增兽医咨询聊天消息 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 结果 + */ + public int insertSysChatMessage(SysChatMessage sysChatMessage); + + /** + * 修改兽医咨询聊天消息 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 结果 + */ + public int updateSysChatMessage(SysChatMessage sysChatMessage); + + /** + * 批量删除兽医咨询聊天消息 + * + * @param messageIds 需要删除的兽医咨询聊天消息主键集合 + * @return 结果 + */ + public int deleteSysChatMessageByMessageIds(Long[] messageIds); + + /** + * 删除兽医咨询聊天消息信息 + * + * @param messageId 兽医咨询聊天消息主键 + * @return 结果 + */ + public int deleteSysChatMessageByMessageId(Long messageId); + + // 新增方法(复制以下代码到现有接口中) + /** + * 根据会话ID查询消息列表 + */ + List selectMessagesBySessionId(String sessionId); + + /** + * 发送文本消息 + */ + int sendTextMessage(String sessionId, String senderType, Long senderId, String content); + + /** + * 发送系统消息 + */ + int sendSystemMessage(String sessionId, String content); + + /** + * 标记消息为已读 + */ + int markMessageAsRead(Long messageId); + + /** + * 标记会话中所有消息为已读 + */ + int markAllMessagesAsRead(String sessionId, String senderType); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysChatSessionService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysChatSessionService.java new file mode 100644 index 0000000..2b5f1d1 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysChatSessionService.java @@ -0,0 +1,102 @@ +package com.chenhai.system.service; + +import java.util.List; +import com.chenhai.system.domain.SysChatSession; + +/** + * 兽医咨询聊天会话Service接口 + * + * @author ruoyi + * @date 2026-01-19 + */ +public interface ISysChatSessionService +{ + /** + * 查询兽医咨询聊天会话 + * + * @param sessionId 兽医咨询聊天会话主键 + * @return 兽医咨询聊天会话 + */ + public SysChatSession selectSysChatSessionBySessionId(String sessionId); + + /** + * 查询兽医咨询聊天会话列表 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 兽医咨询聊天会话集合 + */ + public List selectSysChatSessionList(SysChatSession sysChatSession); + + /** + * 新增兽医咨询聊天会话 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 结果 + */ + public int insertSysChatSession(SysChatSession sysChatSession); + + /** + * 修改兽医咨询聊天会话 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 结果 + */ + public int updateSysChatSession(SysChatSession sysChatSession); + + /** + * 批量删除兽医咨询聊天会话 + * + * @param sessionIds 需要删除的兽医咨询聊天会话主键集合 + * @return 结果 + */ + public int deleteSysChatSessionBySessionIds(String[] sessionIds); + + /** + * 删除兽医咨询聊天会话信息 + * + * @param sessionId 兽医咨询聊天会话主键 + * @return 结果 + */ + public int deleteSysChatSessionBySessionId(String sessionId); + + // 新增的方法(复制以下代码到现有接口中) + /** + * 根据用户ID查询会话列表 + */ + List selectSessionsByUserId(Long userId); + + /** + * 根据专家ID查询会话列表 + */ + List selectSessionsByExpertId(Long expertId); + + /** + * 创建或获取会话 + */ + String createOrGetSession(Long userId, Long expertId, String animalType, String symptomSummary); + + /** + * 更新最后一条消息 + */ + int updateLastMessage(String sessionId, String lastMessage); + + /** + * 增加用户未读数 + */ + int incrementUnreadUser(String sessionId); + + /** + * 增加专家未读数 + */ + int incrementUnreadExpert(String sessionId); + + /** + * 标记用户已读 + */ + int markUserRead(String sessionId); + + /** + * 标记专家已读 + */ + int markExpertRead(String sessionId); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java deleted file mode 100644 index 50d7153..0000000 --- a/chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.chenhai.system.service; - -import java.util.List; -import com.chenhai.system.domain.SysExpertConsultation; - -/** - * 专家咨询Service接口 - * - * @author ruoyi - * @date 2026-01-12 - */ -public interface ISysExpertConsultationService -{ - /** - * 查询专家咨询 - * - * @param consultationId 专家咨询主键 - * @return 专家咨询 - */ - public SysExpertConsultation selectSysExpertConsultationByConsultationId(Long consultationId); - - /** - * 查询专家咨询列表 - * - * @param sysExpertConsultation 专家咨询 - * @return 专家咨询集合 - */ - public List selectSysExpertConsultationList(SysExpertConsultation sysExpertConsultation); - - /** - * 新增专家咨询 - * - * @param sysExpertConsultation 专家咨询 - * @return 结果 - */ - public int insertSysExpertConsultation(SysExpertConsultation sysExpertConsultation); - - /** - * 修改专家咨询 - * - * @param sysExpertConsultation 专家咨询 - * @return 结果 - */ - public int updateSysExpertConsultation(SysExpertConsultation sysExpertConsultation); - - /** - * 批量删除专家咨询 - * - * @param consultationIds 需要删除的专家咨询主键集合 - * @return 结果 - */ - public int deleteSysExpertConsultationByConsultationIds(Long[] consultationIds); - - /** - * 删除专家咨询信息 - * - * @param consultationId 专家咨询主键 - * @return 结果 - */ - public int deleteSysExpertConsultationByConsultationId(Long consultationId); -} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysKnowledgeQueryService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysKnowledgeQueryService.java new file mode 100644 index 0000000..95faf13 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysKnowledgeQueryService.java @@ -0,0 +1,61 @@ +package com.chenhai.system.service; + +import java.util.List; +import com.chenhai.system.domain.SysKnowledgeQuery; + +/** + * 知识库查询Service接口 + * + * @author ruoyi + * @date 2026-01-21 + */ +public interface ISysKnowledgeQueryService +{ + /** + * 查询知识库查询 + * + * @param id 知识库查询主键 + * @return 知识库查询 + */ + public SysKnowledgeQuery selectSysKnowledgeQueryById(Long id); + + /** + * 查询知识库查询列表 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 知识库查询集合 + */ + public List selectSysKnowledgeQueryList(SysKnowledgeQuery sysKnowledgeQuery); + + /** + * 新增知识库查询 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 结果 + */ + public int insertSysKnowledgeQuery(SysKnowledgeQuery sysKnowledgeQuery); + + /** + * 修改知识库查询 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 结果 + */ + public int updateSysKnowledgeQuery(SysKnowledgeQuery sysKnowledgeQuery); + + /** + * 批量删除知识库查询 + * + * @param ids 需要删除的知识库查询主键集合 + * @return 结果 + */ + public int deleteSysKnowledgeQueryByIds(Long[] ids); + + /** + * 删除知识库查询信息 + * + * @param id 知识库查询主键 + * @return 结果 + */ + public int deleteSysKnowledgeQueryById(Long id); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysMedicineRecommendationService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysMedicineRecommendationService.java new file mode 100644 index 0000000..5ac7297 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysMedicineRecommendationService.java @@ -0,0 +1,61 @@ +package com.chenhai.system.service; + +import java.util.List; +import com.chenhai.system.domain.SysMedicineRecommendation; + +/** + * 药品推荐Service接口 + * + * @author ruoyi + * @date 2026-01-20 + */ +public interface ISysMedicineRecommendationService +{ + /** + * 查询药品推荐 + * + * @param id 药品推荐主键 + * @return 药品推荐 + */ + public SysMedicineRecommendation selectSysMedicineRecommendationById(Long id); + + /** + * 查询药品推荐列表 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 药品推荐集合 + */ + public List selectSysMedicineRecommendationList(SysMedicineRecommendation sysMedicineRecommendation); + + /** + * 新增药品推荐 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 结果 + */ + public int insertSysMedicineRecommendation(SysMedicineRecommendation sysMedicineRecommendation); + + /** + * 修改药品推荐 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 结果 + */ + public int updateSysMedicineRecommendation(SysMedicineRecommendation sysMedicineRecommendation); + + /** + * 批量删除药品推荐 + * + * @param ids 需要删除的药品推荐主键集合 + * @return 结果 + */ + public int deleteSysMedicineRecommendationByIds(Long[] ids); + + /** + * 删除药品推荐信息 + * + * @param id 药品推荐主键 + * @return 结果 + */ + public int deleteSysMedicineRecommendationById(Long id); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysPolicyInterpretationService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysPolicyInterpretationService.java index 8693d1d..6e7aa04 100644 --- a/chenhai-system/src/main/java/com/chenhai/system/service/ISysPolicyInterpretationService.java +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysPolicyInterpretationService.java @@ -92,4 +92,12 @@ public interface ISysPolicyInterpretationService * @return 结果 */ public int unpublishSysPolicyInterpretationByIds(Long[] ids, String removalReason); + + /** + * 查询已上架政策解读列表 + * + * @param sysPolicyInterpretation 政策解读查询条件 + * @return 政策解读集合 + */ + public List selectPublishedSysPolicyInterpretationList(SysPolicyInterpretation sysPolicyInterpretation); } diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysQueryTipService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysQueryTipService.java new file mode 100644 index 0000000..da491f3 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysQueryTipService.java @@ -0,0 +1,61 @@ +package com.chenhai.system.service; + +import java.util.List; +import com.chenhai.system.domain.SysQueryTip; + +/** + * 知识库查询提示Service接口 + * + * @author ruoyi + * @date 2026-01-22 + */ +public interface ISysQueryTipService +{ + /** + * 查询知识库查询提示 + * + * @param id 知识库查询提示主键 + * @return 知识库查询提示 + */ + public SysQueryTip selectSysQueryTipById(Long id); + + /** + * 查询知识库查询提示列表 + * + * @param sysQueryTip 知识库查询提示 + * @return 知识库查询提示集合 + */ + public List selectSysQueryTipList(SysQueryTip sysQueryTip); + + /** + * 新增知识库查询提示 + * + * @param sysQueryTip 知识库查询提示 + * @return 结果 + */ + public int insertSysQueryTip(SysQueryTip sysQueryTip); + + /** + * 修改知识库查询提示 + * + * @param sysQueryTip 知识库查询提示 + * @return 结果 + */ + public int updateSysQueryTip(SysQueryTip sysQueryTip); + + /** + * 批量删除知识库查询提示 + * + * @param ids 需要删除的知识库查询提示主键集合 + * @return 结果 + */ + public int deleteSysQueryTipByIds(Long[] ids); + + /** + * 删除知识库查询提示信息 + * + * @param id 知识库查询提示主键 + * @return 结果 + */ + public int deleteSysQueryTipById(Long id); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysChatMessageServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysChatMessageServiceImpl.java new file mode 100644 index 0000000..79854a5 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysChatMessageServiceImpl.java @@ -0,0 +1,207 @@ +package com.chenhai.system.service.impl; + +import java.util.List; +import com.chenhai.common.utils.DateUtils; +import com.chenhai.system.service.ISysChatSessionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.system.mapper.SysChatMessageMapper; +import com.chenhai.system.domain.SysChatMessage; +import com.chenhai.system.service.ISysChatMessageService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 兽医咨询聊天消息Service业务层处理 + * + * @author ruoyi + * @date 2026-01-19 + */ +@Service +public class SysChatMessageServiceImpl implements ISysChatMessageService +{ + @Autowired + private SysChatMessageMapper sysChatMessageMapper; + + @Autowired + private ISysChatSessionService sessionService; // 添加这行 + + + /** + * 查询兽医咨询聊天消息 + * + * @param messageId 兽医咨询聊天消息主键 + * @return 兽医咨询聊天消息 + */ + @Override + public SysChatMessage selectSysChatMessageByMessageId(Long messageId) + { + return sysChatMessageMapper.selectSysChatMessageByMessageId(messageId); + } + + /** + * 查询兽医咨询聊天消息列表 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 兽医咨询聊天消息 + */ + @Override + public List selectSysChatMessageList(SysChatMessage sysChatMessage) + { + return sysChatMessageMapper.selectSysChatMessageList(sysChatMessage); + } + + /** + * 新增兽医咨询聊天消息 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 结果 + */ + @Override + public int insertSysChatMessage(SysChatMessage sysChatMessage) + { + sysChatMessage.setCreateTime(DateUtils.getNowDate()); + return sysChatMessageMapper.insertSysChatMessage(sysChatMessage); + } + + /** + * 修改兽医咨询聊天消息 + * + * @param sysChatMessage 兽医咨询聊天消息 + * @return 结果 + */ + @Override + public int updateSysChatMessage(SysChatMessage sysChatMessage) + { + sysChatMessage.setUpdateTime(DateUtils.getNowDate()); + return sysChatMessageMapper.updateSysChatMessage(sysChatMessage); + } + + /** + * 批量删除兽医咨询聊天消息 + * + * @param messageIds 需要删除的兽医咨询聊天消息主键 + * @return 结果 + */ + @Override + public int deleteSysChatMessageByMessageIds(Long[] messageIds) + { + return sysChatMessageMapper.deleteSysChatMessageByMessageIds(messageIds); + } + + /** + * 删除兽医咨询聊天消息信息 + * + * @param messageId 兽医咨询聊天消息主键 + * @return 结果 + */ + @Override + public int deleteSysChatMessageByMessageId(Long messageId) + { + return sysChatMessageMapper.deleteSysChatMessageByMessageId(messageId); + } + + // ============ 新增的方法 ============ + + @Override + public List selectMessagesBySessionId(String sessionId) { + SysChatMessage query = new SysChatMessage(); + query.setSessionId(sessionId); + query.setDelFlag("0"); + return sysChatMessageMapper.selectSysChatMessageList(query); + } + + @Override + @Transactional + public int sendTextMessage(String sessionId, String senderType, Long senderId, String content) { + SysChatMessage message = new SysChatMessage(); + message.setSessionId(sessionId); + message.setSenderType(senderType); + message.setSenderId(senderId); + message.setContent(content); + message.setMsgType("text"); + message.setIsRead("0"); + message.setDelFlag("0"); + message.setCreateTime(DateUtils.getNowDate()); + + int result = sysChatMessageMapper.insertSysChatMessage(message); + + if (result > 0) { + // 更新会话的最后一条消息(截取前50个字符) + String lastMessage = content.length() > 50 ? content.substring(0, 50) + "..." : content; + sessionService.updateLastMessage(sessionId, lastMessage); + + // 更新未读数 + if ("0".equals(senderType)) { + // 用户发送的消息,增加专家未读数 + sessionService.incrementUnreadExpert(sessionId); + } else { + // 专家发送的消息,增加用户未读数 + sessionService.incrementUnreadUser(sessionId); + } + } + + return result; + } + + @Override + @Transactional + public int sendSystemMessage(String sessionId, String content) { + SysChatMessage message = new SysChatMessage(); + message.setSessionId(sessionId); + message.setSenderType("2"); // 系统消息 + message.setSenderId(0L); + message.setContent("[系统]" + content); + message.setMsgType("text"); + message.setIsRead("1"); // 系统消息默认已读 + message.setDelFlag("0"); + message.setCreateTime(DateUtils.getNowDate()); + + int result = sysChatMessageMapper.insertSysChatMessage(message); + + if (result > 0) { + sessionService.updateLastMessage(sessionId, content); + } + + return result; + } + + @Override + @Transactional + public int markMessageAsRead(Long messageId) { + SysChatMessage message = new SysChatMessage(); + message.setMessageId(messageId); + message.setIsRead("1"); + message.setReadTime(DateUtils.getNowDate()); + message.setUpdateTime(DateUtils.getNowDate()); + return sysChatMessageMapper.updateSysChatMessage(message); + } + + @Override + @Transactional + public int markAllMessagesAsRead(String sessionId, String senderType) { + // 查询所有未读消息 + SysChatMessage query = new SysChatMessage(); + query.setSessionId(sessionId); + query.setIsRead("0"); + query.setSenderType(senderType); + query.setDelFlag("0"); + + List unreadMessages = sysChatMessageMapper.selectSysChatMessageList(query); + + int count = 0; + for (SysChatMessage message : unreadMessages) { + count += markMessageAsRead(message.getMessageId()); + } + + // 更新会话未读数 + if ("0".equals(senderType)) { + // 用户标记专家消息为已读 + sessionService.markExpertRead(sessionId); + } else { + // 专家标记用户消息为已读 + sessionService.markUserRead(sessionId); + } + + return count; + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysChatSessionServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysChatSessionServiceImpl.java new file mode 100644 index 0000000..307b312 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysChatSessionServiceImpl.java @@ -0,0 +1,207 @@ +package com.chenhai.system.service.impl; + +import java.util.List; +import com.chenhai.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.system.mapper.SysChatSessionMapper; +import com.chenhai.system.domain.SysChatSession; +import com.chenhai.system.service.ISysChatSessionService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 兽医咨询聊天会话Service业务层处理 + * + * @author ruoyi + * @date 2026-01-19 + */ +@Service +public class SysChatSessionServiceImpl implements ISysChatSessionService +{ + @Autowired + private SysChatSessionMapper sysChatSessionMapper; + + /** + * 查询兽医咨询聊天会话 + * + * @param sessionId 兽医咨询聊天会话主键 + * @return 兽医咨询聊天会话 + */ + @Override + public SysChatSession selectSysChatSessionBySessionId(String sessionId) + { + return sysChatSessionMapper.selectSysChatSessionBySessionId(sessionId); + } + + /** + * 查询兽医咨询聊天会话列表 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 兽医咨询聊天会话 + */ + @Override + public List selectSysChatSessionList(SysChatSession sysChatSession) + { + return sysChatSessionMapper.selectSysChatSessionList(sysChatSession); + } + + /** + * 新增兽医咨询聊天会话 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 结果 + */ + @Override + public int insertSysChatSession(SysChatSession sysChatSession) + { + sysChatSession.setCreateTime(DateUtils.getNowDate()); + return sysChatSessionMapper.insertSysChatSession(sysChatSession); + } + + /** + * 修改兽医咨询聊天会话 + * + * @param sysChatSession 兽医咨询聊天会话 + * @return 结果 + */ + @Override + public int updateSysChatSession(SysChatSession sysChatSession) + { + sysChatSession.setUpdateTime(DateUtils.getNowDate()); + return sysChatSessionMapper.updateSysChatSession(sysChatSession); + } + + /** + * 批量删除兽医咨询聊天会话 + * + * @param sessionIds 需要删除的兽医咨询聊天会话主键 + * @return 结果 + */ + @Override + public int deleteSysChatSessionBySessionIds(String[] sessionIds) + { + return sysChatSessionMapper.deleteSysChatSessionBySessionIds(sessionIds); + } + + /** + * 删除兽医咨询聊天会话信息 + * + * @param sessionId 兽医咨询聊天会话主键 + * @return 结果 + */ + @Override + public int deleteSysChatSessionBySessionId(String sessionId) + { + return sysChatSessionMapper.deleteSysChatSessionBySessionId(sessionId); + } + + // ============ 新增的方法 ============ + + @Override + public List selectSessionsByUserId(Long userId) { + SysChatSession query = new SysChatSession(); + query.setUserId(userId); + query.setDelFlag("0"); + return sysChatSessionMapper.selectSysChatSessionList(query); + } + + @Override + public List selectSessionsByExpertId(Long expertId) { + SysChatSession query = new SysChatSession(); + query.setExpertId(expertId); + query.setDelFlag("0"); + return sysChatSessionMapper.selectSysChatSessionList(query); + } + + @Override + @Transactional + public String createOrGetSession(Long userId, Long expertId, String animalType, String symptomSummary) { + String sessionId = "user_" + userId + "_expert_" + expertId; + + // 检查是否已存在该会话 + SysChatSession existingSession = selectSysChatSessionBySessionId(sessionId); + + if (existingSession == null || "2".equals(existingSession.getDelFlag())) { + // 创建新会话 + SysChatSession session = new SysChatSession(); + session.setSessionId(sessionId); + session.setUserId(userId); + session.setExpertId(expertId); + session.setAnimalType(animalType); + session.setSymptomSummary(symptomSummary); + session.setLastMessage("开始咨询"); + session.setLastMessageTime(DateUtils.getNowDate()); + session.setUnreadUser(0L); + session.setUnreadExpert(1L); // 专家有1条未读消息(欢迎消息) + session.setSessionStatus("0"); // 进行中 + session.setDelFlag("0"); + session.setCreateTime(DateUtils.getNowDate()); + + sysChatSessionMapper.insertSysChatSession(session); + } else if ("1".equals(existingSession.getSessionStatus())) { + // 如果会话已结束,重新激活 + existingSession.setSessionStatus("0"); + existingSession.setUpdateTime(DateUtils.getNowDate()); + sysChatSessionMapper.updateSysChatSession(existingSession); + } + + return sessionId; + } + + @Override + @Transactional + public int updateLastMessage(String sessionId, String lastMessage) { + SysChatSession session = new SysChatSession(); + session.setSessionId(sessionId); + session.setLastMessage(lastMessage); + session.setLastMessageTime(DateUtils.getNowDate()); + session.setUpdateTime(DateUtils.getNowDate()); + return sysChatSessionMapper.updateSysChatSession(session); + } + + @Override + @Transactional + public int incrementUnreadUser(String sessionId) { + SysChatSession session = selectSysChatSessionBySessionId(sessionId); + if (session != null) { + Long currentUnread = session.getUnreadUser() != null ? session.getUnreadUser() : 0L; + session.setUnreadUser(currentUnread + 1); + session.setUpdateTime(DateUtils.getNowDate()); + return sysChatSessionMapper.updateSysChatSession(session); + } + return 0; + } + + @Override + @Transactional + public int incrementUnreadExpert(String sessionId) { + SysChatSession session = selectSysChatSessionBySessionId(sessionId); + if (session != null) { + Long currentUnread = session.getUnreadExpert() != null ? session.getUnreadExpert() : 0L; + session.setUnreadExpert(currentUnread + 1); + session.setUpdateTime(DateUtils.getNowDate()); + return sysChatSessionMapper.updateSysChatSession(session); + } + return 0; + } + + @Override + @Transactional + public int markUserRead(String sessionId) { + SysChatSession session = new SysChatSession(); + session.setSessionId(sessionId); + session.setUnreadUser(0L); + session.setUpdateTime(DateUtils.getNowDate()); + return sysChatSessionMapper.updateSysChatSession(session); + } + + @Override + @Transactional + public int markExpertRead(String sessionId) { + SysChatSession session = new SysChatSession(); + session.setSessionId(sessionId); + session.setUnreadExpert(0L); + session.setUpdateTime(DateUtils.getNowDate()); + return sysChatSessionMapper.updateSysChatSession(session); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java deleted file mode 100644 index fdae088..0000000 --- a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.chenhai.system.service.impl; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.chenhai.system.mapper.SysExpertConsultationMapper; -import com.chenhai.system.domain.SysExpertConsultation; -import com.chenhai.system.service.ISysExpertConsultationService; - -/** - * 专家咨询Service业务层处理 - * - * @author ruoyi - * @date 2026-01-12 - */ -@Service -public class SysExpertConsultationServiceImpl implements ISysExpertConsultationService -{ - @Autowired - private SysExpertConsultationMapper sysExpertConsultationMapper; - - /** - * 查询专家咨询 - * - * @param consultationId 专家咨询主键 - * @return 专家咨询 - */ - @Override - public SysExpertConsultation selectSysExpertConsultationByConsultationId(Long consultationId) - { - return sysExpertConsultationMapper.selectSysExpertConsultationByConsultationId(consultationId); - } - - /** - * 查询专家咨询列表 - * - * @param sysExpertConsultation 专家咨询 - * @return 专家咨询 - */ - @Override - public List selectSysExpertConsultationList(SysExpertConsultation sysExpertConsultation) - { - return sysExpertConsultationMapper.selectSysExpertConsultationList(sysExpertConsultation); - } - - /** - * 新增专家咨询 - * - * @param sysExpertConsultation 专家咨询 - * @return 结果 - */ - @Override - public int insertSysExpertConsultation(SysExpertConsultation sysExpertConsultation) - { - return sysExpertConsultationMapper.insertSysExpertConsultation(sysExpertConsultation); - } - - /** - * 修改专家咨询 - * - * @param sysExpertConsultation 专家咨询 - * @return 结果 - */ - @Override - public int updateSysExpertConsultation(SysExpertConsultation sysExpertConsultation) - { - return sysExpertConsultationMapper.updateSysExpertConsultation(sysExpertConsultation); - } - - /** - * 批量删除专家咨询 - * - * @param consultationIds 需要删除的专家咨询主键 - * @return 结果 - */ - @Override - public int deleteSysExpertConsultationByConsultationIds(Long[] consultationIds) - { - return sysExpertConsultationMapper.deleteSysExpertConsultationByConsultationIds(consultationIds); - } - - /** - * 删除专家咨询信息 - * - * @param consultationId 专家咨询主键 - * @return 结果 - */ - @Override - public int deleteSysExpertConsultationByConsultationId(Long consultationId) - { - return sysExpertConsultationMapper.deleteSysExpertConsultationByConsultationId(consultationId); - } -} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysKnowledgeQueryServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysKnowledgeQueryServiceImpl.java new file mode 100644 index 0000000..ed5bd90 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysKnowledgeQueryServiceImpl.java @@ -0,0 +1,93 @@ +package com.chenhai.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.system.mapper.SysKnowledgeQueryMapper; +import com.chenhai.system.domain.SysKnowledgeQuery; +import com.chenhai.system.service.ISysKnowledgeQueryService; + +/** + * 知识库查询Service业务层处理 + * + * @author ruoyi + * @date 2026-01-21 + */ +@Service +public class SysKnowledgeQueryServiceImpl implements ISysKnowledgeQueryService +{ + @Autowired + private SysKnowledgeQueryMapper sysKnowledgeQueryMapper; + + /** + * 查询知识库查询 + * + * @param id 知识库查询主键 + * @return 知识库查询 + */ + @Override + public SysKnowledgeQuery selectSysKnowledgeQueryById(Long id) + { + return sysKnowledgeQueryMapper.selectSysKnowledgeQueryById(id); + } + + /** + * 查询知识库查询列表 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 知识库查询 + */ + @Override + public List selectSysKnowledgeQueryList(SysKnowledgeQuery sysKnowledgeQuery) + { + return sysKnowledgeQueryMapper.selectSysKnowledgeQueryList(sysKnowledgeQuery); + } + + /** + * 新增知识库查询 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 结果 + */ + @Override + public int insertSysKnowledgeQuery(SysKnowledgeQuery sysKnowledgeQuery) + { + return sysKnowledgeQueryMapper.insertSysKnowledgeQuery(sysKnowledgeQuery); + } + + /** + * 修改知识库查询 + * + * @param sysKnowledgeQuery 知识库查询 + * @return 结果 + */ + @Override + public int updateSysKnowledgeQuery(SysKnowledgeQuery sysKnowledgeQuery) + { + return sysKnowledgeQueryMapper.updateSysKnowledgeQuery(sysKnowledgeQuery); + } + + /** + * 批量删除知识库查询 + * + * @param ids 需要删除的知识库查询主键 + * @return 结果 + */ + @Override + public int deleteSysKnowledgeQueryByIds(Long[] ids) + { + return sysKnowledgeQueryMapper.deleteSysKnowledgeQueryByIds(ids); + } + + /** + * 删除知识库查询信息 + * + * @param id 知识库查询主键 + * @return 结果 + */ + @Override + public int deleteSysKnowledgeQueryById(Long id) + { + return sysKnowledgeQueryMapper.deleteSysKnowledgeQueryById(id); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysMedicineRecommendationServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysMedicineRecommendationServiceImpl.java new file mode 100644 index 0000000..aaab25d --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysMedicineRecommendationServiceImpl.java @@ -0,0 +1,93 @@ +package com.chenhai.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.system.mapper.SysMedicineRecommendationMapper; +import com.chenhai.system.domain.SysMedicineRecommendation; +import com.chenhai.system.service.ISysMedicineRecommendationService; + +/** + * 药品推荐Service业务层处理 + * + * @author ruoyi + * @date 2026-01-20 + */ +@Service +public class SysMedicineRecommendationServiceImpl implements ISysMedicineRecommendationService +{ + @Autowired + private SysMedicineRecommendationMapper sysMedicineRecommendationMapper; + + /** + * 查询药品推荐 + * + * @param id 药品推荐主键 + * @return 药品推荐 + */ + @Override + public SysMedicineRecommendation selectSysMedicineRecommendationById(Long id) + { + return sysMedicineRecommendationMapper.selectSysMedicineRecommendationById(id); + } + + /** + * 查询药品推荐列表 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 药品推荐 + */ + @Override + public List selectSysMedicineRecommendationList(SysMedicineRecommendation sysMedicineRecommendation) + { + return sysMedicineRecommendationMapper.selectSysMedicineRecommendationList(sysMedicineRecommendation); + } + + /** + * 新增药品推荐 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 结果 + */ + @Override + public int insertSysMedicineRecommendation(SysMedicineRecommendation sysMedicineRecommendation) + { + return sysMedicineRecommendationMapper.insertSysMedicineRecommendation(sysMedicineRecommendation); + } + + /** + * 修改药品推荐 + * + * @param sysMedicineRecommendation 药品推荐 + * @return 结果 + */ + @Override + public int updateSysMedicineRecommendation(SysMedicineRecommendation sysMedicineRecommendation) + { + return sysMedicineRecommendationMapper.updateSysMedicineRecommendation(sysMedicineRecommendation); + } + + /** + * 批量删除药品推荐 + * + * @param ids 需要删除的药品推荐主键 + * @return 结果 + */ + @Override + public int deleteSysMedicineRecommendationByIds(Long[] ids) + { + return sysMedicineRecommendationMapper.deleteSysMedicineRecommendationByIds(ids); + } + + /** + * 删除药品推荐信息 + * + * @param id 药品推荐主键 + * @return 结果 + */ + @Override + public int deleteSysMedicineRecommendationById(Long id) + { + return sysMedicineRecommendationMapper.deleteSysMedicineRecommendationById(id); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysPolicyInterpretationServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysPolicyInterpretationServiceImpl.java index f133d35..c79a8db 100644 --- a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysPolicyInterpretationServiceImpl.java +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysPolicyInterpretationServiceImpl.java @@ -22,7 +22,7 @@ public class SysPolicyInterpretationServiceImpl implements ISysPolicyInterpretat /** * 查询政策解读 - * + * * @param id 政策解读主键 * @return 政策解读 */ @@ -143,4 +143,18 @@ public class SysPolicyInterpretationServiceImpl implements ISysPolicyInterpretat { return sysPolicyInterpretationMapper.unpublishSysPolicyInterpretationByIds(ids, removalReason); } + + /** + * 查询已上架政策解读列表 + * + * @param sysPolicyInterpretation 政策解读查询条件 + * @return 政策解读 + */ + @Override + public List selectPublishedSysPolicyInterpretationList(SysPolicyInterpretation sysPolicyInterpretation) + { + // 强制设置只查询已上架的数据 + sysPolicyInterpretation.setPublishStatus("1"); + return sysPolicyInterpretationMapper.selectPublishedSysPolicyInterpretationList(sysPolicyInterpretation); + } } diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysQueryTipServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysQueryTipServiceImpl.java new file mode 100644 index 0000000..69b8cea --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysQueryTipServiceImpl.java @@ -0,0 +1,93 @@ +package com.chenhai.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.system.mapper.SysQueryTipMapper; +import com.chenhai.system.domain.SysQueryTip; +import com.chenhai.system.service.ISysQueryTipService; + +/** + * 知识库查询提示Service业务层处理 + * + * @author ruoyi + * @date 2026-01-22 + */ +@Service +public class SysQueryTipServiceImpl implements ISysQueryTipService +{ + @Autowired + private SysQueryTipMapper sysQueryTipMapper; + + /** + * 查询知识库查询提示 + * + * @param id 知识库查询提示主键 + * @return 知识库查询提示 + */ + @Override + public SysQueryTip selectSysQueryTipById(Long id) + { + return sysQueryTipMapper.selectSysQueryTipById(id); + } + + /** + * 查询知识库查询提示列表 + * + * @param sysQueryTip 知识库查询提示 + * @return 知识库查询提示 + */ + @Override + public List selectSysQueryTipList(SysQueryTip sysQueryTip) + { + return sysQueryTipMapper.selectSysQueryTipList(sysQueryTip); + } + + /** + * 新增知识库查询提示 + * + * @param sysQueryTip 知识库查询提示 + * @return 结果 + */ + @Override + public int insertSysQueryTip(SysQueryTip sysQueryTip) + { + return sysQueryTipMapper.insertSysQueryTip(sysQueryTip); + } + + /** + * 修改知识库查询提示 + * + * @param sysQueryTip 知识库查询提示 + * @return 结果 + */ + @Override + public int updateSysQueryTip(SysQueryTip sysQueryTip) + { + return sysQueryTipMapper.updateSysQueryTip(sysQueryTip); + } + + /** + * 批量删除知识库查询提示 + * + * @param ids 需要删除的知识库查询提示主键 + * @return 结果 + */ + @Override + public int deleteSysQueryTipByIds(Long[] ids) + { + return sysQueryTipMapper.deleteSysQueryTipByIds(ids); + } + + /** + * 删除知识库查询提示信息 + * + * @param id 知识库查询提示主键 + * @return 结果 + */ + @Override + public int deleteSysQueryTipById(Long id) + { + return sysQueryTipMapper.deleteSysQueryTipById(id); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java index 349d2bc..d9bc46a 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java @@ -76,6 +76,10 @@ public class VetExperts extends BaseEntity @Excel(name = "从业经验") private String workExperience; + /** 专家简介 */ + @Excel(name = "专家简介") + private String introduction; + /** $column.columnComment */ @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") private Date createdAt; @@ -254,6 +258,16 @@ public class VetExperts extends BaseEntity return workExperience; } + public void setIntroduction(String introduction) + { + this.introduction = introduction; + } + + public String getIntroduction() + { + return introduction; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -274,6 +288,7 @@ public class VetExperts extends BaseEntity .append("updatedAt", getUpdatedAt()) .append("expert", getExpert()) .append("workExperience", getWorkExperience()) + .append("introduction", getIntroduction()) .toString(); } } \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetKnowledge.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetKnowledge.java index 20570cc..ad1fb98 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetKnowledge.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetKnowledge.java @@ -1,10 +1,13 @@ package com.chenhai.vet.domain; +import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.chenhai.common.annotation.Excel; import com.chenhai.common.core.domain.BaseEntity; +import java.util.Date; + /** * 兽医文章对象 vet_knowledge * @@ -46,6 +49,31 @@ public class VetKnowledge extends BaseEntity @Excel(name = "审核意见") private String auditComment; + /** 发布时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date publishTime; + + /** 查看次数 */ + @Excel(name = "查看次数") + private Integer viewCount; + + /** 封面图片地址 */ + @Excel(name = "封面图片") + private String coverImage; + + /** 副标题 */ + @Excel(name = "副标题") + private String subtitle; + + /** 专家ID */ + @Excel(name = "专家ID") + private Long expertId; + + /** 专家名称(关联查询使用,非数据库字段) */ + private String expertName; + private String expertAvatar; + public void setId(Long id) { this.id = id; @@ -120,6 +148,64 @@ public class VetKnowledge extends BaseEntity this.auditComment = auditComment; } + public Date getPublishTime() { + return publishTime; + } + + public void setPublishTime(Date publishTime) { + this.publishTime = publishTime; + } + + public Integer getViewCount() { + return viewCount; + } + + public void setViewCount(Integer viewCount) { + this.viewCount = viewCount; + } + + public Long getExpertId() { + return expertId; + } + + public void setExpertId(Long expertId) { + this.expertId = expertId; + } + + public void setExpertAvatar(String expertAvatar) + { + this.expertAvatar = expertAvatar; + } + + public String getExpertAvatar() + { + return expertAvatar; + } + + public String getExpertName() { + return expertName; + } + + public void setExpertName(String expertName) { + this.expertName = expertName; + } + + public String getCoverImage() { + return coverImage; + } + + public void setCoverImage(String coverImage) { + this.coverImage = coverImage; + } + + public String getSubtitle() { + return subtitle; + } + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -136,6 +222,11 @@ public class VetKnowledge extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("remark", getRemark()) + .append("publishTime", getPublishTime()) + .append("viewCount", getViewCount()) + .append("expertId", getExpertId()) + .append("coverImage", getCoverImage()) + .append("subtitle", getSubtitle()) .toString(); } } \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetTrainingVideo.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetTrainingVideo.java index e53e46c..fd3e185 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetTrainingVideo.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetTrainingVideo.java @@ -82,6 +82,7 @@ public class VetTrainingVideo extends BaseEntity /** 用户名称(非数据库字段) */ private String userName; + private String userAvatar; public void setId(Long id) { @@ -259,6 +260,14 @@ public class VetTrainingVideo extends BaseEntity this.userName = userName; } + public String getUserAvatar() { + return userAvatar; + } + + public void setUserAvatar(String userAvatar) { + this.userAvatar = userAvatar; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java index d00abc2..c2e17c5 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java @@ -59,4 +59,17 @@ public interface VetExpertsMapper */ public int deleteVetExpertsByExpertIds(Long[] expertIds); + /** + * 搜索专家信息(按真实姓名和擅长领域) + * + * @param keyword 搜索关键词 + * @return 专家信息集合 + */ + public List searchVetExperts(String keyword); + + /** + * 只更新在线状态(不影响其他字段) + */ + int updateOnlineStatusOnly(VetExperts vetExperts); + } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetKnowledgeMapper.java b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetKnowledgeMapper.java index edbbe76..aeaf720 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetKnowledgeMapper.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetKnowledgeMapper.java @@ -1,6 +1,8 @@ package com.chenhai.vet.mapper; import java.util.List; + +import com.chenhai.vet.domain.VetExperts; import com.chenhai.vet.domain.VetKnowledge; /** @@ -58,4 +60,19 @@ public interface VetKnowledgeMapper * @return 结果 */ public int deleteVetKnowledgeByIds(Long[] ids); + + /** + * 根据用户名查询专家信息 + * @param username 用户名 + * @return 专家信息 + */ + VetExperts selectExpertByUsername(String username); + + /** + * 根据用户ID查询专家信息 + * @param userId 用户ID + * @return 专家信息 + */ + VetExperts selectExpertByUserId(Long userId); + } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java index f96ca41..4efe3b8 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java @@ -58,4 +58,12 @@ public interface IVetExpertsService * @return 结果 */ public int deleteVetExpertsByExpertId(Long expertId); + + /** + * 搜索专家信息(按真实姓名和擅长领域) + * + * @param keyword 搜索关键词 + * @return 专家信息集合 + */ + public List searchVetExperts(String keyword); } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetKnowledgeService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetKnowledgeService.java index c73be4e..778a741 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetKnowledgeService.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetKnowledgeService.java @@ -95,4 +95,21 @@ public interface IVetKnowledgeService * @return 结果 */ AjaxResult offlineVetKnowledge(Long id, String auditComment); + + /** + * 查询已发布且审核通过的兽医文章列表(公开接口) + * + * @param vetKnowledge 兽医文章查询条件 + * @return 兽医文章集合 + */ + public List selectPublishedKnowledgeList(VetKnowledge vetKnowledge); + + /** + * 增加文章查看次数 + * + * @param id 文章ID + * @return 结果 + */ + public int addViewCount(Long id); + } \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetTrainingVideoService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetTrainingVideoService.java index 62f3c2f..21743a3 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetTrainingVideoService.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetTrainingVideoService.java @@ -12,6 +12,7 @@ public interface IVetTrainingVideoService { */ String uploadAndSave(VetTrainingVideo video, MultipartFile videoFile, MultipartFile coverImage); + /** * 获取我的视频列表 */ diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java index cc6e872..16aa858 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java @@ -44,8 +44,6 @@ public class VetExpertsServiceImpl implements IVetExpertsService { VetExperts expert = vetExpertsMapper.selectVetExpertsByExpertId(expertId); if (expert != null) { - // 更新在线状态 - updateOnlineStatus(expert); // 如果userId不为空,尝试从兽医表获取数据 if (expert.getUserId() != null) { autoFillFromVetInfo(expert); @@ -65,12 +63,9 @@ public class VetExpertsServiceImpl implements IVetExpertsService @Override public List selectVetExpertsList(VetExperts vetExperts) { - List list = vetExpertsMapper.selectVetExpertsList(vetExperts); if (list != null) { for (VetExperts expert : list) { - // 更新在线状态 - updateOnlineStatus(expert); // 如果userId不为空,尝试从兽医表获取数据 if (expert.getUserId() != null) { autoFillFromVetInfo(expert); @@ -95,24 +90,22 @@ public class VetExpertsServiceImpl implements IVetExpertsService // 1. 确保设置userId(优先使用传入的,其次使用当前登录用户) ensureUserId(vetExperts); - // 2. 设置在线状态(新增时默认为在线) - vetExperts.setIsOnline("在线"); // 改为汉字"在线" - - // 3. 设置排序值(在线排在前面) - vetExperts.setSortOrder(1L); // 在线专家排序值较高 + // 2. 设置在线状态(新增时默认为离线) + vetExperts.setIsOnline("离线"); + vetExperts.setSortOrder(0L); - // 4. 自动填充默认值(包含从兽医信息表获取数据) + // 3. 自动填充默认值(包含从兽医信息表获取数据) autoFillDefaultValues(vetExperts); - // 5. 设置默认值(如果从兽医表获取后仍然为空) + // 4. 设置默认值(如果从兽医表获取后仍然为空) setDefaultValues(vetExperts); - // 6. 设置创建时间和更新时间 + // 5. 设置创建时间和更新时间 Date now = new Date(); vetExperts.setCreatedAt(now); vetExperts.setUpdatedAt(now); - // 7. 设置操作人 + // 6. 设置操作人 setAuditInfo(vetExperts); return vetExpertsMapper.insertVetExperts(vetExperts); @@ -131,8 +124,14 @@ public class VetExpertsServiceImpl implements IVetExpertsService // 1. 确保userId不为空 ensureUserId(vetExperts); - // 2. 更新在线状态 - updateOnlineStatus(vetExperts); + // 2. 保持原有的在线状态 + if (vetExperts.getExpertId() != null && vetExperts.getIsOnline() == null) { + VetExperts existing = vetExpertsMapper.selectVetExpertsByExpertId(vetExperts.getExpertId()); + if (existing != null) { + vetExperts.setIsOnline(existing.getIsOnline()); + vetExperts.setSortOrder(existing.getSortOrder()); + } + } // 3. 自动填充默认值 autoFillDefaultValues(vetExperts); @@ -149,37 +148,11 @@ public class VetExpertsServiceImpl implements IVetExpertsService return vetExpertsMapper.updateVetExperts(vetExperts); } - /** - * 更新在线状态(如果当前登录用户是该专家,则设置为在线) - */ - private void updateOnlineStatus(VetExperts vetExperts) { - if (vetExperts == null || vetExperts.getUserId() == null) { - return; - } - - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (loginUser != null) { - // 如果当前登录用户就是该专家,设置为在线 - if (loginUser.getUserId().equals(vetExperts.getUserId())) { - vetExperts.setIsOnline("在线"); - vetExperts.setSortOrder(1L); // 在线状态排序值高 - } else { - vetExperts.setIsOnline("离线"); - vetExperts.setSortOrder(0L); // 离线状态排序值低 - } - } else { - // 没有登录用户,设置为离线 - vetExperts.setIsOnline("离线"); - vetExperts.setSortOrder(0L); - } - } - /** * 确保设置userId */ private void ensureUserId(VetExperts vetExperts) { if (vetExperts.getUserId() == null) { - // 尝试获取当前登录用户ID LoginUser loginUser = SecurityUtils.getLoginUser(); if (loginUser != null) { vetExperts.setUserId(loginUser.getUserId()); @@ -284,6 +257,11 @@ public class VetExpertsServiceImpl implements IVetExpertsService && !isFieldEmpty(vetInfo.getUser().getAvatar())) { vetExperts.setAvatar(vetInfo.getUser().getAvatar()); } + + // 10. 专家简介(新增) + if (isFieldEmpty(vetExperts.getIntroduction()) && !isFieldEmpty(vetInfo.getIntroduction())) { + vetExperts.setIntroduction(vetInfo.getIntroduction()); + } } /** @@ -294,7 +272,6 @@ public class VetExpertsServiceImpl implements IVetExpertsService return; } - // 如果专家信息中某些字段是默认值,尝试从兽医表获取 VetPersonalInfo vetInfo = vetPersonalInfoMapper.selectVetPersonalInfoByUserId(expert.getUserId()); if (vetInfo == null) { return; @@ -347,10 +324,17 @@ public class VetExpertsServiceImpl implements IVetExpertsService expert.setAddress(vetInfo.getAddress()); } } + + // 专家简介(新增) + if (isFieldEmpty(expert.getIntroduction()) && !isFieldEmpty(vetInfo.getIntroduction())) { + expert.setIntroduction(vetInfo.getIntroduction()); + } else if ("暂无简介".equals(expert.getIntroduction()) && !isFieldEmpty(vetInfo.getIntroduction())) { + expert.setIntroduction(vetInfo.getIntroduction()); + } } /** - * 设置默认值(修改了在线状态和排序的默认值) + * 设置默认值 */ private void setDefaultValues(VetExperts vetExperts) { // 1. 如果真实姓名为空 @@ -398,16 +382,9 @@ public class VetExpertsServiceImpl implements IVetExpertsService vetExperts.setAvatar("/profile/avatar/default.jpg"); } - // 10. 如果在线状态为空,需要根据登录状态设置 + // 10. 如果在线状态为空,设置为离线 if (isFieldEmpty(vetExperts.getIsOnline())) { - // 检查当前登录用户是否是该专家 - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (loginUser != null && vetExperts.getUserId() != null - && loginUser.getUserId().equals(vetExperts.getUserId())) { - vetExperts.setIsOnline("在线"); // 当前登录用户是在线 - } else { - vetExperts.setIsOnline("离线"); // 离线 - } + vetExperts.setIsOnline("离线"); } // 11. 如果状态为空,设置默认正常 @@ -423,6 +400,57 @@ public class VetExpertsServiceImpl implements IVetExpertsService vetExperts.setSortOrder(0L); // 离线排在后面 } } + + // 13. 如果专家简介为空,设置默认值(新增) + if (isFieldEmpty(vetExperts.getIntroduction())) { + // 根据专家信息生成默认简介 + String defaultIntroduction = generateDefaultIntroduction(vetExperts); + vetExperts.setIntroduction(defaultIntroduction); + } + } + + /** + * 生成默认专家简介(新增方法) + */ + private String generateDefaultIntroduction(VetExperts vetExperts) { + StringBuilder intro = new StringBuilder(); + + // 基本介绍 + intro.append("我是"); + if (!"未填写".equals(vetExperts.getRealName())) { + intro.append(vetExperts.getRealName()); + } else { + intro.append("一位"); + } + + // 职称 + if (!"未设置".equals(vetExperts.getTitle())) { + intro.append(",").append(vetExperts.getTitle()); + } + + // 从业经验 + if (!"暂无".equals(vetExperts.getWorkExperience())) { + intro.append(",拥有").append(vetExperts.getWorkExperience()).append("从业经验"); + } + + // 擅长领域 + if (!"待补充".equals(vetExperts.getExpertiseArea())) { + intro.append(",擅长").append(vetExperts.getExpertiseArea()); + } + + // 工作单位 + if (!"待补充".equals(vetExperts.getAddress())) { + intro.append(",现就职于").append(vetExperts.getAddress()); + } + + intro.append("。"); + + // 如果没有其他信息,返回简单默认值 + if (intro.length() <= 10) { + return "暂无简介"; + } + + return intro.toString(); } /** @@ -455,4 +483,28 @@ public class VetExpertsServiceImpl implements IVetExpertsService { return vetExpertsMapper.deleteVetExpertsByExpertId(expertId); } + + /** + * 搜索专家信息(按真实姓名和擅长领域) + * + * @param keyword 搜索关键词 + * @return 专家信息集合 + */ + @Override + public List searchVetExperts(String keyword) { + // 调用Mapper进行搜索 + List list = vetExpertsMapper.searchVetExperts(keyword); + + if (list != null) { + for (VetExperts expert : list) { + // 如果userId不为空,尝试从兽医表获取数据 + if (expert.getUserId() != null) { + autoFillFromVetInfo(expert); + } + // 确保显示默认值 + setDefaultValues(expert); + } + } + return list; + } } \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetKnowledgeServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetKnowledgeServiceImpl.java index 353693e..6726d67 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetKnowledgeServiceImpl.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetKnowledgeServiceImpl.java @@ -5,11 +5,13 @@ import java.util.List; import com.chenhai.common.core.domain.AjaxResult; import com.chenhai.common.utils.DateUtils; import com.chenhai.common.utils.SecurityUtils; +import com.chenhai.vet.domain.VetExperts; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.chenhai.vet.mapper.VetKnowledgeMapper; import com.chenhai.vet.domain.VetKnowledge; import com.chenhai.vet.service.IVetKnowledgeService; +import org.springframework.transaction.annotation.Transactional; /** * 兽医文章Service业务层处理 @@ -47,7 +49,6 @@ public class VetKnowledgeServiceImpl implements IVetKnowledgeService @Override public int insertVetKnowledge(VetKnowledge vetKnowledge) { - vetKnowledge.setCreateTime(DateUtils.getNowDate()); // 新增文章时,默认状态为草稿,审核状态为待审核 if (vetKnowledge.getArticleStatus() == null) { vetKnowledge.setArticleStatus("0"); // 草稿 @@ -306,4 +307,38 @@ public class VetKnowledgeServiceImpl implements IVetKnowledgeService return AjaxResult.error("文章下架失败: " + e.getMessage()); } } + + /** + * 查询已发布且审核通过的兽医文章列表 + * 只返回状态为已发布(1)且审核通过(2)的文章 + */ + @Override + public List selectPublishedKnowledgeList(VetKnowledge vetKnowledge) { + // 强制设置查询条件为已发布且审核通过 + vetKnowledge.setArticleStatus("1"); // 已发布 + vetKnowledge.setAuditStatus("2"); // 审核通过 + return vetKnowledgeMapper.selectVetKnowledgeList(vetKnowledge); + } + + /** + * 增加文章查看次数 + */ + @Override + @Transactional + public int addViewCount(Long id) { + try { + VetKnowledge current = vetKnowledgeMapper.selectVetKnowledgeById(id); + if (current != null) { + VetKnowledge vetKnowledge = new VetKnowledge(); + vetKnowledge.setId(id); + vetKnowledge.setViewCount((current.getViewCount() == null ? 0 : current.getViewCount()) + 1); + vetKnowledge.setUpdateTime(DateUtils.getNowDate()); + return vetKnowledgeMapper.updateVetKnowledge(vetKnowledge); + } + return 0; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } } \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysChatMessageMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysChatMessageMapper.xml new file mode 100644 index 0000000..04f8a35 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/system/SysChatMessageMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + select message_id, session_id, sender_type, sender_id, content, msg_type, is_read, read_time, del_flag, create_by, create_time, update_by, update_time from sys_chat_message + + + + + + + + insert into sys_chat_message + + session_id, + sender_type, + sender_id, + content, + msg_type, + is_read, + read_time, + del_flag, + create_by, + create_time, + update_by, + update_time, + + + #{sessionId}, + #{senderType}, + #{senderId}, + #{content}, + #{msgType}, + #{isRead}, + #{readTime}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update sys_chat_message + + session_id = #{sessionId}, + sender_type = #{senderType}, + sender_id = #{senderId}, + content = #{content}, + msg_type = #{msgType}, + is_read = #{isRead}, + read_time = #{readTime}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where message_id = #{messageId} + + + + delete from sys_chat_message where message_id = #{messageId} + + + + delete from sys_chat_message where message_id in + + #{messageId} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysChatSessionMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysChatSessionMapper.xml new file mode 100644 index 0000000..0436ca8 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/system/SysChatSessionMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select session_id, user_id, expert_id, animal_type, symptom_summary, last_message, last_message_time, unread_user, unread_expert, session_status, del_flag, create_by, create_time, update_by, update_time, remark from sys_chat_session + + + + + + + + insert into sys_chat_session + + session_id, + user_id, + expert_id, + animal_type, + symptom_summary, + last_message, + last_message_time, + unread_user, + unread_expert, + session_status, + del_flag, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{sessionId}, + #{userId}, + #{expertId}, + #{animalType}, + #{symptomSummary}, + #{lastMessage}, + #{lastMessageTime}, + #{unreadUser}, + #{unreadExpert}, + #{sessionStatus}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update sys_chat_session + + user_id = #{userId}, + expert_id = #{expertId}, + animal_type = #{animalType}, + symptom_summary = #{symptomSummary}, + last_message = #{lastMessage}, + last_message_time = #{lastMessageTime}, + unread_user = #{unreadUser}, + unread_expert = #{unreadExpert}, + session_status = #{sessionStatus}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where session_id = #{sessionId} + + + + delete from sys_chat_session where session_id = #{sessionId} + + + + delete from sys_chat_session where session_id in + + #{sessionId} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml deleted file mode 100644 index 0093cb0..0000000 --- a/chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - select consultation_id, user_id, expert_id, form_id, consultation_type, consultation_status, consultation_title, initial_content, initial_attachments, messages, rating, evaluation, evaluation_tags, evaluation_time, start_time, end_time, created_time, updated_time from sys_expert_consultation - - - - - - - - insert into sys_expert_consultation - - user_id, - expert_id, - form_id, - consultation_type, - consultation_status, - consultation_title, - initial_content, - initial_attachments, - messages, - rating, - evaluation, - evaluation_tags, - evaluation_time, - start_time, - end_time, - created_time, - updated_time, - - - #{userId}, - #{expertId}, - #{formId}, - #{consultationType}, - #{consultationStatus}, - #{consultationTitle}, - #{initialContent}, - #{initialAttachments}, - #{messages}, - #{rating}, - #{evaluation}, - #{evaluationTags}, - #{evaluationTime}, - #{startTime}, - #{endTime}, - #{createdTime}, - #{updatedTime}, - - - - - update sys_expert_consultation - - user_id = #{userId}, - expert_id = #{expertId}, - form_id = #{formId}, - consultation_type = #{consultationType}, - consultation_status = #{consultationStatus}, - consultation_title = #{consultationTitle}, - initial_content = #{initialContent}, - initial_attachments = #{initialAttachments}, - messages = #{messages}, - rating = #{rating}, - evaluation = #{evaluation}, - evaluation_tags = #{evaluationTags}, - evaluation_time = #{evaluationTime}, - start_time = #{startTime}, - end_time = #{endTime}, - created_time = #{createdTime}, - updated_time = #{updatedTime}, - - where consultation_id = #{consultationId} - - - - delete from sys_expert_consultation where consultation_id = #{consultationId} - - - - delete from sys_expert_consultation where consultation_id in - - #{consultationId} - - - \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysKnowledgeQueryMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysKnowledgeQueryMapper.xml new file mode 100644 index 0000000..22173d5 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/system/SysKnowledgeQueryMapper.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + select id, title, content, category_type, keywords, publish_time from sys_knowledge_query + + + + + + + + insert into sys_knowledge_query + + title, + content, + category_type, + keywords, + publish_time, + + + #{title}, + #{content}, + #{categoryType}, + #{keywords}, + #{publishTime}, + + + + + update sys_knowledge_query + + title = #{title}, + content = #{content}, + category_type = #{categoryType}, + keywords = #{keywords}, + publish_time = #{publishTime}, + + where id = #{id} + + + + delete from sys_knowledge_query where id = #{id} + + + + delete from sys_knowledge_query where id in + + #{id} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysMedicineRecommendationMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysMedicineRecommendationMapper.xml new file mode 100644 index 0000000..97d05de --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/system/SysMedicineRecommendationMapper.xml @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select + m.id, + m.medicine_name, + m.medicine_type, + m.specification, + m.price, + m.original_price, + m.sold_quantity, + m.indications, + m.usage_dosage, + m.precautions, + m.storage_method, + m.expiry_date, + m.created_at, + m.updated_at, + m.manufacturer, + m.sales_type, + m.expert_id, + m.recommend_reason, + m.recommend_time, + m.store_name, + m.store_address, + m.store_phone, + m.business_hours, + m.store_remark, + m.longitude, + m.latitude, + m.images, + m.image_url, + e.avatar as expert_avatar, + e.real_name as expert_name, + e.expert as expert_expert, + e.introduction as expert_introduction, + e.address as expert_address, + e.expertise_area as expertise_area, + e.work_experience as work_experience + from sys_medicine_recommendation m + left join vet_experts e on m.expert_id = e.expert_id + left join sys_dict_data d on m.medicine_type = d.dict_value + and d.dict_type = 'medicine_type' + + + + + + + + insert into sys_medicine_recommendation + + medicine_name, + medicine_type, + specification, + price, + original_price, + sold_quantity, + indications, + usage_dosage, + precautions, + storage_method, + expiry_date, + created_at, + updated_at, + manufacturer, + sales_type, + expert_id, + recommend_reason, + recommend_time, + store_name, + store_address, + store_phone, + business_hours, + store_remark, + longitude, + latitude, + images, + image_url, + + + #{medicineName}, + #{medicineType}, + #{specification}, + #{price}, + #{originalPrice}, + #{soldQuantity}, + #{indications}, + #{usageDosage}, + #{precautions}, + #{storageMethod}, + #{expiryDate}, + #{createdAt}, + #{updatedAt}, + #{manufacturer}, + #{salesType}, + #{expertId}, + #{recommendReason}, + #{recommendTime}, + #{storeName}, + #{storeAddress}, + #{storePhone}, + #{businessHours}, + #{storeRemark}, + #{longitude}, + #{latitude}, + #{images}, + #{imageUrl}, + + + + + update sys_medicine_recommendation + + medicine_name = #{medicineName}, + medicine_type = #{medicineType}, + specification = #{specification}, + price = #{price}, + original_price = #{originalPrice}, + sold_quantity = #{soldQuantity}, + indications = #{indications}, + usage_dosage = #{usageDosage}, + precautions = #{precautions}, + storage_method = #{storageMethod}, + expiry_date = #{expiryDate}, + created_at = #{createdAt}, + updated_at = #{updatedAt}, + manufacturer = #{manufacturer}, + sales_type = #{salesType}, + expert_id = #{expertId}, + recommend_reason = #{recommendReason}, + recommend_time = #{recommendTime}, + store_name = #{storeName}, + store_address = #{storeAddress}, + store_phone = #{storePhone}, + business_hours = #{businessHours}, + store_remark = #{storeRemark}, + longitude = #{longitude}, + latitude = #{latitude}, + images = #{images}, + image_url = #{imageUrl}, + + where id = #{id} + + + + delete from sys_medicine_recommendation where id = #{id} + + + + delete from sys_medicine_recommendation where id in + + #{id} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysPolicyInterpretationMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysPolicyInterpretationMapper.xml index 72dbfe3..41d2a24 100644 --- a/chenhai-system/src/main/resources/mapper/system/SysPolicyInterpretationMapper.xml +++ b/chenhai-system/src/main/resources/mapper/system/SysPolicyInterpretationMapper.xml @@ -19,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, title, policy_file, release_date, issuing_agency, content, publish_status, removal_reason, del_flag, create_by, create_time, update_by, update_time, remark from sys_policy_interpretation + select id, title, policy_file, release_date, issuing_agency, content, publish_status, removal_reason, del_flag, create_by, create_time, update_by, update_time, remark, policy_category from sys_policy_interpretation @@ -60,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, remark, + policy_category, #{id}, @@ -76,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{remark}, + #{policyCategory}, @@ -95,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, + policy_category = #{policyCategory}, where id = #{id} @@ -151,4 +156,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysQueryTipMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysQueryTipMapper.xml new file mode 100644 index 0000000..178eea0 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/system/SysQueryTipMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + select id, query_id, tips from sys_query_tip + + + + + + + + insert into sys_query_tip + + id, + query_id, + tips, + + + #{id}, + #{queryId}, + #{tips}, + + + + + update sys_query_tip + + query_id = #{queryId}, + tips = #{tips}, + + where id = #{id} + + + + delete from sys_query_tip where id = #{id} + + + + delete from sys_query_tip where id in + + #{id} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml index 08a8951..f164271 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml @@ -22,11 +22,12 @@ + select expert_id, user_id, avatar, real_name, iphone, email, address, - expertise_area, is_online, remark, sort_order, status, created_at, updated_at, title, expert, work_experience + expertise_area, is_online, remark, sort_order, status, created_at, updated_at, title, expert, work_experience, introduction from vet_experts @@ -48,6 +49,7 @@ and title = #{title} and expert = #{expert} and work_experience = #{workExperience}) + and introduction like concat('%', #{introduction}, '%') @@ -75,6 +77,7 @@ title, expert, work_experience, + introduction, #{userId}, @@ -93,6 +96,7 @@ #{title}, #{expert}, #{workExperience}, + #{introduction}, @@ -115,6 +119,7 @@ title = #{title}, expert = #{expert}, work_experience = #{workExperience}, + introduction = #{introduction}, where expert_id = #{expertId} @@ -129,4 +134,31 @@ #{expertId} + + + + + + + update vet_experts + + is_online = #{isOnline}, + sort_order = #{sortOrder}, + updated_at = now() + + where expert_id = #{expertId} + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/vet/VetKnowledgeMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetKnowledgeMapper.xml index a58cd31..fe8545f 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetKnowledgeMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetKnowledgeMapper.xml @@ -18,10 +18,49 @@ + + + + + + + + + + + + - select id, title, content, category, sensitive_words, article_status, audit_status, audit_comment, create_by, create_time, update_by, update_time, remark from vet_knowledge + select + vk.id, + vk.title, + vk.content, + vk.category, + vk.sensitive_words, + vk.article_status, + vk.audit_status, + vk.audit_comment, + vk.create_by, + vk.create_time, + vk.update_by, + vk.update_time, + vk.remark, + vk.publish_time, + vk.view_count, + vk.cover_image, + vk.subtitle, + vk.expert_id, + ve.real_name as expert_name, + ve.avatar as expert_avatar + from vet_knowledge vk + left join vet_experts ve on vk.expert_id = ve.expert_id @@ -56,6 +98,11 @@ update_by, update_time, remark, + publish_time, + view_count, + expert_id, + cover_image, + subtitle, #{title}, @@ -70,6 +117,11 @@ #{updateBy}, #{updateTime}, #{remark}, + #{publishTime}, + #{viewCount}, + #{expertId}, + #{coverImage}, + #{subtitle}, @@ -88,6 +140,11 @@ update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, + publish_time = #{publishTime}, + view_count = #{viewCount}, + expert_id = #{expertId}, + cover_image = #{coverImage}, + subtitle = #{subtitle}, where id = #{id} diff --git a/chenhai-system/src/main/resources/mapper/vet/VetTrainingVideoMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetTrainingVideoMapper.xml index 2807fa0..19af370 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetTrainingVideoMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetTrainingVideoMapper.xml @@ -22,6 +22,7 @@ + @@ -39,7 +40,7 @@ - SELECT v.*, u.nick_name as user_name + SELECT v.*, u.nick_name as user_name,u.avatar as user_avatar FROM vet_training_video v LEFT JOIN sys_user u ON v.user_id = u.user_id WHERE v.status = '1' @@ -100,7 +101,7 @@ - SELECT v.*, u.nick_name as user_name + SELECT v.*, u.nick_name as user_name,u.avatar as user_avatar FROM vet_training_video v LEFT JOIN sys_user u ON v.user_id = u.user_id WHERE v.audit_status = '0' diff --git a/chenhai-ui/src/api/system/chat.js b/chenhai-ui/src/api/system/chat.js new file mode 100644 index 0000000..a01a3f4 --- /dev/null +++ b/chenhai-ui/src/api/system/chat.js @@ -0,0 +1,72 @@ +// /api/chat/chat.js - 修改为使用现有接口 +import request from '@/utils/request' + +// 使用现有的专家接口获取专家信息 +export function getExpertInfo(expertId) { + return request({ + url: '/vet/experts/' + expertId, + method: 'get' + }) +} + +// 使用现有的会话接口创建会话 +export function createOrGetSession(data) { + return request({ + url: '/system/session/createOrGetSession', + method: 'post', + data: data + }) +} + +// 使用现有的消息接口发送消息 +export function sendTextMessage(data) { + return request({ + url: '/system/message/send', + method: 'post', + data: data + }) +} + +// 使用现有的消息接口获取会话消息 +export function getSessionMessages(sessionId) { + const query = { + sessionId: sessionId, + delFlag: '0' + } + return request({ + url: '/system/message/list', + method: 'get', + params: query + }) +} + +// 标记消息为已读(通过修改消息接口) +export function markMessagesAsRead(sessionId, senderType) { + return request({ + url: '/system/message/markAllRead', + method: 'post', + data: { sessionId, senderType } + }) +} + +// 获取用户会话列表 +export function getUserSessions(userId) { + const query = { + userId: userId, + delFlag: '0' + } + return request({ + url: '/system/session/list', + method: 'get', + params: query + }) +} + +// 结束会话 +export function endSession(sessionId, reason) { + return request({ + url: '/system/session/end', + method: 'post', + data: { sessionId, reason } + }) +} diff --git a/chenhai-ui/src/api/system/consultation.js b/chenhai-ui/src/api/system/consultation.js deleted file mode 100644 index 55c4222..0000000 --- a/chenhai-ui/src/api/system/consultation.js +++ /dev/null @@ -1,44 +0,0 @@ -import request from '@/utils/request' - -// 查询专家咨询列表 -export function listConsultation(query) { - return request({ - url: '/system/consultation/list', - method: 'get', - params: query - }) -} - -// 查询专家咨询详细 -export function getConsultation(consultationId) { - return request({ - url: '/system/consultation/' + consultationId, - method: 'get' - }) -} - -// 新增专家咨询 -export function addConsultation(data) { - return request({ - url: '/system/consultation', - method: 'post', - data: data - }) -} - -// 修改专家咨询 -export function updateConsultation(data) { - return request({ - url: '/system/consultation', - method: 'put', - data: data - }) -} - -// 删除专家咨询 -export function delConsultation(consultationId) { - return request({ - url: '/system/consultation/' + consultationId, - method: 'delete' - }) -} diff --git a/chenhai-ui/src/api/system/message.js b/chenhai-ui/src/api/system/message.js new file mode 100644 index 0000000..8e919c2 --- /dev/null +++ b/chenhai-ui/src/api/system/message.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询兽医咨询聊天消息列表 +export function listMessage(query) { + return request({ + url: '/system/message/list', + method: 'get', + params: query + }) +} + +// 查询兽医咨询聊天消息详细 +export function getMessage(messageId) { + return request({ + url: '/system/message/' + messageId, + method: 'get' + }) +} + +// 新增兽医咨询聊天消息 +export function addMessage(data) { + return request({ + url: '/system/message', + method: 'post', + data: data + }) +} + +// 修改兽医咨询聊天消息 +export function updateMessage(data) { + return request({ + url: '/system/message', + method: 'put', + data: data + }) +} + +// 删除兽医咨询聊天消息 +export function delMessage(messageId) { + return request({ + url: '/system/message/' + messageId, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/api/system/query.js b/chenhai-ui/src/api/system/query.js new file mode 100644 index 0000000..0af5720 --- /dev/null +++ b/chenhai-ui/src/api/system/query.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询知识库查询列表 +export function listQuery(query) { + return request({ + url: '/system/query/list', + method: 'get', + params: query + }) +} + +// 查询知识库查询详细 +export function getQuery(id) { + return request({ + url: '/system/query/' + id, + method: 'get' + }) +} + +// 新增知识库查询 +export function addQuery(data) { + return request({ + url: '/system/query', + method: 'post', + data: data + }) +} + +// 修改知识库查询 +export function updateQuery(data) { + return request({ + url: '/system/query', + method: 'put', + data: data + }) +} + +// 删除知识库查询 +export function delQuery(id) { + return request({ + url: '/system/query/' + id, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/api/system/recommendation.js b/chenhai-ui/src/api/system/recommendation.js new file mode 100644 index 0000000..8ec8b40 --- /dev/null +++ b/chenhai-ui/src/api/system/recommendation.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询药品推荐列表 +export function listRecommendation(query) { + return request({ + url: '/system/recommendation/list', + method: 'get', + params: query + }) +} + +// 查询药品推荐详细 +export function getRecommendation(id) { + return request({ + url: '/system/recommendation/' + id, + method: 'get' + }) +} + +// 新增药品推荐 +export function addRecommendation(data) { + return request({ + url: '/system/recommendation', + method: 'post', + data: data + }) +} + +// 修改药品推荐 +export function updateRecommendation(data) { + return request({ + url: '/system/recommendation', + method: 'put', + data: data + }) +} + +// 删除药品推荐 +export function delRecommendation(id) { + return request({ + url: '/system/recommendation/' + id, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/api/system/session.js b/chenhai-ui/src/api/system/session.js new file mode 100644 index 0000000..066637a --- /dev/null +++ b/chenhai-ui/src/api/system/session.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询兽医咨询聊天会话列表 +export function listSession(query) { + return request({ + url: '/system/session/list', + method: 'get', + params: query + }) +} + +// 查询兽医咨询聊天会话详细 +export function getSession(sessionId) { + return request({ + url: '/system/session/' + sessionId, + method: 'get' + }) +} + +// 新增兽医咨询聊天会话 +export function addSession(data) { + return request({ + url: '/system/session', + method: 'post', + data: data + }) +} + +// 修改兽医咨询聊天会话 +export function updateSession(data) { + return request({ + url: '/system/session', + method: 'put', + data: data + }) +} + +// 删除兽医咨询聊天会话 +export function delSession(sessionId) { + return request({ + url: '/system/session/' + sessionId, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/api/system/tip.js b/chenhai-ui/src/api/system/tip.js new file mode 100644 index 0000000..2a53c6d --- /dev/null +++ b/chenhai-ui/src/api/system/tip.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询知识库查询提示列表 +export function listTip(query) { + return request({ + url: '/system/tip/list', + method: 'get', + params: query + }) +} + +// 查询知识库查询提示详细 +export function getTip(id) { + return request({ + url: '/system/tip/' + id, + method: 'get' + }) +} + +// 新增知识库查询提示 +export function addTip(data) { + return request({ + url: '/system/tip', + method: 'post', + data: data + }) +} + +// 修改知识库查询提示 +export function updateTip(data) { + return request({ + url: '/system/tip', + method: 'put', + data: data + }) +} + +// 删除知识库查询提示 +export function delTip(id) { + return request({ + url: '/system/tip/' + id, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/router/index.js b/chenhai-ui/src/router/index.js index 3316fd1..ae0c866 100644 --- a/chenhai-ui/src/router/index.js +++ b/chenhai-ui/src/router/index.js @@ -30,6 +30,74 @@ import Layout from '@/layout' // 公共路由 export const constantRoutes = [ + // 专家管理路由 + { + path: '/vet/experts', + component: Layout, + children: [ + { + path: 'index', + component: () => import('@/views/vet/experts/index'), + name: 'VetExperts', + meta: { + title: '专家管理', + icon: 'user', + permissions: ['vet:experts:list'] + } + } + ] + }, + + // 聊天页面路由 + { + path: '/chat', + component: Layout, + children: [ + { + path: 'index', + component: () => import('@/views/chat/index'), + name: 'ChatIndex', + meta: { + title: '在线咨询', + icon: 'message' + } + } + ] + }, + // 在路由文件中添加以下路由 + { + path: '/vet/experts', + component: Layout, + redirect: '/expert/chat/list', + meta: { + title: '专家中心', + icon: 'expert', + roles: ['vetnotshenhe', 'admin'] + }, + children: [ + { + path: 'chat/list', + component: () => import('@/views/chat/expert'), // 专家会话列表 + name: 'ExpertChatList', + meta: { + title: '我的咨询', + icon: 'list', + roles: ['vetnotshenhe', 'admin'] + } + }, + { + path: 'chat/index', + component: () => import('@/views/chat/expert'), // 专家聊天页面 + name: 'ExpertChat', + meta: { + title: '专家聊天', + icon: 'message', + roles: ['vetnotshenhe', 'admin'] + } + } + ] + }, + { path: '/redirect', component: Layout, diff --git a/chenhai-ui/src/views/chat/expert.vue b/chenhai-ui/src/views/chat/expert.vue new file mode 100644 index 0000000..d3eb534 --- /dev/null +++ b/chenhai-ui/src/views/chat/expert.vue @@ -0,0 +1,1178 @@ + + + + + + diff --git a/chenhai-ui/src/views/chat/index.vue b/chenhai-ui/src/views/chat/index.vue new file mode 100644 index 0000000..1d7f799 --- /dev/null +++ b/chenhai-ui/src/views/chat/index.vue @@ -0,0 +1,1353 @@ + + + + + + diff --git a/chenhai-ui/src/views/system/consultation/index.vue b/chenhai-ui/src/views/system/consultation/index.vue deleted file mode 100644 index b93cd82..0000000 --- a/chenhai-ui/src/views/system/consultation/index.vue +++ /dev/null @@ -1,460 +0,0 @@ - - - diff --git a/chenhai-ui/src/views/system/interpretation/index.vue b/chenhai-ui/src/views/system/interpretation/index.vue index fb3df34..3d4d8a8 100644 --- a/chenhai-ui/src/views/system/interpretation/index.vue +++ b/chenhai-ui/src/views/system/interpretation/index.vue @@ -111,7 +111,6 @@ - + + + - -