Procházet zdrojové kódy

voice/相关表更改及音频列表接口

private_deployment
谈文友 před 1 rokem
rodič
revize
a0b4472c9c
11 změnil soubory, kde provedl 257 přidání a 25 odebrání
  1. +2
    -2
      suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql
  2. +2
    -2
      suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql
  3. +2
    -2
      suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql
  4. +26
    -10
      suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java
  5. +45
    -0
      suimangService/src/main/java/com/iformall/domain/po/WxCUserAuthority.java
  6. +47
    -0
      suimangService/src/main/java/com/iformall/domain/po/WxCVoiceTable.java
  7. +13
    -0
      suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java
  8. +7
    -0
      suimangService/src/main/java/com/iformall/service/WxCVoiceService.java
  9. +68
    -0
      suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java
  10. +13
    -9
      suimangService/src/main/resources/mapper/WxCVideoMapper.xml
  11. +32
    -0
      suimangService/src/main/resources/mapper/WxCVoiceMapper.xml

+ 2
- 2
suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql Zobrazit soubor

@@ -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


+ 2
- 2
suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql Zobrazit soubor

@@ -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;



+ 2
- 2
suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql Zobrazit soubor

@@ -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;


+ 26
- 10
suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java Zobrazit soubor

@@ -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<VoiceMould> 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<String, String> params) {
String username = params.get("username");

return wxCVoiceService.findByUserName(username);
}
}

+ 45
- 0
suimangService/src/main/java/com/iformall/domain/po/WxCUserAuthority.java Zobrazit soubor

@@ -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;


}

+ 47
- 0
suimangService/src/main/java/com/iformall/domain/po/WxCVoiceTable.java Zobrazit soubor

@@ -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;


}



+ 13
- 0
suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java Zobrazit soubor

@@ -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<WxCVoiceTable, String> {


List<WxCVoiceTable> findByUserName(String username);
}

+ 7
- 0
suimangService/src/main/java/com/iformall/service/WxCVoiceService.java Zobrazit soubor

@@ -0,0 +1,7 @@
package com.iformall.service;

import com.iformall.common.ResultData;

public interface WxCVoiceService {
ResultData findByUserName(String username);
}

+ 68
- 0
suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java Zobrazit soubor

@@ -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<WxCVoiceTable> resultList = wxCVoiceMapper.findByUserName(username);
HashMap<String, Object> result = new HashMap<>();
List audioList = new ArrayList();

for (WxCVoiceTable wxCVoiceTable : resultList) {
HashMap<String, Object> audio = new HashMap<>();
HashMap<String, Object> voice = new HashMap<>();
HashMap<String, Object> 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);
}
}

+ 13
- 9
suimangService/src/main/resources/mapper/WxCVideoMapper.xml Zobrazit soubor

@@ -3,13 +3,13 @@
<mapper namespace="com.iformall.mapper.WxCVideoMapper">

<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCVideoTable">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="user_name" jdbcType="VARCHAR" property="userName"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="image" jdbcType="VARCHAR" property="image"/>
<result column="demo" jdbcType="VARCHAR" property="demo"/>
<result column="preinfo" jdbcType="VARCHAR" property="preInfo"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="user_name" jdbcType="VARCHAR" property="userName"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="image" jdbcType="VARCHAR" property="image"/>
<result column="demo" jdbcType="VARCHAR" property="demo"/>
<result column="preinfo" jdbcType="VARCHAR" property="preInfo"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>

</resultMap>

@@ -19,8 +19,12 @@
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>

</resultMap>-->
<select id="findByUserName" resultMap="BaseResultMap">
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 = '13930071765' AND wca.type = 0 )
<select id="findByUserName" resultMap="BaseResultMap">
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 )
</select>




+ 32
- 0
suimangService/src/main/resources/mapper/WxCVoiceMapper.xml Zobrazit soubor

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.WxCVoiceMapper">

<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCVoiceTable">

<result column="user_name" jdbcType="VARCHAR" property="userName"/>
<result column="local_name" jdbcType="VARCHAR" property="localelName"/>
<result column="local_display_name" jdbcType="VARCHAR" property="localDisPlayName"/>
<result column="voice_id" jdbcType="INTEGER" property="voiceId"/>
<result column="class" jdbcType="INTEGER" property="voiceType"/>
<result column="voice_name" jdbcType="VARCHAR" property="voiceName"/>
<result column="voice_display_name" jdbcType="VARCHAR" property="voiceDisplayName"/>
<result column="gender" jdbcType="INTEGER" property="gender"/>
<result column="style_name" jdbcType="VARCHAR" property="styleName"/>
<result column="style_display_name" jdbcType="VARCHAR" property="styleDisplayName"/>
<result column="style_demo" jdbcType="VARCHAR" property="styleDemo"/>

</resultMap>


<select id="findByUserName" resultMap="BaseResultMap">
select wca.user_name,wca.resource_id,wca.expire_time,wcv.id, wcv.localel_id ,wcv.id ,wcv.voice_name,wcv.voice_display_name ,wcv.gender , wcv.class , wcvl.id,wcvl.local_name,wcvl.local_display_name,wcvs.id,wcvs.voice_id,wcvs.style_name,wcvs.style_display_name,wcvs.style_demo
from wx_c_author wca
INNER JOIN wx_c_voice wcv on wca.resource_id = wcv.id
and wca.type = 1
join wx_c_voice_local wcvl on wcv.localel_id = wcvl.id
join wx_c_voice_style wcvs on wcv.id=wcvs.voice_id where wca.user_name = #{username}
</select>


</mapper>

Načítá se…
Zrušit
Uložit