Search in sources :

Example 26 with User

use of com.stardata.starshop2.authcontext.domain.user.User in project starshop by beautautumn.

the class UserExistenceService method ensureUser.

public User ensureUser(WxOpenId openId, User userToEnsure) {
    User user = userRepository.findByOpenId(openId);
    if (user == null) {
        userToEnsure.setOpenid(openId);
        user = userToEnsure;
        userRepository.add(user);
    } else {
        user.copyMiniAppInfoFrom(userToEnsure);
        userRepository.update(user);
    }
    return user;
}
Also used : User(com.stardata.starshop2.authcontext.domain.user.User)

Aggregations

User (com.stardata.starshop2.authcontext.domain.user.User)25 Test (org.junit.jupiter.api.Test)21 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)21 Rollback (org.springframework.test.annotation.Rollback)17 Transactional (org.springframework.transaction.annotation.Transactional)13 UserToken (com.stardata.starshop2.authcontext.domain.user.UserToken)10 WxOpenId (com.stardata.starshop2.authcontext.domain.user.WxOpenId)8 WxAuthInfo (com.stardata.starshop2.authcontext.domain.user.WxAuthInfo)6 LocalDateTime (java.time.LocalDateTime)6 UserResponse (com.stardata.starshop2.authcontext.pl.UserResponse)5 WxLoginRequest (com.stardata.starshop2.authcontext.pl.WxLoginRequest)5 SessionUser (com.stardata.starshop2.sharedcontext.pl.SessionUser)5 MobileNumber (com.stardata.starshop2.sharedcontext.domain.MobileNumber)4 Transactional (jakarta.transaction.Transactional)4 LongIdentity (com.stardata.starshop2.sharedcontext.domain.LongIdentity)3 ApplicationValidationException (com.stardata.starshop2.sharedcontext.exception.ApplicationValidationException)3 LoginLog (com.stardata.starshop2.authcontext.domain.loginlog.LoginLog)2 MobileNumberResponse (com.stardata.starshop2.authcontext.pl.MobileNumberResponse)1 WxEncryptedUserInfo (com.stardata.starshop2.authcontext.pl.WxEncryptedUserInfo)1