|
@ -569,6 +569,7 @@ public class ImService {
|
|
|
String voiceIds = "";
|
|
|
try {
|
|
|
String voices = request.getParameter("voices");
|
|
|
System.out.println("voices"+voices);
|
|
|
if (org.apache.commons.lang3.StringUtils.isEmpty(voices)) {
|
|
|
return voices;
|
|
|
}
|
|
@ -602,12 +603,17 @@ public class ImService {
|
|
|
public String saveVoiceToDisk(String mediaId,String wechat_appid) throws Exception {
|
|
|
// 文件保存的临时路径
|
|
|
String tempPath = upload_temp_path + File.separator;
|
|
|
System.out.println("tempPath:"+tempPath);
|
|
|
// 拼接年月日路径
|
|
|
String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
|
|
|
System.out.println("datePath:"+datePath);
|
|
|
// 重命名文件
|
|
|
String fileBase = DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000);
|
|
|
System.out.println("fileBase:"+fileBase);
|
|
|
String newFileName = fileBase+ ".amr";
|
|
|
String mp3FileName = fileBase + ".mp3";
|
|
|
System.out.println("newFileName:"+newFileName);
|
|
|
System.out.println("mp3FileName:"+mp3FileName);
|
|
|
// 保存路径
|
|
|
File uploadFile = new File(tempPath + datePath + newFileName);
|
|
|
|
|
@ -626,6 +632,8 @@ public class ImService {
|
|
|
}
|
|
|
String amrFilePath = tempPath+datePath+newFileName;
|
|
|
String Mp3FilePath = tempPath+datePath+mp3FileName;
|
|
|
System.out.println("amrFilePath:"+amrFilePath);
|
|
|
System.out.println("Mp3FilePath:"+Mp3FilePath);
|
|
|
fileUtil.changeToMp3(amrFilePath,Mp3FilePath);
|
|
|
// 返回保存路径
|
|
|
return Mp3FilePath;
|