| | |
| | | private SpeakVoiceMapper voiceMapper; |
| | | |
| | | @Override |
| | | public int takeVoice(String sn, Integer psdk_index, String name, File file,Integer volumn) throws UnsupportedAudioFileException, IOException { |
| | | public SpeakVoiceEntity takeVoice(String name, File file) throws UnsupportedAudioFileException, IOException { |
| | | SpeakVoiceEntity voiceEntity = new SpeakVoiceEntity(); |
| | | SpeakVoiceStartDto dto = new SpeakVoiceStartDto(); |
| | | SpeakVoiceFileDto fileDto = new SpeakVoiceFileDto(); |
| | | SpeakVolumeDto volumeDto=new SpeakVolumeDto(); |
| | | volumeDto.setPsdk_index(psdk_index); |
| | | volumeDto.setPlay_volume(volumn); |
| | | String url = upMinio(file, name); |
| | | fileDto.setUrl(url); |
| | | String md5 = MD5Util.getMD5Checksum(file); |
| | | fileDto.setMd5(md5); |
| | | fileDto.setFormat(FormatEnum.PCM); |
| | | fileDto.setName(name); |
| | | dto.setPsdk_index(psdk_index); |
| | | dto.setFile(fileDto); |
| | | double time = getAudioDuration(file); |
| | | voiceEntity.setMd5(md5); |
| | | voiceEntity.setSecond(time); |
| | | voiceEntity.setUrl(url); |
| | | voiceEntity.setName(name); |
| | | voiceMapper.insert(voiceEntity); |
| | | return voiceEntity; |
| | | } |
| | | @Override |
| | | public int takeVoicee(String sn, Integer psdk_index, String name, File file,Integer volumn,SpeakVoiceEntity entity) { |
| | | SpeakVoiceStartDto dto = new SpeakVoiceStartDto(); |
| | | SpeakVoiceFileDto fileDto = new SpeakVoiceFileDto(); |
| | | SpeakVolumeDto volumeDto=new SpeakVolumeDto(); |
| | | volumeDto.setPsdk_index(psdk_index); |
| | | volumeDto.setPlay_volume(volumn); |
| | | fileDto.setUrl(entity.getUrl()); |
| | | fileDto.setMd5(entity.getMd5()); |
| | | fileDto.setFormat(FormatEnum.PCM); |
| | | fileDto.setName(entity.getName()); |
| | | dto.setPsdk_index(psdk_index); |
| | | dto.setFile(fileDto); |
| | | messageSenderService.publishServicesTopic(sn, VoiceEnums.SPEAKER_PLAY_VOLUME_SET.getMethod(), volumeDto); |
| | | return messageSenderService.publishServicesTopic(sn, VoiceEnums.SPEAKER_AUDIO_PLAY_START.getMethod(), dto).getResult(); |
| | | } |
| | |
| | | dto.setFile(fileDto); |
| | | return messageSenderService.publishServicesTopic(sn, VoiceEnums.SPEAKER_AUDIO_PLAY_START.getMethod(), dto).getResult(); |
| | | } |
| | | |
| | | public int awayCar(String sn) { |
| | | SpeakVoiceStartDto dto = new SpeakVoiceStartDto(); |
| | | SpeakVoiceFileDto fileDto = new SpeakVoiceFileDto(); |
| | | fileDto.setUrl("http://dev.jxpskj.com:9000/cloud-bucket/录音20240730112507301125"); |
| | | fileDto.setMd5("b4e738b1c5c97d4fa52f3918bab3f42d"); |
| | | fileDto.setFormat(FormatEnum.PCM); |
| | | fileDto.setName("违章停车"); |
| | | dto.setPsdk_index(2); |
| | | dto.setFile(fileDto); |
| | | return messageSenderService.publishServicesTopic(sn, VoiceEnums.SPEAKER_AUDIO_PLAY_START.getMethod(), dto).getResult(); |
| | | } |
| | | @Override |
| | | public PaginationData<SpeakVoiceEntity> getVoices(Integer pages,Integer page_size) { |
| | | // Paging Query |