add 用户登录判断是否为初始密码,增加忘记密码,发送验证码

This commit is contained in:
lijiarao
2021-09-23 15:10:48 +08:00
parent 0f42e4c14f
commit 54eeb8c310
11 changed files with 206 additions and 5 deletions
@@ -12,11 +12,13 @@ import com.jero.common.util.*;
import com.jero.company.entity.PayContactsManagement;
import com.jero.company.service.IPayContactsManagementService;
import com.jero.modules.base.service.BaseCommonService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.model.SysLoginModel;
import com.jero.modules.system.service.ISysDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -159,4 +161,29 @@ public class CompanyLoginController {
result.setResult(obj);
result.success("登录成功");
}
@ApiOperation(value = "发送手机号验证码")
@GetMapping(value = "/sendVerificationCode")
public Result<?> sendVerificationCode(String mobile) {
mobile = PasswordUtil.encrypt(mobile);
LambdaQueryWrapper<PayContactsManagement> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PayContactsManagement::getPhone, mobile);
PayContactsManagement contactsManagement = payContactsManagementService.getOne(queryWrapper);
if (Objects.isNull(contactsManagement)){
throw new JeroBootException("手机号不是企业联系人");
}
sysBaseAPI.sendVerificationCode(mobile,"2",null,null);
if (StringUtils.isBlank(contactsManagement.getPassword())){
return Result.error("updatePassword");
}
return Result.OK();
}
@ApiOperation(value = "忘记密码", notes = "忘记密码")
@PostMapping(value = "/forgetPassword")
public Result<?> forgetPassword(@RequestBody PayContactsManagement user) {
//payContactsManagementService.forgetPassword(user);
return Result.OK("修改密码成功");
}
}
@@ -0,0 +1,41 @@
package com.jero.company.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.jeecgframework.poi.excel.annotation.Excel;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
/**
* 企业端登录
* @author liJiaRao
* @date 2021-09-23 14:59
*/
public class CompanyLoginVO {
/**手机号*/
@ApiModelProperty(value = "手机号")
@NotEmpty(message = "手机号不能为空!")
@Pattern(regexp = "^((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(17[0135678])|(18[0-9])|(19[8|9])|(16[6]))\\d{8}$",message = "手机号码格式错误")
private String phone;
/**
* 验证码
*/
@ApiModelProperty(value = "验证码")
@TableField(exist = false)
private String verifyCode;
@TableField(exist = false)
@ApiModelProperty(value = "RSA公钥")
private String rsapublickey;
/**
* 确认密码
*/
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@ApiModelProperty(value = "确认密码")
@TableField(exist = false)
private String verifyPassword;
}