source type and rebind mobile
This commit is contained in:
parent
9a1700fb00
commit
7128d05a28
|
|
@ -3,6 +3,7 @@ package com.bonus.core.customer.controller;
|
||||||
import com.bonus.core.common.base.BaseController;
|
import com.bonus.core.common.base.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.constant.SourceTypeEnum;
|
import com.bonus.constant.SourceTypeEnum;
|
||||||
|
import com.bonus.core.customer.dto.CustBindMobileDTO;
|
||||||
import com.bonus.core.customer.dto.CustQueryDTO;
|
import com.bonus.core.customer.dto.CustQueryDTO;
|
||||||
import com.bonus.core.customer.vo.CustInfoVo;
|
import com.bonus.core.customer.vo.CustInfoVo;
|
||||||
import com.bonus.domain.CustInfo;
|
import com.bonus.domain.CustInfo;
|
||||||
|
|
@ -49,7 +50,7 @@ public class CustInfoController extends BaseController {
|
||||||
//content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
//content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
||||||
AjaxResult ajaxResult = new AjaxResult();
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
try {
|
try {
|
||||||
ajaxResult = this.custInfoService.rebindMobile(content);
|
ajaxResult = this.custInfoService.custForgetPassword(content);
|
||||||
return ajaxResult;
|
return ajaxResult;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("忘记密码异常", e);
|
log.error("忘记密码异常", e);
|
||||||
|
|
@ -59,10 +60,11 @@ public class CustInfoController extends BaseController {
|
||||||
|
|
||||||
@ApiOperation("重新绑定手机号")
|
@ApiOperation("重新绑定手机号")
|
||||||
@PostMapping({"/rebind/mobile"})
|
@PostMapping({"/rebind/mobile"})
|
||||||
public AjaxResult rebindMobile(@Validated @RequestBody CustForgetPasswordDTO content) {
|
public AjaxResult rebindMobile(@RequestHeader Map<String, String> headers, @Validated @RequestBody CustBindMobileDTO content) {
|
||||||
AjaxResult ajaxResult = new AjaxResult();
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
try {
|
try {
|
||||||
ajaxResult = this.custInfoService.custForgetPassword(content);
|
Integer sourceType = this.getSourceTypeByHeaders(headers);
|
||||||
|
ajaxResult = this.custInfoService.rebindMobile(content, sourceType);
|
||||||
return ajaxResult;
|
return ajaxResult;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("忘记密码异常", e);
|
log.error("忘记密码异常", e);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bonus.core.customer.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ApiModel("小程序绑定新手机号")
|
||||||
|
@Data
|
||||||
|
public class CustBindMobileDTO implements Serializable {
|
||||||
|
@ApiModelProperty("mobile")
|
||||||
|
private @NotBlank(
|
||||||
|
message = "手机号不能为空"
|
||||||
|
) String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("newMobile")
|
||||||
|
private @NotBlank(
|
||||||
|
message = "手机号不能为空"
|
||||||
|
) String newMobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("验证码")
|
||||||
|
private String code;
|
||||||
|
}
|
||||||
|
|
@ -26,7 +26,7 @@ public interface CustInfoService extends IService<CustInfo> {
|
||||||
|
|
||||||
AjaxResult custForgetPassword(CustForgetPasswordDTO content);
|
AjaxResult custForgetPassword(CustForgetPasswordDTO content);
|
||||||
|
|
||||||
AjaxResult rebindMobile(CustForgetPasswordDTO content);
|
AjaxResult rebindMobile(CustBindMobileDTO content, Integer sourceType);
|
||||||
|
|
||||||
String getOrderQRCode(Integer sourceType, String paramValue);
|
String getOrderQRCode(Integer sourceType, String paramValue);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,6 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult custForgetPassword(CustForgetPasswordDTO content) {
|
public AjaxResult custForgetPassword(CustForgetPasswordDTO content) {
|
||||||
// content.setMobile(AesEncryptUtil.aesDecode(content.getMobile()));
|
|
||||||
AjaxResult ajaxResult = new AjaxResult();
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
||||||
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
|
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
|
||||||
|
|
@ -286,11 +285,10 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult rebindMobile(CustForgetPasswordDTO content) {
|
public AjaxResult rebindMobile(CustBindMobileDTO content, Integer sourceType) {
|
||||||
AjaxResult ajaxResult = new AjaxResult();
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
|
||||||
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
|
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
|
||||||
smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
|
smsCodeVerifyDTO.setTelephoneNumber(content.getNewMobile());
|
||||||
smsCodeVerifyDTO.setCode(content.getCode());
|
smsCodeVerifyDTO.setCode(content.getCode());
|
||||||
if (!verifySmsCode(smsCodeVerifyDTO, CacheConstants.VERIFICATION_CODE)) {
|
if (!verifySmsCode(smsCodeVerifyDTO, CacheConstants.VERIFICATION_CODE)) {
|
||||||
ajaxResult.put("msg", "验证码异常");
|
ajaxResult.put("msg", "验证码异常");
|
||||||
|
|
@ -304,8 +302,13 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
||||||
ajaxResult.put("msg", "修改密码错误:人员不存在");
|
ajaxResult.put("msg", "修改密码错误:人员不存在");
|
||||||
ajaxResult.put("code", "500");
|
ajaxResult.put("code", "500");
|
||||||
} else {
|
} else {
|
||||||
custInfo.setPwd(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()));
|
custInfo.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getNewMobile()));
|
||||||
custInfoMapper.updateById(custInfo);
|
custInfoMapper.updateById(custInfo);
|
||||||
|
CustCasual custCasual = this.custInfoMapper.selectCustCasualByCustId(custInfo.getCustId(), sourceType, DelFlagEnum.DEL_FALSE.key());
|
||||||
|
if (Objects.nonNull(custCasual)) {
|
||||||
|
custCasual.setMobile(content.getNewMobile());
|
||||||
|
this.custInfoMapper.updateCustCasual(custCasual);
|
||||||
|
}
|
||||||
ajaxResult.put("msg", "修改成功");
|
ajaxResult.put("msg", "修改成功");
|
||||||
ajaxResult.put("code", "200");
|
ajaxResult.put("code", "200");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue