| | |
| | | |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.component.mqtt.service.IMessageSenderService; |
| | | import com.dji.sample.patches.config.pojo.PatchesConfigPojo; |
| | | import com.dji.sample.patches.utils.MultipartFileTOFileUtil; |
| | | import com.dji.sample.speak.model.dto.PsdkModelDto; |
| | | import com.dji.sample.speak.model.dto.SpeakVoiceStartDto; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.sound.sampled.UnsupportedAudioFileException; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | |
| | | @RestController |
| | | @RequestMapping("${url.speak.prefix}${url.speak.version}") |
| | | public class SpeakVoiceController { |
| | | @Autowired |
| | | private SpeakVoiceService voiceServicel; |
| | | |
| | | @Autowired |
| | | private PatchesConfigPojo patchesConfigPojo; |
| | | @PostMapping("/startVoice") |
| | | public ResponseResult takeVoice(@RequestParam String sn, |
| | | @RequestParam int psdk_index, |
| | | @RequestParam String name, |
| | | @RequestParam MultipartFile file) { |
| | | File file1=MultipartFileTOFileUtil.multipartFile2File(file,"src/main/resources/tmp/20240614"); |
| | | return ResponseResult.success(voiceServicel.takeVoice(sn, psdk_index,name,file1)); |
| | | @RequestParam Integer volumn, |
| | | @RequestParam MultipartFile file) throws UnsupportedAudioFileException, IOException { |
| | | File file1=MultipartFileTOFileUtil.multipartFile2File(file,patchesConfigPojo.getUnzip()); |
| | | return ResponseResult.success(voiceServicel.takeVoice(sn, psdk_index,name,file1,volumn)); |
| | | } |
| | | |
| | | @PostMapping("/stopVoice") |
| | |
| | | public ResponseResult restartVoice(@RequestParam int psdkIndex, @RequestParam String sn) { |
| | | return ResponseResult.success(voiceServicel.restartVoice(sn, psdkIndex)); |
| | | } |
| | | @PostMapping("/putVoice") |
| | | public ResponseResult putVoice (int id){ |
| | | return ResponseResult.success(voiceServicel.awayRiver(id)); |
| | | } |
| | | @GetMapping("/selectVoice") |
| | | public ResponseResult getVoices(@RequestParam Integer page,@RequestParam Integer page_size ){ |
| | | return ResponseResult.success(voiceServicel.getVoices(page,page_size)); |
| | | } |
| | | |
| | | } |