Compare commits

..

1 Commits

Author SHA1 Message Date
bjzhoujian
0d6cc3dde0 修改redis、nacos、MySQL、ActiveMQ、RabbitMQ、elasticsearch配置 2025-12-09 13:15:11 +08:00
15 changed files with 34 additions and 95 deletions

View File

@@ -8,7 +8,7 @@ public class CaseAiConstants {
public static final String CASE_DOC_DELETE_INTERFACE_NAME = "文档删除"; public static final String CASE_DOC_DELETE_INTERFACE_NAME = "文档删除";
public static final String CHAT_SYS_ERR_MSG = "当前无法获取回答,请稍后重试"; public static final String CHAT_SYS_ERR_MSG = "服务繁忙,请稍后再试。";
public static final String CHAT_NET_ERR_MSG = "网络异常,请稍后再试"; public static final String CHAT_NET_ERR_MSG = "网络异常,请稍后再试";
} }

View File

@@ -163,7 +163,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
//老师信息 //老师信息
//if(u.getUserType()!=null && u.getUserType()==2) { //if(u.getUserType()!=null && u.getUserType()==2) {
/*if ((user.getTeacher() != null && user.getTeacher()) || (user.getUserType() != null && user.getUserType() == 2)) { if ((user.getTeacher() != null && user.getTeacher()) || (user.getUserType() != null && user.getUserType() == 2)) {
Teacher t = teacherDao.get(user.getId()); Teacher t = teacherDao.get(user.getId());
log.info("用户有教师身份,处理教师身份"); log.info("用户有教师身份,处理教师身份");
if (t == null) { if (t == null) {
@@ -182,7 +182,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
} else { } else {
log.info("教师身份已存在,不再添加"); log.info("教师身份已存在,不再添加");
} }
}*/ }
log.info("同步用户完成"); log.info("同步用户完成");
} }

View File

@@ -230,7 +230,7 @@ public class CaseAiChatApi extends ApiBaseController {
aiChatConversationData.setCaseRefers(caseAiMessageVo.getCaseRefer()); aiChatConversationData.setCaseRefers(caseAiMessageVo.getCaseRefer());
aiChatConversationData.setSuggestions(caseAiMessageVo.getSuggestions()); aiChatConversationData.setSuggestions(caseAiMessageVo.getSuggestions());
aiChatConversationData.setUserId(userId); aiChatConversationData.setUserId(userId);
if (elasticSearchIndexService.createData(aiChatConversationData) != null) { if (elasticSearchIndexService.createData(aiChatConversationData)) {
return success("创建成功"); return success("创建成功");
} }
return error("创建失败"); return error("创建失败");

View File

@@ -41,7 +41,7 @@ public interface IElasticSearchIndexService {
* @param data * @param data
* @return * @return
*/ */
String createData(AiChatConversationData data); boolean createData(AiChatConversationData data);
/** /**
* 查询数据 * 查询数据

View File

@@ -2,7 +2,6 @@ package com.xboe.module.boecase.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSON;
import com.xboe.constants.CaseAiConstants; import com.xboe.constants.CaseAiConstants;
import com.xboe.core.CurrentUser; import com.xboe.core.CurrentUser;
import com.xboe.core.orm.FieldFilters; import com.xboe.core.orm.FieldFilters;
@@ -176,22 +175,22 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
if (org.apache.commons.lang3.StringUtils.isBlank(accessToken)) { if (org.apache.commons.lang3.StringUtils.isBlank(accessToken)) {
errMessage(sseEmitter, conversationId, CaseAiConstants.CHAT_SYS_ERR_MSG); errMessage(sseEmitter, conversationId, CaseAiConstants.CHAT_SYS_ERR_MSG);
// 先响应给前端 // 先响应给前端
sseEmitter.complete();
conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode()); conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode());
conversationData.setErrorMsg("获取AccessToken时发生异常"); conversationData.setErrorMsg("获取AccessToken时发生异常");
conversationData.appendAnswer(CaseAiConstants.CHAT_SYS_ERR_MSG); conversationData.appendAnswer(CaseAiConstants.CHAT_SYS_ERR_MSG);
saveConversationData(sseEmitter, conversationData); saveConversationData(conversationData);
sseEmitter.complete();
return sseEmitter; return sseEmitter;
} }
} catch (Exception e) { } catch (Exception e) {
log.error("获取access_token失败", e); log.error("获取access_token失败", e);
errMessage(sseEmitter, conversationId, CaseAiConstants.CHAT_SYS_ERR_MSG); errMessage(sseEmitter, conversationId, CaseAiConstants.CHAT_SYS_ERR_MSG);
// 先响应给前端 // 先响应给前端
sseEmitter.complete();
conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode()); conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode());
conversationData.setErrorMsg("获取AccessToken时发生异常" + e.getMessage()); conversationData.setErrorMsg("获取AccessToken时发生异常" + e.getMessage());
conversationData.appendAnswer(CaseAiConstants.CHAT_SYS_ERR_MSG); conversationData.appendAnswer(CaseAiConstants.CHAT_SYS_ERR_MSG);
saveConversationData(sseEmitter, conversationData); saveConversationData(conversationData);
sseEmitter.complete();
return sseEmitter; return sseEmitter;
} }
String apiCode = caseAiProperties.getChatApiCode(); String apiCode = caseAiProperties.getChatApiCode();
@@ -240,11 +239,11 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
} }
errMessage(sseEmitter, conversationId, sseContent); errMessage(sseEmitter, conversationId, sseContent);
sseEmitter.complete();
conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode()); conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode());
conversationData.setErrorMsg(sseContent); conversationData.setErrorMsg(sseContent);
conversationData.appendAnswer(sseContent); conversationData.appendAnswer(sseContent);
saveConversationData(sseEmitter, conversationData); saveConversationData(conversationData);
sseEmitter.complete();
// 关闭eventSource // 关闭eventSource
eventSource.cancel(); eventSource.cancel();
return; return;
@@ -257,7 +256,7 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
public void onClosed(@NotNull EventSource eventSource) { public void onClosed(@NotNull EventSource eventSource) {
log.info("调用接口 [{}] 接口关闭", request.url()); log.info("调用接口 [{}] 接口关闭", request.url());
// 对话完成保存到ES // 对话完成保存到ES
saveConversationData(sseEmitter, conversationData); saveConversationData(conversationData);
// 从Map中移除已完成的会话 // 从Map中移除已完成的会话
conversationEventSourceMap.remove(conversationId); conversationEventSourceMap.remove(conversationId);
sseEmitter.complete(); sseEmitter.complete();
@@ -353,14 +352,14 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
} }
errMessage(sseEmitter, conversationId, errorMessage); errMessage(sseEmitter, conversationId, errorMessage);
sseEmitter.complete();
// 从Map中移除失败的会话 // 从Map中移除失败的会话
conversationEventSourceMap.remove(conversationId); conversationEventSourceMap.remove(conversationId);
// 即使失败也要将已有的对话数据保存到ES // 即使失败也要将已有的对话数据保存到ES
conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode()); conversationData.setStatus(CaseAiChatErrCodeEnum.AIOT_ERROR.getCode());
conversationData.setErrorMsg(errorMessage); conversationData.setErrorMsg(errorMessage);
conversationData.appendAnswer(errorMessage); conversationData.appendAnswer(errorMessage);
saveConversationData(sseEmitter, conversationData); saveConversationData(conversationData);
sseEmitter.complete();
} }
}; };
@@ -408,7 +407,6 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
httpPost.setHeader("access_token", accessToken); httpPost.setHeader("access_token", accessToken);
httpPost.setHeader("X-AI-ApiCode", apiCode); httpPost.setHeader("X-AI-ApiCode", apiCode);
httpPost.setHeader("Content-Type", "application/json"); httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("X-AI-ApiRawResponse", "true");
// 设置请求体 // 设置请求体
JSONObject requestBody = new JSONObject(); JSONObject requestBody = new JSONObject();
@@ -1007,17 +1005,7 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
* 异步存储会话数据 * 异步存储会话数据
* @param conversationData * @param conversationData
*/ */
private void saveConversationData(SseEmitter sseEmitter, AiChatConversationData conversationData) { private void saveConversationData(AiChatConversationData conversationData) {
try { esChatExecutor.execute(() -> elasticSearchIndexService.createData(conversationData));
String docId = elasticSearchIndexService.createData(conversationData);
if (docId != null) {
JSONObject responseData = new JSONObject();
responseData.put("docId", docId);
responseData.put("status", "9");
sseEmitter.send(responseData.toJSONString());
}
} catch (Exception e) {
log.error("docId消息发送失败", e);
}
} }
} }

View File

@@ -163,10 +163,10 @@ public class ElasticSearchIndexServiceImpl implements IElasticSearchIndexService
} }
@Override @Override
public String createData(AiChatConversationData conversationData) { public boolean createData(AiChatConversationData conversationData) {
if (elasticsearchClient == null) { if (elasticsearchClient == null) {
log.error("未配置Elasticsearch客户端无法保存对话记录"); log.error("未配置Elasticsearch客户端无法保存对话记录");
return null; return false;
} }
try { try {
@@ -209,10 +209,10 @@ public class ElasticSearchIndexServiceImpl implements IElasticSearchIndexService
IndexResponse indexResponse = elasticsearchClient.index(indexRequest, RequestOptions.DEFAULT); IndexResponse indexResponse = elasticsearchClient.index(indexRequest, RequestOptions.DEFAULT);
log.info("保存对话记录到ES成功文档ID: {}", indexResponse.getId()); log.info("保存对话记录到ES成功文档ID: {}", indexResponse.getId());
return indexResponse.getId(); return true;
} catch (Exception e) { } catch (Exception e) {
log.error("保存对话记录到ES异常", e); log.error("保存对话记录到ES异常", e);
return null; return false;
} }
} }
@@ -238,7 +238,6 @@ public class ElasticSearchIndexServiceImpl implements IElasticSearchIndexService
Map<String, Object> sourceMap = hit.getSourceAsMap(); Map<String, Object> sourceMap = hit.getSourceAsMap();
CaseAiMessageVo data = parseMessageFromES(sourceMap); CaseAiMessageVo data = parseMessageFromES(sourceMap);
if (data != null) { if (data != null) {
data.setDocId(hit.getId());
list.add(data); list.add(data);
} }
} }
@@ -254,7 +253,6 @@ public class ElasticSearchIndexServiceImpl implements IElasticSearchIndexService
private CaseAiMessageVo parseMessageFromES(Map<String, Object> sourceMap) { private CaseAiMessageVo parseMessageFromES(Map<String, Object> sourceMap) {
try { try {
CaseAiMessageVo messageVo = new CaseAiMessageVo(); CaseAiMessageVo messageVo = new CaseAiMessageVo();
messageVo.setConversationId((String) sourceMap.get("conversationId"));
messageVo.setQuery((String) sourceMap.get("query")); messageVo.setQuery((String) sourceMap.get("query"));
messageVo.setAnswer((String) sourceMap.get("answer")); messageVo.setAnswer((String) sourceMap.get("answer"));
if (sourceMap.containsKey("startTime")) { if (sourceMap.containsKey("startTime")) {
@@ -389,7 +387,6 @@ public class ElasticSearchIndexServiceImpl implements IElasticSearchIndexService
Map<String, Object> sourceMap = hit.getSourceAsMap(); Map<String, Object> sourceMap = hit.getSourceAsMap();
CaseAiMessageVo data = parseMessageFromES(sourceMap); CaseAiMessageVo data = parseMessageFromES(sourceMap);
if (data != null) { if (data != null) {
data.setDocId(hit.getId());
list.add(data); list.add(data);
} }
} }

View File

@@ -10,15 +10,6 @@ import java.util.List;
*/ */
@Data @Data
public class CaseAiMessageVo { public class CaseAiMessageVo {
/**
* ES docId
*/
private String docId;
/**
* 会话ID
*/
private String conversationId;
/** /**
* 用户提问内容 * 用户提问内容

View File

@@ -16,7 +16,6 @@ import com.xboe.module.course.entity.*;
import com.xboe.module.course.service.*; import com.xboe.module.course.service.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@@ -138,10 +137,6 @@ public class CourseManageApi extends ApiBaseController{
dto.setOrgIds(ids); dto.setOrgIds(ids);
dto.setReadIds(userOrgIds.getReadIds()); dto.setReadIds(userOrgIds.getReadIds());
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto); PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
//补充审核人,审核时间字段
if(CollectionUtils.isEmpty(coursePageList.getList())){
fullAuditInfo(coursePageList.getList());
}
return success(coursePageList); return success(coursePageList);
}catch(Exception e) { }catch(Exception e) {
log.error("管理课程列表查询错误",e); log.error("管理课程列表查询错误",e);
@@ -1231,19 +1226,4 @@ public class CourseManageApi extends ApiBaseController{
courseService.saveTip(aid); courseService.saveTip(aid);
return success(true); return success(true);
} }
public void fullAuditInfo(List<Course> list){
List<String> courseIdList = list.stream().map(Course::getId).collect(Collectors.toList());
List<CourseHRBPAudit> auditList = hrbpAuditService.listByCourseIds(courseIdList);
Map<String,CourseHRBPAudit> map = auditList.stream().collect(Collectors.toMap(CourseHRBPAudit::getCourseId, i->i));
list.forEach(item ->{
CourseHRBPAudit audit = map.get(item.getId());
if(audit != null){
//暂时获取这两个字段,之后看是否需要调整
item.setAuditUser(audit.getAuditUser());
item.setAuditTime(audit.getAuditTime());
}
});
}
} }

View File

@@ -406,12 +406,6 @@ public class Course extends BaseEntity {
@Transient @Transient
private Boolean isTip; private Boolean isTip;
@Transient
private String auditUser;
@Transient
private LocalDateTime auditTime;
public Course(String id,String name,String summary,String coverImg,String sysCreateAid,String sysCreateBy,Integer type,LocalDateTime publishTime){ public Course(String id,String name,String summary,String coverImg,String sysCreateAid,String sysCreateBy,Integer type,LocalDateTime publishTime){
super.setId(id); super.setId(id);
this.name=name; this.name=name;

View File

@@ -57,8 +57,4 @@ public class CourseTeacher extends IdBaseEntity {
@Transient @Transient
private Integer teacherType; private Integer teacherType;
/**讲师头像*/
@Transient
private String photo;
} }

View File

@@ -56,7 +56,5 @@ public interface ICourseHRBPAuditService {
*/ */
PageList<CourseHRBPAudit> pageList(Integer pageIndex, Integer pageSize,int userType, CourseHRBPAudit info); PageList<CourseHRBPAudit> pageList(Integer pageIndex, Integer pageSize,int userType, CourseHRBPAudit info);
List<CourseHRBPAudit> listByCourseIds(List<String> courseIdList);
} }

View File

@@ -263,8 +263,4 @@ public class CourseHRBPAuditServiceImpl implements ICourseHRBPAuditService {
return courseHRBPAuditDao.get(id); return courseHRBPAuditDao.get(id);
} }
public List<CourseHRBPAudit> getByCourseIds(List<String> courseIdList){
return courseHRBPAuditDao.findList(FieldFilters.in("courseId",courseIdList));
}
} }

View File

@@ -221,7 +221,6 @@ public class StudyCourseApi extends ApiBaseController{
ct.setRemark(t.getDescription()); ct.setRemark(t.getDescription());
ct.setSupplier(t.getSupplier()); ct.setSupplier(t.getSupplier());
ct.setTeacherType(t.getTeacherType()); ct.setTeacherType(t.getTeacherType());
ct.setPhoto(t.getPhoto());
} }
if(redisTemplate.opsForValue().get(ct.getTeacherId())==null){ if(redisTemplate.opsForValue().get(ct.getTeacherId())==null){
List<String>list=new ArrayList<>(); List<String>list=new ArrayList<>();

View File

@@ -9,20 +9,20 @@ spring:
cloud: cloud:
nacos: nacos:
discovery: discovery:
server-addr: 10.251.113.100:8848 server-addr: 10.232.28.76:8848,10.232.28.83:8848,10.232.28.77:8848
config: config:
server-addr: 10.251.113.100:8848 server-addr: 10.232.28.76:8848,10.232.28.83:8848,10.232.28.77:8848
redis: redis:
database: 1 database: 1
host: 10.251.88.213 host: 10.232.27.44
password: qwert!W588 password: j2ZsxUyl
port: 6379 port: 6379
jpa: jpa:
hibernate: hibernate:
ddl-auto: none ddl-auto: none
datasource: datasource:
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull url: jdbc:mysql://10.232.27.47:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
username: admin username: admin
password: boeRds01 password: boeRds01
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
@@ -34,7 +34,7 @@ spring:
max-lifetime: 1800000 max-lifetime: 1800000
maximum-pool-size: 20 maximum-pool-size: 20
activemq: activemq:
broker-url: tcp://10.251.113.100:61616 broker-url: tcp://10.232.28.73:61616
user: admin user: admin
password: admin password: admin
jms: jms:
@@ -67,7 +67,7 @@ xboe:
url: https://u.boe.com/userbasic url: https://u.boe.com/userbasic
elasticsearch: elasticsearch:
server: server:
ip: 10.251.88.218 ip: 10.232.27.40
port: 9200 port: 9200
user: user:
password: password:
@@ -338,9 +338,9 @@ aop-log-record:
#不进行拦截的包或者类 #不进行拦截的包或者类
excludeClassNames: excludeClassNames:
activemq: activemq:
broker-url: tcp://10.251.113.100:61616 broker-url: tcp://10.232.28.73:61616
user: admin user: admin
password: admin password: admin
elasticsearch: elasticsearch:
host: 10.251.88.218 host: 10.232.27.40
port: 9200 port: 9200

View File

@@ -2,8 +2,8 @@
spring: spring:
redis: redis:
database: 1 database: 1
host: 10.251.88.213 host: 10.232.27.44
password: qwert!W588 password: j2ZsxUyl
port: 6379 port: 6379
jpa: jpa:
hibernate: hibernate:
@@ -16,12 +16,12 @@ spring:
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
db1: db1:
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
jdbc-url: jdbc:mysql://10.251.88.216:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull jdbc-url: jdbc:mysql://10.232.27.47:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
username: admin username: admin
password: boeRds01 password: boeRds01
db2: db2:
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
jdbc-url: jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull jdbc-url: jdbc:mysql://10.232.27.47:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
username: admin username: admin
password: boeRds01 password: boeRds01