xhxu 1 рік тому
джерело
коміт
187f3ad5bf
52 змінених файлів з 2104 додано та 55 видалено
  1. +33
    -0
      suimangAdmin/src/main/resources/db/migration/V2023071300001_wx_c_author.sql
  2. +35
    -0
      suimangAdmin/src/main/resources/db/migration/V2023071300002_wx_c_avatar.sql
  3. +32
    -0
      suimangAdmin/src/main/resources/db/migration/V2023071300003wx_c_user_live_basic_info.sql
  4. +34
    -0
      suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql
  5. +31
    -0
      suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql
  6. +33
    -0
      suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql
  7. +3
    -0
      suimangAdmin/src/main/resources/db/migration/V2023071800001_subtitle.sql
  8. +2
    -0
      suimangCApi/pom.xml
  9. +8
    -13
      suimangCApi/src/main/java/com/iformall/controller/PhotoSpeakVideoController.java
  10. +98
    -0
      suimangCApi/src/main/java/com/iformall/controller/SDKController.java
  11. +416
    -0
      suimangCApi/src/main/java/com/iformall/controller/UserLiveController.java
  12. +12
    -4
      suimangCApi/src/main/java/com/iformall/controller/VideoController.java
  13. +17
    -10
      suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java
  14. +17
    -5
      suimangCApi/src/main/java/com/iformall/controller/WxUserGrantController.java
  15. +1
    -1
      suimangCApi/src/main/resources/application-dev.yml
  16. +1
    -1
      suimangSchedule/src/main/resources/application-dev.yml
  17. +2
    -0
      suimangService/src/main/java/com/iformall/common/ErrorCode.java
  18. +28
    -0
      suimangService/src/main/java/com/iformall/domain/po/WxCUserAuthority.java
  19. +16
    -4
      suimangService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java
  20. +54
    -0
      suimangService/src/main/java/com/iformall/domain/po/WxCVideoTable.java
  21. +58
    -0
      suimangService/src/main/java/com/iformall/domain/po/WxCVoiceTable.java
  22. +5
    -1
      suimangService/src/main/java/com/iformall/domain/po/sm/PersonMould.java
  23. +7
    -1
      suimangService/src/main/java/com/iformall/domain/po/sm/PhotoSpeakVideo.java
  24. +3
    -1
      suimangService/src/main/java/com/iformall/domain/po/sm/PreviewParam.java
  25. +29
    -0
      suimangService/src/main/java/com/iformall/domain/vo/WxCLiveLoginVo.java
  26. +44
    -0
      suimangService/src/main/java/com/iformall/enums/EnumClassType.java
  27. +11
    -0
      suimangService/src/main/java/com/iformall/mapper/WxCLiveUserBasicInfoMapper.java
  28. +15
    -0
      suimangService/src/main/java/com/iformall/mapper/WxCUserAuthorityMapper.java
  29. +4
    -0
      suimangService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java
  30. +16
    -0
      suimangService/src/main/java/com/iformall/mapper/WxCVideoMapper.java
  31. +13
    -0
      suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java
  32. +9
    -0
      suimangService/src/main/java/com/iformall/service/WxCLiveUserBasicInfoService.java
  33. +9
    -0
      suimangService/src/main/java/com/iformall/service/WxCUserAuthorityService.java
  34. +5
    -0
      suimangService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java
  35. +14
    -0
      suimangService/src/main/java/com/iformall/service/WxCVideoService.java
  36. +16
    -0
      suimangService/src/main/java/com/iformall/service/WxCVoiceService.java
  37. +27
    -0
      suimangService/src/main/java/com/iformall/service/impl/WxCLiveUserBasicInfoServiceImpl.java
  38. +85
    -0
      suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java
  39. +15
    -2
      suimangService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  40. +165
    -0
      suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java
  41. +191
    -0
      suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java
  42. +14
    -4
      suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java
  43. +3
    -1
      suimangService/src/main/java/com/iformall/service/sm/impl/VoiceInfoServiceImpl.java
  44. +12
    -3
      suimangService/src/main/java/com/iformall/sm/AiPhotoSpeakParam.java
  45. +1
    -0
      suimangService/src/main/java/com/iformall/sm/AiPreviewParam.java
  46. +1
    -1
      suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java
  47. +4
    -1
      suimangService/src/main/resources/mapper/PhotoSpeakVideoMapper.xml
  48. +323
    -0
      suimangService/src/main/resources/mapper/WxCLiveUserBasicInfoMapper.xml
  49. +30
    -0
      suimangService/src/main/resources/mapper/WxCUserAuthorityMapper.xml
  50. +13
    -2
      suimangService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  51. +44
    -0
      suimangService/src/main/resources/mapper/WxCVideoMapper.xml
  52. +45
    -0
      suimangService/src/main/resources/mapper/WxCVoiceMapper.xml

+ 33
- 0
suimangAdmin/src/main/resources/db/migration/V2023071300001_wx_c_author.sql Переглянути файл

@@ -0,0 +1,33 @@
/*
Navicat Premium Data Transfer

Source Server : photo
Source Server Type : MySQL
Source Server Version : 80026 (8.0.26)
Source Host : 182.92.151.30:3306
Source Schema : mallink_suimang_test

Target Server Type : MySQL
Target Server Version : 80026 (8.0.26)
File Encoding : 65001

Date: 13/07/2023 18:41:44
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for wx_c_author
-- ----------------------------
DROP TABLE IF EXISTS `wx_c_author`;
CREATE TABLE `wx_c_author` (
`id` int NOT NULL COMMENT '用户id',
`user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户名',
`type` int NULL DEFAULT NULL COMMENT '权限类型数字人0声纹1',
`resource_id` int NULL DEFAULT NULL COMMENT '对应资源id(数字人id or 声纹id)',
`expire_time` datetime NULL DEFAULT NULL COMMENT '资源权限到期时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

+ 35
- 0
suimangAdmin/src/main/resources/db/migration/V2023071300002_wx_c_avatar.sql Переглянути файл

@@ -0,0 +1,35 @@
/*
Navicat Premium Data Transfer

Source Server : photo
Source Server Type : MySQL
Source Server Version : 80026 (8.0.26)
Source Host : 182.92.151.30:3306
Source Schema : mallink_suimang_test

Target Server Type : MySQL
Target Server Version : 80026 (8.0.26)
File Encoding : 65001

Date: 13/07/2023 18:41:55
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for wx_c_avatar
-- ----------------------------
DROP TABLE IF EXISTS `wx_c_avatar`;
CREATE TABLE `wx_c_avatar` (
`id` int NOT NULL COMMENT '数字人id',
`class` int NULL DEFAULT NULL COMMENT '共享0定制1',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '数字人名称',
`image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '数字人图像',
`demo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '数字人视频样例',
`model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '数字人视频模板文件',
`preinfo` 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;

SET FOREIGN_KEY_CHECKS = 1;

+ 32
- 0
suimangAdmin/src/main/resources/db/migration/V2023071300003wx_c_user_live_basic_info.sql Переглянути файл

@@ -0,0 +1,32 @@
/*
Navicat Premium Data Transfer

Source Server : photo
Source Server Type : MySQL
Source Server Version : 80026 (8.0.26)
Source Host : 182.92.151.30:3306
Source Schema : mallink_suimang_test

Target Server Type : MySQL
Target Server Version : 80026 (8.0.26)
File Encoding : 65001

Date: 18/07/2023 12:14:57
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for wx_c_user_live_basic_info
-- ----------------------------
DROP TABLE IF EXISTS `wx_c_user_live_basic_info`;
CREATE TABLE `wx_c_user_live_basic_info` (
`id` bigint NOT NULL,
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`version` int NULL DEFAULT NULL,
`expire_time` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

+ 34
- 0
suimangAdmin/src/main/resources/db/migration/V2023071300004_wx_c_voice.sql Переглянути файл

@@ -0,0 +1,34 @@
/*
Navicat Premium Data Transfer

Source Server : photo
Source Server Type : MySQL
Source Server Version : 80026 (8.0.26)
Source Host : 182.92.151.30:3306
Source Schema : mallink_suimang_test

Target Server Type : MySQL
Target Server Version : 80026 (8.0.26)
File Encoding : 65001

Date: 19/07/2023 10:37:00
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for wx_c_voice
-- ----------------------------
DROP TABLE IF EXISTS `wx_c_voice`;
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 '声纹名称',
`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
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

+ 31
- 0
suimangAdmin/src/main/resources/db/migration/V2023071300005_wx_c_voice_local.sql Переглянути файл

@@ -0,0 +1,31 @@
/*
Navicat Premium Data Transfer

Source Server : photo
Source Server Type : MySQL
Source Server Version : 80026 (8.0.26)
Source Host : 182.92.151.30:3306
Source Schema : mallink_suimang_test

Target Server Type : MySQL
Target Server Version : 80026 (8.0.26)
File Encoding : 65001

Date: 19/07/2023 10:37:08
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for wx_c_voice_local
-- ----------------------------
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 '地区名称',
`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;

SET FOREIGN_KEY_CHECKS = 1;

+ 33
- 0
suimangAdmin/src/main/resources/db/migration/V2023071300006_wx_c_voice_style.sql Переглянути файл

@@ -0,0 +1,33 @@
/*
Navicat Premium Data Transfer

Source Server : photo
Source Server Type : MySQL
Source Server Version : 80026 (8.0.26)
Source Host : 182.92.151.30:3306
Source Schema : mallink_suimang_test

Target Server Type : MySQL
Target Server Version : 80026 (8.0.26)
File Encoding : 65001

Date: 19/07/2023 10:37:19
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for wx_c_voice_style
-- ----------------------------
DROP TABLE IF EXISTS `wx_c_voice_style`;
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 '风格名称',
`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;

SET FOREIGN_KEY_CHECKS = 1;

+ 3
- 0
suimangAdmin/src/main/resources/db/migration/V2023071800001_subtitle.sql Переглянути файл

@@ -0,0 +1,3 @@
ALTER TABLE `mallink_suimang_test`.`photo_speak_video`
ADD COLUMN `subtitle_enabled` smallint(1) COMMENT '字幕开关' AFTER `person_photo_url`,
ADD COLUMN `subtitle_params` json COMMENT '字幕参数' AFTER `subtitle_enabled`;

+ 2
- 0
suimangCApi/pom.xml Переглянути файл

@@ -168,5 +168,7 @@
</configuration>
</plugin>
</plugins>

</build>

</project>

+ 8
- 13
suimangCApi/src/main/java/com/iformall/controller/PhotoSpeakVideoController.java Переглянути файл

@@ -35,8 +35,7 @@ import java.io.OutputStream;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
import java.util.*;


@RestController
@@ -178,27 +177,22 @@ public class PhotoSpeakVideoController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"视频已生成完成");
}

PhotoSpeakVideo videoUpd = new PhotoSpeakVideo();
videoUpd.setId(record.getId());
// PhotoSpeakVideo videoUpd = new PhotoSpeakVideo();
// videoUpd.setId(record.getId());

if (mouldVideo.getPersonPhotoId() == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到人物照片");
}
if(StringUtils.isBlank(mouldVideo.getPersonPhotoUrl())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到人物照片地址");
}
videoUpd.setPersonPhotoId(mouldVideo.getPersonPhotoId());
videoUpd.setPersonPhotoUrl(mouldVideo.getPersonPhotoUrl());

Integer voiceFrom = mouldVideo.getVoiceFrom();
videoUpd.setVoiceFrom(voiceFrom);
if(EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)){
String voiceMouldSmId = null;
try{
JSONObject personMouldObject = JSONObject.parseObject(mouldVideo.getVoiceMouldSm());
voiceMouldSmId = personMouldObject.getString("mouldSmId");
videoUpd.setVoiceMouldSm(voiceMouldSmId);
videoUpd.setPaperwork(mouldVideo.getPaperwork());
videoUpd.setVoiceMouldSm(mouldVideo.getVoiceMouldSm());
}catch(Exception e){
logger.info(e.getMessage());
}
@@ -220,7 +214,7 @@ public class PhotoSpeakVideoController extends BaseController {
if(StringUtils.isBlank(voiceMaterialUrl)){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到上传声音文件");
}
videoUpd.setVoiceMaterialUrl(voiceMaterialUrl);
mouldVideo.setVoiceMaterialUrl(voiceMaterialUrl);
// videoUpd.setVideoTime(String.valueOf(voiceMaterial.getTime()));
} else if (EnumVoiceFrom.MUSIC.getCode().equals(voiceFrom)) {
Long musicId = mouldVideo.getMusicId();
@@ -234,7 +228,7 @@ public class PhotoSpeakVideoController extends BaseController {
if(musicInfo.getTime() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"音乐时长为空");
}
videoUpd.setVoiceMaterialUrl(musicInfo.getUrl());
mouldVideo.setVoiceMaterialUrl(musicInfo.getUrl());
// videoUpd.setVideoTime(String.valueOf(musicInfo.getTime()));
} else {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"声音数据异常");
@@ -244,9 +238,10 @@ public class PhotoSpeakVideoController extends BaseController {
mouldVideoUpd.setVideoStatus(EnumVideoStatus.ing.getCode());
mouldVideoUpd.setVideoMsg("");
mouldVideoUpd.setCreateVideoDate(new Date());

photoSpeakVideoService.saveOrUpdate(mouldVideoUpd);

photoSpeakVideoService.createVideo(videoUpd);
photoSpeakVideoService.createVideo(mouldVideo);

return new ResultData();
}


+ 98
- 0
suimangCApi/src/main/java/com/iformall/controller/SDKController.java Переглянути файл

@@ -1,11 +1,18 @@
package com.iformall.controller;

import com.alibaba.fastjson.JSONArray;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonObject;
import com.iformall.annotation.AuthIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCVoiceTable;
import com.iformall.domain.po.sm.PhotoSpeakVideo;
import com.iformall.domain.po.sm.PreviewParam;
import com.iformall.enums.EnumVideoStatus;
import com.iformall.service.WxCVoiceService;
import com.iformall.service.sm.PhotoSpeakVideoService;
import com.iformall.service.sm.PersonPhotoService;
import com.iformall.service.sm.VoiceInfoService;
@@ -21,7 +28,11 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
import java.util.Map;

/**
* 对外开放的 API 接口
@@ -38,6 +49,8 @@ public class SDKController extends BaseController {
private VoiceInfoService voiceInfoService;
@Autowired
private PhotoSpeakVideoService photoSpeakVideoService;
@Autowired
private WxCVoiceService wxCVoiceService;

@ApiOperation("图片质量审核接口")
@PostMapping("checkPhoto")
@@ -103,4 +116,89 @@ public class SDKController extends BaseController {
photoSpeakVideoService.createVideo(mouldVideo);
return new ResultData();
}

/**
* 生成音频文件
*/


@AuthIgnore
@PostMapping("/audiotts")
@ApiOperation(value = "视频模板列表", notes = "{\"username\",\"string\",\"voicename\",\"string\",\"stylename\",\"string\",\"speed\",\"int\",\"text\",\"string\"}")
public String audioList(@RequestBody Map<String, String> params) {
String username = params.get("username");
String voiceName = params.get("voicename");
String styleName = params.get("stylename");
Integer speed = Integer.valueOf(params.get("speed"));
String text = params.get("text");
try {
// 构建请求参数JSON对象
JSONObject jsonParams = new JSONObject();
jsonParams.put("username", username);
jsonParams.put("voicename", voiceName);
jsonParams.put("stylename", styleName);
jsonParams.put("speed", speed);
jsonParams.put("text", text);

//请求url
String requestUrl = "";

// 创建URL对象
URL url = new URL(requestUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

// 设置请求方法
connection.setRequestMethod("POST");

// 设置请求头
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "application/json");

// 允许输出请求内容
connection.setDoOutput(true);

// 将参数写入请求体
OutputStream outputStream = connection.getOutputStream();
outputStream.write(jsonParams.toString().getBytes());
outputStream.flush();
outputStream.close();

// 发送请求并获取响应
int responseCode = connection.getResponseCode();

// 读取响应内容
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();

// 处理响应结果
if (responseCode == HttpURLConnection.HTTP_OK) {
// 解析响应内容

JSONObject jsonResponse = new JSONObject(Boolean.parseBoolean(response.toString()));

// 获取ttsurl生成的音频文件链接
String ttsUrl = jsonResponse.getString("ttsurl");

System.out.println("音频文件链接: " + ttsUrl);
return ttsUrl;

} else {
System.out.println("请求失败,错误代码: " + responseCode);
}
// 断开连接
connection.disconnect();
} catch (Exception e) {
e.printStackTrace();

}
return null;

}


}

+ 416
- 0
suimangCApi/src/main/java/com/iformall/controller/UserLiveController.java Переглянути файл

@@ -0,0 +1,416 @@
package com.iformall.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.code.kaptcha.Producer;
import com.iformall.annotation.AuthIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxCVideoTable;
import com.iformall.domain.po.sm.PhotoSpeakVideo;
import com.iformall.domain.po.sm.PreviewParam;
import com.iformall.domain.po.sm.VoiceInfo;
import com.iformall.domain.vo.WxCLiveLoginVo;
import com.iformall.enums.EnumVideoStatus;
import com.iformall.exception.MallinkException;
import com.iformall.service.*;
import com.iformall.service.sm.VoiceInfoService;
import com.iformall.sm.AiPreviewParam;
import com.iformall.utils.Constant;
import com.iformall.utils.PasswordHelper;
import com.iformall.utils.RedisCacheUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.spring.web.json.Json;

import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;

@RestController
@RequestMapping("/api/live")
@Api(description = "直播相关接口")
public class UserLiveController extends BaseController {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private Producer producer;

@Autowired
@Qualifier("objectCommonRedisTemplate")
RedisTemplate<String, Object> redisTemplate;

@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@Autowired
private WxCLiveUserBasicInfoService wxCLiveUserBasicInfoService;

@Autowired
private WxCVideoService wxCVideoService;

@Autowired
private WxCVoiceService wxCVoiceService;

@Autowired
private WxCUserAuthorityService wxCUserAuthorityService;
@Autowired
private VoiceInfoService voiceInfoService;


@AuthIgnore
@PostMapping("/login")
@ApiOperation(value = "用户登录", notes = "{\"username\":\"string\",\"password\":\"string\",\"code\":\"string\",\"status\":\"int\"}")
public Map<String,Object> login(@RequestBody Map<String, String> map, HttpServletResponse response) {
Map<String,Object> wxCLiveLoginVos = new HashMap<>();
String ipAddr = getIpAddr();
logger.debug("[" + ipAddr + "] WxUserGrantController::login");

String phone = map.get("username");
String password = map.get("password");
if (StringUtils.isBlank(phone) || StringUtils.isBlank(password)) {
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.SYS_PARAMETER_ERROR.getCode());
status.put("message","手机号或密码为空");
wxCLiveLoginVos.put("status",status);
return wxCLiveLoginVos;
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码为空");
}
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone);
if (basicInfo == null) {
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.USER_IS_EMPTY);
status.put("message","用户不存在");
wxCLiveLoginVos.put("status",status);
return wxCLiveLoginVos;
// return new ResultData(ErrorCode.USER_IS_EMPTY);
}

String encryptPassword = new PasswordHelper().encryptPassword(password);

if (!encryptPassword.equals(basicInfo.getPassword())) {
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.USER_PASSWD_ERR.getCode());
status.put("message","手机号或密码错误");
wxCLiveLoginVos.put("status",status);
return wxCLiveLoginVos;
// return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误");
}

int statu = Integer.parseInt(map.get("status"));

if (statu == 0) {
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId());
if (basicLiveInfo.getCode() != null && !map.get("code").equals(basicLiveInfo.getCode())) {
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode());
status.put("message","用户已在其他设备登录");
wxCLiveLoginVos.put("status",status);
return wxCLiveLoginVos;
// return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(), "用户已在其他设备登录");
}
if (basicLiveInfo.getCode() == null) {
wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), map.get("code"));
}
}
if (statu == -1) {
wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), null);
basicInfo.setStatus(-2);
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.USER_CANCEL_MCODE.getCode());
status.put("message","设备已注销");
wxCLiveLoginVos.put("status",status);
return wxCLiveLoginVos;
// return new ResultData(ErrorCode.USER_CANCEL_MCODE.getCode(), "设备已注销");
}


wxCUserBasicInfoService.handleLoginUser(basicInfo);
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId());



WxCLiveLoginVo wxCLiveLoginVo = new WxCLiveLoginVo();
wxCLiveLoginVo.setCode(Integer.parseInt(map.get("code")));
//wxCLiveLoginVo.setVersion(basicLiveInfo.getVersion());
wxCLiveLoginVo.setUsername(map.get("username"));
//wxCLiveLoginVo.setStatus(0);
//wxCLiveLoginVo.setCurrent_time(new Date(System.currentTimeMillis() / 1000));
// wxCLiveLoginVo.setExpire_time(basicLiveInfo.getExpireTime().getTime() / 1000);
//生成一个token
String token = UUID.randomUUID().toString().replace("-","");
//将token和用户信息绑定放到redis redis--key:user:info:token value:用户信息
redisTemplate.opsForValue().set("user:login"+token,JSON.toJSONString(wxCLiveLoginVo));
//返回给前端
wxCLiveLoginVo.setToken(token);
Map<String, Object> info = new HashMap();
Map<String, Object> data = new HashMap();
Map<Object, Object> status = new HashMap<>();
status.put("code",1000);
status.put("message","success");


data.put("status",0);
data.put("version",basicLiveInfo.getVersion());
data.put("current_time",new Date(System.currentTimeMillis() / 1000));
data.put("expire_time",basicLiveInfo.getExpireTime().getTime() / 1000);

info.put("log_id", basicInfo.getId());
info.put("server_type","user login");
info.put("username", basicInfo.getPhone());
wxCLiveLoginVos.put("data",data);
wxCLiveLoginVos.put("info",info);
wxCLiveLoginVo.setData(data);
wxCLiveLoginVo.setInfo(info);
wxCLiveLoginVos.put("status",status);
wxCLiveLoginVos.put("token",token);
System.out.println("wxCLiveLoginVo.getToken() = " + wxCLiveLoginVo.getToken());


return wxCLiveLoginVos;
// return new ResultData(1000,"success",wxCLiveLoginVo);
}

/**
* 视频模板列表
*/
@AuthIgnore
@PostMapping("/avatarList")
@ApiOperation(value = "视频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}")
public Map<String,Object> avatarList(@RequestBody Map<String, String> params) throws Exception {
Map<String,Object> avatarVos = new HashMap<>();
String ipaddress = getIpAddr();
logger.debug("[" + ipaddress + "] WxUserGrantController::getAvatarList");
String phone = params.get("username");
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone);
Long id = infoByPhone.getId();
System.out.println("id = " + id);

//鉴权
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id);
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) {
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode());
status.put("message","用户已在其他设备登录");
avatarVos.put("status",status);
return avatarVos;
}

Map<Object, Object> status = new HashMap<>();
status.put("code",1000);
status.put("msg","success");
// long id = getMemberId();
// System.out.println("id = " + id);
// WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(infoByPhone.getId());
avatarVos.put("status",status);

return wxCVideoService.getById(infoByPhone.getId());
// return new ResultData(1000,"success",wxCVideoService.getById(infoByPhone.getId()));
}


/**
* 音频模板列表
*/
@AuthIgnore
@PostMapping("/audioList")
@ApiOperation(value = "音频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}")
public Map<String,Object> audioList(@RequestBody Map<String, String> params) {
Map<String,Object> resultMap = new HashMap<>();
String ipaddress = getIpAddr();
logger.debug("[" + ipaddress + "] WxUserGrantController::getAudioList");
String phone = params.get("username");

WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone);
Long id = infoByPhone.getId();
System.out.println("id = " + id);


WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id);
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) {
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode());
status.put("message","用户已在其他设备登录");
resultMap.put("status",status);
return resultMap;
}

// long id = getMemberId();


return wxCVoiceService.getById(id);
}

/**
* 资源权限查询
*/

@AuthIgnore
@ApiOperation(value = "资源权限查询", notes = "{\"username\",\"string\",\"code\",\"string\",\"type\",\"int\",\"resource_id\",\"long\"}")
@PostMapping("/author")
public Map<String,Object> getAuthor(@RequestBody Map<String, String> params) {
Map<String,Object> resultMap = new HashMap<>();
String ipaddress = getIpAddr();
logger.debug("[" + ipaddress + "] WxUserGrantController::getAuthor");


String phone = params.get("username");
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone);
Long id = infoByPhone.getId();
System.out.println("id = " + id);

WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id);
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) {
HashMap<Object, Object> status = new HashMap<>();
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode());
status.put("message","用户已在其他设备登录");
resultMap.put("status",status);
return resultMap;
}


//long id = getMemberId();

String username = params.get("username");
String code = params.get("code");
Integer type = Integer.parseInt(params.get("type"));
Long resourceId = Long.valueOf(params.get("resource_id"));


return wxCUserAuthorityService.getAuthor(id, code, type, resourceId);
}


@AuthIgnore
@ApiOperation(value = "tts", notes = "{\"username\",\"string\",\"gen_txt\",\"string\",\"voice_id\",\"string\",\"voice_style\",\"string\",\"speed\",\"int\"}")
@PostMapping("/audiotts")
public Map<String,Object> voicePreview(@RequestBody Map<String, String> params) {
logger.debug("[" + getIpAddr() + "] UserLiveController::voicePreview");

String phone = params.get("username");
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone);
Long id = infoByPhone.getId();
AiPreviewParam param = new AiPreviewParam();
if (params.get("voice_id") == null) {
Map<String,Object> status = new HashMap<>();
status.put("code",ErrorCode.SYS_SERVER_ERROR.getCode());
status.put("msg","音色ID不能为空");
return status;
// return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "音色ID不能为空");
}
if (StringUtils.isBlank(params.get("gen_txt"))) {
Map<String,Object> status = new HashMap<>();
status.put("code",ErrorCode.SYS_SERVER_ERROR.getCode());
status.put("msg","需要生成的文字不能为空");
return status;
//return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "需要生成的文字不能为空");
}if (Integer.parseInt(params.get("speed"))==-1){
param.setSpeed(0);
}
param.setSpeed(Integer.parseInt(params.get("speed")));
param.setVoice_id(params.get("voice_id"));
param.setVoice_style(params.get("voice_style"));
param.setGen_txt(params.get("gen_txt"));
Map<String, Object> resultMap = wxCVoiceService.voicePreview(param);
Map<String,Object> info = new HashMap<>();
info.put("log_id",id);
info.put("server_type","audio tts");
resultMap.put("info",info);

return resultMap;
}


@AuthIgnore
@SneakyThrows
@ApiOperation(value = "tts", notes = "{\"username\",\"string\",\"gen_txt\",\"string\",\"voice_id\",\"string\",\"voice_style\",\"string\",\"speed\",\"int\"}")
@GetMapping("exportVideo")
public void exportVideo(@RequestBody Map<String, String> params , HttpServletRequest request, HttpServletResponse response) {
logger.debug("[" + getIpAddr() + "] UserLiveController::exportVideo");

response.reset();

File tmpFile = null;
OutputStream outputStream = null;
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), params.get("username"));
Long id = infoByPhone.getId();
try {
outputStream = response.getOutputStream();
} catch (IOException e) {
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR);
}

try{
if(id == null){
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
WxCVideoTable videoTable = wxCVideoService.selectOne(id,Long.parseLong(params.get("resource_id")));



//获取响应的输出流
InputStream inputStream = new URL(videoTable.getDemo()).openStream();


response.setHeader("Content-Disposition", "attachment; filename="
+ URLEncoder.encode(videoTable.getId()+".mp4", "UTF-8"));
//解决编码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Type","application/octet-stream");

byte[] cache = new byte[1024 * 300];
int flag;
while ((flag = inputStream.read(cache))!=-1){
outputStream.write(cache, 0, flag);
}
// }

}catch(MallinkException e){
ResultData resultData = new ResultData(e.getErrorCode(), e.getMessage());
//解决编码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Type","application/json");
outputStream.write(JSONObject.toJSONString(resultData).getBytes(StandardCharsets.UTF_8));

}finally {
if (tmpFile != null) {
tmpFile.delete();
}
outputStream.flush();
outputStream.close();
}
}
@AuthIgnore
@ApiOperation("选择声音选择风格")
@GetMapping("/chooseType")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData chooseType(Long id) {
logger.debug("[" + getIpAddr() + "] MouldPatchController::chooseType");
List<VoiceInfo> voiceInfos = wxCVoiceService.chooseType(id);
System.out.println("voiceInfos = " + voiceInfos);
return new ResultData(wxCVoiceService.chooseType(id));
}
}

+ 12
- 4
suimangCApi/src/main/java/com/iformall/controller/VideoController.java Переглянути файл

@@ -1,7 +1,10 @@
package com.iformall.controller;

import com.iformall.annotation.AuthIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCVideoTable;
import com.iformall.service.WxCVideoService;
import com.iformall.video.VideoFactory;
import com.iformall.video.entity.VideUploadResult;
import io.swagger.annotations.ApiImplicitParam;
@@ -20,16 +23,19 @@ import java.util.Map;
* @author gongbiao
*/
@RestController
@RequestMapping("api/video")
@RequestMapping("/api/video")
public class VideoController extends BaseController {
private Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
VideoFactory videoFactory;
@Autowired
String videoType;

@Autowired
private WxCVideoService wxCVideoService;

/**
* 上传视频
*
@@ -62,7 +68,7 @@ public class VideoController extends BaseController {
return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR);
}
}
/**
* 上传视频
*
@@ -83,7 +89,7 @@ public class VideoController extends BaseController {
return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR);
}
}
/**
* 上传视频
*
@@ -119,4 +125,6 @@ public class VideoController extends BaseController {
}
}



}

+ 17
- 10
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
@@ -50,6 +52,9 @@ public class VoiceMouldController extends BaseController {
@Autowired
private VoiceLanguageService voiceLanguageService;

@Autowired
private WxCVoiceService wxCVoiceService;

@AuthIgnore
@ApiOperation("获取语种")
@GetMapping("getLanguages")
@@ -84,15 +89,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 +115,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 +168,6 @@ public class VoiceMouldController extends BaseController {
logger.debug("[" + getIpAddr() + "] MouldPatchController::voicePreview");
return new ResultData(voiceInfoService.voicePreview(aiPreviewParam));
}


}

+ 17
- 5
suimangCApi/src/main/java/com/iformall/controller/WxUserGrantController.java Переглянути файл

@@ -36,6 +36,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -98,6 +99,9 @@ public class WxUserGrantController extends BaseController {

@Autowired
private UserConsumptionPackageService userConsumptionPackageService;
@Autowired
private WxCUserAuthorityService wxCUserAuthorityService;


@AuthIgnore
@ApiOperation("验证码")
@@ -128,6 +132,8 @@ public class WxUserGrantController extends BaseController {
}
}



/**
* 用户登录
*
@@ -289,11 +295,17 @@ public class WxUserGrantController extends BaseController {
return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode);
}

/**
* 需要效验用户及图片验证码
* @param phone
* @return
*/






/**
* 需要效验用户及图片验证码
* @param phone
* @return
*/
@AuthIgnore
@ApiOperation("发送修改密码验证码")
@GetMapping("sendPhoneCode")


+ 1
- 1
suimangCApi/src/main/resources/application-dev.yml Переглянути файл

@@ -189,7 +189,7 @@ logging:
path: ./logs/c

photo:
url: http://111.198.0.15:22299
url: http://nas.pucao.cn:2002
hy_url: http://111.198.0.15:22288
talk: http://111.198.0.15:22266
callbackUrl: https://phototest.metavatar.cc/C

+ 1
- 1
suimangSchedule/src/main/resources/application-dev.yml Переглянути файл

@@ -192,7 +192,7 @@ logging:
path: ./logs/s

photo:
url: http://111.198.0.15:22299
url: http://nas.pucao.cn:2002
hy_url: http://111.198.0.15:22288
talk: http://111.198.0.15:22266
callbackUrl: https://phototest.metavatar.cc/C

+ 2
- 0
suimangService/src/main/java/com/iformall/common/ErrorCode.java Переглянути файл

@@ -97,6 +97,8 @@ public enum ErrorCode{
USER_NAME_IS_FOUND(2008,"用户名已存在"),
USER_PHONE_IS_FOUND(2009,"手机号已存在"),
MEMBER_IS_LOCKED(2010, "当前会员已被锁定"),
USER_ALREADY_LOGIN(2011,"用户已在其他端登入"),
USER_CANCEL_MCODE(2012,"用户已在其他端登入"),
USER_BIRTHDATE_AFTER(2109, "出生日期大于当前日期"),
USER_APPINFO_NOT_EXIST(2110,"当前登录用户APP为空"),
USER_APPINFO_NOFUND_PAYACCOUNT(2111,"当前app找不到payAccount"),


+ 28
- 0
suimangService/src/main/java/com/iformall/domain/po/WxCUserAuthority.java Переглянути файл

@@ -0,0 +1,28 @@
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) //数字人 0 声纹 1
private int type;
@TableField(exist = false)
private String resourceId;
//共享 0 定制 1
private int classType;
@TableField(exist = false)
private String currentTime;
@TableField(exist = false)
private String expireTime;


}

+ 16
- 4
suimangService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java Переглянути файл

@@ -64,6 +64,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {
@io.swagger.annotations.ApiModelProperty(value="密码",name="password")
private String password;

@io.swagger.annotations.ApiModelProperty(value="用户名")
@TableField(exist = false)
private String username;

@Excel(name="微信昵称",width = 20,orderNum = "5")
@io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName")
private String nickName;
@@ -157,14 +161,18 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {

@io.swagger.annotations.ApiModelProperty(value = "状态0正常1锁定", name = "status")
private Integer status;
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value = "机器码", name = "code")
private String code;

/*用户登录用token**/
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="用户登录用token",name="token")
protected String token;
/*用户过期时间**/
// @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime")
// protected Date expireTime;
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime")
protected Date expireTime;

@TableField(exist = false)
@Excel(name="标签",width = 50,orderNum = "15")
@@ -200,10 +208,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {

@TableField(exist = false)
private Date creditEndTime;
@TableField(exist = false)
private Integer begin;
@TableField(exist = false)
private Integer limit;

@@ -218,6 +226,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="套餐类型(1、基础版,2、专业版,3、加强版)",name="packageType")
private Integer packageType;
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="套餐类型(1、基础版,2、专业版,3、加强版)",name="packageType")
private Integer version;


public void protectInfos() {
if(StringUtils.isNotBlank(this.password)) {


+ 54
- 0
suimangService/src/main/java/com/iformall/domain/po/WxCVideoTable.java Переглянути файл

@@ -0,0 +1,54 @@
package com.iformall.domain.po;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntityWithoutFinalTenantId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Date;

@TableName(value ="wx_c_author")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxCVideoTable extends TenantEntityWithoutFinalTenantId {

@TableField(exist = false)
private String userName;

@TableField(exist = false)
private String currentTime;
@TableField(exist = false)
private String expireTime;


@io.swagger.annotations.ApiModelProperty(value="数字人id",name="id")
private int id;
@io.swagger.annotations.ApiModelProperty(value="套餐0共享 1定制",name="class")
private int classType;
@io.swagger.annotations.ApiModelProperty(value="数字人名称",name="name")
private String name;

@io.swagger.annotations.ApiModelProperty(value="数字人封面图片链接",name="image")
private String image;
@io.swagger.annotations.ApiModelProperty(value="数字人样例视频链接",name="demo")
private String demo;
@io.swagger.annotations.ApiModelProperty(value="数字人样例视频链接",name="model")
private String model;
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息文件链接",name="preinfo")
private String preInfo;
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息文件链接",name="model_path")
private String modelPath;
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息文件链接",name="preInfo_path")
private String preInfoPath;






}

+ 58
- 0
suimangService/src/main/java/com/iformall/domain/po/WxCVoiceTable.java Переглянути файл

@@ -0,0 +1,58 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;

import java.util.ArrayList;
import java.util.List;

@TableName(value = "voice_info")
@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 = "id")
private int voiceId;
@io.swagger.annotations.ApiModelProperty(value = "声纹名称(用于调微软接口)", name = "local_name")
private String voiceName;
@io.swagger.annotations.ApiModelProperty(value = "声纹展示名称", name = "display_name")
private String voiceDisplayName;
@io.swagger.annotations.ApiModelProperty(value = "性别(男1 女0)", name = "sex")
private int gender;
@io.swagger.annotations.ApiModelProperty(value = "声纹类型 共享:0 定制:1", name = "class")
private int voiceType;

@io.swagger.annotations.ApiModelProperty(value = "声纹列表", name = "mould_sm_id")
private String MouldSmId;

@io.swagger.annotations.ApiModelProperty(value = "声纹列表", name = "style_list")
private String styleList ;



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


}



+ 5
- 1
suimangService/src/main/java/com/iformall/domain/po/sm/PersonMould.java Переглянути файл

@@ -41,12 +41,16 @@ public class PersonMould extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="EnumVideoType",name="videoType")
private Integer videoType;

@io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg")
private String coverImg;

@io.swagger.annotations.ApiModelProperty(value="多封面图",name="coverPicture")
private String coverPicture;

@io.swagger.annotations.ApiModelProperty(value="详情多图",name="detailPicture")
private String detailPicture;

@io.swagger.annotations.ApiModelProperty(value="名称",name="title")
@Excel(name="名称",width = 20,orderNum = "1")
private String title;
@@ -135,5 +139,5 @@ public class PersonMould extends TenantEntity {
}
return priceStr;
}
}

+ 7
- 1
suimangService/src/main/java/com/iformall/domain/po/sm/PhotoSpeakVideo.java Переглянути файл

@@ -51,6 +51,12 @@ public class PhotoSpeakVideo extends TenantEntity {
@TableField(exist = false)
private PersonPhoto personPhoto;

@io.swagger.annotations.ApiModelProperty(value="字幕开关",name="subtitleEnabled")
private Integer subtitleEnabled;

@io.swagger.annotations.ApiModelProperty(value="字幕参数",name="subtitleParams")
private String subtitleParams;

@io.swagger.annotations.ApiModelProperty(value="EnumVoiceFrom 声音来源",name="voiceFrom")
private Integer voiceFrom;

@@ -147,5 +153,5 @@ public class PhotoSpeakVideo extends TenantEntity {
private Integer videoHyStatus;

private Integer isHy;//是否超分(1、是,0、否)
}

+ 3
- 1
suimangService/src/main/java/com/iformall/domain/po/sm/PreviewParam.java Переглянути файл

@@ -8,4 +8,6 @@ public class PreviewParam {
private String voiceId;
private String voiceStyle;
private String gender;
}
private int speed;

}

+ 29
- 0
suimangService/src/main/java/com/iformall/domain/vo/WxCLiveLoginVo.java Переглянути файл

@@ -0,0 +1,29 @@
package com.iformall.domain.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Data
public class WxCLiveLoginVo {

private String token; //令牌
private String username; //令牌
// private int status; //用户登录状态 2设备注销,1登陆失败,0登陆成功
// private int version; //用户购买的软件套餐
// private Date current_time;//服务器当前时间
// private long expire_time;//套餐过期时间
private int code; //机器码
@ApiModelProperty(value = "响应")
private Map<String,Object> data = new HashMap<>();

// @ApiModelProperty(value = "响应")
//private Map<String,Object> Status = new HashMap<>();

@ApiModelProperty(value = "信息")
private Map<String,Object> info = new HashMap<>();

}

+ 44
- 0
suimangService/src/main/java/com/iformall/enums/EnumClassType.java Переглянути файл

@@ -0,0 +1,44 @@
package com.iformall.enums;

public enum EnumClassType {

SHARE(0, "共享"),
CUSTOMIZATION(1, "定制"),
;

public static EnumClassType getEnum(Integer code) {
for (EnumClassType value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private EnumClassType(Integer code, String message) {
this.code = code;
this.message = message;
}

private Integer code;
private String message;



public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

public Integer getCode() {
return code;
}

public void setCode(Integer code) {
this.code = code;
}

}

+ 11
- 0
suimangService/src/main/java/com/iformall/mapper/WxCLiveUserBasicInfoMapper.java Переглянути файл

@@ -0,0 +1,11 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCUserBasicInfo;

public interface WxCLiveUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> {

WxCUserBasicInfo selectById(Long id);

void updateCode(Long id, String code);
}

+ 15
- 0
suimangService/src/main/java/com/iformall/mapper/WxCUserAuthorityMapper.java Переглянути файл

@@ -0,0 +1,15 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCUserAuthority;

import java.util.List;


public interface WxCUserAuthorityMapper extends CommonMapper<WxCUserAuthority, String> {


List<WxCUserAuthority> getAuthorAvatar(Long id, int i, Long resourceId);

List<WxCUserAuthority> getAuthorVoice(Long id, int i, Long resourceId);
}

+ 4
- 0
suimangService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java Переглянути файл

@@ -65,5 +65,9 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S
List<Long> findIdByFilter(WxCUserBasicInfoDto wxCUserBasicInfoDto);

long getTotalCreditAmount(@Param("tenantId")String tenantId, @Param("finalTenantId")String finalTenantId);

//WxCUserBasicInfo selectById1(Long id);

//void updateCode(Long id, String mcode);
}


+ 16
- 0
suimangService/src/main/java/com/iformall/mapper/WxCVideoMapper.java Переглянути файл

@@ -0,0 +1,16 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCUserTags;
import com.iformall.domain.po.WxCVideoTable;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface WxCVideoMapper extends CommonMapper<WxCVideoTable, String> {

List<WxCVideoTable> getById(Long id);


WxCVideoTable selectOne(Long id, long resource_id);
}

+ 13
- 0
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<WxCVoiceTable, String> {


List<WxCVoiceTable> getById(Long id);
}

+ 9
- 0
suimangService/src/main/java/com/iformall/service/WxCLiveUserBasicInfoService.java Переглянути файл

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

import com.iformall.domain.po.WxCUserBasicInfo;

public interface WxCLiveUserBasicInfoService {
WxCUserBasicInfo getById(Long id);

void updateCode(Long id, String code);
}

+ 9
- 0
suimangService/src/main/java/com/iformall/service/WxCUserAuthorityService.java Переглянути файл

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

import com.iformall.common.ResultData;

import java.util.Map;

public interface WxCUserAuthorityService {
Map<String,Object> getAuthor(Long id, String code, Integer type, Long resourceId);
}

+ 5
- 0
suimangService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java Переглянути файл

@@ -200,5 +200,10 @@ public interface WxCUserBasicInfoService {
void sendTicketEmail(WxCUserBasicInfo basicInfo, EnumMsgModel type);

void updUserInfo(WxCUserBasicInfo cUser, Long memberId);

// WxCUserBasicInfo getById1(Long id);


// void updateCode(Long id, String mcode);
}


+ 14
- 0
suimangService/src/main/java/com/iformall/service/WxCVideoService.java Переглянути файл

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

import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCVideoTable;

import java.util.Map;

public interface WxCVideoService {


Map<String,Object> getById(Long id) throws Exception;

WxCVideoTable selectOne(Long id, long resource_id);
}

+ 16
- 0
suimangService/src/main/java/com/iformall/service/WxCVoiceService.java Переглянути файл

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

import com.iformall.common.ResultData;
import com.iformall.domain.po.sm.VoiceInfo;
import com.iformall.sm.AiPreviewParam;

import java.util.List;
import java.util.Map;

public interface WxCVoiceService {
Map<String,Object> getById(Long id);

List<VoiceInfo> chooseType(Long id);

Map<String,Object> voicePreview(AiPreviewParam aiPreviewParam);
}

+ 27
- 0
suimangService/src/main/java/com/iformall/service/impl/WxCLiveUserBasicInfoServiceImpl.java Переглянути файл

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

import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.mapper.WxCLiveUserBasicInfoMapper;
import com.iformall.service.WxCLiveUserBasicInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class WxCLiveUserBasicInfoServiceImpl implements WxCLiveUserBasicInfoService {

@Autowired
WxCLiveUserBasicInfoMapper wxCLiveUserBasicInfoMapper;


@Override
public WxCUserBasicInfo getById(Long id) {
return wxCLiveUserBasicInfoMapper.selectById(id);

}
@Override
public void updateCode(Long id, String code) {

wxCLiveUserBasicInfoMapper.updateCode(id,code);
}
}

+ 85
- 0
suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java Переглянути файл

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

import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUserAuthority;
import com.iformall.enums.EnumClassType;
import com.iformall.mapper.WxCUserAuthorityMapper;
import com.iformall.service.WxCUserAuthorityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class WxCUserAuthorityServiceImpl implements WxCUserAuthorityService {

@Autowired
private WxCUserAuthorityMapper wxCUserAuthorityMapper;


@Override
public Map<String,Object> getAuthor(Long id, String code, Integer type, Long resourceId) {
List<WxCUserAuthority> resultList = new ArrayList<WxCUserAuthority>();
HashMap<String, Object> authorVos = new HashMap<>();

if (type==0){
//查询数字人相关权限
resultList = wxCUserAuthorityMapper.getAuthorAvatar(id,0,resourceId);
}
if (type==1){
//查询声纹相关权限
resultList = wxCUserAuthorityMapper.getAuthorVoice(id,1,resourceId);

}

if (resourceId==null||resourceId==-1){
//若资源id没有传入那就展示所有当前类型资源权限

HashMap<String, Object> info = new HashMap<>();
HashMap<String, Object> status = new HashMap<>();
List authorList = new ArrayList();
for (WxCUserAuthority wxCUserAuthority : resultList) {
HashMap<String, Object> data = new HashMap<>();
data.put("username",wxCUserAuthority.getUserName());
data.put("type",wxCUserAuthority.getType());
data.put("resource_id",wxCUserAuthority.getResourceId());
data.put("class",wxCUserAuthority.getClassType());
data.put("current_time",new Date(System.currentTimeMillis()));
data.put("expire_time",wxCUserAuthority.getExpireTime());
authorList.add(data);
}
authorVos.put("authorList",authorList);
info.put("log_id",id);
info.put("server_type","author");
authorVos.put("info",info);
status.put("code",1000);
status.put("msg","success");
authorVos.put("status",status);
return authorVos;
}
HashMap<String, Object> data = new HashMap<>();
HashMap<String, Object> info = new HashMap<>();
HashMap<String, Object> status = new HashMap<>();
for (WxCUserAuthority wxCUserAuthority : resultList) {
data.put("username",wxCUserAuthority.getUserName());
data.put("type",wxCUserAuthority.getType());
data.put("resource_id",wxCUserAuthority.getResourceId());
if (String.valueOf(wxCUserAuthority.getClassType())!=null){
data.put("class",wxCUserAuthority.getClassType());
}
data.put("class", EnumClassType.SHARE.getCode());
data.put("current_time",new Date(System.currentTimeMillis()));
data.put("expire_time",wxCUserAuthority.getExpireTime());

}
authorVos.put("data",data);
info.put("log_id",id);
info.put("server_type","author");
authorVos.put("info",info);
status.put("code",1000);
status.put("msg","success");
authorVos.put("status",status);

return authorVos;
}
}

+ 15
- 2
suimangService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Переглянути файл

@@ -629,7 +629,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc

@Override
public PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record));
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(
() -> wxCUserBasicInfoMapper.findList(record));
}

@Override
@@ -666,7 +667,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
WxCUserBasicInfo basicQ = new WxCUserBasicInfo();
basicQ.setFinalTenantId(tenantEntity.getFinalTenantId());
basicQ.setPhone(phone);
List<WxCUserBasicInfo> basicInfos = wxCUserBasicInfoMapper.selectList(new QueryWrapper(basicQ));
List<WxCUserBasicInfo> basicInfos = wxCUserBasicInfoMapper.selectList(
new QueryWrapper(basicQ));
if (basicInfos != null && basicInfos.size() > 0) {
WxCUserBasicInfo wxCUserBasicInfo = basicInfos.get(0);
if (wxCUserBasicInfo.getPoins() != null) {
@@ -953,6 +955,17 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
update(info);
}

// @Override
// public WxCUserBasicInfo getById1(Long id) {
// return wxCUserBasicInfoMapper.selectById1(id);
// }

// @Override
// public void updateCode(Long id, String mcode) {
//
// wxCUserBasicInfoMapper.updateCode(id,mcode);
// }


@Override
public WxCUserBasicInfo getById(Long id,String finalTenantId) {


+ 165
- 0
suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java Переглянути файл

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

import cn.afterturn.easypoi.handler.inter.IExcelExportServer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.common.ResultData;

import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxCVideoTable;
import com.iformall.domain.vo.WxCUserBasicInfoVo;
import com.iformall.enums.EnumClassType;
import com.iformall.mapper.WxCUserBasicInfoMapper;
import com.iformall.mapper.WxCVideoMapper;
import com.iformall.service.WxCUserTagsService;
import com.iformall.service.WxCVideoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.*;
import java.util.stream.Collectors;

@Service
public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxCUserBasicInfoMapper wxCUserBasicInfoMapper;

@Autowired
WxCUserTagsService wxCUserTagsService;

@Autowired
WxCVideoMapper wxCVideoMapper;
@Override
public Map<String,Object> getById(Long id) throws Exception {
System.out.println("id = " + id);

List<WxCVideoTable> TemplateVideo = wxCVideoMapper.getById(id);
System.out.println("TemplateVideo = " + TemplateVideo);
Map<String,Object> avatarVos = new HashMap();
Map<String,Object> data = new HashMap();


//Map<String,Object> authorlist = new HashMap();
List authorlist = new ArrayList();
for (WxCVideoTable wxCVideoTable : TemplateVideo) {
data.put("username",wxCVideoTable.getUserName());
data.put("current_time",new Date(System.currentTimeMillis()));

Map<String,Object> avatar = new HashMap();
avatar.put("avatar_id",wxCVideoTable.getId());
avatar.put("avatar_name",wxCVideoTable.getName());
avatar.put("avatar_image",wxCVideoTable.getImage());
avatar.put("avatar_demo",wxCVideoTable.getDemo());
avatar.put("avatar_model",wxCVideoTable.getModel());
File modelFile = new File(wxCVideoTable.getModelPath());

avatar.put("avatar_demo_md5",getFileMD5(modelFile));
avatar.put("avatar_preinfo",wxCVideoTable.getPreInfo());

File preinfoFile = new File(wxCVideoTable.getPreInfoPath());
avatar.put("avatar_preinfo_md5",getFileMD5(preinfoFile));
avatar.put("expire_time",wxCVideoTable.getExpireTime());
avatar.put("class", wxCVideoTable.getClassType());
authorlist.add(avatar);
data.put("authorlist",authorlist);
}

avatarVos.put("data",data);
Map<String,Object> info = new HashMap();
Map<String,Object> status = new HashMap();
info.put("log_id",id);
info.put("server_type","avatar list");
status.put("code",1000);
status.put("msg","success");
avatarVos.put("info",info);
avatarVos.put("status",status);

return avatarVos;
}

@Override
public WxCVideoTable selectOne(Long id, long resource_id) {

return wxCVideoMapper.selectOne(id,resource_id);
}

@Override
public List<Object> selectListForExcelExport(Object queryParams, int page) {
WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) queryParams;
List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>();
basicInfo.setBegin((page-1)*20000);
basicInfo.setLimit(20000);

list = wxCUserBasicInfoMapper.findVoList(basicInfo);
if (null == list || list.size() <= 0 ) {
return null;
}

// List<Long> userIds = list.stream().map(cc -> cc.getId()).collect(Collectors.toList());
// if (null != userIds && userIds.size() > 0 ) {
// WxCreditHistory chaddq = new WxCreditHistory();
// chaddq.setUserIdList(userIds);
// chaddq.setTenantId(tenantInfo.getFinalTenantId());
// chaddq.setStartTime(basicInfo.getCreditStartTime());
// chaddq.setEndTime(basicInfo.getCreditEndTime());
// List<WxCreditHistory> chadds = creditHistoryMapper.findAddList(chaddq);
// Map<Long, Integer> chaddMap = new HashMap<>();
// if(null != chadds){
// chaddMap = chadds.stream().collect(Collectors.toMap(WxCreditHistory::getCUserId, WxCreditHistory::getCreditNum));
// }
//
// WxCreditHistory chlesq = new WxCreditHistory();
// chlesq.setUserIdList(userIds);
// chlesq.setTenantId(tenantInfo.getFinalTenantId());
// chlesq.setStartTime(basicInfo.getCreditStartTime());
// chlesq.setEndTime(basicInfo.getCreditEndTime());
// List<WxCreditHistory> chless = creditHistoryMapper.findLesList(chlesq);
// Map<Long, Integer> chlesMap = new HashMap<>();
// if(null != chless){
// chlesMap = chless.stream().collect(Collectors.toMap(WxCreditHistory::getCUserId, WxCreditHistory::getCreditNum));
// }

//处理会员标签
List<Long> tagIds = list.stream().map(cc -> cc.getTagId()).collect(Collectors.toList());
Map<Long, String> tagIdName = wxCUserTagsService.findIdTagNames(basicInfo.getFinalTenantId(),tagIds);
list.stream().forEach(u->{
// u.setAddCredit(finalChaddMap.get(u.getId()));
// u.setLesCredit(finalChlesMap.get(u.getId()));
u.setTagNames(tagIdName.get(u.getTagId()));
});
//
// }
if (null != list && list.size() > 0 ) {
List<Object> retList = new ArrayList<Object>();
retList.addAll(list);
return retList;
}
return null;
}



public static String getFileMD5(File file) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) {
byte[] buffer = new byte[1024];
int read = 0;
while ((read = bis.read(buffer)) != -1) {
md.update(buffer, 0, read);
}
}
byte[] digest = md.digest();
String md5 = String.format("%032x", new BigInteger(1, digest));
return md5;

}

}

+ 191
- 0
suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java Переглянути файл

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

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCVideoTable;
import com.iformall.domain.po.WxCVoiceTable;
import com.iformall.domain.po.sm.VoiceInfo;
import com.iformall.domain.vo.VoiceInfoVo;
import com.iformall.enums.EnumClassType;
import com.iformall.enums.EnumSpeakType;
import com.iformall.mapper.VoiceMapper;
import com.iformall.mapper.WxCVoiceMapper;
import com.iformall.service.WxCVoiceService;
import com.iformall.sm.AiPreviewParam;
import com.iformall.sm.AiPreviewResult;
import com.iformall.sm.AiVideoHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.*;

@Service
public class WxCVoiceServiceImpl implements WxCVoiceService {

@Autowired
WxCVoiceMapper wxCVoiceMapper;

@Autowired
VoiceMapper voiceMapper;

private final static String str = "\uD83D\uDD57";
private final static String url = "https://suimang.oss-accelerate.aliyuncs.com/builtin/tts_all_sample/";
private final static String end = ".wav";


@Override
public Map<String,Object> getById(Long id) {

List<WxCVoiceTable> resultList = wxCVoiceMapper.getById(id);
HashMap<String, Object> result = new HashMap<>();
HashMap<String, Object> data = new HashMap<>();
List audioList = new ArrayList();

for (WxCVoiceTable wxCVoiceTable : resultList) {
HashMap<String, Object> audio = new HashMap<>();
HashMap<String, Object> voice = new HashMap<>();

data.put("username", wxCVoiceTable.getUserName());
data.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", EnumClassType.SHARE.getCode());
voice.put("displayname", wxCVoiceTable.getVoiceDisplayName());
voice.put("gender", wxCVoiceTable.getGender());
List styleList = new ArrayList();


List<String> strings = JSON.parseArray(wxCVoiceTable.getStyleList(), String.class);
for (String y : strings) {
// List list = new ArrayList<>();
HashMap<String, Object> style = new HashMap<>();
style.put("stylename", y);
style.put("displayname", EnumSpeakType.getEnum(y).getMessage());
style.put("styledemo", url + wxCVoiceTable.getMouldSmId() + "_" + y + end);
//list.add(style);
styleList.add(style);
}



// for (String s : Arrays.asList(wxCVoiceTable.getStyleList())) {
//// VoiceInfoVo infoVo = new VoiceInfoVo();
//// infoVo.setName(EnumSpeakType.getEnum(s).getMessage());
//// infoVo.setEngName(s);
//// infoVo.setUrl(url + wxCVoiceTable.getMouldSmId() + "_" + s + end);
// style.put("stylename", s);
// style.put("displayname", EnumSpeakType.getEnum(s).getMessage());
// style.put("styledemo", url + wxCVoiceTable.getMouldSmId() + "_" + s + end);
// styleList.add(style);
// }
// styleList.add(style);
voice.put("styleList", styleList);


// style.put("stylename", wxCVoiceTable.getStyleName());
// style.put("displayname", wxCVoiceTable.getStyleDisplayName());
// style.put("styledemo", wxCVoiceTable.getStyleDemo());


}


data.put("audioList", audioList);
result.put("data",data);
HashMap<String, Object> info = new HashMap<>();
HashMap<String, Object> status = new HashMap<>();
info.put("log_id",id);
info.put("server_type","audio list");
result.put("info",info);
status.put("code",1000);
status.put("msg","success");
result.put("status",status);
return result;
}

@Override
public Map<String,Object> voicePreview(AiPreviewParam aiPreviewParam) {
VoiceInfo voiceInfo = voiceMapper.selectOne(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getIsDel, 0).eq(VoiceInfo::getId, aiPreviewParam.getVoice_id()));
if (ObjectUtils.isEmpty(voiceInfo)){
Map<String,Object> status = new HashMap<>();
status.put("code",ErrorCode.SYS_SERVER_ERROR.getCode());
status.put("msg","声音信息不存在");
return status;
// return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "声音信息不存在");
}
AiPreviewParam param = new AiPreviewParam();
param.setGen_txt(aiPreviewParam.getGen_txt().replaceAll(str,"[*]"));
param.setVoice_id(voiceInfo.getMouldSmId());
param.setVoice_style(StringUtils.isBlank(aiPreviewParam.getVoice_style()) ? EnumSpeakType.default_0.getMessage() : aiPreviewParam.getVoice_style());
param.setGender(voiceInfo.getSex() == 1 ? "male" : "female");
AiPreviewResult result = AiVideoHelper.voicePreview(param);
// if (result.isSuccess()){
// Map<String,Object> status = new HashMap<>();
// status.put("data",new ResultData(result.getTime()));
//
// return status;
// //return new ResultData(result.getTime());
// }
Map<String,Object> resultMap = new HashMap<>();
Map<String,Object> data = new HashMap<>();
data.put("ttsurl",result.getUrl());

Map<String,Object> status = new HashMap<>();
status.put("code",1000);
status.put("msg","success");
resultMap.put("data",data);
resultMap.put("status",status);
return resultMap;
//return new ResultData(result.getCode(), result.getMsgInfo(result.getCode(),result.getMsg()));
}
//test
@Override
public List<VoiceInfo> chooseType(Long id) {
List<VoiceInfo> voiceInfos = voiceMapper.selectList(
new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getLanguageId, id).orderByAsc(VoiceInfo::getAgeType).orderByAsc(VoiceInfo::getDisplayName));
voiceInfos.forEach(x -> {
if (StringUtils.isNotEmpty(x.getStyleList())) {
List<String> strings = JSON.parseArray(x.getStyleList(), String.class);
List<VoiceInfoVo> list = new ArrayList<>();
strings.forEach(y->{
VoiceInfoVo infoVo = new VoiceInfoVo();
infoVo.setName(EnumSpeakType.getEnum(y).getMessage());
infoVo.setEngName(y);
infoVo.setUrl(url + x.getMouldSmId() + "_" + y + end);
list.add(infoVo);
});

VoiceInfoVo infoVo = new VoiceInfoVo();
infoVo.setName(EnumSpeakType.getEnum(0).getMessage());
infoVo.setUrl(url + x.getMouldSmId() + "_" + "default" + end);
infoVo.setEngName("default");
list.add(infoVo);
x.setStyle(list);
} else {
List<VoiceInfoVo> list = Lists.newArrayList();
VoiceInfoVo infoVo = new VoiceInfoVo();
infoVo.setName(EnumSpeakType.getEnum(0).getMessage());
infoVo.setEngName("default");
infoVo.setUrl(url + x.getMouldSmId() + "_" + "default" + end);
list.add(infoVo);
x.setStyle(list);
}
});
return voiceInfos;
}
}

+ 14
- 4
suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java Переглянути файл

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.gson.JsonObject;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.ResultData;
@@ -32,10 +33,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;

import javax.transaction.xa.XAException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;

@@ -206,6 +204,18 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService {
param.setTask_id(photoSpeakVideo.getId());
param.setCallback_url(callbackUrl + "/callback/photo/speak");
param.setImg(Base64Util.imageUrlToBase64(photoSpeakVideo.getPersonPhotoUrl()));
Map<String,Object> subtitleMap = new HashMap<>();
subtitleMap.put("enabled",photoSpeakVideo.getSubtitleEnabled());
if(EnumYesOrNo.YES.getCode().equals(photoSpeakVideo.getSubtitleEnabled())){
Map titleParams = JSON.parseObject(photoSpeakVideo.getSubtitleParams(),Map.class);
if(titleParams == null || titleParams.isEmpty()){
subtitleMap.put("enabled",EnumYesOrNo.NO.getCode());
}else{
subtitleMap.put("params",titleParams);
}
}
param.setSubtitle(subtitleMap);

String voiceMouldSm = photoSpeakVideo.getVoiceMouldSm();
Integer sex = 1;
Integer speakType = 0;


+ 3
- 1
suimangService/src/main/java/com/iformall/service/sm/impl/VoiceInfoServiceImpl.java Переглянути файл

@@ -34,7 +34,8 @@ public class VoiceInfoServiceImpl implements VoiceInfoService {

@Override
public List<VoiceInfo> chooseType(Long id) {
List<VoiceInfo> voiceInfos = voiceMapper.selectList(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getLanguageId, id).orderByAsc(VoiceInfo::getDisplayName));
List<VoiceInfo> voiceInfos = voiceMapper.selectList(
new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getLanguageId, id).orderByAsc(VoiceInfo::getAgeType).orderByAsc(VoiceInfo::getDisplayName));
voiceInfos.forEach(x -> {
if (StringUtils.isNotEmpty(x.getStyleList())) {
List<String> strings = JSON.parseArray(x.getStyleList(), String.class);
@@ -88,4 +89,5 @@ public class VoiceInfoServiceImpl implements VoiceInfoService {
}
return new ResultData(result.getCode(), result.getMsgInfo(result.getCode(),result.getMsg()));
}

}

+ 12
- 3
suimangService/src/main/java/com/iformall/sm/AiPhotoSpeakParam.java Переглянути файл

@@ -1,8 +1,13 @@
package com.iformall.sm;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.models.auth.In;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;


@Data
public class AiPhotoSpeakParam {
@@ -26,6 +31,8 @@ public class AiPhotoSpeakParam {
private Long task_id;
private String callback_url;

private Map<String,Object> subtitle;

public String neglectImgString() {
StringBuffer str = new StringBuffer();
str.append("{");
@@ -34,9 +41,11 @@ public class AiPhotoSpeakParam {
str.append("\"voice_style\":").append("\"").append(voice_style).append("\",");
str.append("\"gender\":").append("\"").append(gender).append("\",");
str.append("\"url\":").append("\"").append(url).append("\",");
str.append("\"img\":").append("\"").append(img);
str.append("\"task_id\":").append("\"").append(task_id);
str.append("\"callback_url\":").append("\"").append(callback_url).append("\"}");
str.append("\"img\":").append("\"").append("\",");
str.append("\"task_id\":").append("\"").append(task_id).append("\",");
str.append("\"callback_url\":").append("\"").append(callback_url).append("\",");
str.append("\"subtitle\":").append(JSON.toJSONString(subtitle))
.append("\"}");
return str.toString();
}
}

+ 1
- 0
suimangService/src/main/java/com/iformall/sm/AiPreviewParam.java Переглянути файл

@@ -8,5 +8,6 @@ public class AiPreviewParam {
private String voice_id;
private String voice_style;
private String gender;
private int speed;

}

+ 1
- 1
suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java Переглянути файл

@@ -116,9 +116,9 @@ public class AiVideoHelper {
// }
}
public static AiPhotoSpeakResult createPhotoSpeakVideo(AiPhotoSpeakParam videoParam) {
log.info("生成视频start request:" + videoParam.neglectImgString());
String response = doPost(url + photo_speak_suffix, JSONObject.toJSONString(videoParam));
log.info("生成视频end response:" + response);
log.info("生成视频的 IP:" + url + photo_speak_suffix);
AiPhotoSpeakResult result = new AiPhotoSpeakResult();
if (StringUtils.isBlank(response)) {
result.setSuccess(false);


+ 4
- 1
suimangService/src/main/resources/mapper/PhotoSpeakVideoMapper.xml Переглянути файл

@@ -8,6 +8,9 @@
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="person_photo_id" jdbcType="BIGINT" property="personPhotoId"/>
<result column="person_photo_url" jdbcType="VARCHAR" property="personPhotoUrl"/>
<result column="subtitle_enabled" jdbcType="INTEGER" property="subtitleEnabled"/>
<result column="subtitle_params" jdbcType="VARCHAR" property="subtitleParams"/>

<result column="voice_from" jdbcType="INTEGER" property="voiceFrom"/>
<result column="voice_mould_id" jdbcType="BIGINT" property="voiceMouldId"/>
<result column="voice_mould_sm" jdbcType="VARCHAR" property="voiceMouldSm"/>
@@ -39,7 +42,7 @@

<sql id="allColumns">
`id`, `tenant_id`, `parent_tenant_id`, `user_id`,
`person_photo_id`, `person_photo_url`, `voice_from`, `voice_mould_id`, `voice_mould_sm`, `paperwork`, `voice_material_id`, `voice_material_url`,
`person_photo_id`, `person_photo_url`, `subtitle_enabled`, `subtitle_params`, `voice_from`, `voice_mould_id`, `voice_mould_sm`, `paperwork`, `voice_material_id`, `voice_material_url`,
`title`, `cover_img`, `remark`, `video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`, `video_msg`, `create_video_date`, `create_date`, `update_date`,
`is_hy`,`video_hy_status`,`music_id`,`save_dir`
</sql>


+ 323
- 0
suimangService/src/main/resources/mapper/WxCLiveUserBasicInfoMapper.xml Переглянути файл

@@ -0,0 +1,323 @@
<?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.WxCLiveUserBasicInfoMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserBasicInfo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
<result column="education" jdbcType="VARCHAR" property="education"/>
<result column="sex" jdbcType="INTEGER" property="sex"/>
<result column="height" jdbcType="VARCHAR" property="height"/>
<result column="weight" jdbcType="VARCHAR" property="weight"/>
<result column="id_card" jdbcType="VARCHAR" property="idCard"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="poins" jdbcType="INTEGER" property="poins"/>
<result column="tag_id" jdbcType="BIGINT" property="tagId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
<result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
<result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/>
<result column="credit" jdbcType="INTEGER" property="credit"/>
<result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/>
<result column="login_count" jdbcType="INTEGER" property="loginCount"/>
<result column="act_record" jdbcType="INTEGER" property="actRecord"/>
<result column="score_date" jdbcType="TIMESTAMP" property="scoreDate"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>
</resultMap>


<sql id="allColumns">
wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`email`,
wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`,
wcubi.`final_tenant_id`,wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`name`,wcubi.`nick_name`,
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`,
wcubi.score_date,wcubi.status,wcubi1.code,wcubi1.version,wcubi1.expire_time
</sql>

<sql id="dynamicWhereConditions">
where 1=1

<if test=" null != tenantId and '' != tenantId">
and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
</if>
<if test=" null != id ">
and wcubi.`id` = #{id}
</if>

<if test=" null != phone ">
and wcubi.`phone` like concat('%', #{phone},'%')
</if>

<if test=" null != birthdate ">
and wcubi.`birthdate` = #{birthdate}
</if>

<if test=" null != education ">
and wcubi.`education` like concat('%', #{education},'%')
</if>

<if test=" null != sex ">
and wcubi.`sex` = #{sex}
</if>

<if test=" null != email ">
and wcubi.`email` like concat('%', #{email},'%')
</if>

<if test=" null != address ">
and wcubi.`address` like concat('%', #{address},'%')
</if>

<if test=" null != levelStartScore ">
and wcubi.poins &gt;= #{levelStartScore}
</if>

<if test=" null != levelEndScore">
and wcubi.poins &lt; #{levelEndScore}
</if>

<if test=" null != tagId ">
and wcubi.`tag_id` = #{tagId}
</if>

<if test=" null != createDate ">
and wcubi.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and wcubi.`update_date` = #{updateDate}
</if>

<if test=" null != actRecord ">
and wcubi.`act_record` = #{actRecord}
</if>

<if test=" null != name ">
and wcubi.`name` like concat('%', #{name},'%')
</if>
<if test=" null != startTime and null != endTime">
and wcubi.`create_date` between #{startTime} and #{endTime}
</if>

<if test=" null != activeStartTime and null != activeEndTime">
and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime}
</if>

<if test=" null != status ">
and wcubi.`status` = #{status}
</if>

<if test=" null != ids ">
and wcubi.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>

<if test=" null != sortColumns">order by ${sortColumns}</if>

</sql>



<select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select *
from wx_c_user_live_basic_info wcubi1
where wcubi1.id =#{id}
</select>

<update id="updateCode">
update wx_c_user_live_basic_info set code = #{code} where id = #{id}
</update>


<sql id="allColumnsOfScoreList">
wcubi.id,wcubi.phone,wcubi.birthdate,wcubi.education,wcubi.sex,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.email,wcubi.address,wcubi.poins,wcubi.tag_id,
wcubi.create_date,wcubi.update_date,wcubi.name,wcubi.level,wcubi.nick_name,wcubi.score_date,wcubi.final_tenant_id
</sql>


<resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
<result column="education" jdbcType="VARCHAR" property="education"/>
<result column="sex" jdbcType="INTEGER" property="sex"/>
<result column="height" jdbcType="VARCHAR" property="height"/>
<result column="weight" jdbcType="VARCHAR" property="weight"/>
<result column="id_card" jdbcType="VARCHAR" property="idCard"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="poins" jdbcType="INTEGER" property="poins"/>
<result column="tag_id" jdbcType="BIGINT" property="tagId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
<result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
<result column="credit" jdbcType="INTEGER" property="credit"/>
<result column="tags" jdbcType="VARCHAR" property="tags"/>
<result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/>
</resultMap>

<sql id="dynamicVoWhereConditions">
where 1=1

<if test=" null != id ">
and wcubi.`id` = #{id}
</if>

<if test=" null != tenantId and '' != tenantId">
and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
</if>

<if test=" null != phone and '' != phone">
and wcubi.`phone` like concat('%', #{phone},'%')
</if>

<if test=" null != birthdate ">
and wcubi.`birthdate` = #{birthdate}
</if>

<if test=" null != education and '' != education">
and wcubi.`education` like concat('%', #{education},'%')
</if>

<if test=" null != sex ">
and wcubi.`sex` = #{sex}
</if>

<if test=" null != email and '' != email">
and wcubi.`email` like concat('%', #{email},'%')
</if>

<if test=" null != address and '' != address">
and wcubi.`address` like concat('%', #{address},'%')
</if>

<if test=" null != poins ">
and wcubi.`poins` = #{poins}
</if>

<if test=" null != tagId ">
and wcubi.`tag_id` = #{tagId}
</if>

<if test=" null != createDate ">
and wcubi.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and wcubi.`update_date` = #{updateDate}
</if>

<if test=" null != actRecord ">
and wcubi.`act_record` = #{actRecord}
</if>

<if test=" null != name and '' != name">
and wcubi.`name` like concat('%', #{name},'%')
</if>
<if test=" null != startTime and null!=endTime">
and wcubi.`create_date` between #{startTime} and #{endTime}
</if>

<if test=" null != activeStartTime and null!=activeEndTime">
and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime}
</if>

<if test=" null != ids ">
and wcubi.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
order by wcubi.`active_time` DESC
<!--<if test=" null != sortColumns">order by ${sortColumns}</if>-->
</sql>

<sql id="filterWhereConditions">
where 1=1
<if test=" null != tenantId and '' != tenantId">
and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
</if>
<if test=" null != startTime ">
and wcubi.create_date &gt;= #{startTime}
</if>

<if test=" null != endTime">
and wcubi.create_date &lt;= #{endTime}
</if>

<if test=" null != birthStartTime ">
and wcubi.birthdate &gt;= #{birthStartTime}
</if>

<if test=" null != birthEndTime">
and wcubi.birthdate &lt; #{birthEndTime}
</if>

<if test=" null != loginStartTime ">
and wcubi.active_time &gt;= #{loginStartTime}
</if>

<if test=" null != loginEndTime">
and wcubi.active_time &lt;= #{loginEndTime}
</if>

<if test=" null != phones">
and wcubi.phone in (${phones})
</if>

<if test=" null != levelStartScore and (0 != levelStartScore and '' != levelStartScore)">
and wcubi.poins &gt;= #{levelStartScore}
<if test=" null != levelEndScore">
and wcubi.poins &lt; #{levelEndScore}
</if>
</if>

<if test=" null != levelStartScore and (0 == levelStartScore or '' == levelStartScore)">
and (wcubi.poins is null or
(wcubi.poins &gt;= #{levelStartScore}
<if test=" null != levelEndScore">
and wcubi.poins &lt; #{levelEndScore}
</if>
))
</if>

<if test=" null != ids ">
and wcubi.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>

<if test=" null != tagIds ">
and wcubi.`tag_id` in
<foreach collection="tagIds" index="index" item="tagIdItem" open="(" separator="," close=")">
#{tagIdItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>









</mapper>

+ 30
- 0
suimangService/src/main/resources/mapper/WxCUserAuthorityMapper.xml Переглянути файл

@@ -0,0 +1,30 @@
<?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.WxCUserAuthorityMapper">

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

<result column="user_name" jdbcType="VARCHAR" property="userName"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="resource_id" jdbcType="VARCHAR" property="resourceId"/>
<result column="class" jdbcType="INTEGER" property="classType"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>
<result column="current_time" jdbcType="VARCHAR" property="currentTime"/>

</resultMap>
<select id="getAuthorAvatar" resultType="com.iformall.domain.po.WxCUserAuthority">
select wca.user_name,wca.type,wca.resource_id,wca.expire_time,wcav.class
from wx_c_author wca
join wx_c_avatar wcav on wca.resource_id = wcav.id and wca.type = 0
where wca.user_id=#{id} and wca.resource_id = #{resourceId}
</select>
<select id="getAuthorVoice" resultType="com.iformall.domain.po.WxCUserAuthority">
select wca.user_name,wca.type,wca.resource_id,wca.expire_time
from wx_c_author wca
join voice_info vi on wca.resource_id = vi.id
join voice_language vl on vi.language_id =vl.id
where wca.user_id=#{id} and wca.resource_id = #{resourceId}
</select>


</mapper>

+ 13
- 2
suimangService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Переглянути файл

@@ -28,7 +28,9 @@
<result column="login_count" jdbcType="INTEGER" property="loginCount"/>
<result column="act_record" jdbcType="INTEGER" property="actRecord"/>
<result column="score_date" jdbcType="TIMESTAMP" property="scoreDate"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>
</resultMap>

<sql id="allColumns">
@@ -38,6 +40,13 @@
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`,
wcubi.score_date,wcubi.status
</sql>
<sql id="allColumns1">
wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`email`,
wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`,
wcubi.`final_tenant_id`,wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`name`,wcubi.`nick_name`,
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`,
wcubi.score_date,wcubi.status,wcubi1.code,wcubi1.version,wcubi1.expire_time
</sql>

<sql id="dynamicWhereConditions">
where 1=1
@@ -130,6 +139,7 @@
where wcubi.id =#{id}
</select>


<select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
@@ -148,7 +158,7 @@
</foreach>
</if>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="Long">
select id
from wx_c_user_basic_info wcubi
@@ -573,4 +583,5 @@
<update id="cuserOldToNew" statementType="CALLABLE" >
{call cuser_old_to_new(#{oldCuserId},#{newCuserId},#{tableIndex},#{finalTableIndex})}
</update>

</mapper>

+ 44
- 0
suimangService/src/main/resources/mapper/WxCVideoMapper.xml Переглянути файл

@@ -0,0 +1,44 @@
<?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.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="model" jdbcType="VARCHAR" property="model"/>
<result column="model_path" jdbcType="VARCHAR" property="modelPath"/>
<result column="class" jdbcType="VARCHAR" property="classType"/>
<result column="preinfo" jdbcType="VARCHAR" property="preInfo"/>
<result column="preinfo_path" jdbcType="VARCHAR" property="preInfoPath"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>

</resultMap>

<!--<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCVideoTable">

<result column="user_name" jdbcType="VARCHAR" property="username"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>

</resultMap>-->
<select id="getById" resultMap="BaseResultMap">
SELECT wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo,wcav.demo
,wcav.class,wcav.model_path,wcav.preinfo_path
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_id =#{id} AND wca.type = 0 )
</select>

<select id="selectOne" resultType="com.iformall.domain.po.WxCVideoTable">
SELECT wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo,wcav.demo
,wcav.class,wcav.model_path,wcav.preinfo_path
from wx_c_author wca
left join wx_c_avatar wcav on wcav.id =wca.resource_id
where wca.resource_id =#{resource_id} and wca.user_id = #{id}
</select>


</mapper>

+ 45
- 0
suimangService/src/main/resources/mapper/WxCVoiceMapper.xml Переглянути файл

@@ -0,0 +1,45 @@
<?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="name" jdbcType="VARCHAR" property="localelName"/>
<result column="chinese_name" jdbcType="VARCHAR" property="localDisPlayName"/>
<result column="id" jdbcType="INTEGER" property="voiceId"/>
<result column="class" jdbcType="INTEGER" property="voiceType"/>
<result column="local_name" jdbcType="VARCHAR" property="voiceName"/>
<result column="display_name" jdbcType="VARCHAR" property="voiceDisplayName"/>
<result column="sex" jdbcType="INTEGER" property="gender"/>

<result column="style_list" jdbcType="VARCHAR" property="styleList"/>

<result column="mould_sm_id" jdbcType="VARCHAR" property="MouldSmId"/>

<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="getById" 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_id = #{id}-->
<!-- </select> -->
<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,
vl.name,vl.chinese_name
FROM wx_c_author wca
join voice_info vi on wca.resource_id = vi.id
join voice_language vl on vi.language_id =vl.id
WHERE wca.user_id=#{id}
</select>


</mapper>

Завантаження…
Відмінити
Зберегти