| @@ -210,7 +210,7 @@ public class UserLiveController extends BaseController { | |||||
| resultMap.put("status", status); | resultMap.put("status", status); | ||||
| return resultMap; | return resultMap; | ||||
| } | } | ||||
| return wxCVoiceService.getById(id); | |||||
| return wxCVoiceService.getById(id,basicLiveInfo.getPhone()); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -28,7 +28,9 @@ public class WxCVoiceTable { | |||||
| private String localDisPlayName; | private String localDisPlayName; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "声纹ID", name = "id") | @io.swagger.annotations.ApiModelProperty(value = "声纹ID", name = "id") | ||||
| private int voiceId; | |||||
| private Long voiceId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "声纹ID", name = "languageId") | |||||
| private Long languageId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "声纹名称(用于调微软接口)", name = "local_name") | @io.swagger.annotations.ApiModelProperty(value = "声纹名称(用于调微软接口)", name = "local_name") | ||||
| private String voiceName; | private String voiceName; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "声纹展示名称", name = "display_name") | @io.swagger.annotations.ApiModelProperty(value = "声纹展示名称", name = "display_name") | ||||
| @@ -39,7 +41,7 @@ public class WxCVoiceTable { | |||||
| private int voiceType; | private int voiceType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "声纹列表", name = "mould_sm_id") | @io.swagger.annotations.ApiModelProperty(value = "声纹列表", name = "mould_sm_id") | ||||
| private String MouldSmId; | |||||
| private String mouldSmId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "声纹列表", name = "style_list") | @io.swagger.annotations.ApiModelProperty(value = "声纹列表", name = "style_list") | ||||
| private String styleList ; | private String styleList ; | ||||
| @@ -8,7 +8,7 @@ import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| public interface WxCVoiceService { | public interface WxCVoiceService { | ||||
| Map<String,Object> getById(Long id); | |||||
| Map<String,Object> getById(Long id,String phone); | |||||
| List<VoiceInfo> chooseType(Long id); | List<VoiceInfo> chooseType(Long id); | ||||
| @@ -43,20 +43,27 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { | |||||
| @Override | @Override | ||||
| public Map<String, Object> getById(Long id) { | |||||
| public Map<String, Object> getById(Long id,String phone) { | |||||
| List<WxCVoiceTable> resultList = wxCVoiceMapper.getById(id); | List<WxCVoiceTable> resultList = wxCVoiceMapper.getById(id); | ||||
| HashMap<String, Object> result = new HashMap<>(); | HashMap<String, Object> result = new HashMap<>(); | ||||
| HashMap<String, Object> data = 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) { | 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<>(); | 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); | voiceList.add(voice); | ||||
| audio.put("voiceList", voiceList); | audio.put("voiceList", voiceList); | ||||
| voice.put("voiceid", wxCVoiceTable.getVoiceId()); | voice.put("voiceid", wxCVoiceTable.getVoiceId()); | ||||
| @@ -67,17 +74,34 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { | |||||
| voice.put("gender", wxCVoiceTable.getGender()); | voice.put("gender", wxCVoiceTable.getGender()); | ||||
| List styleList = new ArrayList(); | 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<>(); | 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); | 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); | result.put("data", data); | ||||
| HashMap<String, Object> info = new HashMap<>(); | HashMap<String, Object> info = new HashMap<>(); | ||||
| HashMap<String, Object> status = new HashMap<>(); | HashMap<String, Object> status = new HashMap<>(); | ||||
| @@ -8,6 +8,7 @@ | |||||
| <result column="name" jdbcType="VARCHAR" property="localelName"/> | <result column="name" jdbcType="VARCHAR" property="localelName"/> | ||||
| <result column="chinese_name" jdbcType="VARCHAR" property="localDisPlayName"/> | <result column="chinese_name" jdbcType="VARCHAR" property="localDisPlayName"/> | ||||
| <result column="id" jdbcType="INTEGER" property="voiceId"/> | <result column="id" jdbcType="INTEGER" property="voiceId"/> | ||||
| <result column="language_id" jdbcType="INTEGER" property="language_id"/> | |||||
| <result column="class" jdbcType="INTEGER" property="voiceType"/> | <result column="class" jdbcType="INTEGER" property="voiceType"/> | ||||
| <result column="local_name" jdbcType="VARCHAR" property="voiceName"/> | <result column="local_name" jdbcType="VARCHAR" property="voiceName"/> | ||||
| <result column="display_name" jdbcType="VARCHAR" property="voiceDisplayName"/> | <result column="display_name" jdbcType="VARCHAR" property="voiceDisplayName"/> | ||||
| @@ -15,7 +16,7 @@ | |||||
| <result column="style_list" jdbcType="VARCHAR" property="styleList"/> | <result column="style_list" jdbcType="VARCHAR" property="styleList"/> | ||||
| <result column="mould_sm_id" jdbcType="VARCHAR" property="MouldSmId"/> | |||||
| <result column="mould_sm_id" jdbcType="VARCHAR" property="mouldSmId"/> | |||||
| <result column="style_name" jdbcType="VARCHAR" property="styleName"/> | <result column="style_name" jdbcType="VARCHAR" property="styleName"/> | ||||
| <result column="style_display_name" jdbcType="VARCHAR" property="styleDisplayName"/> | <result column="style_display_name" jdbcType="VARCHAR" property="styleDisplayName"/> | ||||
| @@ -33,7 +34,7 @@ | |||||
| <!--join wx_c_voice_style wcvs on wcv.id=wcvs.voice_id where wca.user_id = #{id}--> | <!--join wx_c_voice_style wcvs on wcv.id=wcvs.voice_id where wca.user_id = #{id}--> | ||||
| <!-- </select> --> | <!-- </select> --> | ||||
| <select id="getById" resultMap="BaseResultMap"> | <select id="getById" resultMap="BaseResultMap"> | ||||
| select wca.user_name,wca.resource_id,wca.expire_time,vi.id,vi.language_id,vi.sex,vi.display_name,vi.local_name,vi.style_list, | |||||
| select wca.user_name,wca.resource_id,wca.expire_time,vi.id,vi.language_id,vi.sex,vi.display_name,vi.local_name,vi.mould_sm_id,vi.style_list, | |||||
| vl.name,vl.chinese_name | vl.name,vl.chinese_name | ||||
| FROM wx_c_author wca | FROM wx_c_author wca | ||||
| join voice_info vi on wca.resource_id = vi.id | join voice_info vi on wca.resource_id = vi.id | ||||