@@ -84,8 +84,8 @@ public class UserLiveController extends BaseController { | |||
@AuthIgnore | |||
@PostMapping("/login") | |||
@ApiOperation(value = "用户登录", notes = "{\"username\":\"string\",\"password\":\"string\",\"code\":\"string\",\"status\":\"int\"}") | |||
public Map<String,Object> login(@RequestBody Map<String, String> map, HttpServletResponse response) { | |||
Map<String,Object> wxCLiveLoginVos = new HashMap<>(); | |||
public Map<String, Object> login(@RequestBody Map<String, String> map, HttpServletResponse response) { | |||
Map<String, Object> wxCLiveLoginVos = new HashMap<>(); | |||
String ipAddr = getIpAddr(); | |||
logger.debug("[" + ipAddr + "] WxUserGrantController::login"); | |||
@@ -93,31 +93,31 @@ public class UserLiveController extends BaseController { | |||
String password = map.get("password"); | |||
if (StringUtils.isBlank(phone) || StringUtils.isBlank(password)) { | |||
HashMap<Object, Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.SYS_PARAMETER_ERROR.getCode()); | |||
status.put("message","手机号或密码为空"); | |||
wxCLiveLoginVos.put("status",status); | |||
status.put("code", ErrorCode.SYS_PARAMETER_ERROR.getCode()); | |||
status.put("message", "手机号或密码为空"); | |||
wxCLiveLoginVos.put("status", status); | |||
return wxCLiveLoginVos; | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码为空"); | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码为空"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | |||
if (basicInfo == null) { | |||
HashMap<Object, Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.USER_IS_EMPTY); | |||
status.put("message","用户不存在"); | |||
wxCLiveLoginVos.put("status",status); | |||
status.put("code", ErrorCode.USER_IS_EMPTY); | |||
status.put("message", "用户不存在"); | |||
wxCLiveLoginVos.put("status", status); | |||
return wxCLiveLoginVos; | |||
// return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
// 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); | |||
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(), "手机号或密码错误"); | |||
// return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误"); | |||
} | |||
int statu = Integer.parseInt(map.get("status")); | |||
@@ -126,11 +126,11 @@ public class UserLiveController extends BaseController { | |||
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(basicInfo.getId()); | |||
if (basicLiveInfo.getCode() != null && !map.get("code").equals(basicLiveInfo.getCode())) { | |||
HashMap<Object, Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message","用户已在其他设备登录"); | |||
wxCLiveLoginVos.put("status",status); | |||
status.put("code", ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message", "用户已在其他设备登录"); | |||
wxCLiveLoginVos.put("status", status); | |||
return wxCLiveLoginVos; | |||
// return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(), "用户已在其他设备登录"); | |||
// return new ResultData(ErrorCode.USER_ALREADY_LOGIN.getCode(), "用户已在其他设备登录"); | |||
} | |||
if (basicLiveInfo.getCode() == null) { | |||
wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), map.get("code")); | |||
@@ -140,11 +140,11 @@ public class UserLiveController extends BaseController { | |||
wxCLiveUserBasicInfoService.updateCode(basicInfo.getId(), null); | |||
basicInfo.setStatus(-2); | |||
HashMap<Object, Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.USER_CANCEL_MCODE.getCode()); | |||
status.put("message","设备已注销"); | |||
wxCLiveLoginVos.put("status",status); | |||
status.put("code", ErrorCode.USER_CANCEL_MCODE.getCode()); | |||
status.put("message", "设备已注销"); | |||
wxCLiveLoginVos.put("status", status); | |||
return wxCLiveLoginVos; | |||
// return new ResultData(ErrorCode.USER_CANCEL_MCODE.getCode(), "设备已注销"); | |||
// return new ResultData(ErrorCode.USER_CANCEL_MCODE.getCode(), "设备已注销"); | |||
} | |||
@@ -152,51 +152,50 @@ public class UserLiveController extends BaseController { | |||
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); | |||
// 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"); | |||
status.put("code", 1000); | |||
status.put("message", "success"); | |||
data.put("status",0); | |||
data.put("version",basicLiveInfo.getVersion()); | |||
data.put("current_time",new Date(System.currentTimeMillis() / 1000)); | |||
data.put("expire_time",basicLiveInfo.getExpireTime().getTime() / 1000); | |||
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("server_type", "user login"); | |||
info.put("username", basicInfo.getPhone()); | |||
wxCLiveLoginVos.put("data",data); | |||
wxCLiveLoginVos.put("info",info); | |||
wxCLiveLoginVos.put("data", data); | |||
wxCLiveLoginVos.put("info", info); | |||
wxCLiveLoginVo.setData(data); | |||
wxCLiveLoginVo.setInfo(info); | |||
wxCLiveLoginVos.put("status",status); | |||
wxCLiveLoginVos.put("token",basicInfo.getToken()); | |||
wxCLiveLoginVos.put("status", status); | |||
System.out.println("wxCLiveLoginVo.getToken() = " + wxCLiveLoginVo.getToken()); | |||
return wxCLiveLoginVos; | |||
// return new ResultData(1000,"success",wxCLiveLoginVo); | |||
// return new ResultData(1000,"success",wxCLiveLoginVo); | |||
} | |||
/** | |||
* 视频模板列表 | |||
*/ | |||
@AuthIgnore | |||
@PostMapping("/avatarList") | |||
@ApiOperation(value = "视频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}") | |||
public Map<String,Object> avatarList(@RequestBody Map<String, String> params) throws Exception { | |||
Map<String,Object> avatarVos = new HashMap<>(); | |||
public Map<String, Object> avatarList(@RequestBody Map<String, String> params) throws Exception { | |||
Map<String, Object> avatarVos = new HashMap<>(); | |||
String ipaddress = getIpAddr(); | |||
logger.debug("[" + ipaddress + "] WxUserGrantController::getAvatarList"); | |||
String phone = params.get("username"); | |||
@@ -208,33 +207,33 @@ public class UserLiveController extends BaseController { | |||
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id); | |||
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | |||
HashMap<Object, Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message","用户已在其他设备登录"); | |||
avatarVos.put("status",status); | |||
status.put("code", ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message", "用户已在其他设备登录"); | |||
avatarVos.put("status", status); | |||
return avatarVos; | |||
} | |||
Map<Object, Object> status = new HashMap<>(); | |||
status.put("code",1000); | |||
status.put("msg","success"); | |||
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); | |||
// 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 new ResultData(1000,"success",wxCVideoService.getById(infoByPhone.getId())); | |||
} | |||
/** | |||
* 音频模板列表 | |||
*/ | |||
@AuthIgnore | |||
@PostMapping("/audioList") | |||
@ApiOperation(value = "音频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}") | |||
public Map<String,Object> audioList(@RequestBody Map<String, String> params) { | |||
Map<String,Object> resultMap = new HashMap<>(); | |||
public Map<String, Object> audioList(@RequestBody Map<String, String> params) { | |||
Map<String, Object> resultMap = new HashMap<>(); | |||
String ipaddress = getIpAddr(); | |||
logger.debug("[" + ipaddress + "] WxUserGrantController::getAudioList"); | |||
String phone = params.get("username"); | |||
@@ -247,13 +246,13 @@ public class UserLiveController extends BaseController { | |||
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id); | |||
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | |||
HashMap<Object, Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message","用户已在其他设备登录"); | |||
resultMap.put("status",status); | |||
status.put("code", ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message", "用户已在其他设备登录"); | |||
resultMap.put("status", status); | |||
return resultMap; | |||
} | |||
// long id = getMemberId(); | |||
// long id = getMemberId(); | |||
return wxCVoiceService.getById(id); | |||
@@ -263,11 +262,11 @@ public class UserLiveController extends BaseController { | |||
* 资源权限查询 | |||
*/ | |||
@AuthIgnore | |||
@ApiOperation(value = "资源权限查询", notes = "{\"username\",\"string\",\"code\",\"string\",\"type\",\"int\",\"resource_id\",\"long\"}") | |||
@PostMapping("/author") | |||
public Map<String,Object> getAuthor(@RequestBody Map<String, String> params) { | |||
Map<String,Object> resultMap = new HashMap<>(); | |||
public Map<String, Object> getAuthor(@RequestBody Map<String, String> params) { | |||
Map<String, Object> resultMap = new HashMap<>(); | |||
String ipaddress = getIpAddr(); | |||
logger.debug("[" + ipaddress + "] WxUserGrantController::getAuthor"); | |||
@@ -280,9 +279,9 @@ public class UserLiveController extends BaseController { | |||
WxCUserBasicInfo basicLiveInfo = wxCLiveUserBasicInfoService.getById(id); | |||
if (basicLiveInfo.getCode() != null && !params.get("code").equals(basicLiveInfo.getCode())) { | |||
HashMap<Object, Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message","用户已在其他设备登录"); | |||
resultMap.put("status",status); | |||
status.put("code", ErrorCode.USER_ALREADY_LOGIN.getCode()); | |||
status.put("message", "用户已在其他设备登录"); | |||
resultMap.put("status", status); | |||
return resultMap; | |||
} | |||
@@ -299,10 +298,9 @@ public class UserLiveController extends BaseController { | |||
} | |||
@AuthIgnore | |||
@ApiOperation(value = "tts", notes = "{\"username\",\"string\",\"gen_txt\",\"string\",\"voice_id\",\"string\",\"voice_style\",\"string\",\"speed\",\"int\"}") | |||
@PostMapping("/audiotts") | |||
public Map<String,Object> voicePreview(@RequestBody Map<String, String> params) { | |||
public Map<String, Object> voicePreview(@RequestBody Map<String, String> params) { | |||
logger.debug("[" + getIpAddr() + "] UserLiveController::voicePreview"); | |||
String phone = params.get("username"); | |||
@@ -310,19 +308,20 @@ public class UserLiveController extends BaseController { | |||
Long id = infoByPhone.getId(); | |||
AiPreviewParam param = new AiPreviewParam(); | |||
if (params.get("voice_id") == null) { | |||
Map<String,Object> status = new HashMap<>(); | |||
status.put("code",ErrorCode.SYS_SERVER_ERROR.getCode()); | |||
status.put("msg","音色ID不能为空"); | |||
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不能为空"); | |||
// 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","需要生成的文字不能为空"); | |||
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){ | |||
} | |||
if (Integer.parseInt(params.get("speed")) == -1) { | |||
param.setSpeed(0); | |||
} | |||
param.setSpeed(Integer.parseInt(params.get("speed"))); | |||
@@ -330,10 +329,10 @@ public class UserLiveController extends BaseController { | |||
param.setVoice_style(params.get("voice_style")); | |||
param.setGen_txt(params.get("gen_txt")); | |||
Map<String, Object> resultMap = wxCVoiceService.voicePreview(param); | |||
Map<String,Object> info = new HashMap<>(); | |||
info.put("log_id",id); | |||
info.put("server_type","audio tts"); | |||
resultMap.put("info",info); | |||
Map<String, Object> info = new HashMap<>(); | |||
info.put("log_id", id); | |||
info.put("server_type", "audio tts"); | |||
resultMap.put("info", info); | |||
return resultMap; | |||
} | |||
@@ -341,9 +340,9 @@ public class UserLiveController extends BaseController { | |||
@AuthIgnore | |||
@SneakyThrows | |||
@ApiOperation(value = "tts", notes = "{\"username\",\"string\",\"gen_txt\",\"string\",\"voice_id\",\"string\",\"voice_style\",\"string\",\"speed\",\"int\"}") | |||
@ApiOperation(value = "模板下载接口", notes = "{\"username\",\"string\",\"gen_txt\",\"string\",\"voice_id\",\"string\",\"voice_style\",\"string\",\"speed\",\"int\"}") | |||
@GetMapping("exportVideo") | |||
public void exportVideo(@RequestBody Map<String, String> params , HttpServletRequest request, HttpServletResponse response) { | |||
public void exportVideo(@RequestBody Map<String, String> params, HttpServletRequest request, HttpServletResponse response) { | |||
logger.debug("[" + getIpAddr() + "] UserLiveController::exportVideo"); | |||
response.reset(); | |||
@@ -358,12 +357,11 @@ public class UserLiveController extends BaseController { | |||
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR); | |||
} | |||
try{ | |||
if(id == null){ | |||
try { | |||
if (id == 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"))); | |||
//获取响应的输出流 | |||
@@ -371,26 +369,26 @@ public class UserLiveController extends BaseController { | |||
response.setHeader("Content-Disposition", "attachment; filename=" | |||
+ URLEncoder.encode(videoTable.getId()+".mp4", "UTF-8")); | |||
+ URLEncoder.encode(videoTable.getId() + ".mp4", "UTF-8")); | |||
//解决编码问题 | |||
response.setCharacterEncoding("UTF-8"); | |||
response.setHeader("Content-Type","application/octet-stream"); | |||
response.setHeader("Content-Type", "application/octet-stream"); | |||
byte[] cache = new byte[1024 * 300]; | |||
int flag; | |||
while ((flag = inputStream.read(cache))!=-1){ | |||
while ((flag = inputStream.read(cache)) != -1) { | |||
outputStream.write(cache, 0, flag); | |||
} | |||
// } | |||
}catch(MallinkException e){ | |||
} catch (MallinkException e) { | |||
ResultData resultData = new ResultData(e.getErrorCode(), e.getMessage()); | |||
//解决编码问题 | |||
response.setCharacterEncoding("UTF-8"); | |||
response.setHeader("Content-Type","application/json"); | |||
response.setHeader("Content-Type", "application/json"); | |||
outputStream.write(JSONObject.toJSONString(resultData).getBytes(StandardCharsets.UTF_8)); | |||
}finally { | |||
} finally { | |||
if (tmpFile != null) { | |||
tmpFile.delete(); | |||
} | |||
@@ -398,6 +396,7 @@ public class UserLiveController extends BaseController { | |||
outputStream.close(); | |||
} | |||
} | |||
@AuthIgnore | |||
@ApiOperation("选择声音选择风格") | |||
@GetMapping("/chooseType") | |||
@@ -106,7 +106,7 @@ public class WxUserGrantController extends BaseController { | |||
@AuthIgnore | |||
@ApiOperation("验证码") | |||
@GetMapping("/captcha.jpg") | |||
public void captcha(HttpServletResponse response){ | |||
public void captcha(HttpServletResponse response) { | |||
logger.debug("[" + getIpAddr() + "] WxUserGrantController::captcha"); | |||
response.setHeader("Cache-Control", "no-store, no-cache"); | |||
response.setContentType("image/jpeg"); | |||
@@ -119,7 +119,7 @@ public class WxUserGrantController extends BaseController { | |||
//保存到redis | |||
String ipAddr = getIpAddr(); | |||
String key = Constant.captchaPrev + ":" + ipAddr; | |||
RedisCacheUtils.cache(redisTemplate,key,text,60); | |||
RedisCacheUtils.cache(redisTemplate, key, text, 60); | |||
ServletOutputStream out = null; | |||
try { | |||
@@ -133,7 +133,6 @@ public class WxUserGrantController extends BaseController { | |||
} | |||
/** | |||
* 用户登录 | |||
* | |||
@@ -147,33 +146,33 @@ public class WxUserGrantController extends BaseController { | |||
String ipAddr = getIpAddr(); | |||
logger.debug("[" + ipAddr + "] WxUserGrantController::loginByPhone"); | |||
String code = map.get("code"); | |||
if(StringUtils.isBlank(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(), "验证码不正确"); | |||
} | |||
// 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("phone"); | |||
String password = map.get("password"); | |||
if(StringUtils.isBlank(phone) || StringUtils.isBlank(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){ | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
String encryptPassword = new PasswordHelper().encryptPassword(password); | |||
if(!encryptPassword.equals(basicInfo.getPassword())){ | |||
if (!encryptPassword.equals(basicInfo.getPassword())) { | |||
return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误"); | |||
} | |||
wxCUserBasicInfoService.handleLoginUser(basicInfo); | |||
@@ -190,36 +189,36 @@ public class WxUserGrantController extends BaseController { | |||
String ipAddr = getIpAddr(); | |||
logger.debug("[" + ipAddr + "] WxUserGrantController::loginByEmail"); | |||
String code = map.get("code"); | |||
if(StringUtils.isBlank(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)){ | |||
if (StringUtils.isBlank(code1)) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码已过期"); | |||
} | |||
if(!code1.equals(code)){ | |||
if (!code1.equals(code)) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码不正确"); | |||
} | |||
String email = map.get("email"); | |||
String password = map.get("password"); | |||
if(StringUtils.isBlank(email) || StringUtils.isBlank(password)){ | |||
if (StringUtils.isBlank(email) || StringUtils.isBlank(password)) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "邮箱或密码为空"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); | |||
if(basicInfo == null){ | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
if(EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ | |||
if (EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())) { | |||
return new ResultData(ErrorCode.MEMBER_IS_NOT_ACTIVE); | |||
} | |||
String encryptPassword = new PasswordHelper().encryptPassword(password); | |||
if(!encryptPassword.equals(basicInfo.getPassword())){ | |||
if (!encryptPassword.equals(basicInfo.getPassword())) { | |||
return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "邮箱或密码错误"); | |||
} | |||
wxCUserBasicInfoService.handleLoginUser(basicInfo); | |||
@@ -249,14 +248,14 @@ public class WxUserGrantController extends BaseController { | |||
// check 验证码正确 | |||
boolean isValidCode = false; | |||
try { | |||
isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); | |||
isValidCode = wxMsgValidationcodeService.checkCodeValid(phone, code); | |||
} catch (Exception e) { | |||
return new ResultData(Result.ERROR, e.getMessage()); | |||
} | |||
if(isValidCode) { | |||
if (isValidCode) { | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | |||
if(basicInfo == null){ | |||
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,null); | |||
if (basicInfo == null) { | |||
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(), phone, null); | |||
} | |||
wxCUserBasicInfoService.handleLoginUser(basicInfo); | |||
Map resultMap = new HashMap(); | |||
@@ -285,7 +284,7 @@ public class WxUserGrantController extends BaseController { | |||
@ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true)}) | |||
public ResultData sendLoginPhoneCode(String phone) { | |||
logger.debug("[" + getIpAddr() + "] WxUserGrantController::sendlogincode"); | |||
if(StringUtils.isBlank(phone)){ | |||
if (StringUtils.isBlank(phone)) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "请输入手机号"); | |||
} | |||
@@ -296,42 +295,38 @@ public class WxUserGrantController extends BaseController { | |||
} | |||
/** | |||
* 需要效验用户及图片验证码 | |||
* @param phone | |||
* @return | |||
*/ | |||
/** | |||
* 需要效验用户及图片验证码 | |||
* | |||
* @param phone | |||
* @return | |||
*/ | |||
@AuthIgnore | |||
@ApiOperation("发送修改密码验证码") | |||
@GetMapping("sendPhoneCode") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true)}) | |||
public ResultData sendPhoneCode(String phone,String code) { | |||
public ResultData sendPhoneCode(String phone, String code) { | |||
String ipAddr = getIpAddr(); | |||
logger.debug("[" + ipAddr + "] WxUserGrantController::sendPhoneCode"); | |||
if(StringUtils.isBlank(phone)){ | |||
if (StringUtils.isBlank(phone)) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "请输入手机号"); | |||
} | |||
if(StringUtils.isBlank(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)){ | |||
if (StringUtils.isBlank(code1)) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码已过期"); | |||
} | |||
if(!code1.equals(code)){ | |||
if (!code1.equals(code)) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "验证码不正确"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | |||
if(basicInfo == null){ | |||
return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),"该手机号未注册"); | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(), "该手机号未注册"); | |||
} | |||
WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
@@ -341,7 +336,6 @@ public class WxUserGrantController extends BaseController { | |||
} | |||
@AuthIgnore | |||
@ApiOperation(value = "手机号注册", notes = "{\"phone\",\"string\",\"code\",\"string\"}") | |||
@PostMapping("/doRegisterByPhone") | |||
@@ -363,7 +357,7 @@ public class WxUserGrantController extends BaseController { | |||
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); | |||
// } | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | |||
if(basicInfo != null){ | |||
if (basicInfo != null) { | |||
return new ResultData(ErrorCode.MEMBER_IS_FOUND); | |||
} | |||
@@ -376,10 +370,10 @@ public class WxUserGrantController extends BaseController { | |||
// return new ResultData(Result.ERROR, e.getMessage()); | |||
// } | |||
// if(isValidCode) { | |||
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,password); | |||
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(), phone, password); | |||
Boolean aBoolean = userCreateVideoNumService.initializationUserCreateVideoNum(basicInfo.getId()); | |||
if (!aBoolean){ | |||
if (!aBoolean) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | |||
} | |||
return new ResultData(); | |||
@@ -412,7 +406,7 @@ public class WxUserGrantController extends BaseController { | |||
// } | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); | |||
if(basicInfo != null){ | |||
if (basicInfo != null) { | |||
return new ResultData(ErrorCode.MEMBER_IS_FOUND); | |||
} | |||
@@ -425,10 +419,10 @@ public class WxUserGrantController extends BaseController { | |||
// return new ResultData(Result.ERROR, e.getMessage()); | |||
// } | |||
// if(isValidCode) { | |||
basicInfo = wxCUserBasicInfoService.registerEmail(getTenantInfo(),email,password); | |||
basicInfo = wxCUserBasicInfoService.registerEmail(getTenantInfo(), email, password); | |||
Boolean aBoolean = userCreateVideoNumService.initializationUserCreateVideoNum(basicInfo.getId()); | |||
if (!aBoolean){ | |||
if (!aBoolean) { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | |||
} | |||
return new ResultData(); | |||
@@ -456,10 +450,10 @@ public class WxUserGrantController extends BaseController { | |||
// } | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); | |||
if(basicInfo == null){ | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
if(!EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ | |||
if (!EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())) { | |||
return new ResultData(ErrorCode.MEMBER_IS_ACTIVE); | |||
} | |||
@@ -472,7 +466,7 @@ public class WxUserGrantController extends BaseController { | |||
// return new ResultData(Result.ERROR, e.getMessage()); | |||
// } | |||
// if(isValidCode) { | |||
wxCUserBasicInfoService.sendTicketEmail(basicInfo,EnumMsgModel.EMAIL_ACTIVATION); | |||
wxCUserBasicInfoService.sendTicketEmail(basicInfo, EnumMsgModel.EMAIL_ACTIVATION); | |||
return new ResultData(); | |||
// } else { | |||
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); | |||
@@ -489,11 +483,11 @@ public class WxUserGrantController extends BaseController { | |||
String ticket = params.get("ticket"); | |||
String key = Constant.ticketPrev + ticket; | |||
Long userId = RedisCacheUtils.getCacheLong(redisTemplate, key); | |||
if(userId == null){ | |||
return new ResultData(ErrorCode.NET_TICKET_INVALID.getCode(),"ticket已过期"); | |||
if (userId == null) { | |||
return new ResultData(ErrorCode.NET_TICKET_INVALID.getCode(), "ticket已过期"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId); | |||
if(basicInfo == null){ | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
// if(!EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ | |||
@@ -528,18 +522,18 @@ public class WxUserGrantController extends BaseController { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); | |||
if(basicInfo == null){ | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_PHONE_IS_NOT_FOUND.getCode(), "手机号还未注册"); | |||
} | |||
// check 验证码正确 | |||
boolean isValidCode = false; | |||
try { | |||
isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); | |||
isValidCode = wxMsgValidationcodeService.checkCodeValid(phone, code); | |||
} catch (Exception e) { | |||
return new ResultData(Result.ERROR, e.getMessage()); | |||
} | |||
if(isValidCode) { | |||
if (isValidCode) { | |||
String encryptPassword = new PasswordHelper().encryptPassword(pwd); | |||
WxCUserBasicInfo basicInfoUpd = new WxCUserBasicInfo(); | |||
basicInfoUpd.setId(basicInfo.getId()); | |||
@@ -575,7 +569,7 @@ public class WxUserGrantController extends BaseController { | |||
String encryptPassword = new PasswordHelper().encryptPassword(oldpwd); | |||
if(!encryptPassword.equals(basicInfo.getPassword())){ | |||
if (!encryptPassword.equals(basicInfo.getPassword())) { | |||
return new ResultData(ErrorCode.PASSWORD_ERROR.getCode(), "旧密码错误"); | |||
} | |||
@@ -588,12 +582,12 @@ public class WxUserGrantController extends BaseController { | |||
// return new ResultData(Result.ERROR, e.getMessage()); | |||
// } | |||
// if(isValidCode) { | |||
String newEncryptPassword = new PasswordHelper().encryptPassword(newpwd); | |||
WxCUserBasicInfo basicInfoUpd = new WxCUserBasicInfo(); | |||
basicInfoUpd.setId(basicInfo.getId()); | |||
basicInfoUpd.setPassword(newEncryptPassword); | |||
wxCUserBasicInfoService.update(basicInfoUpd); | |||
return new ResultData(); | |||
String newEncryptPassword = new PasswordHelper().encryptPassword(newpwd); | |||
WxCUserBasicInfo basicInfoUpd = new WxCUserBasicInfo(); | |||
basicInfoUpd.setId(basicInfo.getId()); | |||
basicInfoUpd.setPassword(newEncryptPassword); | |||
wxCUserBasicInfoService.update(basicInfoUpd); | |||
return new ResultData(); | |||
// } else { | |||
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); | |||
// } | |||
@@ -618,10 +612,10 @@ public class WxUserGrantController extends BaseController { | |||
// } | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); | |||
if(basicInfo == null){ | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
if(EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ | |||
if (EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())) { | |||
return new ResultData(ErrorCode.MEMBER_IS_NOT_ACTIVE); | |||
} | |||
@@ -634,7 +628,7 @@ public class WxUserGrantController extends BaseController { | |||
// return new ResultData(Result.ERROR, e.getMessage()); | |||
// } | |||
// if(isValidCode) { | |||
wxCUserBasicInfoService.sendTicketEmail(basicInfo,EnumMsgModel.EMAIL_UPD_PWD); | |||
wxCUserBasicInfoService.sendTicketEmail(basicInfo, EnumMsgModel.EMAIL_UPD_PWD); | |||
return new ResultData(); | |||
// } else { | |||
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); | |||
@@ -651,11 +645,11 @@ public class WxUserGrantController extends BaseController { | |||
String ticket = params.get("ticket"); | |||
String key = Constant.ticketPrev + ticket; | |||
Long userId = RedisCacheUtils.getCacheLong(redisTemplate, key); | |||
if(userId == null){ | |||
return new ResultData(ErrorCode.NET_TICKET_INVALID.getCode(),"已过期"); | |||
if (userId == null) { | |||
return new ResultData(ErrorCode.NET_TICKET_INVALID.getCode(), "已过期"); | |||
} | |||
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId); | |||
if(basicInfo == null){ | |||
if (basicInfo == null) { | |||
return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
} | |||
String pwd = params.get("pwd"); | |||
@@ -715,7 +709,7 @@ public class WxUserGrantController extends BaseController { | |||
@PostMapping("/updUserInfo") | |||
public ResultData updUserInfo(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { | |||
logger.debug("[" + getIpAddr() + "] WxUserGrantController::updUserInfo"); | |||
wxCUserBasicInfoService.updUserInfo(wxCUserBasicInfo,getMemberId()); | |||
wxCUserBasicInfoService.updUserInfo(wxCUserBasicInfo, getMemberId()); | |||
return new ResultData(); | |||
} | |||
@@ -19,7 +19,7 @@ public class WxCUserAuthority { | |||
private int type; | |||
@TableField(exist = false) | |||
private String resourceId; | |||
//共享 0 定制 1 | |||
//共享 0 定制 1 | |||
private int classType; | |||
@TableField(exist = false) | |||
private String currentTime; | |||
@@ -11,7 +11,7 @@ import lombok.ToString; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
@TableName(value ="wx_c_author") | |||
@TableName(value = "wx_c_author") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
@@ -26,33 +26,29 @@ public class WxCVideoTable extends TenantEntityWithoutFinalTenantId { | |||
private Date expireTime; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人id",name="id") | |||
private int id; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐0共享 1定制",name="class") | |||
private int classType; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人名称",name="name") | |||
private String name; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人封面图片链接",name="image") | |||
private String image; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人样例视频链接",name="demo") | |||
private String demo; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板视频链接",name="model") | |||
private String model; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息文件链接",name="preinfo") | |||
private String preInfo; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板文件链接",name="model_path") | |||
private String modelPath; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息文件链接",name="preInfo_path") | |||
private String preInfoPath; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板md文件校验码",name="model_md5") | |||
private String modelMd5; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息md文件校验码",name="preinfo_md5") | |||
private String preInfoMd5; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人id", name = "id") | |||
private int id; | |||
@io.swagger.annotations.ApiModelProperty(value = "套餐0共享 1定制", name = "class") | |||
private int classType; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人名称", name = "name") | |||
private String name; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人封面图片链接", name = "image") | |||
private String image; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人样例视频链接", name = "demo") | |||
private String demo; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人模板视频链接", name = "model") | |||
private String model; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人模板预处理信息文件链接", name = "preinfo") | |||
private String preInfo; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人模板文件链接", name = "model_path") | |||
private String modelPath; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人模板预处理信息文件链接", name = "preInfo_path") | |||
private String preInfoPath; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人模板md文件校验码", name = "model_md5") | |||
private String modelMd5; | |||
@io.swagger.annotations.ApiModelProperty(value = "数字人模板预处理信息md文件校验码", name = "preinfo_md5") | |||
private String preInfoMd5; | |||
} |
@@ -9,7 +9,7 @@ import java.util.List; | |||
public interface WxCVideoMapper extends CommonMapper<WxCVideoTable, String> { | |||
List<WxCVideoTable> getById(Long id); | |||
List<WxCVideoTable> getById(Long id); | |||
WxCVideoTable selectOne(Long id, long resource_id); | |||
@@ -5,10 +5,10 @@ import com.iformall.domain.po.WxCVideoTable; | |||
import java.util.Map; | |||
public interface WxCVideoService { | |||
public interface WxCVideoService { | |||
Map<String,Object> getById(Long id) throws Exception; | |||
Map<String, Object> getById(Long id) throws Exception; | |||
WxCVideoTable selectOne(Long id, long resource_id); | |||
} |
@@ -26,7 +26,7 @@ import java.util.*; | |||
import java.util.stream.Collectors; | |||
@Service | |||
public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { | |||
public class WxCVideoServiceImpl implements WxCVideoService, IExcelExportServer { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
@Autowired | |||
@@ -37,62 +37,63 @@ public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { | |||
@Autowired | |||
WxCVideoMapper wxCVideoMapper; | |||
@Override | |||
public Map<String,Object> getById(Long id) throws Exception { | |||
public Map<String, Object> getById(Long id) throws Exception { | |||
System.out.println("id = " + id); | |||
List<WxCVideoTable> TemplateVideo = wxCVideoMapper.getById(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> avatarVos = new HashMap(); | |||
Map<String, Object> data = new HashMap(); | |||
//Map<String,Object> authorlist = new HashMap(); | |||
List authorlist = new ArrayList(); | |||
for (WxCVideoTable wxCVideoTable : TemplateVideo) { | |||
data.put("username",wxCVideoTable.getUserName()); | |||
data.put("current_time",new Date(System.currentTimeMillis()/1000)); | |||
Map<String,Object> avatar = new HashMap(); | |||
avatar.put("avatar_id",wxCVideoTable.getId()); | |||
avatar.put("avatar_name",wxCVideoTable.getName()); | |||
avatar.put("avatar_image",wxCVideoTable.getImage()); | |||
avatar.put("avatar_demo",wxCVideoTable.getDemo()); | |||
avatar.put("avatar_model",wxCVideoTable.getModel()); | |||
data.put("username", wxCVideoTable.getUserName()); | |||
data.put("current_time", new Date(System.currentTimeMillis() / 1000)); | |||
Map<String, Object> avatar = new HashMap(); | |||
avatar.put("avatar_id", wxCVideoTable.getId()); | |||
avatar.put("avatar_name", wxCVideoTable.getName()); | |||
avatar.put("avatar_image", wxCVideoTable.getImage()); | |||
avatar.put("avatar_demo", wxCVideoTable.getDemo()); | |||
avatar.put("avatar_model", wxCVideoTable.getModel()); | |||
//模板文件和预处理信息存放问题 | |||
try { | |||
File modelFile = new File(wxCVideoTable.getModelPath()); | |||
avatar.put("avatar_model_md5",getFileMD5(modelFile)); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
avatar.put("avatar_model_md5",wxCVideoTable.getModelMd5()); | |||
} | |||
try { | |||
File preinfoFile = new File(wxCVideoTable.getPreInfoPath()); | |||
avatar.put("avatar_preinfo_md5",getFileMD5(preinfoFile)); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
avatar.put("avatar_preinfo_md5",wxCVideoTable.getPreInfoMd5()); | |||
} | |||
avatar.put("avatar_preinfo",wxCVideoTable.getPreInfo()); | |||
avatar.put("expire_time",wxCVideoTable.getExpireTime().getTime()/1000); | |||
try { | |||
File modelFile = new File(wxCVideoTable.getModelPath()); | |||
avatar.put("avatar_model_md5", getFileMD5(modelFile)); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
avatar.put("avatar_model_md5", wxCVideoTable.getModelMd5()); | |||
} | |||
try { | |||
File preinfoFile = new File(wxCVideoTable.getPreInfoPath()); | |||
avatar.put("avatar_preinfo_md5", getFileMD5(preinfoFile)); | |||
} catch (Exception e) { | |||
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); | |||
data.put("authorlist", authorlist); | |||
} | |||
avatarVos.put("data",data); | |||
Map<String,Object> info = new HashMap(); | |||
Map<String,Object> status = new HashMap(); | |||
info.put("log_id",id); | |||
info.put("server_type","avatar list"); | |||
status.put("code",1000); | |||
status.put("msg","success"); | |||
avatarVos.put("info",info); | |||
avatarVos.put("status",status); | |||
avatarVos.put("data", data); | |||
Map<String, Object> info = new HashMap(); | |||
Map<String, Object> status = new HashMap(); | |||
info.put("log_id", id); | |||
info.put("server_type", "avatar list"); | |||
status.put("code", 1000); | |||
status.put("msg", "success"); | |||
avatarVos.put("info", info); | |||
avatarVos.put("status", status); | |||
return avatarVos; | |||
} | |||
@@ -100,18 +101,18 @@ public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { | |||
@Override | |||
public WxCVideoTable selectOne(Long id, long resource_id) { | |||
return wxCVideoMapper.selectOne(id,resource_id); | |||
return wxCVideoMapper.selectOne(id, resource_id); | |||
} | |||
@Override | |||
public List<Object> selectListForExcelExport(Object queryParams, int page) { | |||
WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) queryParams; | |||
WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) queryParams; | |||
List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | |||
basicInfo.setBegin((page-1)*20000); | |||
basicInfo.setBegin((page - 1) * 20000); | |||
basicInfo.setLimit(20000); | |||
list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
if (null == list || list.size() <= 0 ) { | |||
if (null == list || list.size() <= 0) { | |||
return null; | |||
} | |||
@@ -141,15 +142,15 @@ public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { | |||
//处理会员标签 | |||
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->{ | |||
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 ) { | |||
if (null != list && list.size() > 0) { | |||
List<Object> retList = new ArrayList<Object>(); | |||
retList.addAll(list); | |||
return retList; | |||
@@ -158,20 +159,19 @@ public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { | |||
} | |||
public static String getFileMD5(File file) throws Exception { | |||
MessageDigest md = MessageDigest.getInstance("MD5"); | |||
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) { | |||
byte[] buffer = new byte[1024]; | |||
int read = 0; | |||
while ((read = bis.read(buffer)) != -1) { | |||
md.update(buffer, 0, read); | |||
} | |||
public static String getFileMD5(File file) throws Exception { | |||
MessageDigest md = MessageDigest.getInstance("MD5"); | |||
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) { | |||
byte[] buffer = new byte[1024]; | |||
int read = 0; | |||
while ((read = bis.read(buffer)) != -1) { | |||
md.update(buffer, 0, read); | |||
} | |||
byte[] digest = md.digest(); | |||
String md5 = String.format("%032x", new BigInteger(1, digest)); | |||
return md5; | |||
} | |||
byte[] digest = md.digest(); | |||
String md5 = String.format("%032x", new BigInteger(1, digest)); | |||
return md5; | |||
} | |||
} | |||
} |