mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge remote-tracking branch 'origin/main'
# Conflicts: # cf-module-prod-manage/cf-module-prod-manage-biz/pom.xml # cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/test/TestController.java
This commit is contained in:
+112
@@ -70,8 +70,120 @@ public class TestController {
|
||||
}
|
||||
|
||||
|
||||
public class JacobTestController {
|
||||
/* *
|
||||
* 语音转文字并播放
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
private static void convertTextToSpeech(String text) {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
//jacob.dll没成功安装,执行这一步会出错
|
||||
//构建音频格式 调用注册表应用
|
||||
Dispatch spAudioFormat = new ActiveXComponent("Sapi.SpAudioFormat").getObject();
|
||||
//音频文件输出流
|
||||
Dispatch spFileStream = new ActiveXComponent("Sapi.SpFileStream").getObject();
|
||||
//构建音频对象
|
||||
Dispatch spVoice = new ActiveXComponent("Sapi.SpVoice").getObject();
|
||||
|
||||
//设置spAudioFormat音频流格式类型22
|
||||
Dispatch.put(spAudioFormat, "Type", new Variant(22));
|
||||
//设置spFileStream文件输出流的音频格式
|
||||
Dispatch.putRef(spFileStream, "Format", spAudioFormat);
|
||||
|
||||
//设置spFileStream文件输出流参数地址等
|
||||
Dispatch.call(spFileStream, "Open", new Variant("E:AAAAA\48641486.wav"), new Variant(3), new Variant(true));
|
||||
//设置spVoice声音对象的音频输出流为输出文件对象
|
||||
Dispatch.putRef(spVoice, "AudioOutputStream", spFileStream);
|
||||
//设置spVoice声音对象的音量大小100
|
||||
Dispatch.put(spVoice, "Volume", new Variant(100));
|
||||
//设置spVoice声音对象的速度 0为正常速度,范围【..-2 -1 0 1 2..】
|
||||
Dispatch.put(spVoice, "Rate", new Variant(0));
|
||||
//设置spVoice声音对象中的文本内容
|
||||
Dispatch.call(spVoice, "Speak", new Variant(text));
|
||||
//关闭spFileStream输出文件
|
||||
Dispatch.call(spFileStream, "Close");
|
||||
|
||||
//释放资源
|
||||
spVoice.safeRelease();
|
||||
spAudioFormat.safeRelease();
|
||||
spFileStream.safeRelease();
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* private static XxlJobProperties aabb(){
|
||||
|
||||
XxlJobParameter xxlJobParameter = new XxlJobParameter();
|
||||
|
||||
xxlJobParameter.setEnabled(false);
|
||||
xxlJobParameter.setAccessToken("1122");
|
||||
xxlJobParameter.setAddresses("五阿里乌");
|
||||
xxlJobParameter.setAppName("aaappn");
|
||||
XxlJobProperties bean = BeanUtils.toBean(xxlJobParameter, XxlJobProperties.class);
|
||||
return bean;
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void deleteFiles(List<String> filePaths) {
|
||||
// 检查文件路径集合是否为空
|
||||
if (filePaths == null || filePaths.isEmpty()) {
|
||||
System.out.println("文件路径集合为空");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String filePath : filePaths) {
|
||||
// 检查文件路径是否为空
|
||||
if (filePath == null || filePath.isEmpty()) {
|
||||
System.out.println("文件路径为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
File file = new File(filePath);
|
||||
|
||||
// 检查文件是否存在
|
||||
if (!file.exists()) {
|
||||
System.out.println("文件不存在:" + filePath);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 检查是否是文件
|
||||
if (!file.isFile()) {
|
||||
System.out.println("路径指向的不是文件:" + filePath);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 尝试删除文件
|
||||
if (file.delete()) {
|
||||
System.out.println("文件删除成功:" + filePath);
|
||||
} else {
|
||||
System.out.println("文件删除失败:" + filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Integer aacc(){
|
||||
|
||||
RedisTemplate<Object, Object> re = new RedisTemplate<>();
|
||||
|
||||
int randomInt = new Random(System.currentTimeMillis()).nextInt(900) + 100;// 生成100到999之间的随机数
|
||||
|
||||
|
||||
|
||||
return randomInt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@TestOnly
|
||||
|
||||
Reference in New Issue
Block a user