| 
					
				 | 
			
			
				@ -8,8 +8,8 @@ import com.tencentcloudapi.tts.v20190823.TtsClient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.tencentcloudapi.tts.v20190823.models.TextToVoiceRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.tencentcloudapi.tts.v20190823.models.TextToVoiceResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.constant.CommonConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.log.BaseWordToVoiceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.log.BaseWordToVoiceDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.voice.BaseWordToVoiceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.voice.BaseWordToVoiceDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -47,7 +47,7 @@ public class SpeechTtsUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String wordToVoice(String text){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        synchronized (text.intern()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("hzprod".equals(profiles)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(!"hzprod".equals(profiles)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return CommonConstant.BASEURL + "voice/test.mp3"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseWordToVoiceDO voiceDO = wordToVoiceDao.findByWord(text); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -77,12 +77,14 @@ public class SpeechTtsUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // logger.info(TextToVoiceResponse.toJsonString(resp)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                byte[] buffer = new BASE64Decoder().decodeBuffer(resp.getAudio()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Ttsutils.saveResponseToFile(buffer,CommonConstant.TXVOICEPATH + sessionId+".mp3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String voice = CommonConstant.BASEURL + "voice/"+sessionId+".mp3"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                voiceDO = new BaseWordToVoiceDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                voiceDO.setWord(text); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                voiceDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                voiceDO.setVoice(CommonConstant.BASEURL + "voice/"+sessionId+".mp3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                voiceDO.setVoice(voice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wordToVoiceDao.save(voiceDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("ending....."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return voice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 |