Browse Source

Merge branch 'photo' of https://git.malls.iformall.com/suimang/suimangServer into photo

private_deployment
xhxu 1 year ago
parent
commit
1aa90eb2ce
5 changed files with 77 additions and 229 deletions
  1. +5
    -79
      suimangCApi/src/main/java/com/iformall/controller/UserLiveController.java
  2. +2
    -3
      suimangService/src/main/java/com/iformall/service/impl/WxCLiveUserBasicInfoServiceImpl.java
  3. +41
    -38
      suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java
  4. +2
    -38
      suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java
  5. +27
    -71
      suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java

+ 5
- 79
suimangCApi/src/main/java/com/iformall/controller/UserLiveController.java View File

@@ -88,7 +88,6 @@ public class UserLiveController extends BaseController {
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)) {
@@ -97,7 +96,6 @@ public class UserLiveController extends BaseController {
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) {
@@ -106,22 +104,16 @@ public class UserLiveController extends BaseController {
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())) {
@@ -130,7 +122,6 @@ public class UserLiveController extends BaseController {
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"));
@@ -144,34 +135,22 @@ public class UserLiveController extends BaseController {
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);

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("token", basicInfo.getToken());
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());
@@ -180,12 +159,8 @@ public class UserLiveController extends BaseController {
wxCLiveLoginVo.setData(data);
wxCLiveLoginVo.setInfo(info);
wxCLiveLoginVos.put("status", status);

System.out.println("wxCLiveLoginVo.getToken() = " + wxCLiveLoginVo.getToken());


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

/**
@@ -198,11 +173,7 @@ public class UserLiveController extends BaseController {
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);

Long id = getMemberId();
//鉴权
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id);
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) {
@@ -212,17 +183,11 @@ public class UserLiveController extends BaseController {
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()));
return wxCVideoService.getById(id);
}


@@ -236,13 +201,7 @@ public class UserLiveController extends BaseController {
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);


Long id = getMemberId();
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id);
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) {
HashMap<Object, Object> status = new HashMap<>();
@@ -251,10 +210,6 @@ public class UserLiveController extends BaseController {
resultMap.put("status", status);
return resultMap;
}

// long id = getMemberId();


return wxCVoiceService.getById(id);
}

@@ -269,13 +224,7 @@ public class UserLiveController extends BaseController {
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);

Long id = getMemberId();
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id);
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) {
HashMap<Object, Object> status = new HashMap<>();
@@ -284,42 +233,29 @@ public class UserLiveController extends BaseController {
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);
}


@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();
Long id = getMemberId();
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);
@@ -333,7 +269,6 @@ public class UserLiveController extends BaseController {
info.put("log_id", id);
info.put("server_type", "audio tts");
resultMap.put("info", info);

return resultMap;
}

@@ -344,9 +279,7 @@ public class UserLiveController extends BaseController {
@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"));
@@ -356,18 +289,13 @@ public class UserLiveController extends BaseController {
} 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"));
//解决编码问题
@@ -379,8 +307,6 @@ public class UserLiveController extends BaseController {
while ((flag = inputStream.read(cache)) != -1) {
outputStream.write(cache, 0, flag);
}
// }

} catch (MallinkException e) {
ResultData resultData = new ResultData(e.getErrorCode(), e.getMessage());
//解决编码问题


+ 2
- 3
suimangService/src/main/java/com/iformall/service/impl/WxCLiveUserBasicInfoServiceImpl.java View File

@@ -17,11 +17,10 @@ public class WxCLiveUserBasicInfoServiceImpl implements WxCLiveUserBasicInfoServ
@Override
public WxCUserBasicInfo getById(Long id) {
return wxCLiveUserBasicInfoMapper.selectById(id);

}

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

wxCLiveUserBasicInfoMapper.updateCode(id,code);
wxCLiveUserBasicInfoMapper.updateCode(id, code);
}
}

+ 41
- 38
suimangService/src/main/java/com/iformall/service/impl/WxCUserAuthorityServiceImpl.java View File

@@ -18,68 +18,71 @@ public class WxCUserAuthorityServiceImpl implements WxCUserAuthorityService {


@Override
public Map<String,Object> getAuthor(Long id, String code, Integer type, Long resourceId) {
List<WxCUserAuthority> resultList = new ArrayList<WxCUserAuthority>();
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){
if (type == 0) {
//查询数字人相关权限
resultList = wxCUserAuthorityMapper.getAuthorAvatar(id,0,resourceId);
resultList = wxCUserAuthorityMapper.getAuthorAvatar(id, 0, resourceId);
}
if (type==1){
if (type == 1) {
//查询声纹相关权限
resultList = wxCUserAuthorityMapper.getAuthorVoice(id,1,resourceId);

resultList = wxCUserAuthorityMapper.getAuthorVoice(id, 1, resourceId);
}

if (resourceId==null||resourceId==-1){
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()/1000));
data.put("expire_time",wxCUserAuthority.getExpireTime().getTime()/1000);
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() / 1000));
data.put("expire_time", wxCUserAuthority.getExpireTime().getTime() / 1000);
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);
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<>();
if (resultList.size() == 0) {
status.put("code", 5001);
status.put("msg", "没有该资源的权限");
authorVos.put("status", status);
return authorVos;
}
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("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()/1000));
data.put("expire_time",wxCUserAuthority.getExpireTime().getTime()/1000);

data.put("current_time", new Date(System.currentTimeMillis() / 1000));
data.put("expire_time", wxCUserAuthority.getExpireTime().getTime() / 1000);
}
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);

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

+ 2
- 38
suimangService/src/main/java/com/iformall/service/impl/WxCVideoServiceImpl.java View File

@@ -39,16 +39,12 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer
WxCVideoMapper wxCVideoMapper;

@Override
public Map<String, Object> getById(Long id) throws Exception {
public Map<String, Object> getById(Long id) {
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());
@@ -77,14 +73,12 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer
e.printStackTrace();
avatar.put("avatar_preinfo_md5", wxCVideoTable.getPreInfoMd5());
}

avatar.put("avatar_preinfo", wxCVideoTable.getPreInfo());
avatar.put("expire_time", wxCVideoTable.getExpireTime().getTime() / 1000);
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();
@@ -115,41 +109,13 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer
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);
@@ -171,7 +137,5 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer
byte[] digest = md.digest();
String md5 = String.format("%032x", new BigInteger(1, digest));
return md5;

}

}

+ 27
- 71
suimangService/src/main/java/com/iformall/service/impl/WxCVoiceServiceImpl.java View File

@@ -39,121 +39,78 @@ public class WxCVoiceServiceImpl implements WxCVoiceService {


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

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()/1000));
data.put("current_time", new Date(System.currentTimeMillis() / 1000));
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().getTime()/1000);
voice.put("expire_time", wxCVoiceTable.getExpireTime().getTime() / 1000);
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);
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);
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) {
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","声音信息不存在");
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.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);
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(
@@ -162,14 +119,13 @@ public class WxCVoiceServiceImpl implements WxCVoiceService {
if (StringUtils.isNotEmpty(x.getStyleList())) {
List<String> strings = JSON.parseArray(x.getStyleList(), String.class);
List<VoiceInfoVo> list = new ArrayList<>();
strings.forEach(y->{
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);
@@ -187,5 +143,5 @@ public class WxCVoiceServiceImpl implements WxCVoiceService {
}
});
return voiceInfos;
}
}
}

Loading…
Cancel
Save