source type and rebind mobile
This commit is contained in:
parent
e873191063
commit
9a1700fb00
|
|
@ -1,6 +1,6 @@
|
||||||
package com.bonus.core.customer.controller;
|
package com.bonus.core.customer.controller;
|
||||||
|
|
||||||
import com.bonus.common.core.web.controller.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.CustQueryDTO;
|
import com.bonus.core.customer.dto.CustQueryDTO;
|
||||||
|
|
@ -16,7 +16,9 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.bonus.common.core.web.domain.AjaxResult.success;
|
||||||
import static com.bonus.core.common.encrypt.SM4EncryptUtils.sm4Decrypt;
|
import static com.bonus.core.common.encrypt.SM4EncryptUtils.sm4Decrypt;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -45,6 +47,19 @@ public class CustInfoController extends BaseController {
|
||||||
public AjaxResult forgetPassword(@Validated @RequestBody CustForgetPasswordDTO content) {
|
public AjaxResult forgetPassword(@Validated @RequestBody CustForgetPasswordDTO content) {
|
||||||
//content.setMobile(AesEncryptUtil.aesDecode(content.getMobile()));
|
//content.setMobile(AesEncryptUtil.aesDecode(content.getMobile()));
|
||||||
//content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
//content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
||||||
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
|
try {
|
||||||
|
ajaxResult = this.custInfoService.rebindMobile(content);
|
||||||
|
return ajaxResult;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("忘记密码异常", e);
|
||||||
|
return AjaxResult.error("忘记密码异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("重新绑定手机号")
|
||||||
|
@PostMapping({"/rebind/mobile"})
|
||||||
|
public AjaxResult rebindMobile(@Validated @RequestBody CustForgetPasswordDTO content) {
|
||||||
AjaxResult ajaxResult = new AjaxResult();
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
try {
|
try {
|
||||||
ajaxResult = this.custInfoService.custForgetPassword(content);
|
ajaxResult = this.custInfoService.custForgetPassword(content);
|
||||||
|
|
@ -65,8 +80,10 @@ public class CustInfoController extends BaseController {
|
||||||
@PostMapping({"/queryCustInfoDetailForApp"})
|
@PostMapping({"/queryCustInfoDetailForApp"})
|
||||||
public AjaxResult queryCustInfoDetailForApp(@RequestHeader Map<String, String> headers, @RequestBody CustInfo custInfo) {
|
public AjaxResult queryCustInfoDetailForApp(@RequestHeader Map<String, String> headers, @RequestBody CustInfo custInfo) {
|
||||||
log.info("[人员资料]小程序查询人员详细资料_开始");
|
log.info("[人员资料]小程序查询人员详细资料_开始");
|
||||||
|
Integer sourceType = this.getSourceTypeByHeaders(headers);
|
||||||
|
sourceType = Objects.isNull(sourceType) ? SourceTypeEnum.HT_H5_MOBILE.getKey() : sourceType;
|
||||||
AjaxResult ar = new AjaxResult();
|
AjaxResult ar = new AjaxResult();
|
||||||
CustInfoVo result = this.custInfoService.queryCustInfoDetail(custInfo);
|
CustInfoVo result = this.custInfoService.queryCustInfoDetail(custInfo, sourceType);
|
||||||
//System.out.println(sm4Decrypt("29G1AUHDmLvPe1tt0t12Dw==##encrypted"));
|
//System.out.println(sm4Decrypt("29G1AUHDmLvPe1tt0t12Dw==##encrypted"));
|
||||||
result.setMobile(sm4Decrypt(result.getMobile()));
|
result.setMobile(sm4Decrypt(result.getMobile()));
|
||||||
result.setCustName(sm4Decrypt(result.getCustName()));
|
result.setCustName(sm4Decrypt(result.getCustName()));
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,14 @@ import java.util.*;
|
||||||
|
|
||||||
public interface CustInfoService extends IService<CustInfo> {
|
public interface CustInfoService extends IService<CustInfo> {
|
||||||
|
|
||||||
CustInfoVo queryCustInfoDetail(CustInfo custInfo);
|
CustInfoVo queryCustInfoDetail(CustInfo custInfo, Integer sourceType);
|
||||||
|
|
||||||
AjaxResult custChangePassword(CustChangePasswordDTO content);
|
AjaxResult custChangePassword(CustChangePasswordDTO content);
|
||||||
|
|
||||||
AjaxResult custForgetPassword(CustForgetPasswordDTO content);
|
AjaxResult custForgetPassword(CustForgetPasswordDTO content);
|
||||||
|
|
||||||
|
AjaxResult rebindMobile(CustForgetPasswordDTO content);
|
||||||
|
|
||||||
String getOrderQRCode(Integer sourceType, String paramValue);
|
String getOrderQRCode(Integer sourceType, String paramValue);
|
||||||
|
|
||||||
void updateCustPhotoUrl(Long custId, String photoUrl);
|
void updateCustPhotoUrl(Long custId, String photoUrl);
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,8 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
||||||
// private String h5LoginPwd;
|
// private String h5LoginPwd;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustInfoVo queryCustInfoDetail(CustInfo custInfo) {
|
public CustInfoVo queryCustInfoDetail(CustInfo custInfo, Integer sourceType) {
|
||||||
CustInfoVo result = this.getNormalCustInfoDetail(custInfo);
|
CustInfoVo result = this.getNormalCustInfoDetail(custInfo, sourceType);
|
||||||
if (ObjectUtil.isNotNull(result)) {
|
if (ObjectUtil.isNotNull(result)) {
|
||||||
if (LeConstants.DATA_DEFAULT_INTEGER.equals(result.getSex())) {
|
if (LeConstants.DATA_DEFAULT_INTEGER.equals(result.getSex())) {
|
||||||
result.setSex((Integer)null);
|
result.setSex((Integer)null);
|
||||||
|
|
@ -168,10 +168,10 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CustInfoVo getNormalCustInfoDetail(CustInfo custInfo) {
|
protected CustInfoVo getNormalCustInfoDetail(CustInfo custInfo, Integer sourceType) {
|
||||||
custInfo.setCustState(PersonalStatusEnum.NORMAL.getKey());
|
custInfo.setCustState(PersonalStatusEnum.NORMAL.getKey());
|
||||||
CustInfoVo custInfoVo = custInfoMapper.queryCustInfoDetail(custInfo);
|
CustInfoVo custInfoVo = custInfoMapper.queryCustInfoDetail(custInfo);
|
||||||
return addOrUpdateCustCasual(custInfoVo, SourceTypeEnum.HT_H5_MOBILE.getKey());
|
return addOrUpdateCustCasual(custInfoVo, sourceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustInfoVo addOrUpdateCustCasual(CustInfoVo custInfoVo, Integer sourceType) {
|
public CustInfoVo addOrUpdateCustCasual(CustInfoVo custInfoVo, Integer sourceType) {
|
||||||
|
|
@ -285,6 +285,34 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
||||||
return ajaxResult;
|
return ajaxResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult rebindMobile(CustForgetPasswordDTO content) {
|
||||||
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
|
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
||||||
|
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
|
||||||
|
smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
|
||||||
|
smsCodeVerifyDTO.setCode(content.getCode());
|
||||||
|
if (!verifySmsCode(smsCodeVerifyDTO, CacheConstants.VERIFICATION_CODE)) {
|
||||||
|
ajaxResult.put("msg", "验证码异常");
|
||||||
|
ajaxResult.put("code", "500");
|
||||||
|
} else {
|
||||||
|
CustInfo custInfoQuery = new CustInfo();
|
||||||
|
custInfoQuery.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()));
|
||||||
|
CustInfo custInfo = custInfoMapper.selectOne(custInfoQuery);
|
||||||
|
if (ObjectUtil.isNull(custInfo)) {
|
||||||
|
log.error("修改密码错误:人员不存在:" + custInfo);
|
||||||
|
ajaxResult.put("msg", "修改密码错误:人员不存在");
|
||||||
|
ajaxResult.put("code", "500");
|
||||||
|
} else {
|
||||||
|
custInfo.setPwd(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()));
|
||||||
|
custInfoMapper.updateById(custInfo);
|
||||||
|
ajaxResult.put("msg", "修改成功");
|
||||||
|
ajaxResult.put("code", "200");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ajaxResult;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean verifySmsCode(SmsCodeVerifyDTO smsCodeVerifyDTO, String cacheKey) {
|
public boolean verifySmsCode(SmsCodeVerifyDTO smsCodeVerifyDTO, String cacheKey) {
|
||||||
String key = cacheKey + smsCodeVerifyDTO.getTelephoneNumber();
|
String key = cacheKey + smsCodeVerifyDTO.getTelephoneNumber();
|
||||||
String code = redisService.getCacheObject(key); //RedisUtil.getString(key);
|
String code = redisService.getCacheObject(key); //RedisUtil.getString(key);
|
||||||
|
|
|
||||||
Reference in New Issue