提交 5b8b243d 作者: 洪东保

Merge branch 'hongdongbao'

...@@ -10,6 +10,7 @@ import com.cmeeting.service.*; ...@@ -10,6 +10,7 @@ import com.cmeeting.service.*;
import com.cmeeting.vo.TencentMeetingVO; import com.cmeeting.vo.TencentMeetingVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -39,17 +40,19 @@ public class CmeetingJob { ...@@ -39,17 +40,19 @@ public class CmeetingJob {
private MeetingRecordTemplateService meetingRecordTemplateService; private MeetingRecordTemplateService meetingRecordTemplateService;
@Resource @Resource
private UserIdMapper userIdMapper; private UserIdMapper userIdMapper;
@Value("${isDev}")
private Boolean isDev;
@PostConstruct // @PostConstruct
public void weComUserInit(){ public void weComUserInit(){
weComUserSync(); weComUserSync();
} }
@PostConstruct // @PostConstruct
public void tencentUserInit(){ public void tencentUserInit(){
TencentUserSync(); TencentUserSync();
} }
@PostConstruct // @PostConstruct
public void userBindInit(){ public void userBindInit(){
userBind(); userBind();
} }
...@@ -59,6 +62,9 @@ public class CmeetingJob { ...@@ -59,6 +62,9 @@ public class CmeetingJob {
*/ */
@Scheduled(cron = "0 30 6 * * ?") @Scheduled(cron = "0 30 6 * * ?")
public void weComUserSync() { public void weComUserSync() {
if (isDev) {
return;
}
try { try {
log.info("-------企微人员定时同步任务开始-------"); log.info("-------企微人员定时同步任务开始-------");
log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)); log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
...@@ -74,8 +80,10 @@ public class CmeetingJob { ...@@ -74,8 +80,10 @@ public class CmeetingJob {
* 腾讯会议人员定时同步 * 腾讯会议人员定时同步
*/ */
@Scheduled(cron = "0 0 7 * * ?") @Scheduled(cron = "0 0 7 * * ?")
// @Scheduled(fixedRate = 5 * 60 * 1000)
public void TencentUserSync() { public void TencentUserSync() {
if (isDev) {
return;
}
try { try {
log.info("-------腾讯会议人员定时同步任务开始-------"); log.info("-------腾讯会议人员定时同步任务开始-------");
log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)); log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
...@@ -92,6 +100,9 @@ public class CmeetingJob { ...@@ -92,6 +100,9 @@ public class CmeetingJob {
*/ */
@Scheduled(cron = "0 20 7 * * ?") @Scheduled(cron = "0 20 7 * * ?")
public void userBind() { public void userBind() {
if (isDev) {
return;
}
log.info("-------关联企微腾会人员定时任务开始-------"); log.info("-------关联企微腾会人员定时任务开始-------");
log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)); log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
weComService.userBind(); weComService.userBind();
...@@ -99,8 +110,10 @@ public class CmeetingJob { ...@@ -99,8 +110,10 @@ public class CmeetingJob {
} }
@Scheduled(fixedRate = 20 * 60 * 1000,initialDelay = 2 * 60 * 1000) @Scheduled(fixedRate = 20 * 60 * 1000,initialDelay = 2 * 60 * 1000)
// @Scheduled(fixedRate = 20 * 60 * 1000)
public void execute() { public void execute() {
if (isDev) {
return;
}
//查出企微id和腾会id的关联关系 //查出企微id和腾会id的关联关系
List<UserId> userIdRelations = userIdMapper.selectList(null); List<UserId> userIdRelations = userIdMapper.selectList(null);
Map<String,String> widTidRelations = userIdRelations.stream().collect(Collectors.toMap(UserId::getWid,UserId::getTid)); Map<String,String> widTidRelations = userIdRelations.stream().collect(Collectors.toMap(UserId::getWid,UserId::getTid));
...@@ -136,8 +149,10 @@ public class CmeetingJob { ...@@ -136,8 +149,10 @@ public class CmeetingJob {
* 定时扫描早于一小时之前的,所有未重试过的会议,重新生成纪要 * 定时扫描早于一小时之前的,所有未重试过的会议,重新生成纪要
*/ */
@Scheduled(fixedRate = 30 * 60 * 1000,initialDelay = 10 * 60 * 1000) @Scheduled(fixedRate = 30 * 60 * 1000,initialDelay = 10 * 60 * 1000)
// @Scheduled(fixedRate = 30 * 60 * 1000)
public void meetingMinutesRetry() { public void meetingMinutesRetry() {
if (isDev) {
return;
}
try { try {
log.info("-------生成纪要重试定时任务开始-------"); log.info("-------生成纪要重试定时任务开始-------");
log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)); log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
...@@ -182,8 +197,10 @@ public class CmeetingJob { ...@@ -182,8 +197,10 @@ public class CmeetingJob {
* 定时扫描早于一小时之前的,所有邮件推送未重试过的会议,重新推送邮件 * 定时扫描早于一小时之前的,所有邮件推送未重试过的会议,重新推送邮件
*/ */
@Scheduled(fixedRate = 30 * 60 * 1000,initialDelay = 15 * 60 * 1000) @Scheduled(fixedRate = 30 * 60 * 1000,initialDelay = 15 * 60 * 1000)
// @Scheduled(fixedRate = 30 * 60 * 1000)
public void emailPushRetry() { public void emailPushRetry() {
if (isDev) {
return;
}
try { try {
log.info("-------邮件推送重试定时任务开始-------"); log.info("-------邮件推送重试定时任务开始-------");
log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)); log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
......
server: server:
port: 8081 port: 8105
############################################################## minio ############################################################## minio
MINIO_ADDRESS: http://192.168.10.154:9000 MINIO_ADDRESS: http://192.168.10.50:9001
MINIO_BUCKET: zhongji MINIO_BUCKET: zhongji
MINIO_USERNAME: minio MINIO_USERNAME: aigc
MINIO_PASSWORD: minio123 MINIO_PASSWORD: aigc1qaz2wsx
############################################################## redis ############################################################## redis
REDIS_ADDRESS: 192.168.10.154 REDIS_ADDRESS: 192.168.10.157
REDIS_PORT: 6380 REDIS_PORT: 6379
REDIS_PASS: standard123 REDIS_PASS: standard123
REDIS_DATABASE: 8 REDIS_DATABASE: 3
############################################################## llm ############################################################## llm
# local # local
LLM_API_ADDR: https://bedrock.chatbot.cn LLM_API_ADDR: https://bedrock.chatbot.cn
# prod
#LLM_API_ADDR: http://10.56.1.150:8000
############################################################## tencent meeting
# local
#TENCENT_APPID: 211153201
#TENCENT_SDKID: 28370276340
#TENCENT_SECRETID: BKOMDZVbvh0iT7k6UHsSizAWBCOVDtT6
#TENCENT_SECRETKEY: 3Y1j0mzNp7KChKFJGyaEnZHLobFoAQ8eLwfaMx8nLbtXAerO
#TENCENT_ADMIN_USERID: woaJARCQAAhkyWGuf8n9InhZsxQstjjA
#TENCENT_ADMIN_USERID: woaJARCQAAJU1EsO73Ww5rn8YHMW6iYA
# prod # prod
TENCENT_APPID: 210468336 TENCENT_APPID: 210468336
...@@ -52,15 +42,15 @@ spring: ...@@ -52,15 +42,15 @@ spring:
datasource: datasource:
# 主数据源 # 主数据源
master: master:
jdbc-url: jdbc:mysql://192.168.10.154:3307/aigc-zhongji-test?useSSL=false&characterEncoding=utf8&serverTimezone=UTC jdbc-url: jdbc:mysql://192.168.10.157:3306/zhongji-aigc?useSSL=false&characterEncoding=utf8&serverTimezone=UTC
username: root username: root
password: 123456 password: qizhi123
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
# 从数据源 # 从数据源
slave: slave:
jdbc-url: jdbc:mysql://192.168.10.154:3307/useradmin-zhongji-test?useSSL=false&characterEncoding=utf8&serverTimezone=UTC jdbc-url: jdbc:mysql://192.168.10.157:3306/zhongji-user?useSSL=false&characterEncoding=utf8&serverTimezone=UTC
username: root username: root
password: 123456 password: qizhi123
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
redis: redis:
database: ${REDIS_DATABASE} database: ${REDIS_DATABASE}
...@@ -75,9 +65,6 @@ spring: ...@@ -75,9 +65,6 @@ spring:
timeout: 6000ms timeout: 6000ms
password: ${REDIS_PASS} password: ${REDIS_PASS}
# MyBatis ??
# mybatis.mapper-locations=classpath:mapper/primary/*.xml
mybatis.type-aliases-package: com.cmeeting.pojo\ mybatis.type-aliases-package: com.cmeeting.pojo\
mybatis: mybatis:
configuration: configuration:
...@@ -141,12 +128,12 @@ ldap: ...@@ -141,12 +128,12 @@ ldap:
domain: '@cimc.com' domain: '@cimc.com'
userAdmin: userAdmin:
domain: http://192.168.10.154:8303 domain: http://192.168.10.157:8103
systemDomain: http://192.168.10.154:8301 systemDomain: http://192.168.10.157:8101
appId: af94e0ec9cc0bef2bfa63f470f6f4351 appId: af94e0ec9cc0bef2bfa63f470f6f4351
secret: 4luHTMYMyXzOmDHN0ZOSMwOst702plcr9EKqAHtT8Nag6EPlP0VSFvqv9Zq0NRDE secret: 4luHTMYMyXzOmDHN0ZOSMwOst702plcr9EKqAHtT8Nag6EPlP0VSFvqv9Zq0NRDE
file-download-path: /download/minio/ file-download-path: /download/minio/
docDomain: http://192.168.10.154:8302/knowledgePlatform docDomain: http://192.168.10.157:8102/knowledgePlatform
removeMenus: 关键词回复,业务词库,同义词管理,答案库 removeMenus: 关键词回复,业务词库,同义词管理,答案库
...@@ -169,3 +156,5 @@ logging: ...@@ -169,3 +156,5 @@ logging:
com.cmeeting.mapper.primary: TRACE com.cmeeting.mapper.primary: TRACE
com.cmeeting.mapper.secondary: TRACE com.cmeeting.mapper.secondary: TRACE
root: DEBUG root: DEBUG
isDev: true
\ No newline at end of file
import com.tencentcloudapi.wemeet.Client;
import com.tencentcloudapi.wemeet.core.authenticator.JWTAuthenticator;
import com.tencentcloudapi.wemeet.core.exception.ClientException;
import com.tencentcloudapi.wemeet.core.exception.ServiceException;
import com.tencentcloudapi.wemeet.service.records.api.RecordsApi;
import com.tencentcloudapi.wemeet.service.records.model.V1AddressesRecordFileIdGet200Response;
import com.tencentcloudapi.wemeet.service.records.model.V1AddressesRecordFileIdGet200ResponseAiMeetingTranscriptsInner;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.List;
public class MeetingApiTest {
public static void main(String[] args) throws ServiceException, ClientException {
// 根据recordFileId下载源文件
String tencentAppId = "210468336";
String tencentSdkId = "28790143843";
String tencentSecretId = "0ks7u8cgQ8DGVtlYZeRA9TxZCjvUT3oL";
String tencentSecretKey = "gQU09rkJjiQfiGcUYdhiKq5Ol6LebXg4w7F7Ol0rwvvdv3Xy";
String tencentAdminUserId = "woaJARCQAAftcvU6GGoOn66rdSZ4IrOA";
String recordFileId = "1943182582051381249";
Client client = new Client.Builder()
.withAppId(tencentAppId).withSdkId(tencentSdkId)
.withSecret(tencentSecretId,tencentSecretKey)
.build();
RecordsApi.ApiV1AddressesRecordFileIdGetRequest addressRequest =
new RecordsApi.ApiV1AddressesRecordFileIdGetRequest.Builder(recordFileId)
.operatorId(tencentAdminUserId)
.operatorIdType("1")
.build();
RecordsApi.ApiV1AddressesRecordFileIdGetResponse addressResponse =
client.records().v1AddressesRecordFileIdGet(addressRequest,
new JWTAuthenticator.Builder().nonce(BigInteger.valueOf(Math.abs((new SecureRandom()).nextInt())))
.timestamp(String.valueOf(System.currentTimeMillis() / 1000L)));
// 处理响应
if (addressResponse != null && addressResponse.getData() != null) {
V1AddressesRecordFileIdGet200Response addressData = addressResponse.getData();
// 获取AI会议转录文件
List<V1AddressesRecordFileIdGet200ResponseAiMeetingTranscriptsInner> transcripts =
addressData.getAiMeetingTranscripts();
if (transcripts != null && !transcripts.isEmpty()) {
// 处理每个转录文件
for (V1AddressesRecordFileIdGet200ResponseAiMeetingTranscriptsInner transcript : transcripts) {
String fileType = transcript.getFileType();
if (fileType.equalsIgnoreCase("txt")) {
String downloadUrl = transcript.getDownloadAddress();
System.out.println("downloadUrl: " + downloadUrl);
byte[] fileData = downloadFile(downloadUrl);
// 2. 将二进制文件转换为文本
String recordTextContent = new String(fileData, StandardCharsets.UTF_8);
System.out.println(recordTextContent);
}
}
}
}
}
private static byte[] downloadFile(String url) {
// 实现文件下载逻辑
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(url).build();
try {
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
return response.body().bytes();
}catch (Exception e){
throw new RuntimeException("下载文件失败", e);
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论