diff --git a/suimangCApi/src/main/java/com/iformall/controller/SDKController.java b/suimangCApi/src/main/java/com/iformall/controller/SDKController.java index 0d63a8d..ffa7031 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/SDKController.java +++ b/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 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; + + } + + } diff --git a/suimangCApi/src/main/java/com/iformall/controller/UserLiveController.java b/suimangCApi/src/main/java/com/iformall/controller/UserLiveController.java new file mode 100644 index 0000000..1267221 --- /dev/null +++ b/suimangCApi/src/main/java/com/iformall/controller/UserLiveController.java @@ -0,0 +1,242 @@ +package com.iformall.controller; + + +import com.alibaba.fastjson.JSON; +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.vo.WxCLiveLoginVo; +import com.iformall.service.*; +import com.iformall.utils.Constant; +import com.iformall.utils.PasswordHelper; +import com.iformall.utils.RedisCacheUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +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.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +@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 redisTemplate; + + @Autowired + private WxCUserBasicInfoService wxCUserBasicInfoService; + + @Autowired + private WxCLiveUserBasicInfoService wxCLiveUserBasicInfoService; + + @Autowired + private WxCVideoService wxCVideoService; + + @Autowired + private WxCVoiceService wxCVoiceService; + + @Autowired + private WxCUserAuthorityService wxCUserAuthorityService; + + @AuthIgnore + @ApiOperation("验证码") + @GetMapping("/captcha.jpg") + public void captcha(HttpServletResponse response) { + logger.debug("[" + getIpAddr() + "] WxUserGrantController::captcha"); + response.setHeader("Cache-Control", "no-store, no-cache"); + response.setContentType("image/jpeg"); + + //生成文字验证码 + String text = producer.createText(); + //生成图片验证码 + BufferedImage image = producer.createImage(text); + + //保存到redis + String ipAddr = getIpAddr(); + String key = Constant.captchaPrev + ":" + ipAddr; + RedisCacheUtils.cache(redisTemplate, key, text, 60); + + ServletOutputStream out = null; + try { + out = response.getOutputStream(); + ImageIO.write(image, "jpg", out); + } catch (IOException e) { + e.printStackTrace(); + } finally { + IOUtils.closeQuietly(out); + } + } + + @AuthIgnore + @PostMapping("/login") + @ApiOperation(value = "用户登录", notes = "{\"username\":\"string\",\"password\":\"string\",\"code\":\"string\",\"Mcode\":\"string\",\"status\":\"int\"}") + public ResultData login(@RequestBody Map map, HttpServletResponse response) { + String ipAddr = getIpAddr(); + logger.debug("[" + ipAddr + "] WxUserGrantController::login"); + String code = map.get("code"); + if (StringUtils.isBlank(code)) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "请输入验证码"); + } + String key = Constant.captchaPrev + ":" + ipAddr; + String code1 = RedisCacheUtils.getCacheString(redisTemplate, key); +// if (StringUtils.isBlank(code1)) { +// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码已过期"); +// } +// if (!code1.equals(code)) { +// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码不正确"); +// } + String phone = map.get("username"); + String password = map.get("password"); + if (StringUtils.isBlank(phone) || StringUtils.isBlank(password)) { + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码为空"); + } + WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); + if (basicInfo == null) { + return new ResultData(ErrorCode.USER_IS_EMPTY); + } + + String encryptPassword = new PasswordHelper().encryptPassword(password); + + if (!encryptPassword.equals(basicInfo.getPassword())) { + return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误"); + } + + int status = Integer.parseInt(map.get("status")); + + if (status == 0) { + WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); + if (basicLiveInfo.getCode() != null && !map.get("Mcode").equals(basicLiveInfo.getCode())) { + return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(), "用户已在其他设备登录"); + } + if (basicLiveInfo.getCode() == null) { + wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), map.get("Mcode")); + } + } + if (status == -1) { + wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), null); + basicInfo.setStatus(-2); + return new ResultData(ErrorCode.USER_CANCEL_MCODE.getCode(), "设备已注销"); + } + + + wxCUserBasicInfoService.handleLoginUser(basicInfo); + WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); + + Map resultMap = new HashMap(); + + WxCLiveLoginVo wxCLiveLoginVo = new WxCLiveLoginVo(); + wxCLiveLoginVo.setCode(Integer.parseInt(map.get("Mcode"))); + 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 info = new HashMap(); + Map Status = new HashMap(); + info.put("log_id", basicInfo.getId()); + info.put("username", basicInfo.getPhone()); + wxCLiveLoginVo.setParam(info); + Status.put("code",1000); + Status.put("msg","success"); + wxCLiveLoginVo.setParam(Status); + + + return new ResultData(wxCLiveLoginVo); + } + + /** + * 视频模板列表 + */ + + @PostMapping("/avatarList") + @ApiOperation(value = "视频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}") + public ResultData avatarList(@RequestHeader(value = "token") String token) { + String ipaddress = getIpAddr(); + logger.debug("[" + ipaddress + "] WxUserGrantController::getAvatarList"); + if (token==null||token.isEmpty()){ + //用户未登录 + } + long id = getMemberId(); + WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(id); + + + return wxCVideoService.getById(id); + } + + + /** + * 音频模板列表 + */ + + @PostMapping("/audioList") + @ApiOperation(value = "音频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}") + public ResultData audioList(@RequestHeader(value = "token") String token) { + String ipaddress = getIpAddr(); + logger.debug("[" + ipaddress + "] WxUserGrantController::getAudioList"); + if (token==null||token.isEmpty()){ + //用户未登录 + } + // 已登录 + long id = getMemberId(); + + + return wxCVoiceService.getById(id); + } + + /** + * 资源权限查询 + */ + + + @ApiOperation(value = "资源权限查询", notes = "{\"username\",\"string\",\"code\",\"string\",\"type\",\"int\",\"resource_id\",\"long\"}") + @PostMapping("/author") + public ResultData getAuthor(@RequestBody Map params,@RequestHeader(value = "token") String token) { + String ipaddress = getIpAddr(); + logger.debug("[" + ipaddress + "] WxUserGrantController::getAuthor"); + + if (token==null||token.isEmpty()){ + //用户未登录 + } + // 已登录 + 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); + } +} diff --git a/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java b/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java index 451aae4..42b9c41 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/VoiceMouldController.java @@ -51,6 +51,7 @@ public class VoiceMouldController extends BaseController { @Autowired private VoiceLanguageService voiceLanguageService; + @Autowired private WxCVoiceService wxCVoiceService; diff --git a/suimangCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/suimangCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 2a5b581..73bbe20 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -85,10 +85,6 @@ public class WxUserGrantController extends BaseController { @Autowired WxMallService mallService; - @Autowired - private WxCLiveUserBasicInfoService wxCLiveUserBasicInfoService; - - @Autowired private QrCodeService qrCodeService; @@ -136,79 +132,6 @@ public class WxUserGrantController extends BaseController { } } - @AuthIgnore - @PostMapping("/userlogin") - @ApiOperation(value = "用户登录", notes = "{\"username\":\"string\",\"password\":\"string\",\"code\":\"string\",\"Mcode\":\"string\",\"status\":\"int\"}") - public ResultData userLogin(@RequestBody Map map,HttpServletResponse response){ - String ipAddr = getIpAddr(); - logger.debug("[" + ipAddr + "] WxUserGrantController::userlogin"); - String code = map.get("code"); - if(StringUtils.isBlank(code)){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "请输入验证码"); - } - String key = Constant.captchaPrev + ":" + ipAddr; - String code1 = RedisCacheUtils.getCacheString(redisTemplate, key); - if(StringUtils.isBlank(code1)){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码已过期"); - } - if(!code1.equals(code)){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码不正确"); - } - String phone = map.get("username"); - String password = map.get("password"); - if(StringUtils.isBlank(phone) || StringUtils.isBlank(password)){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码为空"); - } - WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); - if(basicInfo == null){ - return new ResultData(ErrorCode.USER_IS_EMPTY); - } - - String encryptPassword = new PasswordHelper().encryptPassword(password); - - if(!encryptPassword.equals(basicInfo.getPassword())){ - return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误"); - } - - int status = Integer.parseInt(map.get("status")); - - if (status==0){ - WxCUserBasicInfo basicLiveInfo =wxCLiveUserBasicInfoService.getById(basicInfo.getId()); - if (basicLiveInfo.getCode()!=null && !map.get("Mcode").equals(basicLiveInfo.getCode())){ - return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(),"用户已在其他设备登录"); - }if (basicLiveInfo.getCode()==null){ - wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(),map.get("Mcode")); - } - } - if (status==-1){ - wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(),null); - basicInfo.setStatus(-2); - return new ResultData(ErrorCode.USER_CANCEL_MCODE.getCode(),"设备已注销"); - } - - - wxCUserBasicInfoService.handleLoginUser(basicInfo); - WxCUserBasicInfo basicLiveInfo =wxCLiveUserBasicInfoService.getById(basicInfo.getId()); - Map resultMap = new HashMap(); -// resultMap.put("phone", basicInfo.getPhone()); - Map data = new HashMap(); - data.put("status",basicInfo.getStatus()); - data.put("version",basicLiveInfo.getVersion()); - data.put("current_time",new Date(System.currentTimeMillis()/1000)); - data.put("expire_time",basicLiveInfo.getExpireTime().getTime()/1000); - Map info = new HashMap(); - info.put("log_id",basicInfo.getId()); - info.put("username",basicInfo.getPhone()); - - resultMap.put("data",data); - resultMap.put("info",info); - - - // resultMap.put("expire_time", basicInfo.getExpireTime()); - return new ResultData(resultMap); - } - - /** diff --git a/suimangService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java b/suimangService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java index 172a300..13144c2 100644 --- a/suimangService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/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; @@ -204,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; diff --git a/suimangService/src/main/java/com/iformall/domain/po/sm/PersonMould.java b/suimangService/src/main/java/com/iformall/domain/po/sm/PersonMould.java index 83c00a4..40aa8e7 100644 --- a/suimangService/src/main/java/com/iformall/domain/po/sm/PersonMould.java +++ b/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; } - + } diff --git a/suimangService/src/main/java/com/iformall/domain/vo/WxCLiveLoginVo.java b/suimangService/src/main/java/com/iformall/domain/vo/WxCLiveLoginVo.java new file mode 100644 index 0000000..5a67175 --- /dev/null +++ b/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 data = new HashMap<>(); + + // @ApiModelProperty(value = "响应") + //private Map Status = new HashMap<>(); + + @ApiModelProperty(value = "其它参数") + private Map param = new HashMap<>(); + +} diff --git a/suimangService/src/main/java/com/iformall/mapper/WxCUserAuthorityMapper.java b/suimangService/src/main/java/com/iformall/mapper/WxCUserAuthorityMapper.java index a29688a..a484080 100644 --- a/suimangService/src/main/java/com/iformall/mapper/WxCUserAuthorityMapper.java +++ b/suimangService/src/main/java/com/iformall/mapper/WxCUserAuthorityMapper.java @@ -9,7 +9,7 @@ import java.util.List; public interface WxCUserAuthorityMapper extends CommonMapper { - List getAuthorAvatar(String username, int i, Long resourceId); + List getAuthorAvatar(Long id, int i, Long resourceId); - List getAuthorVoice(String username, int i, Long resourceId); + List getAuthorVoice(Long id, int i, Long resourceId); } diff --git a/suimangService/src/main/java/com/iformall/mapper/WxCVideoMapper.java b/suimangService/src/main/java/com/iformall/mapper/WxCVideoMapper.java index 72600f2..5908bc5 100644 --- a/suimangService/src/main/java/com/iformall/mapper/WxCVideoMapper.java +++ b/suimangService/src/main/java/com/iformall/mapper/WxCVideoMapper.java @@ -9,6 +9,8 @@ import java.util.List; public interface WxCVideoMapper extends CommonMapper { - List findByUserName(@Param("username") String username); + List getById(@Param("user_id") Long id); + + } diff --git a/suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java b/suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java index b33e190..5d900a7 100644 --- a/suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java +++ b/suimangService/src/main/java/com/iformall/mapper/WxCVoiceMapper.java @@ -9,5 +9,5 @@ import java.util.List; public interface WxCVoiceMapper extends CommonMapper { - List findByUserName(String username); + List getById(Long id); } diff --git a/suimangService/src/main/java/com/iformall/service/WxCUserAuthorityService.java b/suimangService/src/main/java/com/iformall/service/WxCUserAuthorityService.java index 3c72e3e..0d21e65 100644 --- a/suimangService/src/main/java/com/iformall/service/WxCUserAuthorityService.java +++ b/suimangService/src/main/java/com/iformall/service/WxCUserAuthorityService.java @@ -3,5 +3,5 @@ package com.iformall.service; import com.iformall.common.ResultData; public interface WxCUserAuthorityService { - ResultData getAuthor(String username, String code, Integer type, Long resourceId); + ResultData getAuthor(Long id, String code, Integer type, Long resourceId); } diff --git a/suimangService/src/main/java/com/iformall/service/WxCVideoService.java b/suimangService/src/main/java/com/iformall/service/WxCVideoService.java index ec95ad8..5e19191 100644 --- a/suimangService/src/main/java/com/iformall/service/WxCVideoService.java +++ b/suimangService/src/main/java/com/iformall/service/WxCVideoService.java @@ -6,5 +6,5 @@ import com.iformall.domain.po.WxCVideoTable; public interface WxCVideoService { - ResultData findByUserName(String username); + ResultData getById(Long id); } diff --git a/suimangService/src/main/java/com/iformall/service/WxCVoiceService.java b/suimangService/src/main/java/com/iformall/service/WxCVoiceService.java index 94c649d..b1533be 100644 --- a/suimangService/src/main/java/com/iformall/service/WxCVoiceService.java +++ b/suimangService/src/main/java/com/iformall/service/WxCVoiceService.java @@ -3,5 +3,5 @@ package com.iformall.service; import com.iformall.common.ResultData; public interface WxCVoiceService { - ResultData findByUserName(String username); + ResultData getById(Long id); } diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java index 02017d9..187a621 100644 --- a/suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java @@ -20,16 +20,16 @@ public class WxCUserAuthorityServiceImpl implements WxCUserAuthorityService { @Override - public ResultData getAuthor(String username, String code, Integer type, Long resourceId) { + public ResultData getAuthor(Long id, String code, Integer type, Long resourceId) { List resultList = new ArrayList(); if (type==0){ //查询数字人相关权限 - resultList = wxCUserAuthorityMapper.getAuthorAvatar(username,0,resourceId); + resultList = wxCUserAuthorityMapper.getAuthorAvatar(id,0,resourceId); } if (type==1){ //查询声纹相关权限 - resultList = wxCUserAuthorityMapper.getAuthorVoice(username,1,resourceId); + resultList = wxCUserAuthorityMapper.getAuthorVoice(id,1,resourceId); } if (resourceId==null){ diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java index 48e5f28..2d34756 100644 --- a/suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java @@ -32,17 +32,20 @@ public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { @Autowired WxCVideoMapper wxCVideoMapper; @Override - public ResultData findByUserName(String username) { - List TemplateVideo = wxCVideoMapper.findByUserName(username); + public ResultData getById(Long id) { + + List TemplateVideo = wxCVideoMapper.getById(id); System.out.println("TemplateVideo = " + TemplateVideo); Map resultMap = new HashMap(); Map data = new HashMap(); - data.put("username",username); - data.put("current_time",new Date(System.currentTimeMillis())); + //Map 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 avatar = new HashMap(); avatar.put("avatar_id",wxCVideoTable.getId()); avatar.put("avatar_name",wxCVideoTable.getName()); diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java index fda9046..3be82a4 100644 --- a/suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java @@ -21,9 +21,9 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { @Override - public ResultData findByUserName(String username) { + public ResultData getById(Long id) { - List resultList = wxCVoiceMapper.findByUserName(username); + List resultList = wxCVoiceMapper.getById(id); HashMap result = new HashMap<>(); List audioList = new ArrayList(); diff --git a/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java b/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java index 2e6f1fb..4923f26 100644 --- a/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java @@ -221,6 +221,11 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); String voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); + if (photoSpeakVideo.getSubtitleEnabled()==1){ + //开启字幕 查询字幕列表 + + } + if (EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)) { param.setGen_txt(photoSpeakVideo.getPaperwork().replaceAll(str, "[*]")); if (sex == 1){ diff --git a/suimangService/src/main/resources/mapper/WxCUserAuthorityMapper.xml b/suimangService/src/main/resources/mapper/WxCUserAuthorityMapper.xml index 9c90330..290c750 100644 --- a/suimangService/src/main/resources/mapper/WxCUserAuthorityMapper.xml +++ b/suimangService/src/main/resources/mapper/WxCUserAuthorityMapper.xml @@ -16,13 +16,13 @@ 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_name=#{username} and wca.resource_id = #{resourceId} +where wca.user_id=#{id} and wca.resource_id = #{resourceId} diff --git a/suimangService/src/main/resources/mapper/WxCVideoMapper.xml b/suimangService/src/main/resources/mapper/WxCVideoMapper.xml index 4a8cf25..36298f1 100644 --- a/suimangService/src/main/resources/mapper/WxCVideoMapper.xml +++ b/suimangService/src/main/resources/mapper/WxCVideoMapper.xml @@ -19,12 +19,12 @@ --> - SELECT wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo,wcav.demo from wx_c_author wca left join wx_c_avatar wcav on wcav.id =wca.resource_id where wca.resource_id -in (select wca.resource_id from wx_c_author wca WHERE wca.user_name =#{username} AND wca.type = 0 ) +in (select wca.resource_id from wx_c_author wca WHERE wca.user_id =#{id} AND wca.type = 0 ) diff --git a/suimangService/src/main/resources/mapper/WxCVoiceMapper.xml b/suimangService/src/main/resources/mapper/WxCVoiceMapper.xml index 07be05e..6f2827b 100644 --- a/suimangService/src/main/resources/mapper/WxCVoiceMapper.xml +++ b/suimangService/src/main/resources/mapper/WxCVoiceMapper.xml @@ -19,13 +19,13 @@ - select wca.user_name,wca.resource_id,wca.expire_time,wcv.id, wcv.localel_id ,wcv.id ,wcv.voice_name,wcv.voice_display_name ,wcv.gender , wcv.class , wcvl.id,wcvl.local_name,wcvl.local_display_name,wcvs.id,wcvs.voice_id,wcvs.style_name,wcvs.style_display_name,wcvs.style_demo from wx_c_author wca INNER JOIN wx_c_voice wcv on wca.resource_id = wcv.id and wca.type = 1 join wx_c_voice_local wcvl on wcv.localel_id = wcvl.id -join wx_c_voice_style wcvs on wcv.id=wcvs.voice_id where wca.user_name = #{username} +join wx_c_voice_style wcvs on wcv.id=wcvs.voice_id where wca.user_id = #{id}