@@ -1,11 +1,18 @@ | |||||
package com.iformall.controller; | package com.iformall.controller; | ||||
import com.alibaba.fastjson.JSONArray; | |||||
import com.alibaba.fastjson.JSONObject; | 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.ErrorCode; | ||||
import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
import com.iformall.domain.po.WxCVoiceTable; | |||||
import com.iformall.domain.po.sm.PhotoSpeakVideo; | import com.iformall.domain.po.sm.PhotoSpeakVideo; | ||||
import com.iformall.domain.po.sm.PreviewParam; | import com.iformall.domain.po.sm.PreviewParam; | ||||
import com.iformall.enums.EnumVideoStatus; | import com.iformall.enums.EnumVideoStatus; | ||||
import com.iformall.service.WxCVoiceService; | |||||
import com.iformall.service.sm.PhotoSpeakVideoService; | import com.iformall.service.sm.PhotoSpeakVideoService; | ||||
import com.iformall.service.sm.PersonPhotoService; | import com.iformall.service.sm.PersonPhotoService; | ||||
import com.iformall.service.sm.VoiceInfoService; | 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.bind.annotation.*; | ||||
import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||
import java.io.*; | |||||
import java.net.HttpURLConnection; | |||||
import java.net.URL; | |||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Map; | |||||
/** | /** | ||||
* 对外开放的 API 接口 | * 对外开放的 API 接口 | ||||
@@ -38,6 +49,8 @@ public class SDKController extends BaseController { | |||||
private VoiceInfoService voiceInfoService; | private VoiceInfoService voiceInfoService; | ||||
@Autowired | @Autowired | ||||
private PhotoSpeakVideoService photoSpeakVideoService; | private PhotoSpeakVideoService photoSpeakVideoService; | ||||
@Autowired | |||||
private WxCVoiceService wxCVoiceService; | |||||
@ApiOperation("图片质量审核接口") | @ApiOperation("图片质量审核接口") | ||||
@PostMapping("checkPhoto") | @PostMapping("checkPhoto") | ||||
@@ -103,4 +116,89 @@ public class SDKController extends BaseController { | |||||
photoSpeakVideoService.createVideo(mouldVideo); | photoSpeakVideoService.createVideo(mouldVideo); | ||||
return new ResultData(); | 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; | |||||
} | |||||
} | } |
@@ -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<String, Object> 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<String, String> 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<String, Object> 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<String, Object> info = new HashMap(); | |||||
Map<String, Object> 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<String, String> 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); | |||||
} | |||||
} |
@@ -51,6 +51,7 @@ public class VoiceMouldController extends BaseController { | |||||
@Autowired | @Autowired | ||||
private VoiceLanguageService voiceLanguageService; | private VoiceLanguageService voiceLanguageService; | ||||
@Autowired | @Autowired | ||||
private WxCVoiceService wxCVoiceService; | private WxCVoiceService wxCVoiceService; | ||||
@@ -85,10 +85,6 @@ public class WxUserGrantController extends BaseController { | |||||
@Autowired | @Autowired | ||||
WxMallService mallService; | WxMallService mallService; | ||||
@Autowired | |||||
private WxCLiveUserBasicInfoService wxCLiveUserBasicInfoService; | |||||
@Autowired | @Autowired | ||||
private QrCodeService qrCodeService; | 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<String, String> 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<String,Object> resultMap = new HashMap(); | |||||
// resultMap.put("phone", basicInfo.getPhone()); | |||||
Map<String,Object> 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<String,Object> 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); | |||||
} | |||||
/** | /** | ||||
@@ -64,6 +64,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||||
@io.swagger.annotations.ApiModelProperty(value="密码",name="password") | @io.swagger.annotations.ApiModelProperty(value="密码",name="password") | ||||
private String password; | private String password; | ||||
@io.swagger.annotations.ApiModelProperty(value="用户名") | |||||
@TableField(exist = false) | |||||
private String username; | |||||
@Excel(name="微信昵称",width = 20,orderNum = "5") | @Excel(name="微信昵称",width = 20,orderNum = "5") | ||||
@io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | ||||
private String nickName; | private String nickName; | ||||
@@ -204,10 +208,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private Date creditEndTime; | private Date creditEndTime; | ||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private Integer begin; | private Integer begin; | ||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private Integer limit; | private Integer limit; | ||||
@@ -41,12 +41,16 @@ public class PersonMould extends TenantEntity { | |||||
@io.swagger.annotations.ApiModelProperty(value="EnumVideoType",name="videoType") | @io.swagger.annotations.ApiModelProperty(value="EnumVideoType",name="videoType") | ||||
private Integer videoType; | private Integer videoType; | ||||
@io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | ||||
private String coverImg; | private String coverImg; | ||||
@io.swagger.annotations.ApiModelProperty(value="多封面图",name="coverPicture") | @io.swagger.annotations.ApiModelProperty(value="多封面图",name="coverPicture") | ||||
private String coverPicture; | private String coverPicture; | ||||
@io.swagger.annotations.ApiModelProperty(value="详情多图",name="detailPicture") | @io.swagger.annotations.ApiModelProperty(value="详情多图",name="detailPicture") | ||||
private String detailPicture; | private String detailPicture; | ||||
@io.swagger.annotations.ApiModelProperty(value="名称",name="title") | @io.swagger.annotations.ApiModelProperty(value="名称",name="title") | ||||
@Excel(name="名称",width = 20,orderNum = "1") | @Excel(name="名称",width = 20,orderNum = "1") | ||||
private String title; | private String title; | ||||
@@ -135,5 +139,5 @@ public class PersonMould extends TenantEntity { | |||||
} | } | ||||
return priceStr; | return priceStr; | ||||
} | } | ||||
} | } |
@@ -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> param = new HashMap<>(); | |||||
} |
@@ -9,7 +9,7 @@ import java.util.List; | |||||
public interface WxCUserAuthorityMapper extends CommonMapper<WxCUserAuthority, String> { | public interface WxCUserAuthorityMapper extends CommonMapper<WxCUserAuthority, String> { | ||||
List<WxCUserAuthority> getAuthorAvatar(String username, int i, Long resourceId); | |||||
List<WxCUserAuthority> getAuthorAvatar(Long id, int i, Long resourceId); | |||||
List<WxCUserAuthority> getAuthorVoice(String username, int i, Long resourceId); | |||||
List<WxCUserAuthority> getAuthorVoice(Long id, int i, Long resourceId); | |||||
} | } |
@@ -9,6 +9,8 @@ import java.util.List; | |||||
public interface WxCVideoMapper extends CommonMapper<WxCVideoTable, String> { | public interface WxCVideoMapper extends CommonMapper<WxCVideoTable, String> { | ||||
List<WxCVideoTable> findByUserName(@Param("username") String username); | |||||
List<WxCVideoTable> getById(@Param("user_id") Long id); | |||||
} | } |
@@ -9,5 +9,5 @@ import java.util.List; | |||||
public interface WxCVoiceMapper extends CommonMapper<WxCVoiceTable, String> { | public interface WxCVoiceMapper extends CommonMapper<WxCVoiceTable, String> { | ||||
List<WxCVoiceTable> findByUserName(String username); | |||||
List<WxCVoiceTable> getById(Long id); | |||||
} | } |
@@ -3,5 +3,5 @@ package com.iformall.service; | |||||
import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
public interface WxCUserAuthorityService { | public interface WxCUserAuthorityService { | ||||
ResultData getAuthor(String username, String code, Integer type, Long resourceId); | |||||
ResultData getAuthor(Long id, String code, Integer type, Long resourceId); | |||||
} | } |
@@ -6,5 +6,5 @@ import com.iformall.domain.po.WxCVideoTable; | |||||
public interface WxCVideoService { | public interface WxCVideoService { | ||||
ResultData findByUserName(String username); | |||||
ResultData getById(Long id); | |||||
} | } |
@@ -3,5 +3,5 @@ package com.iformall.service; | |||||
import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
public interface WxCVoiceService { | public interface WxCVoiceService { | ||||
ResultData findByUserName(String username); | |||||
ResultData getById(Long id); | |||||
} | } |
@@ -20,16 +20,16 @@ public class WxCUserAuthorityServiceImpl implements WxCUserAuthorityService { | |||||
@Override | @Override | ||||
public ResultData getAuthor(String username, String code, Integer type, Long resourceId) { | |||||
public ResultData getAuthor(Long id, String code, Integer type, Long resourceId) { | |||||
List<WxCUserAuthority> resultList = new ArrayList<WxCUserAuthority>(); | List<WxCUserAuthority> resultList = new ArrayList<WxCUserAuthority>(); | ||||
if (type==0){ | if (type==0){ | ||||
//查询数字人相关权限 | //查询数字人相关权限 | ||||
resultList = wxCUserAuthorityMapper.getAuthorAvatar(username,0,resourceId); | |||||
resultList = wxCUserAuthorityMapper.getAuthorAvatar(id,0,resourceId); | |||||
} | } | ||||
if (type==1){ | if (type==1){ | ||||
//查询声纹相关权限 | //查询声纹相关权限 | ||||
resultList = wxCUserAuthorityMapper.getAuthorVoice(username,1,resourceId); | |||||
resultList = wxCUserAuthorityMapper.getAuthorVoice(id,1,resourceId); | |||||
} | } | ||||
if (resourceId==null){ | if (resourceId==null){ | ||||
@@ -32,17 +32,20 @@ public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { | |||||
@Autowired | @Autowired | ||||
WxCVideoMapper wxCVideoMapper; | WxCVideoMapper wxCVideoMapper; | ||||
@Override | @Override | ||||
public ResultData findByUserName(String username) { | |||||
List<WxCVideoTable> TemplateVideo = wxCVideoMapper.findByUserName(username); | |||||
public ResultData getById(Long id) { | |||||
List<WxCVideoTable> TemplateVideo = wxCVideoMapper.getById(id); | |||||
System.out.println("TemplateVideo = " + TemplateVideo); | System.out.println("TemplateVideo = " + TemplateVideo); | ||||
Map<String,Object> resultMap = new HashMap(); | Map<String,Object> resultMap = new HashMap(); | ||||
Map<String,Object> data = new HashMap(); | Map<String,Object> data = new HashMap(); | ||||
data.put("username",username); | |||||
data.put("current_time",new Date(System.currentTimeMillis())); | |||||
//Map<String,Object> authorlist = new HashMap(); | //Map<String,Object> authorlist = new HashMap(); | ||||
List authorlist = new ArrayList(); | List authorlist = new ArrayList(); | ||||
for (WxCVideoTable wxCVideoTable : TemplateVideo) { | for (WxCVideoTable wxCVideoTable : TemplateVideo) { | ||||
data.put("username",wxCVideoTable.getUserName()); | |||||
data.put("current_time",new Date(System.currentTimeMillis())); | |||||
Map<String,Object> avatar = new HashMap(); | Map<String,Object> avatar = new HashMap(); | ||||
avatar.put("avatar_id",wxCVideoTable.getId()); | avatar.put("avatar_id",wxCVideoTable.getId()); | ||||
avatar.put("avatar_name",wxCVideoTable.getName()); | avatar.put("avatar_name",wxCVideoTable.getName()); | ||||
@@ -21,9 +21,9 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { | |||||
@Override | @Override | ||||
public ResultData findByUserName(String username) { | |||||
public ResultData getById(Long id) { | |||||
List<WxCVoiceTable> resultList = wxCVoiceMapper.findByUserName(username); | |||||
List<WxCVoiceTable> resultList = wxCVoiceMapper.getById(id); | |||||
HashMap<String, Object> result = new HashMap<>(); | HashMap<String, Object> result = new HashMap<>(); | ||||
List audioList = new ArrayList(); | List audioList = new ArrayList(); | ||||
@@ -221,6 +221,11 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); | Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); | ||||
String voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); | String voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); | ||||
if (photoSpeakVideo.getSubtitleEnabled()==1){ | |||||
//开启字幕 查询字幕列表 | |||||
} | |||||
if (EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)) { | if (EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)) { | ||||
param.setGen_txt(photoSpeakVideo.getPaperwork().replaceAll(str, "[*]")); | param.setGen_txt(photoSpeakVideo.getPaperwork().replaceAll(str, "[*]")); | ||||
if (sex == 1){ | if (sex == 1){ | ||||
@@ -16,13 +16,13 @@ | |||||
select wca.user_name,wca.type,wca.resource_id,wca.expire_time,wcav.class | select wca.user_name,wca.type,wca.resource_id,wca.expire_time,wcav.class | ||||
from wx_c_author wca | from wx_c_author wca | ||||
join wx_c_avatar wcav on wca.resource_id = wcav.id and wca.type = 0 | 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} | |||||
</select> | </select> | ||||
<select id="getAuthorVoice" resultType="com.iformall.domain.po.WxCUserAuthority"> | <select id="getAuthorVoice" resultType="com.iformall.domain.po.WxCUserAuthority"> | ||||
select wca.user_name,wca.type,wca.resource_id,wca.expire_time,wcv.class | select wca.user_name,wca.type,wca.resource_id,wca.expire_time,wcv.class | ||||
from wx_c_author wca | from wx_c_author wca | ||||
join wx_c_voice wcv on wca.resource_id =wcv.id and wca.type = 1 | join wx_c_voice wcv on wca.resource_id =wcv.id and wca.type = 1 | ||||
where wca.user_name=#{username} and wca.resource_id = #{resourceId} | |||||
where wca.user_id=#{id} and wca.resource_id = #{resourceId} | |||||
</select> | </select> | ||||
@@ -19,12 +19,12 @@ | |||||
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/> | <result column="expire_time" jdbcType="VARCHAR" property="expireTime"/> | ||||
</resultMap>--> | </resultMap>--> | ||||
<select id="findByUserName" resultMap="BaseResultMap"> | |||||
<select id="getById" resultMap="BaseResultMap"> | |||||
SELECT wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo,wcav.demo | SELECT wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo,wcav.demo | ||||
from wx_c_author wca | from wx_c_author wca | ||||
left join wx_c_avatar wcav on wcav.id =wca.resource_id | left join wx_c_avatar wcav on wcav.id =wca.resource_id | ||||
where 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 ) | |||||
</select> | </select> | ||||
@@ -19,13 +19,13 @@ | |||||
</resultMap> | </resultMap> | ||||
<select id="findByUserName" resultMap="BaseResultMap"> | |||||
<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 | 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 | from wx_c_author wca | ||||
INNER JOIN wx_c_voice wcv on wca.resource_id = wcv.id | INNER JOIN wx_c_voice wcv on wca.resource_id = wcv.id | ||||
and wca.type = 1 | and wca.type = 1 | ||||
join wx_c_voice_local wcvl on wcv.localel_id = wcvl.id | 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} | |||||
</select> | </select> | ||||