登录 增加1.7
parent
af18a097e7
commit
7ce12af177
|
@ -8,7 +8,7 @@
|
|||
<artifactId>base-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<version>3.6.4</version>
|
||||
<version>3.6.5</version>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -11,60 +11,23 @@ import lombok.Data;
|
|||
@Data
|
||||
public class User {
|
||||
|
||||
/*
|
||||
用户id
|
||||
*/
|
||||
|
||||
private Integer userId;
|
||||
|
||||
/*
|
||||
医院名称
|
||||
*/
|
||||
private String hospitalName;
|
||||
|
||||
/*
|
||||
部门id
|
||||
*/
|
||||
private Long departmentId;
|
||||
|
||||
/*
|
||||
头衔id
|
||||
*/
|
||||
private Long titleId;
|
||||
|
||||
/*
|
||||
邮箱账户
|
||||
*/
|
||||
private String emailCount;
|
||||
|
||||
/*
|
||||
验证码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/*
|
||||
密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
private String userName;
|
||||
/*
|
||||
确认密码
|
||||
*/
|
||||
private String finalPassword;
|
||||
|
||||
/*
|
||||
个人简介
|
||||
*/
|
||||
private String userIntroduce;
|
||||
/*
|
||||
个人擅长领域
|
||||
*/
|
||||
private String skilledArea;
|
||||
|
||||
private Long roleId;
|
||||
|
||||
private String password;
|
||||
private String email;
|
||||
private String inviteCode;
|
||||
private String avatar;
|
||||
private Integer gender;
|
||||
private Integer height;
|
||||
private Integer weight;
|
||||
private Integer age;
|
||||
private String wechatNumber;
|
||||
private String hospital;
|
||||
private Integer deptId;
|
||||
private Integer titleId;
|
||||
private String introduce;
|
||||
private String skilled;
|
||||
private Integer status;
|
||||
|
||||
public void setCreateBy(String username) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.health.system.common.domain.model;
|
|||
|
||||
import com.health.common.core.user.CommonBody;
|
||||
import com.health.system.common.domain.SysUser;
|
||||
import com.health.system.common.domain.User;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -24,16 +25,18 @@ public class LoginUser implements Serializable {
|
|||
/**
|
||||
* 用户名id
|
||||
*/
|
||||
private Long userid;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
//-----------------------------------
|
||||
private User user;
|
||||
//------------------------------------------
|
||||
private CommonBody commonBody;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
|
@ -73,20 +76,20 @@ public class LoginUser implements Serializable {
|
|||
this.token = token;
|
||||
}
|
||||
|
||||
public Long getUserid() {
|
||||
return userid;
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserid(Long userid) {
|
||||
this.userid = userid;
|
||||
public void setUserId(Integer userid) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
public void setUserName(String username) {
|
||||
this.userName = username;
|
||||
}
|
||||
|
||||
public Long getLoginTime() {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<artifactId>base-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<version>3.6.5</version>
|
||||
<version>3.6.7</version>
|
||||
<artifactId>base-system-remote</artifactId>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
|
|
@ -31,8 +31,8 @@ public interface RemoteUserService {
|
|||
public Result<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
@PostMapping("/user/email/info")
|
||||
public Result<LoginUser> emailInfo(@RequestBody EmailLoginUser emailLoginUser,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
@PostMapping("/user/email/info/{email}")
|
||||
public Result<LoginUser> emailInfo(@PathVariable String email, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
|
|
|
@ -33,7 +33,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
|
||||
//-------------------------------------------------------------
|
||||
@Override
|
||||
public Result<LoginUser> emailInfo(EmailLoginUser emailLoginUser, String source) {
|
||||
public Result<LoginUser> emailInfo(String email, String source) {
|
||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>com.health</groupId>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<version>3.6.5</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
|
|
|
@ -122,26 +122,19 @@ public class SysUserController extends BaseController
|
|||
|
||||
//-------------邮箱获取用户信息------------------
|
||||
|
||||
@PostMapping("/email/info")
|
||||
public Result<LoginUser> emailInfo(@RequestBody EmailLoginUser emailLoginUser){
|
||||
System.out.println("收到请求对象是:"+emailLoginUser);
|
||||
//先根据邮箱查询有无此人
|
||||
CommonBody commonBody=userService.selectByEmail(emailLoginUser);
|
||||
if (StringUtils.isNull(commonBody)){
|
||||
@PostMapping("/email/info/{email}")
|
||||
public Result<LoginUser> emailInfo(@PathVariable String email){
|
||||
System.out.println("收到请求邮箱是:"+email);
|
||||
//先根据邮箱查询有无此人user
|
||||
User user=userService.selectByEmail(email);
|
||||
if (StringUtils.isNull(user)){
|
||||
return Result.error("邮箱不存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(commonBody.getHospital())){
|
||||
System.out.println("是医生");
|
||||
commonBody.setRoleId(2);
|
||||
}else{
|
||||
System.out.println("是患者");
|
||||
commonBody.setRoleId(1);
|
||||
}
|
||||
//查询该用户下的所有角色
|
||||
Set<String> roles=permissionService.getEmailRolePermission(commonBody);
|
||||
Set<String> roles=permissionService.getEmailRolePermission(user);
|
||||
System.out.println("所有角色是"+roles);
|
||||
LoginUser loginUserVo = new LoginUser();
|
||||
loginUserVo.setCommonBody(commonBody);
|
||||
loginUserVo.setUser(user);
|
||||
loginUserVo.setRoles(roles);
|
||||
System.out.println("最后的返回对象是:"+loginUserVo);
|
||||
return Result.success(loginUserVo);
|
||||
|
@ -189,17 +182,17 @@ public class SysUserController extends BaseController
|
|||
|
||||
System.out.println("userId是"+SecurityUtils.getUserId());
|
||||
//---------------------------------------------------------------
|
||||
CommonBody commonBody=userService.selectCommonbodyByUserId(SecurityUtils.getUserId());
|
||||
User user=userService.selectUserByUserId(SecurityUtils.getUserId());
|
||||
//-------------------------------------------------------------------------
|
||||
// SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
||||
System.out.println();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getEmailRolePermission(commonBody);
|
||||
Set<String> roles = permissionService.getEmailRolePermission(user);
|
||||
// 权限集合
|
||||
// Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
Result result = Result.success();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("user", commonBody);
|
||||
map.put("user", user);
|
||||
map.put("roles", roles);
|
||||
// map.put("permissions", permissions);
|
||||
result.setData(map);
|
||||
|
|
|
@ -109,5 +109,5 @@ public interface SysRoleMapper {
|
|||
public int deleteRoleByIds(Long[] roleIds);
|
||||
|
||||
//0---------------------------------------------------------------
|
||||
List<String> selectEmailRoleByUserId(@Param("userId") Integer userId, @Param("roleTag") Integer roleTag);
|
||||
List<String> selectEmailRoleByUserId(@Param("userId") Integer userId);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ public interface SysUserMapper {
|
|||
*/
|
||||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
//-----------------------------------------------------------
|
||||
User selectUserByUserEmail(@Param("email") String email);
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
|
@ -147,8 +149,10 @@ public interface SysUserMapper {
|
|||
int insertNewUser(CommonBody commonBody);
|
||||
|
||||
//------------------------------------------
|
||||
CommonBody selectUserByUserEmail(EmailLoginUser emailLoginUser);
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
CommonBody selectCommonbodyByUserId(@Param("userId1") int userId1);
|
||||
User selectUserByUserId(@Param("userId1") int userId1);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.health.system.server.service;
|
|||
|
||||
import com.health.common.core.user.CommonBody;
|
||||
import com.health.system.common.domain.SysUser;
|
||||
import com.health.system.common.domain.User;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -28,5 +29,5 @@ public interface ISysPermissionService {
|
|||
public Set<String> getMenuPermission(SysUser user);
|
||||
|
||||
//---------------------------------
|
||||
Set<String> getEmailRolePermission(CommonBody commonBody);
|
||||
Set<String> getEmailRolePermission(User user);
|
||||
}
|
||||
|
|
|
@ -175,5 +175,5 @@ public interface ISysRoleService {
|
|||
public int insertAuthUsers(Long roleId, Long[] userIds);
|
||||
|
||||
//-----------------------------------------------------------
|
||||
Set<String> selectEmailRoleByUserId(Integer userId, Integer roleId);
|
||||
Set<String> selectEmailRoleByUserId(Integer userId);
|
||||
}
|
||||
|
|
|
@ -47,6 +47,9 @@ public interface ISysUserService
|
|||
*/
|
||||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
|
||||
//-------------------------
|
||||
User selectByEmail(String email);
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
|
@ -212,8 +215,7 @@ public interface ISysUserService
|
|||
|
||||
int registerNewUser(CommonBody commonBody);
|
||||
|
||||
//-------------------------
|
||||
CommonBody selectByEmail(EmailLoginUser emailLoginUser);
|
||||
|
||||
CommonBody selectCommonbodyByUserId(Long userId);
|
||||
|
||||
User selectUserByUserId(Long userId);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.lang.hash.Hash;
|
|||
import com.health.common.core.user.CommonBody;
|
||||
import com.health.system.common.domain.SysRole;
|
||||
import com.health.system.common.domain.SysUser;
|
||||
import com.health.system.common.domain.User;
|
||||
import com.health.system.server.service.ISysMenuService;
|
||||
import com.health.system.server.service.ISysPermissionService;
|
||||
import com.health.system.server.service.ISysRoleService;
|
||||
|
@ -49,9 +50,9 @@ public class SysPermissionServiceImpl implements ISysPermissionService {
|
|||
//--------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Set<String> getEmailRolePermission(CommonBody commonBody) {
|
||||
public Set<String> getEmailRolePermission(User user) {
|
||||
HashSet<String> roles = new HashSet<>();
|
||||
roles.addAll(roleService.selectEmailRoleByUserId(commonBody.getUserId(),commonBody.getRoleId()));
|
||||
roles.addAll(roleService.selectEmailRoleByUserId(user.getUserId()));
|
||||
return roles;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -90,9 +90,8 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||
|
||||
//-------------------------------------------------------
|
||||
@Override
|
||||
public Set<String> selectEmailRoleByUserId(Integer userId,Integer roleTag) {
|
||||
System.out.println("角色id"+userId+",角色标识"+roleTag);
|
||||
List<String> roleList=roleMapper.selectEmailRoleByUserId(userId,roleTag);
|
||||
public Set<String> selectEmailRoleByUserId(Integer userId) {
|
||||
List<String> roleList=roleMapper.selectEmailRoleByUserId(userId);
|
||||
System.out.println("用户角色集合是:"+roleList);
|
||||
HashSet<String> roleSet = new HashSet<>();
|
||||
roleSet.addAll(roleList);
|
||||
|
|
|
@ -581,18 +581,19 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userId;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------
|
||||
@Override
|
||||
public CommonBody selectByEmail(EmailLoginUser emailLoginUser) {
|
||||
CommonBody commonBody= userMapper.selectUserByUserEmail(emailLoginUser);
|
||||
return commonBody;
|
||||
public User selectByEmail(String email) {
|
||||
User user= userMapper.selectUserByUserEmail(email);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonBody selectCommonbodyByUserId(Long userId) {
|
||||
public User selectUserByUserId(Long userId) {
|
||||
int userId1 = userId.intValue();
|
||||
CommonBody commonBody= userMapper.selectCommonbodyByUserId(userId1);
|
||||
return commonBody;
|
||||
User user= userMapper.selectUserByUserId(userId1);
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT role_name FROM tb_user_role ur
|
||||
LEFT JOIN
|
||||
tb_role r on ur.role_id=r.role_id
|
||||
where ur.user_id=#{userId} and ur.role_tag=#{roleTag}
|
||||
where ur.user_id=#{userId}
|
||||
</select>
|
||||
<!--用户角色sql-->
|
||||
|
||||
|
|
|
@ -141,17 +141,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||
</select>
|
||||
<!--邮箱查用户-->
|
||||
<select id="selectUserByUserEmail" resultType="com.health.common.core.user.CommonBody">
|
||||
<if test="roleId==1">
|
||||
select * from tb_patient where email=#{email}
|
||||
</if>
|
||||
<if test="roleId==2">
|
||||
select * from tb_doctor where email=#{email}
|
||||
</if>
|
||||
|
||||
|
||||
<select id="selectUserByUserEmail" resultType="com.health.system.common.domain.User">
|
||||
select * from tb_user where email=#{email}
|
||||
</select>
|
||||
<select id="selectCommonbodyByUserId" resultType="com.health.common.core.user.CommonBody">
|
||||
select * from tb_patient where user_id=#{userId1}
|
||||
<select id="selectUserByUserId" resultType="com.health.system.common.domain.User">
|
||||
select * from tb_user where user_id=#{userId1}
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
|
|
Loading…
Reference in New Issue