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 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 ((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());
log.info("用户有教师身份,处理教师身份");
if (t == null) {
@@ -182,7 +182,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
} else {
log.info("教师身份已存在,不再添加");
}
}*/
}
log.info("同步用户完成");
}

View File

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

View File

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

View File

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

View File

@@ -10,15 +10,6 @@ import java.util.List;
*/
@Data
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 org.apache.commons.lang3.StringUtils;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -138,10 +137,6 @@ public class CourseManageApi extends ApiBaseController{
dto.setOrgIds(ids);
dto.setReadIds(userOrgIds.getReadIds());
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
//补充审核人,审核时间字段
if(CollectionUtils.isEmpty(coursePageList.getList())){
fullAuditInfo(coursePageList.getList());
}
return success(coursePageList);
}catch(Exception e) {
log.error("管理课程列表查询错误",e);
@@ -1231,19 +1226,4 @@ public class CourseManageApi extends ApiBaseController{
courseService.saveTip(aid);
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
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){
super.setId(id);
this.name=name;

View File

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

View File

@@ -55,8 +55,6 @@ public interface ICourseHRBPAuditService {
* @return
*/
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);
}
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.setSupplier(t.getSupplier());
ct.setTeacherType(t.getTeacherType());
ct.setPhoto(t.getPhoto());
}
if(redisTemplate.opsForValue().get(ct.getTeacherId())==null){
List<String>list=new ArrayList<>();

View File

@@ -9,20 +9,20 @@ spring:
cloud:
nacos:
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:
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:
database: 1
host: 10.251.88.213
password: qwert!W588
host: 10.232.27.44
password: j2ZsxUyl
port: 6379
jpa:
hibernate:
ddl-auto: none
datasource:
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
password: boeRds01
type: com.zaxxer.hikari.HikariDataSource
@@ -34,7 +34,7 @@ spring:
max-lifetime: 1800000
maximum-pool-size: 20
activemq:
broker-url: tcp://10.251.113.100:61616
broker-url: tcp://10.232.28.73:61616
user: admin
password: admin
jms:
@@ -67,7 +67,7 @@ xboe:
url: https://u.boe.com/userbasic
elasticsearch:
server:
ip: 10.251.88.218
ip: 10.232.27.40
port: 9200
user:
password:
@@ -338,9 +338,9 @@ aop-log-record:
#不进行拦截的包或者类
excludeClassNames:
activemq:
broker-url: tcp://10.251.113.100:61616
broker-url: tcp://10.232.28.73:61616
user: admin
password: admin
elasticsearch:
host: 10.251.88.218
host: 10.232.27.40
port: 9200

View File

@@ -2,8 +2,8 @@
spring:
redis:
database: 1
host: 10.251.88.213
password: qwert!W588
host: 10.232.27.44
password: j2ZsxUyl
port: 6379
jpa:
hibernate:
@@ -16,12 +16,12 @@ spring:
driverClassName: com.mysql.jdbc.Driver
db1:
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
password: boeRds01
db2:
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
password: boeRds01