pwd
This commit is contained in:
parent
d8c982d47d
commit
7c30de203f
|
|
@ -0,0 +1,42 @@
|
||||||
|
package net.xnzn.core.customer.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.xnzn.core.customer.dto.CustChangePasswordDTO;
|
||||||
|
import net.xnzn.core.customer.dto.CustForgetPasswordDTO;
|
||||||
|
import net.xnzn.core.customer.service.CustInfoService;
|
||||||
|
import net.xnzn.utils.AesEncryptUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dept")
|
||||||
|
@Slf4j
|
||||||
|
public class CustInfoController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CustInfoService custInfoService;
|
||||||
|
|
||||||
|
@ApiOperation("小程序修改密码")
|
||||||
|
@PostMapping({"/change/password"})
|
||||||
|
public AjaxResult changePassword(@Validated @RequestBody CustChangePasswordDTO content) {
|
||||||
|
this.custInfoService.custChangePassword(content);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("忘记密码")
|
||||||
|
@PostMapping({"/forget/password"})
|
||||||
|
public AjaxResult forgetPassword(@Validated @RequestBody CustForgetPasswordDTO content) {
|
||||||
|
content.setMobile(AesEncryptUtil.aesDecode(content.getMobile()));
|
||||||
|
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
||||||
|
this.custInfoService.custForgetPassword(content);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package net.xnzn.core.customer.service.impl;
|
package net.xnzn.core.customer.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import net.xnzn.constant.RetCodeEnum;
|
import net.xnzn.constant.RetCodeEnum;
|
||||||
import net.xnzn.core.customer.api.CustCasualApi;
|
import net.xnzn.core.customer.api.CustCasualApi;
|
||||||
|
|
@ -28,9 +26,9 @@ import java.util.*;
|
||||||
@Service
|
@Service
|
||||||
public class CustInfoServiceImpl implements CustInfoService {
|
public class CustInfoServiceImpl implements CustInfoService {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CustInfoServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(CustInfoServiceImpl.class);
|
||||||
@Autowired
|
// @Autowired
|
||||||
@Lazy
|
// @Lazy
|
||||||
private AesEncryptUtil aesEncryptUtil;
|
// private AesEncryptUtil aesEncryptUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
private SmsCodeApi smsCodeApi;
|
private SmsCodeApi smsCodeApi;
|
||||||
|
|
@ -72,8 +70,8 @@ public class CustInfoServiceImpl implements CustInfoService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void custForgetPassword(CustForgetPasswordDTO content) {
|
public void custForgetPassword(CustForgetPasswordDTO content) {
|
||||||
content.setMobile(this.aesEncryptUtil.aesDecode(content.getMobile()));
|
content.setMobile(AesEncryptUtil.aesDecode(content.getMobile()));
|
||||||
content.setNewPassword(this.aesEncryptUtil.aesDecode(content.getNewPassword()));
|
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
|
||||||
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
|
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
|
||||||
smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
|
smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
|
||||||
smsCodeVerifyDTO.setCode(content.getCode());
|
smsCodeVerifyDTO.setCode(content.getCode());
|
||||||
|
|
@ -84,7 +82,7 @@ public class CustInfoServiceImpl implements CustInfoService {
|
||||||
custInfoQuery.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()));
|
custInfoQuery.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()));
|
||||||
CustInfo custInfo = custInfoMapper.selectOne(custInfoQuery);
|
CustInfo custInfo = custInfoMapper.selectOne(custInfoQuery);
|
||||||
if (ObjectUtil.isNull(custInfo)) {
|
if (ObjectUtil.isNull(custInfo)) {
|
||||||
log.error("修改密码错误:人员不存在:" + String.valueOf(custInfo));
|
log.error("修改密码错误:人员不存在:" + custInfo);
|
||||||
throw new ServiceException("修改密码错误:人员不存在", RetCodeEnum.PAY_PERSONAL_NO_EXIT.getKey());
|
throw new ServiceException("修改密码错误:人员不存在", RetCodeEnum.PAY_PERSONAL_NO_EXIT.getKey());
|
||||||
} else {
|
} else {
|
||||||
String newPassword = content.getNewPassword();
|
String newPassword = content.getNewPassword();
|
||||||
|
|
|
||||||
Reference in New Issue