Commit f79a08da47dc84bd99c5d7944d279ac51755e2b6

Authored by ljq
2 parents e7a6cc0e b2b3b29f

Merge remote-tracking branch 'origin/lggj' into lggj

src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -436,11 +436,11 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ @@ -436,11 +436,11 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ
436 List<LineRegion> lineRegions = lineRegionRepository.findAll(new CustomerSpecs<>(param)); 436 List<LineRegion> lineRegions = lineRegionRepository.findAll(new CustomerSpecs<>(param));
437 if (objects.size()>0) { 437 if (objects.size()>0) {
438 // 报站音频 438 // 报站音频
439 - Set<String> languages = new HashSet<>();  
440 - languages.add("cn");  
441 - languages.add("sh");  
442 - languages.add("en");  
443 - InputStream tts = ttsAndZip(objects, line, languages); 439 +// Set<String> languages = new HashSet<>();
  440 +// languages.add("cn");
  441 +// languages.add("sh");
  442 +// languages.add("en");
  443 +// InputStream tts = ttsAndZip(objects, line, languages);
444 /** 获取配置文件里的ftp登录参数 */ 444 /** 获取配置文件里的ftp登录参数 */
445 Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); 445 Map<String, Object> FTPParamMap = readPropertiesGetFTPParam();
446 // 压缩文件名 446 // 压缩文件名
@@ -519,8 +519,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -519,8 +519,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
519 } 519 }
520 520
521 521
522 - clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode()));  
523 - clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode()), tts); 522 +// clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode()));
  523 +// clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode()), tts);
524 524
525 resultMap.put("status", ResponseCode.SUCCESS); 525 resultMap.put("status", ResponseCode.SUCCESS);
526 }else { 526 }else {
src/main/java/com/bsth/util/IFlyUtils.java
@@ -37,6 +37,10 @@ public class IFlyUtils { @@ -37,6 +37,10 @@ public class IFlyUtils {
37 * @param text 37 * @param text
38 */ 38 */
39 public static void textToSpeechCn(String text, String outputPath) throws Exception { 39 public static void textToSpeechCn(String text, String outputPath) throws Exception {
  40 + File file = new File(outputPath);
  41 + if (!file.getParentFile().exists()) {
  42 + file.getParentFile().mkdirs();
  43 + }
40 String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); 44 String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://");
41 SpeechRequest request = new SpeechRequest(); 45 SpeechRequest request = new SpeechRequest();
42 request.getCommon().put("app_id", appId); 46 request.getCommon().put("app_id", appId);
@@ -45,7 +49,7 @@ public class IFlyUtils { @@ -45,7 +49,7 @@ public class IFlyUtils {
45 request.getBusiness().put("vcn", "x4_lingxiaoshan_profnews"); 49 request.getBusiness().put("vcn", "x4_lingxiaoshan_profnews");
46 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK"))); 50 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK")));
47 request.getData().put("status", 2); 51 request.getData().put("status", 2);
48 - websocketWork(wsUrl, request, new FileOutputStream(outputPath)); 52 + websocketWork(wsUrl, request, new FileOutputStream(file));
49 while (!request.isCompleted()) { 53 while (!request.isCompleted()) {
50 Thread.sleep(500); 54 Thread.sleep(500);
51 } 55 }
@@ -57,6 +61,10 @@ public class IFlyUtils { @@ -57,6 +61,10 @@ public class IFlyUtils {
57 * @param text 61 * @param text
58 */ 62 */
59 public static void textToSpeechSh(String text, String outputPath) throws Exception { 63 public static void textToSpeechSh(String text, String outputPath) throws Exception {
  64 + File file = new File(outputPath);
  65 + if (!file.getParentFile().exists()) {
  66 + file.getParentFile().mkdirs();
  67 + }
60 String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); 68 String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://");
61 SpeechRequest request = new SpeechRequest(); 69 SpeechRequest request = new SpeechRequest();
62 request.getCommon().put("app_id", appId); 70 request.getCommon().put("app_id", appId);
@@ -65,7 +73,7 @@ public class IFlyUtils { @@ -65,7 +73,7 @@ public class IFlyUtils {
65 request.getBusiness().put("vcn", "x3_ziling"); 73 request.getBusiness().put("vcn", "x3_ziling");
66 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK"))); 74 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK")));
67 request.getData().put("status", 2); 75 request.getData().put("status", 2);
68 - websocketWork(wsUrl, request, new FileOutputStream(outputPath)); 76 + websocketWork(wsUrl, request, new FileOutputStream(file));
69 while (!request.isCompleted()) { 77 while (!request.isCompleted()) {
70 Thread.sleep(500); 78 Thread.sleep(500);
71 } 79 }
@@ -77,6 +85,10 @@ public class IFlyUtils { @@ -77,6 +85,10 @@ public class IFlyUtils {
77 * @param text 85 * @param text
78 */ 86 */
79 public static void textToSpeechEn(String text, String outputPath) throws Exception { 87 public static void textToSpeechEn(String text, String outputPath) throws Exception {
  88 + File file = new File(outputPath);
  89 + if (!file.getParentFile().exists()) {
  90 + file.getParentFile().mkdirs();
  91 + }
80 String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); 92 String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://");
81 SpeechRequest request = new SpeechRequest(); 93 SpeechRequest request = new SpeechRequest();
82 request.getCommon().put("app_id", appId); 94 request.getCommon().put("app_id", appId);
@@ -85,7 +97,7 @@ public class IFlyUtils { @@ -85,7 +97,7 @@ public class IFlyUtils {
85 request.getBusiness().put("vcn", "x4_enus_luna_assist"); 97 request.getBusiness().put("vcn", "x4_enus_luna_assist");
86 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes(StandardCharsets.UTF_8))); 98 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes(StandardCharsets.UTF_8)));
87 request.getData().put("status", 2); 99 request.getData().put("status", 2);
88 - websocketWork(wsUrl, request, new FileOutputStream(outputPath)); 100 + websocketWork(wsUrl, request, new FileOutputStream(file));
89 while (!request.isCompleted()) { 101 while (!request.isCompleted()) {
90 Thread.sleep(500); 102 Thread.sleep(500);
91 } 103 }