@author plexpt
| 47 | * @author plexpt |
| 48 | */ |
| 49 | @Service |
| 50 | @RequiredArgsConstructor |
| 51 | public class UserService extends ServiceImpl<UserDao, UserEntity> { |
| 52 | |
| 53 | private final UserDao userDao; |
| 54 | private final InvitationService invitationService; |
| 55 | private final UserCredentialService userCredentialService; |
| 56 | private final CheckCodeManager checkCodeManager; |
| 57 | private final PasskeyManager passkeyManager; |
| 58 | private final CaptchaService captchaService; |
| 59 | private final MailService mailService; |
| 60 | private final EmailCodeService emailCodeService; |
| 61 | private final UserRoleService userRoleService; |
| 62 | private final RedisUtil redisUtil; |
| 63 | |
| 64 | private final GoogleAuthenticatorService googleAuthenticatorService; |
| 65 | |
| 66 | |
| 67 | @Transactional(rollbackFor = Exception.class) |
| 68 | public UserEntity createUser(String username, |
| 69 | String fullName, |
| 70 | String avatar, |
| 71 | UserEntity.Gender gender, |
| 72 | String email, |
| 73 | UserEntity.State state) { |
| 74 | UserEntity userEntity = new UserEntity(); |
| 75 | userEntity.setUsername(username); |
| 76 | userEntity.setNickname(fullName); |
| 77 | userEntity.setAvatar(avatar); |
| 78 | userEntity.setGender(gender.getCode()); |
| 79 | userEntity.setEmail(email); |
| 80 | userEntity.setState(state.getCode()); |
| 81 | userEntity.setCreateTime(LocalDateTime.now()); |
| 82 | save(userEntity); |
| 83 | DomainEventPublisher.instance().publish(new UserCreated(userEntity)); |
| 84 | return userEntity; |
| 85 | } |
| 86 | |
| 87 | @Transactional(rollbackFor = Exception.class) |
| 88 | public UserEntity createUser(UserEntity entity) { |
| 89 | entity.setState(0); |
| 90 | entity.setCreateTime(LocalDateTime.now()); |
| 91 | save(entity); |
| 92 | DomainEventPublisher.instance().publish(new UserCreated(entity)); |
| 93 | return entity; |
| 94 | } |
| 95 | |
| 96 | public Set<UserEntity> findUserByIds(Set<Integer> userIds) { |
| 97 | List<UserEntity> userEntities = listByIds(userIds); |
| 98 | return new LinkedHashSet<>(userEntities); |
| 99 | } |
| 100 | |
| 101 | public List<UserEntity> findUserByIds(List<Integer> ids) { |
| 102 | List<UserEntity> list = listByIds(ids); |
| 103 | return list; |
| 104 | } |
| 105 | |
| 106 | public UserEntity findUserById(Integer userId) { |
nothing calls this directly
no outgoing calls
no test coverage detected