diff --git a/suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql b/suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql index 7982da6..b21d495 100644 --- a/suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql +++ b/suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql @@ -11,7 +11,7 @@ Target Server Version : 80026 (8.0.26) File Encoding : 65001 - Date: 13/07/2023 18:42:24 + Date: 19/07/2023 10:37:00 */ SET NAMES utf8mb4; @@ -25,7 +25,7 @@ CREATE TABLE `wx_c_voice` ( `id` int NOT NULL COMMENT '声纹id', `localel_id` int NULL DEFAULT NULL COMMENT '地区id', `voice_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '声纹名称', - `display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '声纹显示名称', + `voice_display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '声纹显示名称', `gender` int NULL DEFAULT NULL COMMENT '男1女0', `class` int NULL DEFAULT NULL COMMENT '共享0定制1', PRIMARY KEY (`id`) USING BTREE diff --git a/suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql b/suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql index ebb6c90..14e20fd 100644 --- a/suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql +++ b/suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql @@ -11,7 +11,7 @@ Target Server Version : 80026 (8.0.26) File Encoding : 65001 - Date: 13/07/2023 18:42:33 + Date: 19/07/2023 10:37:08 */ SET NAMES utf8mb4; @@ -24,7 +24,7 @@ DROP TABLE IF EXISTS `wx_c_voice_local`; CREATE TABLE `wx_c_voice_local` ( `id` int NOT NULL COMMENT '地区id', `local_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地区名称', - `display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地区名称显示', + `local_display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地区名称显示', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; diff --git a/suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql b/suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql index 66636c5..896366d 100644 --- a/suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql +++ b/suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql @@ -11,7 +11,7 @@ Target Server Version : 80026 (8.0.26) File Encoding : 65001 - Date: 13/07/2023 18:42:38 + Date: 19/07/2023 10:37:19 */ SET NAMES utf8mb4; @@ -25,7 +25,7 @@ CREATE TABLE `wx_c_voice_style` ( `id` int NOT NULL COMMENT '风格', `voice_id` int NULL DEFAULT NULL COMMENT '声纹id', `style_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '风格名称', - `display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '风格显示名称', + `style_display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '风格显示名称', `style_demo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '样例视频', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; diff --git a/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java b/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java index ef59f6b..39f887d 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java @@ -12,6 +12,7 @@ import com.iformall.domain.po.sm.VoiceMould; import com.iformall.enums.*; import com.iformall.language.LanguageDetect; import com.iformall.mapper.VoiceLanguageMapper; +import com.iformall.service.WxCVoiceService; import com.iformall.service.sm.*; import com.iformall.sm.AiPreviewParam; import io.swagger.annotations.Api; @@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; +import java.util.Map; @RestController @@ -49,6 +51,8 @@ public class VoiceMouldController extends BaseController { @Autowired private VoiceLanguageService voiceLanguageService; + @Autowired + private WxCVoiceService wxCVoiceService; @AuthIgnore @ApiOperation("获取语种") @@ -84,15 +88,15 @@ public class VoiceMouldController extends BaseController { public ResultData findById(Long id) { logger.debug("[" + getIpAddr() + "] MouldPatchController::findById"); VoiceMould voiceMould = voiceMouldService.getDetailById(id); - if(voiceMould != null - && voiceMould.getParentId() == 0l && voiceMould.getCountSub() > 0){ + if (voiceMould != null + && voiceMould.getParentId() == 0l && voiceMould.getCountSub() > 0) { VoiceMould voiceQ = new VoiceMould(); voiceQ.setParentId(voiceMould.getId()); voiceQ.setVoiceType(EnumVoiceType.speak.getCode());//目前只查询说话风格 voiceQ.setStatus(EnumaMouldPatchStatus.put_on.getCode()); voiceQ.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); List sublist = voiceMouldService.getClist(voiceQ); - if(sublist != null && !sublist.isEmpty()){ + if (sublist != null && !sublist.isEmpty()) { voiceMould.setSubVoiceMould(sublist); } } @@ -110,20 +114,20 @@ public class VoiceMouldController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } Integer sex = null; - if(record.getPersonMouldId() != null){ + if (record.getPersonMouldId() != null) { PersonMould personMode = personMouldService.getDetailById(record.getPersonMouldId()); - if(personMode == null){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"选择模板不存在"); + if (personMode == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "选择模板不存在"); } sex = personMode.getSex(); } String detect = LanguageDetect.detect(record.getPaperwork()); - if(StringUtils.isBlank(detect)){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"语种识别失败"); + if (StringUtils.isBlank(detect)) { + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "语种识别失败"); } EnumLanguages anEnum = EnumLanguages.getEnum(detect); - if(anEnum == null){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"暂不支持该语种"); + if (anEnum == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "暂不支持该语种"); } VoiceMould voiceMould = new VoiceMould(); @@ -163,4 +167,16 @@ public class VoiceMouldController extends BaseController { logger.debug("[" + getIpAddr() + "] MouldPatchController::voicePreview"); return new ResultData(voiceInfoService.voicePreview(aiPreviewParam)); } + + /** + * 视频模板列表 + */ + @AuthIgnore + @PostMapping("/audioList") + @ApiOperation(value = "视频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}") + public ResultData audioList(@RequestBody Map params) { + String username = params.get("username"); + + return wxCVoiceService.findByUserName(username); + } } diff --git a/suimangService/src/main/java/com/iformall/domain/po/WxCUserAuthority.java b/suimangService/src/main/java/com/iformall/domain/po/WxCUserAuthority.java new file mode 100644 index 0000000..c656f93 --- /dev/null +++ b/suimangService/src/main/java/com/iformall/domain/po/WxCUserAuthority.java @@ -0,0 +1,45 @@ +package com.iformall.domain.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.ToString; + +@TableName(value = "wx_c_voice") +@Data +@ToString(callSuper = true) +public class WxCUserAuthority { + + + @TableField(exist = false) + private String userName; + @TableField(exist = false) + private String currentTime; + @TableField(exist = false) + private String expireTime; + + @io.swagger.annotations.ApiModelProperty(value = "地区名称", name = "local_name") + private String localelName; + @io.swagger.annotations.ApiModelProperty(value = "地区显示名称", name = "local_display_name") + private String localDisPlayName; + + @io.swagger.annotations.ApiModelProperty(value = "声纹ID", name = "voice_id") + private int voiceId; + @io.swagger.annotations.ApiModelProperty(value = "声纹名称(用于调微软接口)", name = "voice_name") + private String voiceName; + @io.swagger.annotations.ApiModelProperty(value = "声纹展示名称", name = "voice_display_name") + private String voiceDisplayName; + @io.swagger.annotations.ApiModelProperty(value = "性别(男1 女0)", name = "gender") + private int gender; + @io.swagger.annotations.ApiModelProperty(value = "声纹类型 共享:0 定制:1", name = "class") + private int voiceType; + + @io.swagger.annotations.ApiModelProperty(value = "声纹风格名称(用于微软接口)", name = "style_name") + private String styleName; + @io.swagger.annotations.ApiModelProperty(value = "声纹风格展示名称", name = "style_display_name") + private String styleDisplayName; + @io.swagger.annotations.ApiModelProperty(value = "声纹风格样例文件链接", name = "style_demo") + private String styleDemo; + + +} diff --git a/suimangService/src/main/java/com/iformall/domain/po/WxCVoiceTable.java b/suimangService/src/main/java/com/iformall/domain/po/WxCVoiceTable.java new file mode 100644 index 0000000..bca83b8 --- /dev/null +++ b/suimangService/src/main/java/com/iformall/domain/po/WxCVoiceTable.java @@ -0,0 +1,47 @@ +package com.iformall.domain.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.ToString; + +@TableName(value = "wx_c_voice") +@Data +@ToString(callSuper = true) +public class WxCVoiceTable { + + + @TableField(exist = false) + private String userName; + @TableField(exist = false) + private String currentTime; + @TableField(exist = false) + private String expireTime; + + @io.swagger.annotations.ApiModelProperty(value = "地区名称", name = "local_name") + private String localelName; + @io.swagger.annotations.ApiModelProperty(value = "地区显示名称", name = "local_display_name") + private String localDisPlayName; + + @io.swagger.annotations.ApiModelProperty(value = "声纹ID", name = "voice_id") + private int voiceId; + @io.swagger.annotations.ApiModelProperty(value = "声纹名称(用于调微软接口)", name = "voice_name") + private String voiceName; + @io.swagger.annotations.ApiModelProperty(value = "声纹展示名称", name = "voice_display_name") + private String voiceDisplayName; + @io.swagger.annotations.ApiModelProperty(value = "性别(男1 女0)", name = "gender") + private int gender; + @io.swagger.annotations.ApiModelProperty(value = "声纹类型 共享:0 定制:1", name = "class") + private int voiceType; + + @io.swagger.annotations.ApiModelProperty(value = "声纹风格名称(用于微软接口)", name = "style_name") + private String styleName; + @io.swagger.annotations.ApiModelProperty(value = "声纹风格展示名称", name = "style_display_name") + private String styleDisplayName; + @io.swagger.annotations.ApiModelProperty(value = "声纹风格样例文件链接", name = "style_demo") + private String styleDemo; + + +} + + diff --git a/suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java b/suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java new file mode 100644 index 0000000..b33e190 --- /dev/null +++ b/suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java @@ -0,0 +1,13 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxCVideoTable; +import com.iformall.domain.po.WxCVoiceTable; + +import java.util.List; + +public interface WxCVoiceMapper extends CommonMapper { + + + List findByUserName(String username); +} diff --git a/suimangService/src/main/java/com/iformall/service/WxCVoiceService.java b/suimangService/src/main/java/com/iformall/service/WxCVoiceService.java new file mode 100644 index 0000000..94c649d --- /dev/null +++ b/suimangService/src/main/java/com/iformall/service/WxCVoiceService.java @@ -0,0 +1,7 @@ +package com.iformall.service; + +import com.iformall.common.ResultData; + +public interface WxCVoiceService { + ResultData findByUserName(String username); +} diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java new file mode 100644 index 0000000..fda9046 --- /dev/null +++ b/suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java @@ -0,0 +1,68 @@ +package com.iformall.service.impl; + +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxCVideoTable; +import com.iformall.domain.po.WxCVoiceTable; +import com.iformall.mapper.WxCVoiceMapper; +import com.iformall.service.WxCVoiceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +@Service +public class WxCVoiceServiceImpl implements WxCVoiceService { + + @Autowired + WxCVoiceMapper wxCVoiceMapper; + + + @Override + public ResultData findByUserName(String username) { + + List resultList = wxCVoiceMapper.findByUserName(username); + HashMap result = new HashMap<>(); + List audioList = new ArrayList(); + + for (WxCVoiceTable wxCVoiceTable : resultList) { + HashMap audio = new HashMap<>(); + HashMap voice = new HashMap<>(); + HashMap style = new HashMap<>(); + result.put("username", wxCVoiceTable.getUserName()); + result.put("current_time", new Date(System.currentTimeMillis())); + 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()); + voice.put("expire_time", wxCVoiceTable.getExpireTime()); + voice.put("voicename", wxCVoiceTable.getVoiceName()); + voice.put("voicetype", wxCVoiceTable.getVoiceType()); + voice.put("displayname", wxCVoiceTable.getVoiceDisplayName()); + voice.put("gender", wxCVoiceTable.getGender()); + List styleList = new ArrayList(); + styleList.add(style); + voice.put("styleList", styleList); + + + style.put("stylename", wxCVoiceTable.getStyleName()); + style.put("displayname", wxCVoiceTable.getStyleDisplayName()); + style.put("styledemo", wxCVoiceTable.getStyleDemo()); + + + } + + result.put("audioList", audioList); + + + return new ResultData(result); + } +} diff --git a/suimangService/src/main/resources/mapper/WxCVideoMapper.xml b/suimangService/src/main/resources/mapper/WxCVideoMapper.xml index 2ae2a93..4a8cf25 100644 --- a/suimangService/src/main/resources/mapper/WxCVideoMapper.xml +++ b/suimangService/src/main/resources/mapper/WxCVideoMapper.xml @@ -3,13 +3,13 @@ - - - - - - - + + + + + + + @@ -19,8 +19,12 @@ --> - +SELECT wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo,wcav.demo +from wx_c_author wca +left join wx_c_avatar wcav on wcav.id =wca.resource_id +where wca.resource_id +in (select wca.resource_id from wx_c_author wca WHERE wca.user_name =#{username} AND wca.type = 0 ) diff --git a/suimangService/src/main/resources/mapper/WxCVoiceMapper.xml b/suimangService/src/main/resources/mapper/WxCVoiceMapper.xml new file mode 100644 index 0000000..07be05e --- /dev/null +++ b/suimangService/src/main/resources/mapper/WxCVoiceMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + +