Commit 22eeac2a authored by mlchun's avatar mlchun

1.注册、登录、切换身份

parent 545beac6
...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implements UserService { public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implements UserService {
...@@ -99,6 +100,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -99,6 +100,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
map.put("token", tokenEntity.getToken()); map.put("token", tokenEntity.getToken());
map.put("expire", tokenEntity.getExpireDate().getTime() - System.currentTimeMillis()); map.put("expire", tokenEntity.getExpireDate().getTime() - System.currentTimeMillis());
List<UserRoleInfoDTO> roles = userDao.getUserRoleInfo(user.getId()); List<UserRoleInfoDTO> roles = userDao.getUserRoleInfo(user.getId());
roles = roles.stream().distinct().collect(Collectors.toList());
map.put("roles", roles); map.put("roles", roles);
return map; return map;
...@@ -134,6 +136,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -134,6 +136,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Override @Override
public void registerUser(UserRegisterDTO dto) { public void registerUser(UserRegisterDTO dto) {
UserEntity reRegister = getByOpenId(dto.getOpenid());
if (null != reRegister) {
reRegister.setOpenid("");
updateById(reRegister);
}
UserRegisterDTO userRegisterDTO = getUserInfoByIdCardNo(dto.getIdCardNo()); UserRegisterDTO userRegisterDTO = getUserInfoByIdCardNo(dto.getIdCardNo());
UserEntity userEntity; UserEntity userEntity;
if (null != userRegisterDTO) { if (null != userRegisterDTO) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment