|
@@ -7,6 +7,7 @@ import cn.cslg.permission.common.model.vo.RoleVO;
|
|
import cn.cslg.permission.common.utils.*;
|
|
import cn.cslg.permission.common.utils.*;
|
|
import cn.cslg.permission.common.utils.message.MessageUtils;
|
|
import cn.cslg.permission.common.utils.message.MessageUtils;
|
|
import cn.cslg.permission.domain.Personnel;
|
|
import cn.cslg.permission.domain.Personnel;
|
|
|
|
+import cn.cslg.permission.domain.ReSetPasswordDTO;
|
|
import cn.cslg.permission.domain.Tenant;
|
|
import cn.cslg.permission.domain.Tenant;
|
|
import cn.cslg.permission.mapper.PersonnelMapper;
|
|
import cn.cslg.permission.mapper.PersonnelMapper;
|
|
import cn.cslg.permission.service.associate.PerDpService;
|
|
import cn.cslg.permission.service.associate.PerDpService;
|
|
@@ -225,25 +226,37 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
return Response.success(true);
|
|
return Response.success(true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 登录前重置密码
|
|
* 登录前重置密码
|
|
*
|
|
*
|
|
- * @param personnelUserName 人员账号
|
|
|
|
|
|
+ * @param reSetPasswordDTO 人员账号和邮箱
|
|
*/
|
|
*/
|
|
- public void reSetPasswordBeforeLogin(String personnelUserName) {
|
|
|
|
- log.info("开始处理【登录前重置密码】的业务,参数为:{}", personnelUserName);
|
|
|
|
|
|
+ public void reSetPasswordBeforeLogin(ReSetPasswordDTO reSetPasswordDTO) {
|
|
|
|
+ log.info("开始处理【登录前重置密码】的业务,参数为:{}", reSetPasswordDTO);
|
|
|
|
+
|
|
|
|
+ //若账号与邮箱未填写或格式不正确,则返回提示"请正确填写账号与邮箱"
|
|
|
|
+ if (reSetPasswordDTO.getPersonnelUserName() == null || reSetPasswordDTO.getPersonnelUserName().trim().equals("")
|
|
|
|
+ || reSetPasswordDTO.getPersonnelEmail() == null || reSetPasswordDTO.getPersonnelEmail().trim().equals("")) {
|
|
|
|
+ ThrowException.throwXiaoShiException("请正确填写账号与邮箱");
|
|
|
|
+ }
|
|
|
|
|
|
//检查账号是否存在,若不存在则返回提示"账号不存在,请检查账号是否输入正确"
|
|
//检查账号是否存在,若不存在则返回提示"账号不存在,请检查账号是否输入正确"
|
|
- Personnel personnel = this.getOne(new LambdaQueryWrapper<Personnel>().eq(Personnel::getPersonnelUserName, personnelUserName).last("LIMIT 1"));
|
|
|
|
|
|
+ Personnel personnel = this.getOne(new LambdaQueryWrapper<Personnel>().eq(Personnel::getPersonnelUserName, reSetPasswordDTO.getPersonnelUserName()).last("LIMIT 1"));
|
|
if (personnel == null) {
|
|
if (personnel == null) {
|
|
ThrowException.throwXiaoShiException("该账号不存在或已被禁用,请检查账号是否输入正确");
|
|
ThrowException.throwXiaoShiException("该账号不存在或已被禁用,请检查账号是否输入正确");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
//检查邮箱是否存在,若没有邮箱则返回提示"该账号未绑定邮箱无法重置密码,您可在登陆后进行密码重置"
|
|
//检查邮箱是否存在,若没有邮箱则返回提示"该账号未绑定邮箱无法重置密码,您可在登陆后进行密码重置"
|
|
- String personnelEmail = personnel.getPersonnelEmail();
|
|
|
|
- if (personnelEmail == null || personnelEmail.trim().equals("")) {
|
|
|
|
- ThrowException.throwXiaoShiException("该账号未绑定邮箱无法重置密码,您可在登陆后进行密码重置");
|
|
|
|
|
|
+// String personnelEmail = personnel.getPersonnelEmail();
|
|
|
|
+// if (personnelEmail == null || personnelEmail.trim().equals("")) {
|
|
|
|
+// ThrowException.throwXiaoShiException("该账号未绑定邮箱无法重置密码,您也可在登陆后进行密码重置");
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ //检查邮箱是否正确,若错误则返回提示"该账号未绑定邮箱无法重置密码,您可在登陆后进行密码重置"
|
|
|
|
+ if (!reSetPasswordDTO.getPersonnelEmail().equals(personnel.getPersonnelEmail())) {
|
|
|
|
+ ThrowException.throwXiaoShiException("邮箱不正确,请检查后重新填写");
|
|
}
|
|
}
|
|
|
|
|
|
//重置密码,发送邮件通知
|
|
//重置密码,发送邮件通知
|
|
@@ -256,7 +269,7 @@ public class LoginService extends ServiceImpl<PersonnelMapper, Personnel> {
|
|
map.put("template", "mail/email.html");
|
|
map.put("template", "mail/email.html");
|
|
map.put("value1", newPassword);
|
|
map.put("value1", newPassword);
|
|
map.put("img", "/logo.png");
|
|
map.put("img", "/logo.png");
|
|
- map.put("email", personnelEmail);
|
|
|
|
|
|
+ map.put("email", personnel.getPersonnelEmail());
|
|
map.put("value2", personnel.getPersonnelName());
|
|
map.put("value2", personnel.getPersonnelName());
|
|
mailUtils.sendEmailMessage(map);
|
|
mailUtils.sendEmailMessage(map);
|
|
}
|
|
}
|