|
@@ -150,7 +150,7 @@ public class WxUserGrantController extends BaseController { |
|
|
String encryptPassword = new PasswordHelper().encryptPassword(password); |
|
|
String encryptPassword = new PasswordHelper().encryptPassword(password); |
|
|
|
|
|
|
|
|
if(!encryptPassword.equals(basicInfo.getPassword())){ |
|
|
if(!encryptPassword.equals(basicInfo.getPassword())){ |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "手机号或密码错误"); |
|
|
|
|
|
|
|
|
return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "手机号或密码错误"); |
|
|
} |
|
|
} |
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
Map resultMap = new HashMap(); |
|
|
Map resultMap = new HashMap(); |
|
@@ -190,13 +190,13 @@ public class WxUserGrantController extends BaseController { |
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
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_LOCKED.getCode(),"该用户未激活"); |
|
|
|
|
|
|
|
|
return new ResultData(ErrorCode.MEMBER_IS_NOT_ACTIVE); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String encryptPassword = new PasswordHelper().encryptPassword(password); |
|
|
String encryptPassword = new PasswordHelper().encryptPassword(password); |
|
|
|
|
|
|
|
|
if(!encryptPassword.equals(basicInfo.getPassword())){ |
|
|
if(!encryptPassword.equals(basicInfo.getPassword())){ |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "邮箱或密码错误"); |
|
|
|
|
|
|
|
|
return new ResultData(ErrorCode.USER_PASSWD_ERR.getCode(), "邮箱或密码错误"); |
|
|
} |
|
|
} |
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
Map resultMap = new HashMap(); |
|
|
Map resultMap = new HashMap(); |
|
@@ -205,6 +205,45 @@ public class WxUserGrantController extends BaseController { |
|
|
return new ResultData(resultMap); |
|
|
return new ResultData(resultMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
|
|
@ApiOperation(value = "手机验证码登录", notes = "{\"phone\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/doLoginByPhone") |
|
|
|
|
|
public ResultData doLoginByPhone(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
String ipaddress = getIpAddr(); |
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doLoginByPhone"); |
|
|
|
|
|
// String phone,String code,String pwd |
|
|
|
|
|
String phone = params.get("phone"); |
|
|
|
|
|
String code = params.get("code"); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(phone)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(code)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// check 验证码正确 |
|
|
|
|
|
boolean isValidCode = false; |
|
|
|
|
|
try { |
|
|
|
|
|
isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
return new ResultData(Result.ERROR, e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
if(isValidCode) { |
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); |
|
|
|
|
|
if(basicInfo == null){ |
|
|
|
|
|
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,null); |
|
|
|
|
|
} |
|
|
|
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
|
|
|
Map resultMap = new HashMap(); |
|
|
|
|
|
// resultMap.put("phone", basicInfo.getPhone()); |
|
|
|
|
|
resultMap.put("token", basicInfo.getToken()); |
|
|
|
|
|
return new ResultData(resultMap); |
|
|
|
|
|
} else { |
|
|
|
|
|
return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
@AuthIgnore |
|
|
@ApiOperation("发送手机验证码") |
|
|
@ApiOperation("发送手机验证码") |
|
|
@GetMapping("sendLoginPhoneCode") |
|
|
@GetMapping("sendLoginPhoneCode") |
|
@@ -261,66 +300,73 @@ public class WxUserGrantController extends BaseController { |
|
|
return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); |
|
|
return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
@AuthIgnore |
|
|
@ApiOperation(value = "手机验证码登录", notes = "{\"phone\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/doLoginByPhone") |
|
|
|
|
|
public ResultData doLoginByPhone(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
|
|
|
@ApiOperation(value = "手机号注册", notes = "{\"phone\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/doRegisterByPhone") |
|
|
|
|
|
public ResultData doRegisterByPhone(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
String ipaddress = getIpAddr(); |
|
|
String ipaddress = getIpAddr(); |
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doLoginByPhone"); |
|
|
|
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doRegisterByPhone"); |
|
|
// String phone,String code,String pwd |
|
|
// String phone,String code,String pwd |
|
|
String phone = params.get("phone"); |
|
|
String phone = params.get("phone"); |
|
|
|
|
|
String password = params.get("password"); |
|
|
String code = params.get("code"); |
|
|
String code = params.get("code"); |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(phone)) { |
|
|
if (StringUtils.isBlank(phone)) { |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空"); |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空"); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isBlank(code)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(password)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); |
|
|
} |
|
|
} |
|
|
|
|
|
// if (StringUtils.isBlank(code)) { |
|
|
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
|
|
|
// } |
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); |
|
|
|
|
|
if(basicInfo != null){ |
|
|
|
|
|
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check 验证码正确 |
|
|
// check 验证码正确 |
|
|
boolean isValidCode = false; |
|
|
|
|
|
try { |
|
|
|
|
|
isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
return new ResultData(Result.ERROR, e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
if(isValidCode) { |
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); |
|
|
|
|
|
if(basicInfo == null){ |
|
|
|
|
|
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,null); |
|
|
|
|
|
} |
|
|
|
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
|
|
|
Map resultMap = new HashMap(); |
|
|
|
|
|
resultMap.put("phone", basicInfo.getPhone()); |
|
|
|
|
|
resultMap.put("token", basicInfo.getToken()); |
|
|
|
|
|
return new ResultData(resultMap); |
|
|
|
|
|
} else { |
|
|
|
|
|
return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// boolean isValidCode = false; |
|
|
|
|
|
// try { |
|
|
|
|
|
// isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); |
|
|
|
|
|
// } catch (Exception e) { |
|
|
|
|
|
// return new ResultData(Result.ERROR, e.getMessage()); |
|
|
|
|
|
// } |
|
|
|
|
|
// if(isValidCode) { |
|
|
|
|
|
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,password); |
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
|
|
|
// } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
@AuthIgnore |
|
|
@ApiOperation(value = "手机号注册", notes = "{\"phone\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/doRegisterByPhone") |
|
|
|
|
|
public ResultData doRegisterByPhone(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
|
|
|
@ApiOperation(value = "邮箱注册", notes = "{\"email\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/doRegisterByEmail") |
|
|
|
|
|
public ResultData doRegisterByEmail(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
String ipaddress = getIpAddr(); |
|
|
String ipaddress = getIpAddr(); |
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doRegisterByPhone"); |
|
|
|
|
|
// String phone,String code,String pwd |
|
|
|
|
|
String phone = params.get("phone"); |
|
|
|
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doRegisterByEmail"); |
|
|
|
|
|
// String name,String username,String password |
|
|
|
|
|
String name = params.get("name"); |
|
|
|
|
|
String email = params.get("email"); |
|
|
String password = params.get("password"); |
|
|
String password = params.get("password"); |
|
|
String code = params.get("code"); |
|
|
String code = params.get("code"); |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(phone)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空"); |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(email)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "邮箱不能为空"); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isBlank(password)) { |
|
|
if (StringUtils.isBlank(password)) { |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); |
|
|
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(), "验证码不能为空"); |
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
// } |
|
|
// } |
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); |
|
|
if(basicInfo != null){ |
|
|
if(basicInfo != null){ |
|
|
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND); |
|
|
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND); |
|
|
} |
|
|
} |
|
@@ -334,13 +380,83 @@ public class WxUserGrantController extends BaseController { |
|
|
// return new ResultData(Result.ERROR, e.getMessage()); |
|
|
// return new ResultData(Result.ERROR, e.getMessage()); |
|
|
// } |
|
|
// } |
|
|
// if(isValidCode) { |
|
|
// if(isValidCode) { |
|
|
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,password); |
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
|
|
|
basicInfo = wxCUserBasicInfoService.registerEmail(getTenantInfo(),email,password); |
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
|
|
|
// } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
|
|
@ApiOperation(value = "发送激活邮件", notes = "{\"email\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/sendRegisterEmail") |
|
|
|
|
|
public ResultData sendRegisterEmail(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
String ipaddress = getIpAddr(); |
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::sendRegisterEmail"); |
|
|
|
|
|
// String name,String username,String password |
|
|
|
|
|
String email = params.get("email"); |
|
|
|
|
|
String code = params.get("code"); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(email)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "邮箱不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (StringUtils.isBlank(code)) { |
|
|
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); |
|
|
|
|
|
if(basicInfo == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
|
|
} |
|
|
|
|
|
if(!EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ |
|
|
|
|
|
return new ResultData(ErrorCode.MEMBER_IS_ACTIVE); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check 验证码正确 |
|
|
|
|
|
// boolean isValidCode = false; |
|
|
|
|
|
// try { |
|
|
|
|
|
// isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); |
|
|
|
|
|
// } catch (Exception e) { |
|
|
|
|
|
// return new ResultData(Result.ERROR, e.getMessage()); |
|
|
|
|
|
// } |
|
|
|
|
|
// if(isValidCode) { |
|
|
|
|
|
wxCUserBasicInfoService.sendTicketEmail(basicInfo,EnumMsgModel.EMAIL_ACTIVATION); |
|
|
|
|
|
return new ResultData(); |
|
|
// } else { |
|
|
// } else { |
|
|
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
// } |
|
|
// } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
|
|
@ApiOperation(value = "激活", notes = "") |
|
|
|
|
|
@PostMapping("/doActivation") |
|
|
|
|
|
public ResultData doActivation(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
String ipaddress = getIpAddr(); |
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doActivation"); |
|
|
|
|
|
// |
|
|
|
|
|
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已过期"); |
|
|
|
|
|
} |
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId, getTenantInfo().getFinalTenantId()); |
|
|
|
|
|
if(basicInfo == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
|
|
} |
|
|
|
|
|
if(!EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ |
|
|
|
|
|
return new ResultData(ErrorCode.MEMBER_IS_ACTIVE); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wxCUserBasicInfoService.handleLoginUser(basicInfo); |
|
|
|
|
|
Map resultMap = new HashMap(); |
|
|
|
|
|
// resultMap.put("username", basicInfo.getEmail()); |
|
|
|
|
|
resultMap.put("token", basicInfo.getToken()); |
|
|
|
|
|
return new ResultData(resultMap); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
@AuthIgnore |
|
|
@ApiOperation(value = "手机验证码修改密码", notes = "{\"phone\",\"string\",\"code\",\"string\"}") |
|
|
@ApiOperation(value = "手机验证码修改密码", notes = "{\"phone\",\"string\",\"code\",\"string\"}") |
|
|
@PostMapping("/updPass") |
|
|
@PostMapping("/updPass") |
|
@@ -385,6 +501,126 @@ public class WxUserGrantController extends BaseController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "旧密码修改密码", notes = "{\"oldpwd\",\"string\",\"newpwd\",\"string\"}") |
|
|
|
|
|
@PostMapping("/oldUpdPass") |
|
|
|
|
|
public ResultData oldUpdPass(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
String ipaddress = getIpAddr(); |
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::oldUpdPass"); |
|
|
|
|
|
|
|
|
|
|
|
WxCUserBasicInfo basicInfo = getCUser(); |
|
|
|
|
|
// |
|
|
|
|
|
String oldpwd = params.get("oldpwd"); |
|
|
|
|
|
// String code = params.get("code"); |
|
|
|
|
|
String newpwd = params.get("newpwd"); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(oldpwd)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "旧密码不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
// if (StringUtils.isBlank(code)) { |
|
|
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
|
|
|
// } |
|
|
|
|
|
if (StringUtils.isBlank(newpwd)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "新密码不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String encryptPassword = new PasswordHelper().encryptPassword(oldpwd); |
|
|
|
|
|
|
|
|
|
|
|
if(!encryptPassword.equals(basicInfo.getPassword())){ |
|
|
|
|
|
return new ResultData(ErrorCode.PASSWORD_ERROR.getCode(), "旧密码错误"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check 验证码正确 |
|
|
|
|
|
// boolean isValidCode = false; |
|
|
|
|
|
// try { |
|
|
|
|
|
// isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); |
|
|
|
|
|
// } catch (Exception e) { |
|
|
|
|
|
// 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(); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
|
|
|
// } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
|
|
@ApiOperation(value = "发送修改密码邮件", notes = "{\"email\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/sendUpdPwdEmail") |
|
|
|
|
|
public ResultData sendUpdPwdEmail(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
String ipaddress = getIpAddr(); |
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::sendUpdPwdEmail"); |
|
|
|
|
|
// String name,String username,String password |
|
|
|
|
|
String email = params.get("email"); |
|
|
|
|
|
String code = params.get("code"); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(email)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "邮箱不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (StringUtils.isBlank(code)) { |
|
|
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByEmail(getTenantInfo(), email); |
|
|
|
|
|
if(basicInfo == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
|
|
} |
|
|
|
|
|
if(EnumCUserBasicInfoStatus.NOT_ACTIVE.getCode().equals(basicInfo.getStatus())){ |
|
|
|
|
|
return new ResultData(ErrorCode.MEMBER_IS_NOT_ACTIVE); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check 验证码正确 |
|
|
|
|
|
// boolean isValidCode = false; |
|
|
|
|
|
// try { |
|
|
|
|
|
// isValidCode = wxMsgValidationcodeService.checkCodeValid(phone,code); |
|
|
|
|
|
// } catch (Exception e) { |
|
|
|
|
|
// return new ResultData(Result.ERROR, e.getMessage()); |
|
|
|
|
|
// } |
|
|
|
|
|
// if(isValidCode) { |
|
|
|
|
|
wxCUserBasicInfoService.sendTicketEmail(basicInfo,EnumMsgModel.EMAIL_UPD_PWD); |
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); |
|
|
|
|
|
// } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
|
|
@ApiOperation(value = "修改密码", notes = "{\"username\",\"string\",\"code\",\"string\"}") |
|
|
|
|
|
@PostMapping("/doUpdPass") |
|
|
|
|
|
public ResultData doUpdPass(@RequestBody Map<String, String> params, HttpServletResponse response) { |
|
|
|
|
|
String ipaddress = getIpAddr(); |
|
|
|
|
|
logger.debug("[" + ipaddress + "] WxUserGrantController::doUpdPass"); |
|
|
|
|
|
// |
|
|
|
|
|
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(),"已过期"); |
|
|
|
|
|
} |
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(userId, getTenantInfo().getFinalTenantId()); |
|
|
|
|
|
if(basicInfo == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
|
|
} |
|
|
|
|
|
String pwd = params.get("pwd"); |
|
|
|
|
|
if (StringUtils.isBlank(pwd)) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String encryptPassword = new PasswordHelper().encryptPassword(pwd); |
|
|
|
|
|
WxCUserBasicInfo basicInfoUpd = new WxCUserBasicInfo(); |
|
|
|
|
|
basicInfoUpd.setId(basicInfo.getId()); |
|
|
|
|
|
basicInfoUpd.setPassword(encryptPassword); |
|
|
|
|
|
wxCUserBasicInfoService.update(basicInfoUpd); |
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation("登出") |
|
|
@ApiOperation("登出") |
|
|
@GetMapping("/logout") |
|
|
@GetMapping("/logout") |
|
|
public ResultData logout() { |
|
|
public ResultData logout() { |
|
|