|
|
@@ -174,27 +174,22 @@ public class SpeakerServiceImpl implements ISpeakerService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void textParseVoiceAppIps(String texts,List<PlayVo> playVoList) {
|
|
|
- if (playVoList.size() == 1) {
|
|
|
- commonTextUrlVoice(texts, playVoList);
|
|
|
- } else {
|
|
|
- PlayBatchVo playBatchVo = new PlayBatchVo();
|
|
|
- BeanUtils.copyProperties(playVoList.get(0), playBatchVo);
|
|
|
- List<UrlVo> urlVoList = getUrlList(texts);
|
|
|
- if (null != playBatchVo.getParams()) {
|
|
|
- playBatchVo.getParams().setTid(UUID.randomUUID().toString());
|
|
|
- playBatchVo.getParams().setUrls(urlVoList);
|
|
|
- }
|
|
|
- List<String> snsList = new ArrayList<>();
|
|
|
- for (PlayVo playVo : playVoList) {
|
|
|
- snsList.add(playVo.getSn());
|
|
|
- }
|
|
|
- String deviceIp =playVoList.get(0).getDeviceIp();
|
|
|
- playBatchVo.setSns(snsList.toArray(new String[snsList.size()]));
|
|
|
- boolean isTrue = invokePost(JSONObject.toJSON(playBatchVo).toString(), deviceIp,1, playVoList.get(0).getPort());
|
|
|
- if (isTrue) {
|
|
|
- textParseVoiceAppIps(texts,playVoList);
|
|
|
- }
|
|
|
+ public void textParseVoiceAppIps(String texts,List<PlayVo> playVoList,Integer playNum,Integer level) {
|
|
|
+// if (playVoList.size() == 1) {
|
|
|
+// commonTextUrlVoice(texts, playVoList,playNum,level);
|
|
|
+// } else {
|
|
|
+// String deviceIp =playVoList.get(0).getDeviceIp();
|
|
|
+// PlayBatchVo playBatchVo=commonPatchTextUrlVoice(texts,playVoList,playNum,level);
|
|
|
+// boolean isTrue = invokePost(JSONObject.toJSON(playBatchVo).toString(), deviceIp,1, playVoList.get(0).getPort());
|
|
|
+// if (isTrue) {
|
|
|
+// textParseVoiceAppIps(texts,playVoList,playNum,level);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ String deviceIp =playVoList.get(0).getDeviceIp();
|
|
|
+ PlayBatchVo playBatchVo=commonPatchTextUrlVoice(texts,playVoList,playNum,level);
|
|
|
+ boolean isTrue = invokePost(JSONObject.toJSON(playBatchVo).toString(), deviceIp,1, playVoList.get(0).getPort());
|
|
|
+ if (isTrue) {
|
|
|
+ textParseVoiceAppIps(texts,playVoList,playNum,level);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -211,7 +206,7 @@ public class SpeakerServiceImpl implements ISpeakerService {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("sn", sn);
|
|
|
jsonObject.put("type", "req");
|
|
|
- jsonObject.put("name", "songs_queue_clear");
|
|
|
+ jsonObject.put("name", "priority_task_stop");
|
|
|
String responseStr = okHttpRequest.doPostJson(remoteUrlIp, token, jsonObject.toString());
|
|
|
logger.info("responseStr:+++++++++++++++++++++++++++" + responseStr + "+++++++++++++++++++++++++");
|
|
|
return tokenRefresh(responseStr);
|
|
|
@@ -231,10 +226,12 @@ public class SpeakerServiceImpl implements ISpeakerService {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- private List<UrlVo> getUrlList(String texts) {
|
|
|
+ private List<UrlVo> getUrlList(String texts,Integer playNum) {
|
|
|
List<UrlVo> urlVoList = new ArrayList<>();
|
|
|
- UrlVo urlVo = new UrlVo(texts.substring(0, 1), texts);
|
|
|
- urlVoList.add(urlVo);
|
|
|
+ for(int i=0;i<playNum;i++){
|
|
|
+ UrlVo urlVo = new UrlVo(texts.substring(0, 1), texts);
|
|
|
+ urlVoList.add(urlVo);
|
|
|
+ }
|
|
|
return urlVoList;
|
|
|
}
|
|
|
|
|
|
@@ -275,22 +272,49 @@ public class SpeakerServiceImpl implements ISpeakerService {
|
|
|
* @param texts
|
|
|
* @param playVoList
|
|
|
*/
|
|
|
- private void commonTextUrlVoice(String texts,List<PlayVo> playVoList) {
|
|
|
+ private void commonTextUrlVoice(String texts,List<PlayVo> playVoList,Integer playNum,Integer level) {
|
|
|
for (PlayVo play : playVoList) {
|
|
|
String deviceIp=play.getDeviceIp();
|
|
|
- List<UrlVo> urlVoList = getUrlList(texts);
|
|
|
+ List<UrlVo> urlVoList = getUrlList(texts,playNum);
|
|
|
if (null != play.getParams()) {
|
|
|
play.getParams().setTid(UUID.randomUUID().toString());
|
|
|
play.getParams().setUrls(urlVoList);
|
|
|
}
|
|
|
boolean isTrue = invokePost(JSONObject.toJSON(play).toString(),deviceIp, 0, play.getPort());
|
|
|
if (isTrue) {
|
|
|
- commonTextParseVoice(texts,playVoList);
|
|
|
+ commonTextUrlVoice(texts,playVoList,playNum,level);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 公共的语音路径播放
|
|
|
+ * commonTextUrlVoice
|
|
|
+ * @param texts
|
|
|
+ * @param playVoList
|
|
|
+ */
|
|
|
+ private PlayBatchVo commonPatchTextUrlVoice(String texts,List<PlayVo> playVoList,Integer playNum,Integer level) {
|
|
|
+ PlayBatchVo playBatchVo = new PlayBatchVo();
|
|
|
+ BeanUtils.copyProperties(playVoList.get(0), playBatchVo);
|
|
|
+ List<UrlVo> urlVoList = getUrlList(texts,playNum);
|
|
|
+ if (null != playBatchVo.getParams()) {
|
|
|
+ playBatchVo.getParams().setTid(UUID.randomUUID().toString());
|
|
|
+ playBatchVo.getParams().setUrls(urlVoList);
|
|
|
+ playBatchVo.getParams().setUid(UUID.randomUUID().toString());
|
|
|
+ }
|
|
|
+ List<String> snsList = new ArrayList<>();
|
|
|
+ List<String> reqList = new ArrayList<>();
|
|
|
+ for (PlayVo playVo : playVoList) {
|
|
|
+ snsList.add(playVo.getSn());
|
|
|
+ reqList.add("req");
|
|
|
+ }
|
|
|
+ playBatchVo.setSns(snsList.toArray(new String[snsList.size()]));
|
|
|
+ playBatchVo.setType(reqList.toArray(new String[reqList.size()]));
|
|
|
+ return playBatchVo;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param body
|
|
|
* @param type 0是单个,1是批量
|