| @@ -88,7 +88,6 @@ public class UserLiveController extends BaseController { | |||||
| Map<String, Object> wxCLiveLoginVos = new HashMap<>(); | Map<String, Object> wxCLiveLoginVos = new HashMap<>(); | ||||
| String ipAddr = getIpAddr(); | String ipAddr = getIpAddr(); | ||||
| logger.debug("[" + ipAddr + "] WxUserGrantController::login"); | logger.debug("[" + ipAddr + "] WxUserGrantController::login"); | ||||
| String phone = map.get("username"); | String phone = map.get("username"); | ||||
| String password = map.get("password"); | String password = map.get("password"); | ||||
| if (StringUtils.isBlank(phone) || StringUtils.isBlank(password)) { | if (StringUtils.isBlank(phone) || StringUtils.isBlank(password)) { | ||||
| @@ -97,7 +96,6 @@ public class UserLiveController extends BaseController { | |||||
| status.put("message", "手机号或密码为空"); | status.put("message", "手机号或密码为空"); | ||||
| wxCLiveLoginVos.put("status", status); | wxCLiveLoginVos.put("status", status); | ||||
| return wxCLiveLoginVos; | return wxCLiveLoginVos; | ||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码为空"); | |||||
| } | } | ||||
| WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | ||||
| if (basicInfo == null) { | if (basicInfo == null) { | ||||
| @@ -106,22 +104,16 @@ public class UserLiveController extends BaseController { | |||||
| status.put("message", "用户不存在"); | status.put("message", "用户不存在"); | ||||
| wxCLiveLoginVos.put("status", status); | wxCLiveLoginVos.put("status", status); | ||||
| return wxCLiveLoginVos; | return wxCLiveLoginVos; | ||||
| // return new ResultData(ErrorCode.USER_IS_EMPTY); | |||||
| } | } | ||||
| String encryptPassword = new PasswordHelper().encryptPassword(password); | String encryptPassword = new PasswordHelper().encryptPassword(password); | ||||
| if (!encryptPassword.equals(basicInfo.getPassword())) { | if (!encryptPassword.equals(basicInfo.getPassword())) { | ||||
| HashMap<Object, Object> status = new HashMap<>(); | HashMap<Object, Object> status = new HashMap<>(); | ||||
| status.put("code", ErrorCode.USER_PASSWD_ERR.getCode()); | status.put("code", ErrorCode.USER_PASSWD_ERR.getCode()); | ||||
| status.put("message", "手机号或密码错误"); | status.put("message", "手机号或密码错误"); | ||||
| wxCLiveLoginVos.put("status", status); | wxCLiveLoginVos.put("status", status); | ||||
| return wxCLiveLoginVos; | return wxCLiveLoginVos; | ||||
| // return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误"); | |||||
| } | } | ||||
| int statu = Integer.parseInt(map.get("status")); | int statu = Integer.parseInt(map.get("status")); | ||||
| if (statu == 0) { | if (statu == 0) { | ||||
| WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); | WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); | ||||
| if (basicLiveInfo.getCode() != null && !map.get("code").equals(basicLiveInfo.getCode())) { | if (basicLiveInfo.getCode() != null && !map.get("code").equals(basicLiveInfo.getCode())) { | ||||
| @@ -130,7 +122,6 @@ public class UserLiveController extends BaseController { | |||||
| status.put("message", "用户已在其他设备登录"); | status.put("message", "用户已在其他设备登录"); | ||||
| wxCLiveLoginVos.put("status", status); | wxCLiveLoginVos.put("status", status); | ||||
| return wxCLiveLoginVos; | return wxCLiveLoginVos; | ||||
| // return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(), "用户已在其他设备登录"); | |||||
| } | } | ||||
| if (basicLiveInfo.getCode() == null) { | if (basicLiveInfo.getCode() == null) { | ||||
| wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), map.get("code")); | wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), map.get("code")); | ||||
| @@ -144,34 +135,22 @@ public class UserLiveController extends BaseController { | |||||
| status.put("message", "设备已注销"); | status.put("message", "设备已注销"); | ||||
| wxCLiveLoginVos.put("status", status); | wxCLiveLoginVos.put("status", status); | ||||
| return wxCLiveLoginVos; | return wxCLiveLoginVos; | ||||
| // return new ResultData(ErrorCode.USER_CANCEL_MCODE.getCode(), "设备已注销"); | |||||
| } | } | ||||
| wxCUserBasicInfoService.handleLoginUser(basicInfo); | wxCUserBasicInfoService.handleLoginUser(basicInfo); | ||||
| WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); | WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); | ||||
| WxCLiveLoginVo wxCLiveLoginVo = new WxCLiveLoginVo(); | WxCLiveLoginVo wxCLiveLoginVo = new WxCLiveLoginVo(); | ||||
| wxCLiveLoginVo.setCode(Integer.parseInt(map.get("code"))); | wxCLiveLoginVo.setCode(Integer.parseInt(map.get("code"))); | ||||
| //wxCLiveLoginVo.setVersion(basicLiveInfo.getVersion()); | |||||
| wxCLiveLoginVo.setUsername(map.get("username")); | 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> info = new HashMap(); | ||||
| Map<String, Object> data = new HashMap(); | Map<String, Object> data = new HashMap(); | ||||
| Map<Object, Object> status = new HashMap<>(); | Map<Object, Object> status = new HashMap<>(); | ||||
| status.put("code", 1000); | status.put("code", 1000); | ||||
| status.put("message", "success"); | status.put("message", "success"); | ||||
| data.put("token", basicInfo.getToken()); | data.put("token", basicInfo.getToken()); | ||||
| data.put("status", 0); | data.put("status", 0); | ||||
| data.put("version", basicLiveInfo.getVersion()); | data.put("version", basicLiveInfo.getVersion()); | ||||
| data.put("current_time", new Date(System.currentTimeMillis() / 1000)); | data.put("current_time", new Date(System.currentTimeMillis() / 1000)); | ||||
| data.put("expire_time", basicLiveInfo.getExpireTime().getTime() / 1000); | data.put("expire_time", basicLiveInfo.getExpireTime().getTime() / 1000); | ||||
| info.put("log_id", basicInfo.getId()); | info.put("log_id", basicInfo.getId()); | ||||
| info.put("server_type", "user login"); | info.put("server_type", "user login"); | ||||
| info.put("username", basicInfo.getPhone()); | info.put("username", basicInfo.getPhone()); | ||||
| @@ -180,12 +159,8 @@ public class UserLiveController extends BaseController { | |||||
| wxCLiveLoginVo.setData(data); | wxCLiveLoginVo.setData(data); | ||||
| wxCLiveLoginVo.setInfo(info); | wxCLiveLoginVo.setInfo(info); | ||||
| wxCLiveLoginVos.put("status", status); | wxCLiveLoginVos.put("status", status); | ||||
| System.out.println("wxCLiveLoginVo.getToken() = " + wxCLiveLoginVo.getToken()); | System.out.println("wxCLiveLoginVo.getToken() = " + wxCLiveLoginVo.getToken()); | ||||
| return wxCLiveLoginVos; | return wxCLiveLoginVos; | ||||
| // return new ResultData(1000,"success",wxCLiveLoginVo); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -198,11 +173,7 @@ public class UserLiveController extends BaseController { | |||||
| Map<String, Object> avatarVos = new HashMap<>(); | Map<String, Object> avatarVos = new HashMap<>(); | ||||
| String ipaddress = getIpAddr(); | String ipaddress = getIpAddr(); | ||||
| logger.debug("[" + ipaddress + "] WxUserGrantController::getAvatarList"); | 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); | WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id); | ||||
| if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | ||||
| @@ -212,17 +183,11 @@ public class UserLiveController extends BaseController { | |||||
| avatarVos.put("status", status); | avatarVos.put("status", status); | ||||
| return avatarVos; | return avatarVos; | ||||
| } | } | ||||
| Map<Object, Object> status = new HashMap<>(); | Map<Object, Object> status = new HashMap<>(); | ||||
| status.put("code", 1000); | status.put("code", 1000); | ||||
| status.put("msg", "success"); | status.put("msg", "success"); | ||||
| // long id = getMemberId(); | |||||
| // System.out.println("id = " + id); | |||||
| // WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(infoByPhone.getId()); | |||||
| avatarVos.put("status", status); | 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<>(); | Map<String, Object> resultMap = new HashMap<>(); | ||||
| String ipaddress = getIpAddr(); | String ipaddress = getIpAddr(); | ||||
| logger.debug("[" + ipaddress + "] WxUserGrantController::getAudioList"); | 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); | WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id); | ||||
| if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | ||||
| HashMap<Object, Object> status = new HashMap<>(); | HashMap<Object, Object> status = new HashMap<>(); | ||||
| @@ -251,10 +210,6 @@ public class UserLiveController extends BaseController { | |||||
| resultMap.put("status", status); | resultMap.put("status", status); | ||||
| return resultMap; | return resultMap; | ||||
| } | } | ||||
| // long id = getMemberId(); | |||||
| return wxCVoiceService.getById(id); | return wxCVoiceService.getById(id); | ||||
| } | } | ||||
| @@ -269,13 +224,7 @@ public class UserLiveController extends BaseController { | |||||
| Map<String, Object> resultMap = new HashMap<>(); | Map<String, Object> resultMap = new HashMap<>(); | ||||
| String ipaddress = getIpAddr(); | String ipaddress = getIpAddr(); | ||||
| logger.debug("[" + ipaddress + "] WxUserGrantController::getAuthor"); | 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); | WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id); | ||||
| if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | ||||
| HashMap<Object, Object> status = new HashMap<>(); | HashMap<Object, Object> status = new HashMap<>(); | ||||
| @@ -284,42 +233,29 @@ public class UserLiveController extends BaseController { | |||||
| resultMap.put("status", status); | resultMap.put("status", status); | ||||
| return resultMap; | return resultMap; | ||||
| } | } | ||||
| //long id = getMemberId(); | |||||
| String username = params.get("username"); | |||||
| String code = params.get("code"); | String code = params.get("code"); | ||||
| Integer type = Integer.parseInt(params.get("type")); | Integer type = Integer.parseInt(params.get("type")); | ||||
| Long resourceId = Long.valueOf(params.get("resource_id")); | Long resourceId = Long.valueOf(params.get("resource_id")); | ||||
| return wxCUserAuthorityService.getAuthor(id, code, type, resourceId); | return wxCUserAuthorityService.getAuthor(id, code, type, resourceId); | ||||
| } | } | ||||
| @ApiOperation(value = "tts", notes = "{\"username\",\"string\",\"gen_txt\",\"string\",\"voice_id\",\"string\",\"voice_style\",\"string\",\"speed\",\"int\"}") | @ApiOperation(value = "tts", notes = "{\"username\",\"string\",\"gen_txt\",\"string\",\"voice_id\",\"string\",\"voice_style\",\"string\",\"speed\",\"int\"}") | ||||
| @PostMapping("/audiotts") | @PostMapping("/audiotts") | ||||
| public Map<String, Object> voicePreview(@RequestBody Map<String, String> params) { | public Map<String, Object> voicePreview(@RequestBody Map<String, String> params) { | ||||
| logger.debug("[" + getIpAddr() + "] UserLiveController::voicePreview"); | 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(); | AiPreviewParam param = new AiPreviewParam(); | ||||
| if (params.get("voice_id") == null) { | if (params.get("voice_id") == null) { | ||||
| Map<String, Object> status = new HashMap<>(); | Map<String, Object> status = new HashMap<>(); | ||||
| status.put("code", ErrorCode.SYS_SERVER_ERROR.getCode()); | status.put("code", ErrorCode.SYS_SERVER_ERROR.getCode()); | ||||
| status.put("msg", "音色ID不能为空"); | status.put("msg", "音色ID不能为空"); | ||||
| return status; | return status; | ||||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "音色ID不能为空"); | |||||
| } | } | ||||
| if (StringUtils.isBlank(params.get("gen_txt"))) { | if (StringUtils.isBlank(params.get("gen_txt"))) { | ||||
| Map<String, Object> status = new HashMap<>(); | Map<String, Object> status = new HashMap<>(); | ||||
| status.put("code", ErrorCode.SYS_SERVER_ERROR.getCode()); | status.put("code", ErrorCode.SYS_SERVER_ERROR.getCode()); | ||||
| status.put("msg", "需要生成的文字不能为空"); | status.put("msg", "需要生成的文字不能为空"); | ||||
| return status; | return status; | ||||
| //return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "需要生成的文字不能为空"); | |||||
| } | } | ||||
| if (Integer.parseInt(params.get("speed")) == -1) { | if (Integer.parseInt(params.get("speed")) == -1) { | ||||
| param.setSpeed(0); | param.setSpeed(0); | ||||
| @@ -333,7 +269,6 @@ public class UserLiveController extends BaseController { | |||||
| info.put("log_id", id); | info.put("log_id", id); | ||||
| info.put("server_type", "audio tts"); | info.put("server_type", "audio tts"); | ||||
| resultMap.put("info", info); | resultMap.put("info", info); | ||||
| return resultMap; | return resultMap; | ||||
| } | } | ||||
| @@ -344,9 +279,7 @@ public class UserLiveController extends BaseController { | |||||
| @GetMapping("exportVideo") | @GetMapping("exportVideo") | ||||
| public void exportVideo(@RequestBody Map<String, String> params, HttpServletRequest request, HttpServletResponse response) { | public void exportVideo(@RequestBody Map<String, String> params, HttpServletRequest request, HttpServletResponse response) { | ||||
| logger.debug("[" + getIpAddr() + "] UserLiveController::exportVideo"); | logger.debug("[" + getIpAddr() + "] UserLiveController::exportVideo"); | ||||
| response.reset(); | response.reset(); | ||||
| File tmpFile = null; | File tmpFile = null; | ||||
| OutputStream outputStream = null; | OutputStream outputStream = null; | ||||
| WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), params.get("username")); | WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), params.get("username")); | ||||
| @@ -356,18 +289,13 @@ public class UserLiveController extends BaseController { | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR); | throw new MallinkException(ErrorCode.SYS_SERVER_ERROR); | ||||
| } | } | ||||
| try { | try { | ||||
| if (id == null) { | if (id == null) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| WxCVideoTable videoTable = wxCVideoService.selectOne(id, Long.parseLong(params.get("resource_id"))); | WxCVideoTable videoTable = wxCVideoService.selectOne(id, Long.parseLong(params.get("resource_id"))); | ||||
| //获取响应的输出流 | //获取响应的输出流 | ||||
| InputStream inputStream = new URL(videoTable.getDemo()).openStream(); | InputStream inputStream = new URL(videoTable.getDemo()).openStream(); | ||||
| response.setHeader("Content-Disposition", "attachment; filename=" | response.setHeader("Content-Disposition", "attachment; filename=" | ||||
| + URLEncoder.encode(videoTable.getId() + ".mp4", "UTF-8")); | + URLEncoder.encode(videoTable.getId() + ".mp4", "UTF-8")); | ||||
| //解决编码问题 | //解决编码问题 | ||||
| @@ -379,8 +307,6 @@ public class UserLiveController extends BaseController { | |||||
| while ((flag = inputStream.read(cache)) != -1) { | while ((flag = inputStream.read(cache)) != -1) { | ||||
| outputStream.write(cache, 0, flag); | outputStream.write(cache, 0, flag); | ||||
| } | } | ||||
| // } | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| ResultData resultData = new ResultData(e.getErrorCode(), e.getMessage()); | ResultData resultData = new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| //解决编码问题 | //解决编码问题 | ||||
| @@ -17,11 +17,10 @@ public class WxCLiveUserBasicInfoServiceImpl implements WxCLiveUserBasicInfoServ | |||||
| @Override | @Override | ||||
| public WxCUserBasicInfo getById(Long id) { | public WxCUserBasicInfo getById(Long id) { | ||||
| return wxCLiveUserBasicInfoMapper.selectById(id); | return wxCLiveUserBasicInfoMapper.selectById(id); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void updateCode(Long id, String code) { | public void updateCode(Long id, String code) { | ||||
| wxCLiveUserBasicInfoMapper.updateCode(id,code); | |||||
| wxCLiveUserBasicInfoMapper.updateCode(id, code); | |||||
| } | } | ||||
| } | } | ||||
| @@ -18,68 +18,71 @@ public class WxCUserAuthorityServiceImpl implements WxCUserAuthorityService { | |||||
| @Override | @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<>(); | 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没有传入那就展示所有当前类型资源权限 | //若资源id没有传入那就展示所有当前类型资源权限 | ||||
| HashMap<String, Object> info = new HashMap<>(); | HashMap<String, Object> info = new HashMap<>(); | ||||
| HashMap<String, Object> status = new HashMap<>(); | HashMap<String, Object> status = new HashMap<>(); | ||||
| List authorList = new ArrayList(); | List authorList = new ArrayList(); | ||||
| for (WxCUserAuthority wxCUserAuthority : resultList) { | for (WxCUserAuthority wxCUserAuthority : resultList) { | ||||
| HashMap<String, Object> data = new HashMap<>(); | 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); | 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; | return authorVos; | ||||
| } | } | ||||
| HashMap<String, Object> data = new HashMap<>(); | HashMap<String, Object> data = new HashMap<>(); | ||||
| HashMap<String, Object> info = new HashMap<>(); | HashMap<String, Object> info = new HashMap<>(); | ||||
| HashMap<String, Object> status = 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) { | 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("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; | return authorVos; | ||||
| } | } | ||||
| } | } | ||||
| @@ -39,16 +39,12 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer | |||||
| WxCVideoMapper wxCVideoMapper; | WxCVideoMapper wxCVideoMapper; | ||||
| @Override | @Override | ||||
| public Map<String, Object> getById(Long id) throws Exception { | |||||
| public Map<String, Object> getById(Long id) { | |||||
| System.out.println("id = " + id); | System.out.println("id = " + id); | ||||
| List<WxCVideoTable> TemplateVideo = wxCVideoMapper.getById(id); | List<WxCVideoTable> TemplateVideo = wxCVideoMapper.getById(id); | ||||
| System.out.println("TemplateVideo = " + TemplateVideo); | System.out.println("TemplateVideo = " + TemplateVideo); | ||||
| Map<String, Object> avatarVos = new HashMap(); | Map<String, Object> avatarVos = new HashMap(); | ||||
| Map<String, Object> data = new HashMap(); | Map<String, Object> data = 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("username", wxCVideoTable.getUserName()); | ||||
| @@ -77,14 +73,12 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| avatar.put("avatar_preinfo_md5", wxCVideoTable.getPreInfoMd5()); | avatar.put("avatar_preinfo_md5", wxCVideoTable.getPreInfoMd5()); | ||||
| } | } | ||||
| avatar.put("avatar_preinfo", wxCVideoTable.getPreInfo()); | avatar.put("avatar_preinfo", wxCVideoTable.getPreInfo()); | ||||
| avatar.put("expire_time", wxCVideoTable.getExpireTime().getTime() / 1000); | avatar.put("expire_time", wxCVideoTable.getExpireTime().getTime() / 1000); | ||||
| avatar.put("class", wxCVideoTable.getClassType()); | avatar.put("class", wxCVideoTable.getClassType()); | ||||
| authorlist.add(avatar); | authorlist.add(avatar); | ||||
| data.put("authorlist", authorlist); | data.put("authorlist", authorlist); | ||||
| } | } | ||||
| avatarVos.put("data", data); | avatarVos.put("data", data); | ||||
| Map<String, Object> info = new HashMap(); | Map<String, Object> info = new HashMap(); | ||||
| Map<String, Object> status = new HashMap(); | Map<String, Object> status = new HashMap(); | ||||
| @@ -115,41 +109,13 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer | |||||
| if (null == list || list.size() <= 0) { | if (null == list || list.size() <= 0) { | ||||
| return null; | 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()); | List<Long> tagIds = list.stream().map(cc -> cc.getTagId()).collect(Collectors.toList()); | ||||
| Map<Long, String> tagIdName = wxCUserTagsService.findIdTagNames(basicInfo.getFinalTenantId(), tagIds); | Map<Long, String> tagIdName = wxCUserTagsService.findIdTagNames(basicInfo.getFinalTenantId(), tagIds); | ||||
| list.stream().forEach(u -> { | list.stream().forEach(u -> { | ||||
| // u.setAddCredit(finalChaddMap.get(u.getId())); | |||||
| // u.setLesCredit(finalChlesMap.get(u.getId())); | |||||
| u.setTagNames(tagIdName.get(u.getTagId())); | u.setTagNames(tagIdName.get(u.getTagId())); | ||||
| }); | }); | ||||
| // | |||||
| // } | |||||
| if (null != list && list.size() > 0) { | if (null != list && list.size() > 0) { | ||||
| List<Object> retList = new ArrayList<Object>(); | List<Object> retList = new ArrayList<Object>(); | ||||
| retList.addAll(list); | retList.addAll(list); | ||||
| @@ -171,7 +137,5 @@ public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer | |||||
| byte[] digest = md.digest(); | byte[] digest = md.digest(); | ||||
| String md5 = String.format("%032x", new BigInteger(1, digest)); | String md5 = String.format("%032x", new BigInteger(1, digest)); | ||||
| return md5; | return md5; | ||||
| } | } | ||||
| } | } | ||||
| @@ -39,121 +39,78 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { | |||||
| @Override | @Override | ||||
| public Map<String,Object> getById(Long id) { | |||||
| public Map<String, Object> getById(Long id) { | |||||
| List<WxCVoiceTable> resultList = wxCVoiceMapper.getById(id); | List<WxCVoiceTable> resultList = wxCVoiceMapper.getById(id); | ||||
| HashMap<String, Object> result = new HashMap<>(); | HashMap<String, Object> result = new HashMap<>(); | ||||
| HashMap<String, Object> data = new HashMap<>(); | HashMap<String, Object> data = new HashMap<>(); | ||||
| List audioList = new ArrayList(); | List audioList = new ArrayList(); | ||||
| for (WxCVoiceTable wxCVoiceTable : resultList) { | for (WxCVoiceTable wxCVoiceTable : resultList) { | ||||
| HashMap<String, Object> audio = new HashMap<>(); | HashMap<String, Object> audio = new HashMap<>(); | ||||
| HashMap<String, Object> voice = new HashMap<>(); | HashMap<String, Object> voice = new HashMap<>(); | ||||
| data.put("username", wxCVoiceTable.getUserName()); | 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); | audioList.add(audio); | ||||
| audio.put("LocaleName", wxCVoiceTable.getLocalelName()); | audio.put("LocaleName", wxCVoiceTable.getLocalelName()); | ||||
| audio.put("displayname", wxCVoiceTable.getLocalDisPlayName()); | audio.put("displayname", wxCVoiceTable.getLocalDisPlayName()); | ||||
| List voiceList = new ArrayList(); | List voiceList = new ArrayList(); | ||||
| voiceList.add(voice); | voiceList.add(voice); | ||||
| audio.put("voiceList", voiceList); | audio.put("voiceList", voiceList); | ||||
| voice.put("voiceid", wxCVoiceTable.getVoiceId()); | 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("voicename", wxCVoiceTable.getVoiceName()); | ||||
| voice.put("voicetype", EnumClassType.SHARE.getCode()); | voice.put("voicetype", EnumClassType.SHARE.getCode()); | ||||
| voice.put("displayname", wxCVoiceTable.getVoiceDisplayName()); | voice.put("displayname", wxCVoiceTable.getVoiceDisplayName()); | ||||
| voice.put("gender", wxCVoiceTable.getGender()); | voice.put("gender", wxCVoiceTable.getGender()); | ||||
| List styleList = new ArrayList(); | List styleList = new ArrayList(); | ||||
| List<String> strings = JSON.parseArray(wxCVoiceTable.getStyleList(), String.class); | List<String> strings = JSON.parseArray(wxCVoiceTable.getStyleList(), String.class); | ||||
| for (String y : strings) { | for (String y : strings) { | ||||
| // List list = new ArrayList<>(); | |||||
| HashMap<String, Object> style = new HashMap<>(); | HashMap<String, Object> style = new HashMap<>(); | ||||
| style.put("stylename", y); | style.put("stylename", y); | ||||
| style.put("displayname", EnumSpeakType.getEnum(y).getMessage()); | style.put("displayname", EnumSpeakType.getEnum(y).getMessage()); | ||||
| style.put("styledemo", url + wxCVoiceTable.getMouldSmId() + "_" + y + end); | style.put("styledemo", url + wxCVoiceTable.getMouldSmId() + "_" + y + end); | ||||
| //list.add(style); | |||||
| styleList.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); | voice.put("styleList", styleList); | ||||
| // style.put("stylename", wxCVoiceTable.getStyleName()); | |||||
| // style.put("displayname", wxCVoiceTable.getStyleDisplayName()); | |||||
| // style.put("styledemo", wxCVoiceTable.getStyleDemo()); | |||||
| } | } | ||||
| data.put("audioList", audioList); | data.put("audioList", audioList); | ||||
| result.put("data",data); | |||||
| result.put("data", data); | |||||
| HashMap<String, Object> info = new HashMap<>(); | HashMap<String, Object> info = new HashMap<>(); | ||||
| HashMap<String, Object> status = 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; | return result; | ||||
| } | } | ||||
| @Override | @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())); | 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 status; | ||||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "声音信息不存在"); | |||||
| } | } | ||||
| AiPreviewParam param = new AiPreviewParam(); | 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_id(voiceInfo.getMouldSmId()); | ||||
| param.setVoice_style(StringUtils.isBlank(aiPreviewParam.getVoice_style()) ? EnumSpeakType.default_0.getMessage() : aiPreviewParam.getVoice_style()); | param.setVoice_style(StringUtils.isBlank(aiPreviewParam.getVoice_style()) ? EnumSpeakType.default_0.getMessage() : aiPreviewParam.getVoice_style()); | ||||
| param.setGender(voiceInfo.getSex() == 1 ? "male" : "female"); | param.setGender(voiceInfo.getSex() == 1 ? "male" : "female"); | ||||
| AiPreviewResult result = AiVideoHelper.voicePreview(param); | 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 resultMap; | ||||
| //return new ResultData(result.getCode(), result.getMsgInfo(result.getCode(),result.getMsg())); | |||||
| } | } | ||||
| //test | |||||
| @Override | @Override | ||||
| public List<VoiceInfo> chooseType(Long id) { | public List<VoiceInfo> chooseType(Long id) { | ||||
| List<VoiceInfo> voiceInfos = voiceMapper.selectList( | List<VoiceInfo> voiceInfos = voiceMapper.selectList( | ||||
| @@ -162,14 +119,13 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { | |||||
| if (StringUtils.isNotEmpty(x.getStyleList())) { | if (StringUtils.isNotEmpty(x.getStyleList())) { | ||||
| List<String> strings = JSON.parseArray(x.getStyleList(), String.class); | List<String> strings = JSON.parseArray(x.getStyleList(), String.class); | ||||
| List<VoiceInfoVo> list = new ArrayList<>(); | List<VoiceInfoVo> list = new ArrayList<>(); | ||||
| strings.forEach(y->{ | |||||
| strings.forEach(y -> { | |||||
| VoiceInfoVo infoVo = new VoiceInfoVo(); | VoiceInfoVo infoVo = new VoiceInfoVo(); | ||||
| infoVo.setName(EnumSpeakType.getEnum(y).getMessage()); | infoVo.setName(EnumSpeakType.getEnum(y).getMessage()); | ||||
| infoVo.setEngName(y); | infoVo.setEngName(y); | ||||
| infoVo.setUrl(url + x.getMouldSmId() + "_" + y + end); | infoVo.setUrl(url + x.getMouldSmId() + "_" + y + end); | ||||
| list.add(infoVo); | list.add(infoVo); | ||||
| }); | }); | ||||
| VoiceInfoVo infoVo = new VoiceInfoVo(); | VoiceInfoVo infoVo = new VoiceInfoVo(); | ||||
| infoVo.setName(EnumSpeakType.getEnum(0).getMessage()); | infoVo.setName(EnumSpeakType.getEnum(0).getMessage()); | ||||
| infoVo.setUrl(url + x.getMouldSmId() + "_" + "default" + end); | infoVo.setUrl(url + x.getMouldSmId() + "_" + "default" + end); | ||||
| @@ -187,5 +143,5 @@ public class WxCVoiceServiceImpl implements WxCVoiceService { | |||||
| } | } | ||||
| }); | }); | ||||
| return voiceInfos; | return voiceInfos; | ||||
| } | |||||
| } | |||||
| } | } | ||||