迭代 注册方法1.5
parent
4742f6e8f3
commit
4f5110ec9e
|
@ -103,11 +103,6 @@
|
|||
<groupId>com.health</groupId>
|
||||
<artifactId>health-common-log</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
<version>2.7.13</version>
|
||||
</dependency>
|
||||
<!-- RuoYi Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.health</groupId>
|
||||
|
@ -116,7 +111,7 @@
|
|||
<dependency>
|
||||
<groupId>com.health</groupId>
|
||||
<artifactId>health-common-core</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<version>3.6.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
|
|
@ -143,12 +143,6 @@ public class SysUserController extends BaseController
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
//获取邮箱验证码
|
||||
@PostMapping("/getEmailCode")
|
||||
public Result getEmailCode(@RequestParam("email") String email){
|
||||
|
||||
return userService.getEmailCode(email);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
//注册
|
||||
|
|
|
@ -208,7 +208,6 @@ public interface ISysUserService
|
|||
*/
|
||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
Result getEmailCode(String email);
|
||||
|
||||
int registerNewUser(CommonBody commonBody);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.validation.Validator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -46,8 +44,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
@Autowired
|
||||
private JavaMailSender javaMailSender;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
|
@ -558,23 +555,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
|
||||
|
||||
@Override
|
||||
public Result getEmailCode(String emailCount) {
|
||||
String emailCode = RandomUtil.randomNumbers(4);
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
try {
|
||||
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);
|
||||
mimeMessageHelper.setFrom("371894675@qq.com");
|
||||
mimeMessageHelper.setTo(emailCount);
|
||||
mimeMessageHelper.setSubject("邮箱验证码");
|
||||
mimeMessageHelper.setText("验证码为:"+emailCode);
|
||||
|
||||
} catch (MessagingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
redisTemplate.opsForValue().set(emailCount,emailCode);
|
||||
return Result.success(emailCode,"邮箱验证码发送成功");
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
@Override
|
||||
|
@ -589,6 +570,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
int role=101;
|
||||
//添加用户不管是患者还是医生
|
||||
int userId=userMapper.insertNewUser(commonBody);
|
||||
System.out.println("获取的自增userId是"+userId);
|
||||
//如果角色标识roleId==2的时候再赋值为102
|
||||
if (commonBody.getRoleId()==2){
|
||||
role=102;
|
||||
|
|
|
@ -23,8 +23,4 @@ spring:
|
|||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
mail:
|
||||
host: smtp.qq.com
|
||||
port: 587
|
||||
username: 371894675@qq.com
|
||||
password: abkabckjtgmgcafb
|
||||
|
||||
|
|
|
@ -181,13 +181,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
|
||||
<!--添加患者或者医生公用这个动态sql-->
|
||||
<insert id="insertNewUser" useGeneratedKeys="true" keyProperty="patientId" >
|
||||
|
||||
<insert id="insertNewUser" useGeneratedKeys="true" keyProperty="userId" >
|
||||
<choose>
|
||||
<when test="roleId==1">
|
||||
insert into tb_patient
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="patientId!=null">patient_id,</if>
|
||||
<if test="userId!=null">user_id,</if>
|
||||
<if test="name!=null and name!=''">patient_name,</if>
|
||||
<if test="password!=null and password!=''">password,</if>
|
||||
<if test="email!=null and email!=''">email,</if>
|
||||
|
@ -202,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="patientId!=null">#{patientId},</if>
|
||||
<if test="userId!=null">#{userId},</if>
|
||||
<if test="name!=null and name!=''">#{name},</if>
|
||||
<if test="password!=null and password!=''">#{password},</if>
|
||||
<if test="email!=null and email!=''">#{email},</if>
|
||||
|
@ -218,7 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<otherwise>
|
||||
insert into tb_doctor
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="doctorId!=null"> doctor_id,</if>
|
||||
<if test="userId!=null"> user_id,</if>
|
||||
<if test="name!=null and name!=''">doctor_name,</if>
|
||||
<if test="password!=null and password!=''">password,</if>
|
||||
<if test="email!=null and email!=''">email,</if>
|
||||
|
@ -231,7 +230,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="doctorId!=null"> #{doctorId},</if>
|
||||
<if test="userId!=null"> #{userId},</if>
|
||||
<if test="name!=null and name!=''">#{name},</if>
|
||||
<if test="password!=null and password!=''">#{password},</if>
|
||||
<if test="email!=null and email!=''">#{email},</if>
|
||||
|
|
Loading…
Reference in New Issue