This commit is contained in:
sxu 2025-01-27 21:21:00 +08:00
parent bd3314db1c
commit 0337633ce1
4 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,32 @@
package net.xnzn.core.customer.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ApiModel("小程序使用修改密码")
@Data
public class CustChangePasswordDTO implements Serializable {
@ApiModelProperty("人员id")
private @NotNull(
message = "人员id不能为空"
) Long custId;
@ApiModelProperty("旧密码")
private @NotNull(
message = "旧密码不能为空"
) String oldPassword;
@ApiModelProperty("新密码")
private @NotNull(
message = "新密码不能为空"
) String newPassword;
@ApiModelProperty("openid")
private String openid;
@ApiModelProperty("源类型 1-钉钉 2-微信 3-小程序")
private Integer sourceType;
}

View File

@ -0,0 +1,25 @@
package net.xnzn.core.customer.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ApiModel("小程序使用修改密码")
@Data
public class CustForgetPasswordDTO implements Serializable {
@ApiModelProperty("新密码")
private @NotNull(
message = "新密码不能为空"
) String newPassword;
@ApiModelProperty("mobile")
private @NotBlank(
message = "手机号不能为空"
) String mobile;
@ApiModelProperty("验证码")
private String code;
}

View File

@ -0,0 +1,13 @@
package net.xnzn.core.customer.service;
import net.xnzn.core.customer.dto.CustChangePasswordDTO;
import net.xnzn.core.customer.dto.CustForgetPasswordDTO;
public interface CustInfoService {
void custChangePassword(CustChangePasswordDTO content);
void custForgetPassword(CustForgetPasswordDTO content);
}

View File

@ -0,0 +1,83 @@
//package net.xnzn.core.customer.service.impl;
//
//import cn.hutool.core.util.ObjectUtil;
//import net.xnzn.core.customer.dto.CustChangePasswordDTO;
//import net.xnzn.core.customer.dto.CustForgetPasswordDTO;
//import net.xnzn.core.customer.service.*;
//import net.xnzn.domain.CustInfo;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Lazy;
//import org.springframework.core.task.AsyncTaskExecutor;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.stereotype.Service;
//import java.util.*;
//
//@Service
//public class CustInfoServiceImpl implements CustInfoService {
// private static final Logger log = LoggerFactory.getLogger(CustInfoServiceImpl.class);
// @Autowired
// @Lazy
// private AesEncryptUtil aesEncryptUtil;
// @Autowired
// @Lazy
// private SmsCodeApi smsCodeApi;
// @Autowired
// @Lazy
// private CustCasualApi custCasualApi;
//
// @Value("${customer.h5-login-default-pwd}")
// private String h5LoginPwd;
//
// public void custChangePassword(CustChangePasswordDTO content) {
// CustInfo custInfo = (CustInfo)this.getOne((Wrapper)((LambdaQueryWrapper)(new LambdaQueryWrapper()).eq(CustInfo::getCustId, content.getCustId())).eq(CustInfo::getCustState, PersonalStatusEnum.NORMAL.getKey()));
// if (ObjectUtil.isNull(custInfo)) {
// log.error("小程序修改密码错误:人员不存在:" + String.valueOf(custInfo));
// throw new LeException(RetCodeEnum.PAY_PERSONAL_NO_EXIT, I18n.getMessage("customer.customer.inExists", new Object[0]));
// } else {
// String oldPassword = content.getOldPassword();
// String newPassword = content.getNewPassword();
// if (Objects.equals(oldPassword, newPassword)) {
// log.error("小程序修改密码错误:两次密码不能一致");
// throw new LeException(I18n.getMessage("customer.password.change.same", new Object[0]));
// } else {
// BCryptPasswordEncoder bCrypt = new BCryptPasswordEncoder();
// if (!bCrypt.matches(oldPassword, custInfo.getPwd())) {
// log.error("小程序修改密码错误:原密码不正确");
// throw new LeException(I18n.getMessage("customer.password.ord.error", new Object[0]));
// } else {
// String password = bCrypt.encode(newPassword);
// custInfo.setPwd(password);
// this.updateById(custInfo);
// this.custCasualApi.updateLoginState(content.getCustId(), content.getOpenid());
// }
// }
// }
// }
//
// public void custForgetPassword(CustForgetPasswordDTO content) {
// content.setMobile(this.aesEncryptUtil.aesDecode(content.getMobile()));
// content.setNewPassword(this.aesEncryptUtil.aesDecode(content.getNewPassword()));
// SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
// smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
// smsCodeVerifyDTO.setCode(content.getCode());
// if (!this.smsCodeApi.verifySmsCode(smsCodeVerifyDTO)) {
// throw new LeException(I18n.getMessage("notice_verify_sms_code_exception", new Object[0]));
// } else {
// CustInfo custInfo = (CustInfo)this.getOne((Wrapper)((LambdaQueryWrapper)(new LambdaQueryWrapper()).eq(CustInfo::getMobile, SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()))).eq(CustInfo::getCustState, PersonalStatusEnum.NORMAL.getKey()));
// if (ObjectUtil.isNull(custInfo)) {
// log.error("修改密码错误:人员不存在:" + String.valueOf(custInfo));
// throw new LeException(RetCodeEnum.PAY_PERSONAL_NO_EXIT, I18n.getMessage("customer.customer.inExists", new Object[0]));
// } else {
// String newPassword = content.getNewPassword();
// BCryptPasswordEncoder bCrypt = new BCryptPasswordEncoder();
// String password = bCrypt.encode(newPassword);
// custInfo.setPwd(password);
// this.updateById(custInfo);
// }
// }
// }
//
//}