commit: 配置local的配置文件

This commit is contained in:
republicline 2025-03-14 14:23:04 +08:00
parent 868011b38e
commit 9cc5fed164
5 changed files with 347 additions and 200 deletions

View File

@ -40,7 +40,7 @@ public class RaxRedisOAuth2AuthorizationService implements OAuth2AuthorizationSe
String token = authorization.getAttribute("state");
redisTemplate.setValueSerializer(RedisSerializer.java());
redisTemplate.opsForValue()
.set(buildKey(OAuth2ParameterNames.STATE, token), authorization, TIMEOUT, TimeUnit.MINUTES);
.set(buildKey(OAuth2ParameterNames.STATE, token), authorization, TIMEOUT, TimeUnit.MINUTES); // token有效期
}
if (isCode(authorization)) {

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import java.net.URLDecoder;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
@ -110,31 +111,54 @@ public class ChatHandler implements WebSocketHandler {
// redisTemplate.expire("chat_" + dbName, 60 * 60, TimeUnit.SECONDS);
// redisTemplate.opsForHash().putAll("chat_sessionId_" + dbName, sessionDbMap);
// redisTemplate.expire("chat_" + dbName, 60 * 60, TimeUnit.SECONDS);
} else if ("msg".equals(jsonObject.getString("msgType")) ||
"audio".equals(jsonObject.getString("msgType"))) {
}
else if ("msg".equals(jsonObject.getString("msgType"))) {
//String patientName = jsonObject.getString("patientName");
String dbName = 'a' + jsonObject.getString("idNum");
String dbName = "a" + jsonObject.getString("idNum");
//String date = jsonObject.getString("date");
String msgType = jsonObject.getString("msgType");
// 消息内容
String content = jsonObject.getString("msg");
List<WebSocketSession> webSocketSessions = dbNameSessionList.get(dbName);
// 转发消息
JSONObject param = new JSONObject();
param.put("msgType", msgType);
param.put("createUser", username);
param.put("createTime", DateUtil.now());
param.put("msg", content);
param.put("dbName", dbName);
for (WebSocketSession webSocketSession : webSocketSessions) {
webSocketSession.sendMessage(new TextMessage(param.toJSONString().getBytes()));
if (webSocketSessions != null) {
// 转发消息
JSONObject param = new JSONObject();
param.put("msgType", msgType);
param.put("createUser", username);
param.put("createTime", DateUtil.now());
param.put("msg", content);
param.put("dbName", dbName);
for (WebSocketSession webSocketSession : webSocketSessions) {
webSocketSession.sendMessage(new TextMessage(param.toJSONString().getBytes()));
}
// 异步入库
EXECUTOR_SERVICE.execute(() -> saveChatMsg(param.toJSONString()));
// 之前的
// chatService.sendMessageMysql(username, patientName, dbName, msgType, session, msg, webSocketSessions);
}
// 异步入库
EXECUTOR_SERVICE.execute(() -> saveChatMsg(param.toJSONString()));
// 之前的
// chatService.sendMessageMysql(username, patientName, dbName, msgType, session, msg, webSocketSessions);
} else if ("historyChat".equals(jsonObject.getString("msgType"))) {
// 查询历史消息
String dbName = 'a' + jsonObject.getString("idNum");
ArrayList<Map> history = new ArrayList<>();
CustomDataSource source = new MySQLSource(mysqlHost, mysqlPassword, mysqlUsername, dbName);
source.open();
Connection connection = source.getConnection();
if (connection != null) {
Statement statement = connection.createStatement();
String sql = "select content, create_time, create_user from t_chat where deleted = 0 and revoked = 0 order by create_time asc ";
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
Map map = new HashMap();
map.put("msg", resultSet.getString("content"));
map.put("createUser", resultSet.getString("create_user"));
history.add(map);
}
JSONObject param = new JSONObject();
param.put("history", history);
param.put("msgType", "historyChat");
session.sendMessage(new TextMessage(param.toJSONString().getBytes()));
}
source.close();
}
} else {
String msgContent = "token无效,认证失败";
@ -277,7 +301,7 @@ public class ChatHandler implements WebSocketHandler {
JSONObject jsonObj = JSON.parseObject(jsonStr);
String msgType = jsonObj.getString("msgType");
Object content = jsonObj.get("content");
String content = jsonObj.getString("msg");
String username = jsonObj.getString("createUser");
String dbName = jsonObj.getString("dbName");
@ -289,7 +313,7 @@ public class ChatHandler implements WebSocketHandler {
PreparedStatement preparedStatement = null;
try {
preparedStatement = connection.prepareStatement("INSERT INTO t_chat (content, create_time, create_user, msg_type, deleted, revoked) VALUES (?, ?, ?, ?, ?, ?)");
preparedStatement.setObject(1, content);
preparedStatement.setString(1, content);
preparedStatement.setString(2, now);
preparedStatement.setString(3, username);
preparedStatement.setString(4, msgType);

View File

@ -0,0 +1,109 @@
spring:
# 定时任务属性配置
quartz:
properties:
org:
quartz:
scheduler:
instanceName: clusteredScheduler
instanceId: AUTO
jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
clusterCheckinInterval: 10000
useProperties: false
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 50
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
job-store-type: jdbc
jdbc:
initialize-schema: never # 生产注意设置为 never
# 上传文件大小限制
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
# 静态资源文件
mvc:
static-path-pattern: /static/**
# 缓存相关配置
cache:
type: redis
# 数据库相关配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: Xg137839
# 一期
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
data:
redis:
host: 110.41.142.124
port: 16373
password: rax137839
connect-timeout: 5000
database: 1 # 一期
# 本地文件系统
file:
local:
enable: true
base-path: /Users/wangchi/Downloads/img
## spring security 对外暴露接口设置
security:
oauth2:
ignore:
urls:
- /webjars/**
- /v3/api-docs/**
- /doc.html
- /swagger-ui.html
- /swagger-ui/**
- /swagger-resources
- /token/check_token
- /error
- /actuator/**
- /code/**
- /rax/**
- /hospital/getHospitalList
# 临时白名单
#--------------如下配置尽量不要变动-------------
# mybatis-plus 配置
mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml
global-config:
banner: false
db-config:
id-type: auto
where-strategy: not_empty
insert-strategy: not_empty
update-strategy: not_null
type-handlers-package: com.rax.common.mybatis.handler
configuration:
jdbc-type-for-null: 'null'
call-setters-on-nulls: true
shrink-whitespaces-in-sql: true
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
vital-sign:
except-database: admin,config,local
information-database: information
mongodb:
host: 110.41.142.124:27017
password: Xg137839mg
username: useradmin
mysql:
host: 110.41.142.124:3306
password: Xg137839
username: root

View File

@ -0,0 +1,187 @@
spring:
profiles:
active: prod
application:
name: ${project.artifactId}
# 定时任务属性配置
quartz:
properties:
org:
quartz:
scheduler:
instanceName: clusteredScheduler
instanceId: AUTO
jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
clusterCheckinInterval: 10000
useProperties: false
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 50
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
job-store-type: jdbc
jdbc:
initialize-schema: always # 生产注意设置为 never
# 上传文件大小限制
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
# 静态资源文件
mvc:
static-path-pattern: /static/**
gateway:
# 前端密码登录解密密钥,和前端 .env 保存一致16位
encodeKey: thanks,rax4cloud
# 跳过验证码的客户端 clientId1,clientId2
ignore-clients: test,rax
# 本地文件系统
file:
local:
enable: true
base-path: /Users/lengleng/Downloads/img
## spring security 对外暴露接口设置
security:
oauth2:
ignore:
urls:
- /webjars/**
- /v3/api-docs/**
- /doc.html
- /swagger-ui.html
- /swagger-ui/**
- /swagger-resources
- /token/check_token
- /error
- /actuator/**
- /code/**
- /rax/**
- /hospital/getHospitalList
# 临时白名单
# 阿里云短信
ali:
sms:
templateCode: SMS_471660037 # 模板code
accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK
accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK
signName: AAceshi #阿里云签名名
# 使用阿里提供的smsClient类
aliyun:
sms:
SMS_471660037:
accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK
accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK
signName: AAceshi #阿里云签名名
templateCode: SMS_471660037 # 模板code
#--------------如下配置尽量不要变动-------------
# mybatis-plus 配置
mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml
global-config:
banner: false
db-config:
id-type: auto
where-strategy: not_empty
insert-strategy: not_empty
update-strategy: not_null
type-handlers-package: com.rax.common.mybatis.handler
configuration:
jdbc-type-for-null: 'null'
call-setters-on-nulls: true
shrink-whitespaces-in-sql: true
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
---
spring:
config:
activate:
on-profile: prod
# 缓存相关配置
cache:
type: redis
data:
redis:
host: 110.41.142.124
port: 16373
password: rax137839
connect-timeout: 5000
# database: 0 # 二期
database: 1 # 一期
# 数据库相关配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: Xg137839
# 一期
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
# 二期
# url: jdbc:mysql://110.41.142.124:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
server:
port: 6679 #一期
# port: 6379 #二期
servlet:
context-path: /admin
vital-sign:
except-database: admin,config,local
information-database: information
mongodb:
host: 110.41.142.124:27017
password: Xg137839mg
username: useradmin
mysql:
host: 110.41.142.124:3306
password: Xg137839
username: root
---
spring:
config:
activate:
on-profile: dev
# 缓存相关配置
cache:
type: redis
data:
redis:
host: localhost
# 数据库相关配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 一期
# url: jdbc:mysql://localhost:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 二期
server:
port: 9999
servlet:
context-path: /admin
vital-sign:
except-database: admin,config,local
information-database: information
mongodb:
host: localhost:27017
password: root
username: root
mysql:
host: localhost:3306
password: root
username: root

View File

@ -1,187 +1,14 @@
spring:
profiles:
active: prod
application:
name: ${project.artifactId}
# 定时任务属性配置
quartz:
properties:
org:
quartz:
scheduler:
instanceName: clusteredScheduler
instanceId: AUTO
jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
clusterCheckinInterval: 10000
useProperties: false
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 50
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
job-store-type: jdbc
jdbc:
initialize-schema: always # 生产注意设置为 never
# 上传文件大小限制
active: application-loc.yml
server:
port: 6379
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
# 静态资源文件
mvc:
static-path-pattern: /static/**
context-path: /admin
gateway:
# 前端密码登录解密密钥,和前端 .env 保存一致16位
encodeKey: thanks,rax4cloud
# 跳过验证码的客户端 clientId1,clientId2
ignore-clients: test,rax
# 本地文件系统
file:
local:
enable: true
base-path: /Users/lengleng/Downloads/img
## spring security 对外暴露接口设置
security:
oauth2:
ignore:
urls:
- /webjars/**
- /v3/api-docs/**
- /doc.html
- /swagger-ui.html
- /swagger-ui/**
- /swagger-resources
- /token/check_token
- /error
- /actuator/**
- /code/**
- /rax/**
- /hospital/getHospitalList
# 临时白名单
# 阿里云短信
ali:
sms:
templateCode: SMS_471660037 # 模板code
accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK
accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK
signName: AAceshi #阿里云签名名
# 使用阿里提供的smsClient类
aliyun:
sms:
SMS_471660037:
accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK
accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK
signName: AAceshi #阿里云签名名
templateCode: SMS_471660037 # 模板code
#--------------如下配置尽量不要变动-------------
# mybatis-plus 配置
mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml
global-config:
banner: false
db-config:
id-type: auto
where-strategy: not_empty
insert-strategy: not_empty
update-strategy: not_null
type-handlers-package: com.rax.common.mybatis.handler
configuration:
jdbc-type-for-null: 'null'
call-setters-on-nulls: true
shrink-whitespaces-in-sql: true
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
---
spring:
config:
activate:
on-profile: prod
# 缓存相关配置
cache:
type: redis
data:
redis:
host: 110.41.142.124
port: 16373
password: rax137839
connect-timeout: 5000
# database: 0 # 二期
database: 1 # 一期
# 数据库相关配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: Xg137839
# 一期
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
# 二期
# url: jdbc:mysql://110.41.142.124:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
server:
port: 6679 #一期
# port: 6379 #二期
servlet:
context-path: /admin
vital-sign:
except-database: admin,config,local
information-database: information
mongodb:
host: 110.41.142.124:27017
password: Xg137839mg
username: useradmin
mysql:
host: 110.41.142.124:3306
password: Xg137839
username: root
---
spring:
config:
activate:
on-profile: dev
# 缓存相关配置
cache:
type: redis
data:
redis:
host: localhost
# 数据库相关配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 一期
# url: jdbc:mysql://localhost:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 二期
server:
port: 9999
servlet:
context-path: /admin
vital-sign:
except-database: admin,config,local
information-database: information
mongodb:
host: localhost:27017
password: root
username: root
mysql:
host: localhost:3306
password: root
username: root