|
|
@@ -43,20 +43,27 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> getById(Long id) { |
|
|
|
public Map<String, Object> getById(Long id,String phone) { |
|
|
|
List<WxCVoiceTable> resultList = wxCVoiceMapper.getById(id); |
|
|
|
HashMap<String, Object> result = new HashMap<>(); |
|
|
|
HashMap<String, Object> data = new HashMap<>(); |
|
|
|
List audioList = new ArrayList(); |
|
|
|
data.put("username", phone); |
|
|
|
data.put("current_time", new Date(System.currentTimeMillis() / 1000)); |
|
|
|
// List audioList = new ArrayList(); |
|
|
|
Map<Long,Map<String, Object>> audioList = new HashMap(); |
|
|
|
for (WxCVoiceTable wxCVoiceTable : resultList) { |
|
|
|
HashMap<String, Object> audio = new HashMap<>(); |
|
|
|
Map<String, Object> audio = audioList.get(wxCVoiceTable.getLanguageId()); |
|
|
|
if(audio == null){ |
|
|
|
audio = new HashMap<>(); |
|
|
|
audio.put("LocaleName", wxCVoiceTable.getLocalelName()); |
|
|
|
audio.put("displayname", wxCVoiceTable.getLocalDisPlayName()); |
|
|
|
} |
|
|
|
List<Map<String, Object>> voiceList = (List<Map<String, Object>>) audio.get("styleList"); |
|
|
|
if(voiceList == null){ |
|
|
|
voiceList = new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
HashMap<String, Object> voice = new HashMap<>(); |
|
|
|
data.put("username", wxCVoiceTable.getUserName()); |
|
|
|
data.put("current_time", new Date(System.currentTimeMillis() / 1000)); |
|
|
|
audioList.add(audio); |
|
|
|
audio.put("LocaleName", wxCVoiceTable.getLocalelName()); |
|
|
|
audio.put("displayname", wxCVoiceTable.getLocalDisPlayName()); |
|
|
|
List voiceList = new ArrayList(); |
|
|
|
voiceList.add(voice); |
|
|
|
audio.put("voiceList", voiceList); |
|
|
|
voice.put("voiceid", wxCVoiceTable.getVoiceId()); |
|
|
@@ -67,17 +74,34 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { |
|
|
|
voice.put("gender", wxCVoiceTable.getGender()); |
|
|
|
List styleList = new ArrayList(); |
|
|
|
|
|
|
|
List<String> strings = JSON.parseArray(wxCVoiceTable.getStyleList(), String.class); |
|
|
|
for (String y : strings) { |
|
|
|
if(StringUtils.isBlank(wxCVoiceTable.getStyleList())){ |
|
|
|
HashMap<String, Object> style = new HashMap<>(); |
|
|
|
style.put("stylename", "default"); |
|
|
|
style.put("displayname", EnumSpeakType.getEnum("default").getMessage()); |
|
|
|
style.put("styledemo", aliyunOSSConfig.getFiledomain() + demoDirectory + wxCVoiceTable.getMouldSmId() + "_" + "default" + demoSuffix); |
|
|
|
styleList.add(style); |
|
|
|
voice.put("styleList", styleList); |
|
|
|
}else{ |
|
|
|
HashMap<String, Object> style = new HashMap<>(); |
|
|
|
style.put("stylename", y); |
|
|
|
style.put("displayname", EnumSpeakType.getEnum(y).getMessage()); |
|
|
|
style.put("styledemo", aliyunOSSConfig.getFiledomain() + demoDirectory + wxCVoiceTable.getMouldSmId() + "_" + y + demoSuffix); |
|
|
|
style.put("stylename", "default"); |
|
|
|
style.put("displayname", EnumSpeakType.getEnum("default").getMessage()); |
|
|
|
style.put("styledemo", aliyunOSSConfig.getFiledomain() + demoDirectory + wxCVoiceTable.getMouldSmId() + "_" + "default" + demoSuffix); |
|
|
|
styleList.add(style); |
|
|
|
|
|
|
|
List<String> strings = JSON.parseArray(wxCVoiceTable.getStyleList(), String.class); |
|
|
|
for (String y : strings) { |
|
|
|
style = new HashMap<>(); |
|
|
|
style.put("stylename", y); |
|
|
|
style.put("displayname", EnumSpeakType.getEnum(y).getMessage()); |
|
|
|
style.put("styledemo", aliyunOSSConfig.getFiledomain() + demoDirectory + wxCVoiceTable.getMouldSmId() + "_" + y + demoSuffix); |
|
|
|
styleList.add(style); |
|
|
|
} |
|
|
|
voice.put("styleList", styleList); |
|
|
|
} |
|
|
|
voice.put("styleList", styleList); |
|
|
|
} |
|
|
|
data.put("audioList", audioList); |
|
|
|
|
|
|
|
data.put("audioList", new ArrayList<>(audioList.values())); |
|
|
|
|
|
|
|
result.put("data", data); |
|
|
|
HashMap<String, Object> info = new HashMap<>(); |
|
|
|
HashMap<String, Object> status = new HashMap<>(); |
|
|
|